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

Bugfix: fixed `DocumentProofTypeCheck()` function #325

Closed arnabghose997 closed 1 year ago

arnabghose997 commented 1 year ago

Reference issue: https://github.com/hypersign-protocol/hid-node/issues/324

Earlier, the DocumentProofTypeCheck() function was iterating through all the Signers corresponding to Document's Author, and it was asserted against the verificationMethodId from the Document's Proof. The problem was when the assertion failed, it threw an error that stated that required verification method id was not found, even though it was present in the Singer.

The function is refactored to iterate over all the signers and pick the singer's VM Id that matches with Verification Method ID present in Document's proof without breaking on non-matching cases.