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

Support for `X25519KeyAgreementKey2020` and `X25519KeyAgreementKeyEIP5630` based keys #363

Closed arnabghose997 closed 1 year ago

arnabghose997 commented 1 year ago

This PR aims to introduce support for X25519KeyAgreementKey2020 and X25519KeyAgreementKeyEIP5630 verification method types

These keys are based on keyAgreement attribute. Hence, any verification method of these types can only be part of the keyAgreement attribute only, and hence they are not allowed to be used for Authentication as well as Assertion purposes. This also means that Ed25519VerificationKey2020 based Verification Methods cannot be used for keyAgreement Purposes

Test Cases:

  1. FAIL: Ed25519VerificationKey2020 based Verification Method ID being added to keyAgreement attribute

  2. FAIL: X25519KeyAgreementKey2020 based Verification Method ID being added to authentication attribute

  3. PASS: A DID Document is created with Ed25519VerificationKey2020 and X25519KeyAgreementKey2020 based VMs

  4. FAIL: An attempt is made to update the DID Document by passing the signature of X25519KeyAgreementKey2020 based verification method

  5. PASS: An attempt is made to update the DID Document by passing the signature of Ed25519VerificationKey2020 based verification method

  6. FAIL: An attempt is made to deactivate the DID Document by passing the signature of X25519KeyAgreementKey2020 based verification method

  7. PASS: An attempt is made to deactivate the DID Document by passing the signature of Ed25519VerificationKey2020 based verification method