expect transformCredentialInput to move top-level props of W3C credentials inside vc
See original GitHub issueBased on my reading of the W3C spec, it seems as though top-level optional props like evidence
and credentialSubject
should be copied inside the vc
claim in the resulting JWT encoded credential.
However, when you pass transformCredentialInput
an arg of type CredentialPayload
they are copied to the top level of the JWT:
const cred = {
'@context': ['https://www.w3.org/2018/credentials/v1'],
credentialSubject: {
id: 'did:ethr:0x435df3eda57154cf8cf7926079881f2912f54db4',
bar: 'baz',
},
evidence: { foo: 'bar' },
type: ['VerifiableCredential'],
};
transformCredentialInput(cred);
Results in
{
vc: {
credentialSubject: { bar: 'baz' },
'@context': [ 'https://www.w3.org/2018/credentials/v1' ],
type: [ 'VerifiableCredential' ]
},
evidence: { foo: 'bar' },
sub: 'did:ethr:0x435df3eda57154cf8cf7926079881f2912f54db4'
}
Expect
{
vc: {
credentialSubject: { bar: 'baz' },
'@context': [ 'https://www.w3.org/2018/credentials/v1' ],
type: [ 'VerifiableCredential' ],
evidence: { foo: 'bar' }
},
sub: 'did:ethr:0x435df3eda57154cf8cf7926079881f2912f54db4'
}
A workaround is to move the props inside a manually constructed vc
object. But then it’s unclear whether all of the props should be manually transformed to match the JwtCredentialPayload
type or left for the transformation function to handle.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Verifiable Credentials Data Model v1.1 - W3C
This specification provides a mechanism to express these sorts of credentials on the Web in a way that is cryptographically secure, ...
Read more >Verifiable Credentials Implementation Guidelines 1.0 - W3C
This specification decouples the identity provider concept into two distinct concepts: the issuer and the holder. issuer: A role an entity can ...
Read more >Verifiable Credentials Use Cases - W3C
A verifiable claim is a qualification, achievement, quality, or piece of information about an entity's background such as a name, government ID, ...
Read more >Verifiable Credentials Working Group Charter - W3C
The Working Group will maintain the Verifiable Credentials Data Model specification, which provides a mechanism to express a verifiable credential on the Web...
Read more >Verifiable Credentials Working Group Charter - W3C
Registries for the data model to support extension points in the normative deliverables. Algorithms for the expression and verification of proofs that use ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes, and the same for the presentation transforms.
Also it loosely relates to #64 since it relates to JWT-JSON payload conversion.
Also,
normalizeCredential
has the inverse problem:Result