Skip to content

Commit

Permalink
chore: Kvk unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Sep 18, 2024
1 parent 4936ccf commit 6066ba3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/PEX.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,12 @@ describe('evaluate', () => {
});

it('Evaluate case without any error 1', () => {
const pdSchema: PresentationDefinitionV1 = getFileAsJson(
'./test/dif_pe_examples/pdV1/pd-simple-schema-age-predicate.json',
).presentation_definition;
const vpSimple: IVerifiablePresentation = getFileAsJson('./test/dif_pe_examples/vp/vp-simple-age-predicate.json');
pdSchema.input_descriptors[0].schema.push({ uri: 'https://www.w3.org/TR/vc-data-model/#types1' });
const pdSchema: PresentationDefinitionV2 = getFileAsJson(
'test/dif_pe_examples/pdV2/kvk.json',
);
const vpSimple: IVerifiablePresentation = getFileAsJson('test/dif_pe_examples/vp/vp-kvk.json');
const pex: PEX = new PEX();
const evaluationResults = pex.evaluatePresentation(pdSchema, vpSimple, {
limitDisclosureSignatureSuites: LIMIT_DISCLOSURE_SIGNATURE_SUITES,
});
const evaluationResults = pex.evaluatePresentation(pdSchema, vpSimple, { });
expect(evaluationResults!.value!.descriptor_map!.length).toEqual(1);
expect(evaluationResults!.errors!.length).toEqual(0);
});
Expand Down
22 changes: 22 additions & 0 deletions test/dif_pe_examples/pdV2/kvk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"id" : "KVKRegistration",
"name" : "KVK registratie",
"input_descriptors" : [ {
"id" : "KVKRegistration",
"format" : {
"jwt_vc_json" : {
"alg" : [ "EdDSA", "ES256" ]
}
},
"constraints" : {
"fields" : [ {
"path" : [ "$.type" ],
"filter" : {
"type" : "string",
"pattern" : "KVKRegistration"
}
} ]
}
} ],
"purpose" : "We need to ensure you have a KvK registration for your company"
}
22 changes: 22 additions & 0 deletions test/dif_pe_examples/vp/vp-kvk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"sub": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5Iiwia2lkIjoidkpkVTBPdG1TQVU4VE1uaVRqS2I0TUdWMzRZTmdibG5NM0pMMk1LZllSOCIsIngiOiIxUDdHV0dsOGFyV3NRRi10QXQ2WU9OLWxNLU9vS3FKTG5lVnJaTEhVSnlvIn0",
"nbf": 1726663141,
"iat": 1726663201,
"jti": "KVKRegistration",
"iss": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5Iiwia2lkIjoidkpkVTBPdG1TQVU4VE1uaVRqS2I0TUdWMzRZTmdibG5NM0pMMk1LZllSOCIsIngiOiIxUDdHV0dsOGFyV3NRRi10QXQ2WU9OLWxNLU9vS3FKTG5lVnJaTEhVSnlvIn0",
"nonce": "e75c3e8c-2b9d-4eac-8630-550e51f2a09e",
"aud": "did:web:ssi-agent.sander.home.sphereon.com",
"vp": {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiablePresentation"
],
"id": "KVKRegistration",
"holder": "did:jwk:eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5Iiwia2lkIjoidkpkVTBPdG1TQVU4VE1uaVRqS2I0TUdWMzRZTmdibG5NM0pMMk1LZllSOCIsIngiOiIxUDdHV0dsOGFyV3NRRi10QXQ2WU9OLWxNLU9vS3FKTG5lVnJaTEhVSnlvIn0",
"verifiableCredential": [
"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImRpZDplYnNpOnptS0M5aW4zY3YzeThEUFNFcURVbkcxIzM2WlJCMlFwUzd3aTBUUWMwQVI0NVM4UXpsS2I5UkdUMXRKUndDNGctakEifQ.eyJpc3MiOiJkaWQ6ZWJzaTp6bUtDOWluM2N2M3k4RFBTRXFEVW5HMSIsInN1YiI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpQUzFBaUxDSmpjbllpT2lKRlpESTFOVEU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