This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: credential manifest support in vcwallet (#3136)
- added new resolve credential manifest interface to resolve fulfillments and credentials - refactores testdata files to avoid duplicate testdata files across various packages - Closes #3120 Signed-off-by: sudesh.shetty <sudesh.shetty@securekey.com>
- Loading branch information
1 parent
7753c86
commit 86571b0
Showing
28 changed files
with
1,369 additions
and
948 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
internal/testdata/samples/wallet/VP_with_multiple_VCs_and_credential_fulfillment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"@context":[ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://identity.foundation/credential-manifest/fulfillment/v1" | ||
], | ||
"type":[ | ||
"VerifiablePresentation", | ||
"CredentialFulfillment" | ||
], | ||
"credential_fulfillment":{ | ||
"id":"a30e3b91-fb77-4d22-95fa-871689c322e2", | ||
"manifest_id":"dcc75a16-19f5-4273-84ce-4da69ee2b7fe", | ||
"descriptor_map":[ | ||
{ | ||
"id":"udc_output", | ||
"format":"ldp_vc", | ||
"path":"$.verifiableCredential[0]" | ||
}, | ||
{ | ||
"id":"prc_output", | ||
"format":"ldp_vc", | ||
"path":"$.verifiableCredential[1]" | ||
} | ||
] | ||
}, | ||
"verifiableCredential":[ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://www.w3.org/2018/credentials/examples/v1" | ||
], | ||
"type": [ | ||
"VerifiableCredential", | ||
"UniversityDegreeCredential" | ||
], | ||
"id": "http://example.gov/credentials/3732", | ||
"issuanceDate": "2020-03-16T22:37:26.544Z", | ||
"issuer": { | ||
"id": "did:example:oakek12as93mas91220dapop092", | ||
"name": "University" | ||
}, | ||
"credentialSubject": { | ||
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21", | ||
"degree": { | ||
"type": "BachelorDegree", | ||
"degree": "MIT" | ||
}, | ||
"name": "Jayden Doe", | ||
"spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1" | ||
} | ||
}, | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://w3id.org/citizenship/v1" | ||
], | ||
"id": "http://example.gov/credentials/ff98f978-588f-4eb0-b17b-60c18e1dac2c", | ||
"type": [ | ||
"VerifiableCredential", | ||
"PermanentResidentCard" | ||
], | ||
"name": "Permanent Resident Card", | ||
"description": "Permanent Resident Card", | ||
"issuer": "did:v1:test:nym:z6MkfG5HTrBXzsAP8AbayNpG3ZaoyM4PCqNPrdWQRSpHDV6J", | ||
"issuanceDate": "2019-12-03T12:19:52Z", | ||
"expirationDate": "2029-12-03T12:19:52Z", | ||
"credentialSubject": { | ||
"id": "did:example:b34ca6cd37bbf23", | ||
"type": [ | ||
"PermanentResident", | ||
"Person" | ||
], | ||
"givenName": "JOHN", | ||
"familyName": "SMITH", | ||
"gender": "Male", | ||
"image": "data:image/png;base64,iVBORw0KGgo...kJggg==", | ||
"residentSince": "2015-01-01", | ||
"lprCategory": "C09", | ||
"lprNumber": "999-999-999", | ||
"commuterClassification": "C1", | ||
"birthCountry": "Bahamas", | ||
"birthDate": "1958-07-17" | ||
}, | ||
"proof": { | ||
"type": "Ed25519Signature2018", | ||
"created": "2020-05-11T22:04:28Z", | ||
"jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..1ClIc5Vyfz2zQ5SAT2pmX30dAlrltd3ezhxsls7Uu87VyW3PgiDif7Bv6MPt5lmDYtFKiPmAeuEUNY1clJv1Dw", | ||
"proofPurpose": "assertionMethod", | ||
"verificationMethod": "did:v1:test:nym:z6MkfG5HTrBXzsAP8AbayNpG3ZaoyM4PCqNPrdWQRSpHDV6J#z6MkqfvdBsFw4QdGrZrnx7L1EKfY5zh9tT4gumUGsMMEZHY3" | ||
} | ||
} | ||
] | ||
} |
204 changes: 204 additions & 0 deletions
204
internal/testdata/samples/wallet/credential_manifest_multiple_vcs.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
{ | ||
"id": "dcc75a16-19f5-4273-84ce-4da69ee2b7fe", | ||
"version": "0.1.0", | ||
"issuer": { | ||
"id": "did:example:123?linked-domains=3", | ||
"name": "Example Authority", | ||
"styles": {} | ||
}, | ||
"output_descriptors": [ | ||
{ | ||
"id": "udc_output", | ||
"schema": "https://www.w3.org/2018/credentials/examples/v1", | ||
"display": { | ||
"title": { | ||
"path": [ | ||
"$.title", | ||
"$.vc.title" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Bachelor's Degree" | ||
}, | ||
"subtitle": { | ||
"path": [ | ||
"$.minor", | ||
"$.vc.minor" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "" | ||
}, | ||
"description": { | ||
"text": "Awarded for completing a four year program at Example University." | ||
}, | ||
"properties": [ | ||
{ | ||
"path": [ | ||
"$.name", | ||
"$.credentialSubject.name" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Not Applicable", | ||
"label": "Degree Holder's name" | ||
}, | ||
{ | ||
"path": [ | ||
"$.credentialSubject.degree.type" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Unknown", | ||
"label": "Degree" | ||
} | ||
] | ||
}, | ||
"styles": { | ||
"thumbnail": { | ||
"uri": "http://example-university.org/logo.png", | ||
"alt": "Example University logo" | ||
}, | ||
"hero": { | ||
"uri": "http://example-university.org/hero.png", | ||
"alt": "Example University students in graduation ceremony" | ||
}, | ||
"background": { | ||
"color": "#ff0000" | ||
}, | ||
"text": { | ||
"color": "#d4d400" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "prc_output", | ||
"schema": "https://w3id.org/citizenship/v1", | ||
"display": { | ||
"title": { | ||
"path": [ | ||
"$.name", | ||
"$.vc.name" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Permanent Resident Card" | ||
}, | ||
"subtitle": { | ||
"path": [ | ||
"$.description", | ||
"$.vc.description" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "" | ||
}, | ||
"description": { | ||
"text": "PR card of John Smith." | ||
}, | ||
"properties": [ | ||
{ | ||
"path": [ | ||
"$.credentialSubject.givenName" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Not Applicable", | ||
"label": "Card Holder's first name" | ||
}, | ||
{ | ||
"path": [ | ||
"$.credentialSubject.familyName" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback": "Unknown", | ||
"label": "Card Holder's family name" | ||
} | ||
] | ||
}, | ||
"styles": { | ||
"thumbnail": { | ||
"uri": "http://example-university.org/logo.png", | ||
"alt": "Example University logo" | ||
}, | ||
"hero": { | ||
"uri": "http://example-university.org/hero.png", | ||
"alt": "Example University students in graduation ceremony" | ||
}, | ||
"background": { | ||
"color": "#ff0000" | ||
}, | ||
"text": { | ||
"color": "#d4d400" | ||
} | ||
} | ||
}, | ||
{ | ||
"id":"driver_license_output", | ||
"schema":"https://schema.org/EducationalOccupationalCredential", | ||
"display":{ | ||
"title":{ | ||
"path":[ | ||
"$.name", | ||
"$.vc.name" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback":"Washington State Driver License" | ||
}, | ||
"subtitle":{ | ||
"path":[ | ||
"$.class", | ||
"$.vc.class" | ||
], | ||
"schema": { | ||
"type": "string" | ||
}, | ||
"fallback":"Class A, Commercial" | ||
}, | ||
"description":{ | ||
"text":"License to operate a vehicle with a gross combined weight rating (GCWR) of 26,001 or more pounds, as long as the GVWR of the vehicle(s) being towed is over 10,000 pounds." | ||
}, | ||
"properties":[ | ||
{ | ||
"path":[ | ||
"$.donor", | ||
"$.credentialSubject.license.number" | ||
], | ||
"schema": { | ||
"type": "boolean" | ||
}, | ||
"fallback":"Unknown", | ||
"label":"Driving License Number" | ||
} | ||
] | ||
}, | ||
"styles":{ | ||
"thumbnail":{ | ||
"uri":"https://dol.wa.com/logo.png", | ||
"alt":"Washington State Seal" | ||
}, | ||
"hero":{ | ||
"uri":"https://dol.wa.com/happy-people-driving.png", | ||
"alt":"Happy people driving" | ||
}, | ||
"background":{ | ||
"color":"#ff0000" | ||
}, | ||
"text":{ | ||
"color":"#d4d400" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://www.w3.org/2018/credentials/examples/v1", | ||
"https://w3id.org/security/bbs/v1" | ||
], | ||
"type": ["VerifiableCredential", "UniversityDegreeCredential"], | ||
"@explicit": true, | ||
"identifier": {}, | ||
"issuer": {}, | ||
"issuanceDate": {}, | ||
"credentialSubject": { | ||
"@explicit": true, | ||
"degree": {}, | ||
"name": {} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
internal/testdata/samples/wallet/sample_content_keybase58.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"@context": ["https://w3id.org/wallet/v1"], | ||
"id": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5", | ||
"controller": "did:example:123456789abcdefghi", | ||
"type": "Ed25519VerificationKey2018", | ||
"privateKeyBase58":"2MP5gWCnf67jvW3E4Lz8PpVrDWAXMYY1sDxjnkEnKhkkbKD7yP2mkVeyVpu5nAtr3TeDgMNjBPirk2XcQacs3dvZ" | ||
} |
10 changes: 10 additions & 0 deletions
10
internal/testdata/samples/wallet/sample_content_metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"@context": ["https://w3id.org/wallet/v1"], | ||
"id": "did:example:123456789abcdefghi", | ||
"type": "Person", | ||
"name": "John Smith", | ||
"image": "https://via.placeholder.com/150", | ||
"description" : "Professional software developer for Acme Corp.", | ||
"tags": ["professional", "person"], | ||
"correlation": ["4058a72a-9523-11ea-bb37-0242ac130002"] | ||
} |
37 changes: 37 additions & 0 deletions
37
internal/testdata/samples/wallet/sample_docresolution_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"@context": [ | ||
"https://w3id.org/wallet/v1", | ||
"https://w3id.org/did-resolution/v1" | ||
], | ||
"id": "did:example:123", | ||
"type": ["DIDResolutionResponse"], | ||
"name": "Farming Sensor DID Document", | ||
"image": "https://via.placeholder.com/150", | ||
"description": "An IoT device in the middle of a corn field.", | ||
"tags": ["professional"], | ||
"correlation": ["4058a72a-9523-11ea-bb37-0242ac130002"], | ||
"created": "2017-06-18T21:19:10Z", | ||
"expires": "2026-06-18T21:19:10Z", | ||
"didDocument": { | ||
"@context": ["https://w3id.org/did/v1"], | ||
"id": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5", | ||
"verificationMethod": [{ | ||
"controller": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5", | ||
"id": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5", | ||
"publicKeyBase58": "8jkuMBqmu1TRA6is7TT5tKBksTZamrLhaXrg9NAczqeh", | ||
"type": "Ed25519VerificationKey2018" | ||
}], | ||
"authentication": ["did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5"], | ||
"assertionMethod": ["did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5"], | ||
"capabilityDelegation": ["did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5"], | ||
"capabilityInvocation": ["did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5"], | ||
"keyAgreement": [{ | ||
"controller": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5", | ||
"id": "did:key:z6MknC1wwS6DEYwtGbZZo2QvjQjkh2qSBjb4GYmbye8dv4S5#z6LSmjNfS5FC9W59JtPZq7fHgrjThxsidjEhZeMxCarbR998", | ||
"publicKeyBase58": "B4CVumSL43MQDW1oJU9LNGWyrpLbw84YgfeGi8D4hmNN", | ||
"type": "X25519KeyAgreementKey2019" | ||
}], | ||
"created": "2021-03-23T19:25:18.513655-04:00", | ||
"updated": "2021-03-23T19:25:18.513655-04:00" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"@context": ["https://w3id.org/did/v1"], | ||
"id": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHdI", | ||
"verificationMethod": [{ | ||
"controller": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd", | ||
"id": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd#z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd", | ||
"publicKeyBase58": "5yKdnU7ToTjAoRNDzfuzVTfWBH38qyhE1b9xh4v8JaWF", | ||
"type": "Ed25519VerificationKey2018" | ||
}], | ||
"capabilityDelegation": ["did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd#z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd"], | ||
"capabilityInvocation": ["did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd#z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd"], | ||
"keyAgreement": [{ | ||
"controller": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd", | ||
"id": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd#z6LShKMZ117txS1WuExddVM2rbJ2zy3AKFtZVY5WNi44aKzA", | ||
"publicKeyBase58": "6eBPUhK2ryHmoras6qq5Y15Z9pW3ceiQcZMptFQXrxDQ", | ||
"type": "X25519KeyAgreementKey2019" | ||
}], | ||
"created": "2021-03-23T16:23:39.682869-04:00", | ||
"updated": "2021-03-23T16:23:39.682869-04:00" | ||
} |
Oops, something went wrong.