-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operations contracts signing with JOSE #84
Conversation
We now create a json encodable elixir map from a proto struct, and then encode as json it to create a signable canonical string encoding. On the verification side, the verified payload is now deserialized and returned as a proto struct.
elixir/lib/contracts.ex
Outdated
jwk = JOSE.JWK.from_pem(pem_private_key) | ||
updated_opts = [{:will_be_signed?, true} | opts] | ||
|
||
{:ok, json_encodable_map} = Protobuf.JSON.to_encodable(struct, emit_unpopulated: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default for emit_unpopulated
is false. Just being explicit here.
deduplication, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @gagandeepb
I think we need to decide where to send the encoded data.
For me, it looks counterintuitive to send the payload in the signature
field and send the data
empty.
We should send the payload in data
with the correct data type. If the time and expiration time are encapsuled there, we don't need new empty fields (if they are not needed for some validation in the receiver part)
Signed payloads sent as text not in signature attribute field.
This function, decode_json_trento_event, was observed to be not necessary with a bit of refactoring
As a consequence of the shared conversation around this topic facilitated by the doc shared elsewhere and this PoC, message signing/verification and the security properties it promises will be re-evaluated at a later point, once a better need for these properties is established. |
PoC/WIP