decentralized-identity / veramo

A JavaScript Framework for Verifiable Data
https://veramo.io
Apache License 2.0
445 stars 133 forks source link

feat: add signOnly flag and logic for add/remove key/service #1389

Closed radleylewis closed 5 months ago

radleylewis commented 5 months ago

What issue is this PR fixing

Closes #1373

What is being changed

Due to constraints within the secure MetaMask Snap context, it is not possible to invoke the didManagerAdd(Remove)Service or didManagerAdd(Remove)Key methods on the did-manager successfully. Refer here for the list of blocked RPC methods.

As outlined in the referenced issue, the changes proposed herein allow for the transaction to be signed only, through the addition of a new signOnly flag within one agent (in the demonstration case, by an agent in the constrained MetaMask Snap environment), and then submitted from another context (for example via the ethers.InfuraProvider in another context).

Quality

Check all that apply:

Details

I have successfully tested this (with the did-ethr-provider on the sepolia testnet).

radleylewis commented 5 months ago

This looks much better than before!

I think we are missing a couple of things before we can merge this:

  1. tests to validate the new behavior
  2. (optional, but highly recommended) even more simplification of the code:

We now have 3 paths for adding/removing an attribute:

  • a. sign and send a transaction directly. (default case)
  • b. sign a message using one key and sign and/or send a transaction using another key (metaIdentifierKeyId)
  • c. sign a message using one key (signOnly param)

Ideally, we would use the functionality from c. as a first step in b.

Hi @mirceanis. I have pushed some tests up which cover the introduced signOnly behaviour. Just a few points to clarify:

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.97%. Comparing base (1c6627c) to head (4db3a2d). Report is 4 commits behind head on next.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #1389 +/- ## ========================================== + Coverage 89.95% 89.97% +0.01% ========================================== Files 176 176 Lines 27695 27730 +35 Branches 2201 2204 +3 ========================================== + Hits 24912 24949 +37 + Misses 2783 2781 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.