Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Multiple values for a single key are not supported (ie, missing version 2 support) #5

Open
jkakar opened this issue Apr 2, 2014 · 1 comment

Comments

@jkakar
Copy link

jkakar commented Apr 2, 2014

In section 5 the specification requires support for multiple
values with the same key:

Key names might not be unique.  OpenToken supports multiple values
for a key name by simply adding another key-value pair.

But this doesn't appear to be implemented in the opentoken gem:

irb(main):013:0> attributes_in = {"subject" => "Andre", "email" => ["[email protected]", "[email protected]"]}
=> {"subject"=>"Andre", "email"=>["[email protected]", "[email protected]"]}
irb(main):014:0> OpenToken.encode attributes_in, OpenToken::Cipher::AES_128_CBC
NoMethodError: undefined method `each_byte' for ["[email protected]", "[email protected]"]:Array
    from /Users/jkakar/src/projects/opentoken/lib/opentoken/key_value_serializer.rb:131:in `escape_value'
    from /Users/jkakar/src/projects/opentoken/lib/opentoken/key_value_serializer.rb:21:in `block in serialize'
    from /Users/jkakar/src/projects/opentoken/lib/opentoken/key_value_serializer.rb:15:in `each_pair'
    from /Users/jkakar/src/projects/opentoken/lib/opentoken/key_value_serializer.rb:15:in `serialize'
    from /Users/jkakar/src/projects/opentoken/lib/opentoken.rb:31:in `encode'
    from (irb):14
    from /Users/jkakar/.rbenv/versions/2.0.0-p353/bin/irb:12:in `<main>'

I guess that means that this implementation is based on version 1,
right? Are there plans to support version 2?

@jkakar
Copy link
Author

jkakar commented Apr 2, 2014

Ah, I see now that the library is emitting the 1 in the version part
of the format, so I guess this isn't a bug at this stage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant