hypersign-protocol / hid-node

A permissionless blockchain network to manage digital identity and access rights
https://hypersign.id
Apache License 2.0
223 stars 23 forks source link

feat: Add support for `blockchainAccountId` #331

Closed arnabghose997 closed 1 year ago

arnabghose997 commented 1 year ago

Closes: https://github.com/hypersign-protocol/hid-node/issues/57

This PR aims to introduce support for blockchainAccountId, where users can pass blockchain addresses instead of a public key, to validate a recoverable signature. This PR aims to support only EVM based address at the moment.

The e2e test report for x/ssi module is attached. Test Cases TC-10 and TC-11 has been written for the feature of this PR e2e_ssi_module_test_report.txt

arnabghose997 commented 1 year ago

@Vishwas1 There is one change that is needed to be pushed, based on an observation from running a Client Side Application for signing the DID Document using Metamask

The personal_sign method only accepts the message as a string input, which is why we JSON.stringify() the DID Doc before passing it to the method. However, on the blockchain end, in its current implementation, the serialisation of DID Doc happens based binary encoding, because of which the message is interprated differently here.

In order to solve it, the didDoc object on hid-node has to serialised using JSON Marshaller, instead of Proto Marshaller. This will be only specific for Ethereum based addresses only.

arnabghose997 commented 1 year ago

personal_sign (https://docs.metamask.io/guide/signing-data.html#personal-sign) support has been added as a clientSpec for SSI Docs.