nevermined-io / common-utils-py

Provides common functions to interact with the Nevermind ecosystem.
Apache License 2.0
1 stars 1 forks source link

Added a new optional field to jwt grant #18

Closed r-marques closed 3 years ago

r-marques commented 3 years ago

Description

This pr adds a new optional eths field to the grant token.

This field is used to signal that a token was signed with ethereum. Right now the only supported value is personal that should be used when signing a token with web3.eth.personal.sign. When using this sign method the message to sign is prefixed with :

eth_signature_input = ('\u0019Ethereum Signed Message:\n' + str(len(signature_input)) + signature_input.decode()).encode()

eths: 'personal' signals the gateway to add this prefix to the payload of the token before verifying the signature.

Since there is no standard way of producing ethereum signatures other tools may use a different prefix for the message (e.g. metamask). We can in the future add support for other tools by allowing other values for eths (e.g. eths: 'metamask')

Is this PR related with an open issue?

Related to Issue #

Types of changes

Checklist: