decentralized-identity / did-jwt

Create and verify DID verifiable JWT's in Javascript
Apache License 2.0
334 stars 71 forks source link

[proposal] Add support for more Ed25519 Verification Methods, incl. `Ed25519VerificationKey2020` & `JsonWebKey2020` #233

Closed Eengineer1 closed 2 years ago

Eengineer1 commented 2 years ago

On our network we're using later than 2018 & 2019 Ed25519 verification methods, so the library cannot technically resolve back the method used.

There's more context on our plugins built on top of Veramo which utilizes DIF libraries did-jwt & did-jwt-vc.

Happy to help on implementations.

mirceanis commented 2 years ago

Thank you for reporting this!

This should be relatively easy to add. The list of compatible verification methods for each JWA is here And the method to convert the public key representation from the DID document to the raw byte array is here

I'm not sure how the verification methods you need represent their public keys, but it may be just a matter of adding a multibase decoder.

Do you have bandwidth to look into this issue and parhaps provide an implementation?

bshambaugh commented 2 years ago

I am not sure it helps, but JsonWebKey2020 was buried in this huge PR that needs to be broken up and redone in order to be indigestible. https://github.com/decentralized-identity/did-jwt/pull/212 . specifically see: https://github.com/bshambaugh/did-jwt/blob/masterb4PRrefactor/src/JWT.ts#L94 for the my guess of the most relevant stuff coming in. This was for P-256 / ES256signer. In any case, this is an indication to me to revisit this code and try to help as I may have seen many of the concepts in this thread before while attempting a PR on the code base. the only part I haven't thoroughly reviewed is JWE.ts

Eengineer1 commented 2 years ago

Thanks @mirceanis , @bshambaugh .

@bshambaugh From my understanding your implementation is SHA-256 & Secp256r1 oriented. For our case, the current EdDSA & Ed25519 decoders are suffiecient, meaning it's just a matter of adding the supported VerKeys in the supported public keys, under the respective algo.

Initially, we added an Ed25519 JWK decoder as well, but along the way there was a pending PR that was merged in, so no additional work needed in the decoder, as far as I'm concerned.

Raised the PR. here.

mirceanis commented 2 years ago

I think this was closed by #235

Please reopen if that is not the case