Skip to content

Commit 6ffd86c

Browse files
Johan SellströmJohan Sellström
authored andcommitted
Fix preregistered wallet verifier request
1 parent 554c96e commit 6ffd86c

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

STATUS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Status
22

3+
- [x] Add the missing `client_id_scheme=pre-registered` fields to the wallet verifier flow
4+
- [x] Verify the wallet verifier request shape locally with tests
5+
- [x] Redeploy the public verifier and confirm the live wallet request JWT includes the preregistered client ID scheme
6+
37
- [x] Add a local demo-conductor package for the Village speed-build presentation
48
- [x] Verify the demo-conductor build and unit tests locally
59
- [x] Commit the demo-conductor changes

verifier/src/wallet-rp.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const SESSION_TTL_MS = 15 * 60_000
55
const QR_SIZE = 280
66
const EUDI_PID_VCTS = ['urn:eudi:pid:1']
77
const LAB_AGE_VCTS = ['https://example.org/vct/age-credential']
8+
const PREREGISTERED_CLIENT_ID_SCHEME = 'pre-registered'
89

910
export type WalletVerifierProfile = {
1011
baseUrl: string
@@ -55,6 +56,7 @@ export type WalletDirectPostBody = {
5556

5657
export type WalletRequestObject = {
5758
client_id: string
59+
client_id_scheme: 'pre-registered'
5860
response_uri: string
5961
response_type: 'vp_token'
6062
response_mode: 'direct_post'
@@ -117,12 +119,13 @@ export function createWalletSession(baseUrl: string, now = Date.now()): WalletRp
117119
}
118120

119121
export function buildWalletDeepLink(clientId: string, requestUri: string) {
120-
return `eudi-openid4vp://${clientId}?client_id=${encodeURIComponent(clientId)}&request_uri=${encodeURIComponent(requestUri)}`
122+
return `eudi-openid4vp://${clientId}?client_id=${encodeURIComponent(clientId)}&client_id_scheme=${encodeURIComponent(PREREGISTERED_CLIENT_ID_SCHEME)}&request_uri=${encodeURIComponent(requestUri)}`
121123
}
122124

123125
export function buildWalletRequestObject(session: WalletRpSession, walletNonce?: string): WalletRequestObject & { wallet_nonce?: string } {
124126
return {
125127
client_id: session.clientId,
128+
client_id_scheme: PREREGISTERED_CLIENT_ID_SCHEME,
126129
response_uri: session.responseUri,
127130
response_type: 'vp_token',
128131
response_mode: 'direct_post',

verifier/test/wallet-request-signing.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ test('wallet request signer embeds an x5c certificate for verifier.ipid.me', asy
2828
})
2929

3030
assert.equal(verified.payload.client_id, 'verifier.ipid.me')
31+
assert.equal(verified.payload.client_id_scheme, 'pre-registered')
3132
assert.equal(verified.payload.response_mode, 'direct_post')
3233
})
3334

verifier/test/wallet-rp.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test('createWalletSession builds a preregistered deep link for the public verifi
1717
assert.match(session.resultUri, /^https:\/\/verifier\.ipid\.me\/wallet\/session\//)
1818
assert.match(
1919
session.deepLink,
20-
/^eudi-openid4vp:\/\/verifier\.ipid\.me\?client_id=verifier\.ipid\.me&request_uri=https%3A%2F%2Fverifier\.ipid\.me%2Fwallet%2Frequest\.jwt%2F/
20+
/^eudi-openid4vp:\/\/verifier\.ipid\.me\?client_id=verifier\.ipid\.me&client_id_scheme=pre-registered&request_uri=https%3A%2F%2Fverifier\.ipid\.me%2Fwallet%2Frequest\.jwt%2F/
2121
)
2222
})
2323

@@ -26,6 +26,7 @@ test('buildWalletRequestObject asks for over-21 plus nationality with a fallback
2626
const request = buildWalletRequestObject(session)
2727

2828
assert.equal(request.client_id, 'verifier.ipid.me')
29+
assert.equal(request.client_id_scheme, 'pre-registered')
2930
assert.equal(request.response_uri, session.responseUri)
3031
assert.equal(request.response_type, 'vp_token')
3132
assert.equal(request.response_mode, 'direct_post')

0 commit comments

Comments
 (0)