WalletConnect / blockchain-api

WalletConnect's Blockchain API
MIT License
51 stars 40 forks source link

feat(sessions): implement permissions context update endpoint #697

Closed geekbrother closed 1 month ago

geekbrother commented 2 months ago

Description

This PR implements the permission context update endpoint /v1/sessions/{address}/context according to the API SPEC draft.

For the request authentication, the signature (signed message) is used. As a signing message, the context canonized JSON object from the request is used and signed by the signing key (created during the session creation request). Then the signature is verified at the server by the verification key which is stored during the session creation in the permission session object.

The keys format was changed to DER, sec1 encoded by Base64 instead of PEM for better (compact) usage in JSON.

How Has This Been Tested?

Due Diligence