Skip to content

Add support for Ruby Time/Date/DateTime objects in #generate_key, etc.Β #18

Open
@ribose-jeffreylau

Description

@ribose-jeffreylau

Currently, only Integer time is supported:

rnp = Rnp.new
k = rnp.generate_key( {
  primary: {
    type: 'RSA',
    length: 4096,
    userid: 'hello test',
    usage: [:sign],
    expiration: (Time.now + 60000).to_i,
  },
})

If a Time/Date/DateTime object is supplied, it would fail:

rnp = Rnp.new
k = rnp.generate_key( {
  primary: {
    type: 'RSA',
    length: 4096,
    userid: 'hello test',
    usage: [:sign],
    expiration: Time.now + 60000,
  },
})
# => Rnp::Error: rnp_generate_key_json failed - (rc: 0x10000002): Bad parameters
#    from /opt/ribose/bundle/gems/rnp-1.0.0/lib/rnp/error.rb:29:in
#    `raise_error'

ruby-rnp should be able to accept a Time/Date/DateTime and convert it
to an Integer when necessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions