Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] publicKeyMultibase in a DID document is not usable to verify JWT credentials #1248

Closed
mirceanis opened this issue Sep 19, 2023 · 0 comments · Fixed by #1261
Closed
Labels
bug Something isn't working pinned don't close this just for being stale

Comments

@mirceanis
Copy link
Member

Bug severity
3

Describe the bug

Credentials issued by did:peer fail verification.
Here is a sample test to reproduce the issue:

    // using an agent with `@veramo/did-provider-peer#PeerDIDProvider`
    // and `@veramo/did-provider-peer#getResolver`

    // did:peer uses publicKeyMultibase
    const issuer = await agent.didManagerCreate({
      provider: 'did:peer',
      options: {
        num_algo: 0
      }
    })
    const payload = {
      issuer: issuer.did,
      credentialSubject: {
        nothing: 'else matters',
      },
    }
    const credential = await agent.createVerifiableCredential({
      credential: payload,
      proofFormat: 'jwt',
    })
    const verifyResult = await agent.verifyCredential({ credential })
    expect(verifyResult.verified).toBeTruthy()

Details
It seems that the publicKeyMultibase is a multibase encoding of a multicodec encoding of an ed25519 public key.
did-jwt@7.2.5 doesn't know how to interpret the multicodec encoding so it tries to use the byte array as is so verification fails.

The fix would be in the did-jwt library.

Versions (please complete the following information):

  • Veramo: 5.4.1
  • did-jwt: 7.2.5
@mirceanis mirceanis added the bug Something isn't working label Sep 19, 2023
@mirceanis mirceanis changed the title publicKeyMultibase in a DID document is not usable to verify JWT credentials [bug] publicKeyMultibase in a DID document is not usable to verify JWT credentials Sep 19, 2023
@mirceanis mirceanis added the pinned don't close this just for being stale label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned don't close this just for being stale
Projects
None yet
1 participant