generated from digitalcredentials/isomorphic-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Hello!
I am trying to use this library to load a did:web
whose verificationMethod type is an RsaVerificationKey2018.
I thought that having this suite loaded in the vc.verifyCredential method was enough, but it seems that the securityLoader also requires it.
My vc.verifyCredential method:
const result = await vc.verifyCredential({
credential,
suite: [suiteRSA, suiteEd25519],
documentLoader,
checkStatus: checkStatus
})
However, I am encountering the following error:
LOG {
"name": "VerificationError",
"errors": [
{
"name": "Error",
"message": "Support for key type \"RsaVerificationKey2018\" is not installed.",
"stack": "Error: Support for key type \"RsaVerificationKey2018\" is not installed.\n at _suiteForType
I might need to add it here:
security-document-loader/src/documentLoader.ts
Lines 26 to 29 in 28db64f
const cryptoLd = new CryptoLD(); | |
cryptoLd.use(Ed25519VerificationKey2020); | |
cryptoLd.use(X25519KeyAgreementKey2020); | |
const didWebDriver = didWeb.driver({ cryptoLd }); |
Should this library support adding custom verification keys for CryptoLd?
Thank you
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done (Deployed)
Milestone
Relationships
Development
Select code repository
Activity
fabrii commentedon Feb 19, 2025
Hello!
If you find it helpful, I can submit a PR with this feature.
Thank you
dmitrizagidulin commentedon Feb 19, 2025
Hi @fabrii! Re submitting a PR - sure, we can at least take a look!
fabrii commentedon Feb 26, 2025
Hi @dmitrizagidulin. I have two ideas to resolve this.
First option:
npm i @sphereon/rsa-verification-key-2018
, from https://www.npmjs.com/package/@sphereon/rsa-verification-key-2018.It is a fork from https://github.com/digitalbazaar/rsa-verification-key-2018 published to npm.
Modify documentLoader.ts with:
Second option:
Allow to send keys by param when creating the securityDocumentLoader. Move resolver creation inside securityLoader method.
If any of these options are ok, I can make a PR.
Thank you
fabrii commentedon Mar 10, 2025
I see both proposals are not compatible with #20 made by @jchartrand. I couldn't find an implementation for the did-method-web library.
jchartrand commentedon Mar 10, 2025
Hi @fabrii I think you'd have to make more or less the same changes to the https://www.npmjs.com/package/@sphereon/rsa-verification-key-2018 to have it work with the crypto-ld package in the currently published security-document-loader as you'd have to make to have it work in the forthcoming security-document-loader (the version I'm working on in the PR).
In particular I think you'd have to at the very least provide support for multibase/multicodec keys, and more likely also support for the multikey type. You could look at https://github.com/digitalbazaar/ed25519-multikey/tree/main for an example of this.
For reference this is the did-method-web (https://github.com/digitalcredentials/did-method-web/tree/jc-modify-for-dcc) that will be used with the 'new' security-document-loader.
fabrii commentedon Mar 10, 2025
Hi @jchartrand. The
RsaVerificationKey2018
suite publishes the key using the publicKeyPem parameter, which requires the key in PEM format. Unfortunately, it doesn't support multibase.After reconsidering the solutions mentioned in my previous comment, I believe that sending the verification suites as a parameter (option 2) is the better approach. This would allow the library to handle custom cases more flexibly.
fabrii commentedon Apr 15, 2025
Hello. As a follow-up, we decided to maintain a local copy of the documentLoader class with our proposed changes.
This is fine for now, as we plan to migrate to Data Model v2 in the future.
Thanks!
alexfigtree commentedon Apr 24, 2025
@fabrii Ok, thank you, we will close the issue.