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

Missing credentialSubject.id property in JWT VC #394

Closed
italobb opened this issue Feb 24, 2021 · 0 comments · Fixed by #430 or #431
Closed

Missing credentialSubject.id property in JWT VC #394

italobb opened this issue Feb 24, 2021 · 0 comments · Fixed by #430 or #431
Assignees
Labels
bug Something isn't working

Comments

@italobb
Copy link
Contributor

italobb commented Feb 24, 2021

Bug severity
3

Describe the bug
Although the VC specs for JWT specifies that credentialSubject.id becomes sub, the DIF .well-known DID configuration spec requires an id property in the credentialSubject and it includes that property even in the JWT VCs examples they share. There should be some way to force createVerifiableCredential to keep that field in the credentialSubject.

To Reproduce
Steps to reproduce the behaviour:

  1. Use the code below to generate the VC:
const vcArgs: ICreateVerifiableCredentialArgs = {
        credential: {
          '@context': ["https://www.w3.org/2018/credentials/v1", "https://identity.foundation/.well-known/contexts/did-configuration-v0.0.jsonld"],
          type: ["VerifiableCredential", "DomainLinkageCredential"],
          issuer: { id: did },
          issuanceDate: new Date().toISOString(),
          credentialSubject: {
            id: did,
            origin: "acme.com"
          }
        },
        proofFormat: 'jwt'
      };
const vc: VerifiableCredential = await context.agent.createVerifiableCredential(vcArgs);
  1. Check the generated JWT VC. It won't have the credentialSubject.id

Observed behaviour
JWT VCs have credentialSubject.id property removed.

Expected behaviour
createVerifiableCredential should keep the credentialSubject.id property maybe by passing some additional parameter in ICreateVerifiableCredentialArgs.

Details
An example JWT VC from identity.foundation: eyJhbGciOiJFZERTQSJ9.eyJleHAiOjE3NjQ4Nzg5MDgsImlzcyI6ImRpZDprZXk6ejZNa29USHNnTk5yYnk4SnpDTlExaVJMeVc1UVE2UjhYdXU2QUE4aWdHck1WUFVNIiwibmJmIjoxNjA3MTEyNTA4LCJzdWIiOiJkaWQ6a2V5Ono2TWtvVEhzZ05OcmJ5OEp6Q05RMWlST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WFsIiwiRG9tYWluTGlua2FnZUNyZWRlbnRpYWwiXX0sInN1YiI6ImRpZDp3ZWI6bWVzaC54eXoiLCJuYmYiOjE2MTQxODQ1NTQsImlzcyI6ImRpZDp3ZWI6bWVzaC54eXoifQ.kch-1I8T2-ciCB5Unv5jjSodDW6PT18_8ufIFNwYPwliUqFvqUA9n1Zykdzuwo-PZRgr8ZG1Yz1MwVDURZjq6Q

Additional context

Versions (please complete the following information):

  • Veramo: 1.1.0
@italobb italobb added the bug Something isn't working label Feb 24, 2021
@mirceanis mirceanis self-assigned this Feb 25, 2021
mirceanis added a commit that referenced this issue Mar 26, 2021
BREAKING CHANGES:
* `IResolver` interface adapted to core spec
* No more `EcdsaSignature` for signers, only `string` output
* Signers must accept `Uint8Array` input as well as `string`
* Using EcdsaSecp256k1VerificationKey2019 and ...RecoveryMethod2020
* using `verificationMethod` and `blockchainAccountId` from DID documents
* deprecated `UniversalResolver` class in favor of `getUniversalResolver` method

closes #418
closes #428
closes #417
closes #416
closes #412
closes #397
unblocks #384
fixes #394
@mirceanis mirceanis reopened this Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants