-
Notifications
You must be signed in to change notification settings - Fork 20
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
feature/jarm_sdk #158
feature/jarm_sdk #158
Changes from 78 commits
e9dd686
5954644
44b35dc
e3e862f
820e507
08d54c9
f2b5a4b
fa80d94
072576a
d7fb47a
faa6060
4a43bd7
ec20823
8ae9923
e929c18
6fde238
ab32f58
f0375b5
505ee0d
695f4a9
22ec4c9
872893a
48418e4
9017e1f
95e52dc
6e2a518
304c131
2684b15
c97c034
c3767b6
d36176c
2a8e323
339661c
9d73138
6af9026
78339f3
020cb9a
00f6008
11890c5
7f68c75
104fa7e
0d48112
9a9f1ab
6900e09
b10e7a4
549dddb
2eda61d
993a655
e4e28fa
e194376
dc97861
b3104e6
7effabd
0d7ae93
fba3f6b
04dc758
6e7f459
9429e05
566f226
25e694d
34d9734
d69bad5
604e62b
e520711
e71cd2d
1c1b668
be5ceef
cc8fd0a
2ea042b
355a256
fffe923
2c7d3e6
3c63a27
104a2b5
bb1002c
e2dd3ce
05e3b18
019a955
36c7e09
b3acdfb
f439944
51a21d6
d6854b9
d0b4ad4
d484513
0603b43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,4 @@ | |
"OID4VP" | ||
] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,26 @@ describe('create Request Uri should', () => { | |
response_type: 'id_token', | ||
request_object_signing_alg_values_supported: [SigningAlgo.EDDSA, SigningAlgo.ES256], | ||
redirect_uri: EXAMPLE_REDIRECT_URL, | ||
claims: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this all of a sudden? claims are only required when it really is OID4VP. Not for SIOPv2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed again and tests are passing. I remember tests failing at some point, but something else must have been fixed by now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually test "succeed when requesting with a valid PD" fails when I do not provide the claims on line 553
|
||
vp_token: { | ||
presentation_definition: { | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
purpose: 'purpose', | ||
input_descriptors: [ | ||
{ | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
schema: [ | ||
{ | ||
uri: 'https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan', | ||
}, | ||
], | ||
}, | ||
], | ||
} as IPresentationDefinition, | ||
}, | ||
}, | ||
}, | ||
requestObject: { | ||
jwtIssuer: { | ||
|
@@ -152,7 +172,7 @@ describe('create Request Uri should', () => { | |
expect(uriRequest.authorizationRequestPayload).toBeDefined() | ||
|
||
const uriDecoded = decodeURIComponent(uriRequest.encodedUri) | ||
expect(uriDecoded).toContain(`openid://`) | ||
expect(uriDecoded).toContain(`openid4vp://`) | ||
expect(uriDecoded).toContain(`response_type=${ResponseType.ID_TOKEN}`) | ||
expect(uriDecoded).toContain(`&redirect_uri=${opts.payload?.redirect_uri}`) | ||
expect(uriDecoded).toContain(`&scope=${Scope.OPENID}`) | ||
|
@@ -167,6 +187,33 @@ describe('create Request Uri should', () => { | |
expect.assertions(4) | ||
const opts: CreateAuthorizationRequestOpts = { | ||
version: SupportedVersion.SIOPv2_ID1, | ||
payload: { | ||
client_id: WELL_KNOWN_OPENID_FEDERATION, | ||
scope: 'test', | ||
response_type: 'id_token', | ||
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA], | ||
redirect_uri: EXAMPLE_REDIRECT_URL, | ||
claims: { | ||
vp_token: { | ||
presentation_definition: { | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
purpose: 'purpose', | ||
input_descriptors: [ | ||
{ | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
schema: [ | ||
{ | ||
uri: 'https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan', | ||
}, | ||
], | ||
}, | ||
], | ||
} as IPresentationDefinition, | ||
}, | ||
}, | ||
}, | ||
requestObject: { | ||
jwtIssuer: { method: 'did', didUrl: KID, alg: SigningAlgo.ES256 }, | ||
passBy: PassBy.REFERENCE, | ||
|
@@ -184,6 +231,26 @@ describe('create Request Uri should', () => { | |
response_type: 'id_token', | ||
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA], | ||
redirect_uri: EXAMPLE_REDIRECT_URL, | ||
claims: { | ||
vp_token: { | ||
presentation_definition: { | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
purpose: 'purpose', | ||
input_descriptors: [ | ||
{ | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
schema: [ | ||
{ | ||
uri: 'https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan', | ||
}, | ||
], | ||
}, | ||
], | ||
} as IPresentationDefinition, | ||
}, | ||
}, | ||
}, | ||
}, | ||
clientMetadata: { | ||
|
@@ -222,6 +289,33 @@ describe('create Request Uri should', () => { | |
expect.assertions(3) | ||
const opts: CreateAuthorizationRequestOpts = { | ||
version: SupportedVersion.SIOPv2_ID1, | ||
payload: { | ||
client_id: WELL_KNOWN_OPENID_FEDERATION, | ||
scope: 'test', | ||
response_type: 'id_token', | ||
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA], | ||
redirect_uri: EXAMPLE_REDIRECT_URL, | ||
claims: { | ||
vp_token: { | ||
presentation_definition: { | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
purpose: 'purpose', | ||
input_descriptors: [ | ||
{ | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
schema: [ | ||
{ | ||
uri: 'https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan', | ||
}, | ||
], | ||
}, | ||
], | ||
} as IPresentationDefinition, | ||
}, | ||
}, | ||
}, | ||
requestObject: { | ||
passBy: PassBy.VALUE, | ||
jwtIssuer: { | ||
|
@@ -268,10 +362,10 @@ describe('create Request Uri should', () => { | |
const uriRequest = await URI.fromOpts(opts) | ||
|
||
const uriDecoded = decodeURIComponent(uriRequest.encodedUri) | ||
expect(uriDecoded).toContain(`openid://?request=eyJhbGciOi`) | ||
expect(uriDecoded).toContain(`openid4vp://?client_id=https://www.example.com/`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not remove the test for request = jwt. This obviously should have been a new expect. And then not toContain but a check that it starts with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
const data = URI.parse(uriDecoded) | ||
expect(data.scheme).toEqual('openid://') | ||
expect(data.scheme).toEqual('openid4vp://') | ||
expect(data.authorizationRequestPayload.request).toContain(`eyJhbGciOi`) | ||
}) | ||
}) | ||
|
@@ -511,30 +605,33 @@ describe('create Request JWT should', () => { | |
it('succeed when requesting with a valid PD', async () => { | ||
const opts: CreateAuthorizationRequestOpts = { | ||
version: SupportedVersion.SIOPv2_ID1, | ||
/*payload: { | ||
payload: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the payload fully re-enabled, whilst this test already contains a request object. If you need to add things add them there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reverted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually test "should throw error if presentation definition object is not valid" fails without the payload
but receives
There is a payload in the opts root, but that doesn't end up in the requestObject |
||
client_id: WELL_KNOWN_OPENID_FEDERATION, | ||
scope: 'test', | ||
response_type: 'id_token', | ||
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA], | ||
redirect_uri: EXAMPLE_REDIRECT_URL, | ||
request_object_signing_alg_values_supported: [SigningAlgo.EDDSA, SigningAlgo.ES256], | ||
claims: { | ||
vp_token: { | ||
presentation_definition: { | ||
id: 'Insurance Plans', | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
purpose: 'purpose', | ||
input_descriptors: [ | ||
{ | ||
id: 'Ontario Health Insurance Plan', | ||
name: 'Ontario', | ||
schema: [ | ||
{ | ||
uri: 'https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
} as IPresentationDefinition, | ||
}, | ||
}, | ||
},*/ | ||
}, | ||
requestObject: { | ||
jwtIssuer: { method: 'did', didUrl: KID, alg: SigningAlgo.ES256K }, | ||
passBy: PassBy.REFERENCE, | ||
|
@@ -598,7 +695,7 @@ describe('create Request JWT should', () => { | |
const uriRequest = await URI.fromOpts(opts) | ||
|
||
const uriDecoded = decodeURIComponent(uriRequest.encodedUri) | ||
expect(uriDecoded).toEqual(`openid://?request_uri=https://rp.acme.com/siop/jwts`) | ||
expect(uriDecoded).toEqual(`openid4vp://?client_id=https://www.example.com/.well-known/openid-federation&scope=test&response_type=id_token&request_object_signing_alg_values_supported=[\"ES256\",\"EdDSA\"]&redirect_uri=https://acme.com/hello&claims={"vp_token\":{\"presentation_definition":{\"id\":\"Ontario Health Insurance Plan\",\"name\":"Ontario\",\"purpose":"purpose\","input_descriptors":[{\"id":\"Ontario Health Insurance Plan\",\"name":\"Ontario\",\"schema":[{\"uri\":\"https://did.itsourweb.org:3000/smartcredential/Ontario-Health-Insurance-Plan\"}]}]}}}&request_uri=https://rp.acme.com/siop/jwts`) | ||
expect((await (await uriRequest.toAuthorizationRequest())?.requestObject?.getPayload())?.claims.vp_token).toBeDefined() | ||
}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert. The assert method below ensures a string is always present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it now. But my tsc does not look inside assertIssSelfIssuedOrDid, so have to return payload.sub! instead