Skip to content

Commit e54071c

Browse files
committed
feat: Enable tx_code support for the issuer, and properly handle both the old userPin and tx_code on the client side. fixes #117
1 parent 1c9b5ea commit e54071c

22 files changed

Lines changed: 191 additions & 131 deletions

packages/callback-example/lib/__tests__/issuerCallback.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('issuerCallback', () => {
119119
lastUpdatedAt: +new Date(),
120120
status: IssueStatus.OFFER_CREATED,
121121
notification_id: v4(),
122-
userPin: '123456',
122+
txCode: '123456',
123123
credentialOffer: {
124124
credential_offer: {
125125
credential_issuer: 'did:key:test',

packages/client/lib/AccessTokenClient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
JsonURIMode,
1515
OpenIDResponse,
1616
PRE_AUTH_CODE_LITERAL,
17+
PRE_AUTH_GRANT_LITERAL,
1718
TokenErrorResponse,
1819
toUniformCredentialOfferRequest,
1920
TxCodeAndPinRequired,
@@ -107,8 +108,7 @@ export class AccessTokenClient {
107108

108109
request.grant_type = GrantTypes.PRE_AUTHORIZED_CODE;
109110
// we actually know it is there because of the isPreAuthCode call
110-
request[PRE_AUTH_CODE_LITERAL] =
111-
credentialOfferRequest?.credential_offer.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.[PRE_AUTH_CODE_LITERAL];
111+
request[PRE_AUTH_CODE_LITERAL] = credentialOfferRequest?.credential_offer.grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL];
112112

113113
return request as AccessTokenRequest;
114114
}
@@ -146,7 +146,7 @@ export class AccessTokenClient {
146146
}
147147
const issuer = getIssuerFromCredentialOfferPayload(requestPayload);
148148

149-
const grantDetails = requestPayload.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code'];
149+
const grantDetails = requestPayload.grants?.[PRE_AUTH_GRANT_LITERAL];
150150
const isPinRequired = !!grantDetails?.tx_code ?? false;
151151

152152
LOG.warning(`Pin required for issuer ${issuer}: ${isPinRequired}`);
@@ -211,7 +211,7 @@ export class AccessTokenClient {
211211
if (accessTokenRequest.grant_type === GrantTypes.PRE_AUTHORIZED_CODE) {
212212
this.assertPreAuthorizedGrantType(accessTokenRequest.grant_type);
213213
this.assertNonEmptyPreAuthorizedCode(accessTokenRequest);
214-
this.assertAlphanumericPin(pinMeta, accessTokenRequest.user_pin);
214+
this.assertAlphanumericPin(pinMeta, accessTokenRequest.tx_code ?? accessTokenRequest.user_pin);
215215
} else if (accessTokenRequest.grant_type === GrantTypes.AUTHORIZATION_CODE) {
216216
this.assertAuthorizationGrantType(accessTokenRequest.grant_type);
217217
this.assertNonEmptyCodeVerifier(accessTokenRequest);

packages/client/lib/AccessTokenClientV1_0_11.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
OpenId4VCIVersion,
1818
OpenIDResponse,
1919
PRE_AUTH_CODE_LITERAL,
20+
PRE_AUTH_GRANT_LITERAL,
2021
TokenErrorResponse,
2122
toUniformCredentialOfferRequest,
2223
UniformCredentialOfferPayload,
@@ -112,8 +113,7 @@ export class AccessTokenClientV1_0_11 {
112113

113114
request.grant_type = GrantTypes.PRE_AUTHORIZED_CODE;
114115
// we actually know it is there because of the isPreAuthCode call
115-
request[PRE_AUTH_CODE_LITERAL] =
116-
credentialOfferRequest?.credential_offer.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.[PRE_AUTH_CODE_LITERAL];
116+
request[PRE_AUTH_CODE_LITERAL] = credentialOfferRequest?.credential_offer.grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL];
117117

118118
return request as AccessTokenRequest;
119119
}
@@ -135,7 +135,7 @@ export class AccessTokenClientV1_0_11 {
135135

136136
private assertPreAuthorizedGrantType(grantType: GrantTypes): void {
137137
if (GrantTypes.PRE_AUTHORIZED_CODE !== grantType) {
138-
throw new Error("grant type must be 'urn:ietf:params:oauth:grant-type:pre-authorized_code'");
138+
throw new Error('grant type must be PRE_AUTH_GRANT_LITERAL');
139139
}
140140
}
141141

@@ -151,8 +151,8 @@ export class AccessTokenClientV1_0_11 {
151151
throw new Error(TokenErrorResponse.invalid_request);
152152
}
153153
const issuer = getIssuerFromCredentialOfferPayload(requestPayload);
154-
if (requestPayload.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']) {
155-
isPinRequired = requestPayload.grants['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.user_pin_required ?? false;
154+
if (requestPayload.grants?.[PRE_AUTH_GRANT_LITERAL]) {
155+
isPinRequired = requestPayload.grants[PRE_AUTH_GRANT_LITERAL]?.user_pin_required ?? false;
156156
}
157157
debug(`Pin required for issuer ${issuer}: ${isPinRequired}`);
158158
return isPinRequired;

packages/client/lib/CredentialOfferClient.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
determineSpecVersionFromURI,
1111
getClientIdFromCredentialOfferPayload,
1212
OpenId4VCIVersion,
13+
PRE_AUTH_CODE_LITERAL,
14+
PRE_AUTH_GRANT_LITERAL,
1315
toUniformCredentialOfferRequest,
1416
} from '@sphereon/oid4vci-common';
1517
import Debug from 'debug';
@@ -64,17 +66,16 @@ export class CredentialOfferClient {
6466
...(clientId && { clientId }),
6567
...request,
6668
...(grants?.authorization_code?.issuer_state && { issuerState: grants.authorization_code.issuer_state }),
67-
...(grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.['pre-authorized_code'] && {
68-
preAuthorizedCode: grants['urn:ietf:params:oauth:grant-type:pre-authorized_code']['pre-authorized_code'],
69+
...(grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL] && {
70+
preAuthorizedCode: grants[PRE_AUTH_GRANT_LITERAL][PRE_AUTH_CODE_LITERAL],
6971
}),
7072
userPinRequired:
71-
request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.user_pin_required ??
72-
!!request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code ??
73+
request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.user_pin_required ??
74+
!!request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.tx_code ??
7375
false,
74-
...(request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code &&
75-
{
76-
// txCode: request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code,
77-
}),
76+
...(request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.tx_code && {
77+
txCode: request.credential_offer.grants[PRE_AUTH_GRANT_LITERAL].tx_code,
78+
}),
7879
};
7980
}
8081

packages/client/lib/CredentialOfferClientV1_0_11.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
determineSpecVersionFromURI,
1111
getClientIdFromCredentialOfferPayload,
1212
OpenId4VCIVersion,
13+
PRE_AUTH_CODE_LITERAL,
14+
PRE_AUTH_GRANT_LITERAL,
1315
toUniformCredentialOfferRequest,
1416
} from '@sphereon/oid4vci-common';
1517
import Debug from 'debug';
@@ -59,10 +61,10 @@ export class CredentialOfferClientV1_0_11 {
5961
...(clientId && { clientId }),
6062
...request,
6163
...(grants?.authorization_code?.issuer_state && { issuerState: grants.authorization_code.issuer_state }),
62-
...(grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.['pre-authorized_code'] && {
63-
preAuthorizedCode: grants['urn:ietf:params:oauth:grant-type:pre-authorized_code']['pre-authorized_code'],
64+
...(grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL] && {
65+
preAuthorizedCode: grants[PRE_AUTH_GRANT_LITERAL][PRE_AUTH_CODE_LITERAL],
6466
}),
65-
userPinRequired: !!request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.user_pin_required ?? false,
67+
userPinRequired: !!request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.user_pin_required ?? false,
6668
};
6769
}
6870

packages/client/lib/CredentialOfferClientV1_0_13.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
determineSpecVersionFromURI,
77
getClientIdFromCredentialOfferPayload,
88
OpenId4VCIVersion,
9+
PRE_AUTH_CODE_LITERAL,
10+
PRE_AUTH_GRANT_LITERAL,
911
toUniformCredentialOfferRequest,
1012
} from '@sphereon/oid4vci-common';
1113
import Debug from 'debug';
@@ -46,14 +48,13 @@ export class CredentialOfferClientV1_0_13 {
4648
...(clientId && { clientId }),
4749
...request,
4850
...(grants?.authorization_code?.issuer_state && { issuerState: grants.authorization_code.issuer_state }),
49-
...(grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.['pre-authorized_code'] && {
50-
preAuthorizedCode: grants['urn:ietf:params:oauth:grant-type:pre-authorized_code']['pre-authorized_code'],
51+
...(grants?.[PRE_AUTH_GRANT_LITERAL]?.[PRE_AUTH_CODE_LITERAL] && {
52+
preAuthorizedCode: grants[PRE_AUTH_GRANT_LITERAL][PRE_AUTH_CODE_LITERAL],
53+
}),
54+
userPinRequired: !!request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.tx_code ?? false,
55+
...(request.credential_offer?.grants?.[PRE_AUTH_GRANT_LITERAL]?.tx_code && {
56+
txCode: request.credential_offer.grants[PRE_AUTH_GRANT_LITERAL].tx_code,
5157
}),
52-
userPinRequired: !!request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code ?? false,
53-
...(request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code &&
54-
{
55-
// txCode: request.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code,
56-
}),
5758
};
5859
}
5960

packages/client/lib/__tests__/AccessTokenClient.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { AccessTokenRequest, AccessTokenResponse, GrantTypes, OpenIDResponse, WellKnownEndpoints } from '@sphereon/oid4vci-common';
1+
import {
2+
AccessTokenRequest,
3+
AccessTokenResponse,
4+
GrantTypes,
5+
OpenIDResponse,
6+
PRE_AUTH_CODE_LITERAL,
7+
WellKnownEndpoints,
8+
} from '@sphereon/oid4vci-common';
29
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
310
// @ts-ignore
411
import nock from 'nock';
@@ -48,7 +55,7 @@ describe('AccessTokenClient should', () => {
4855
pinMetadata: {
4956
isPinRequired: true,
5057
txCode: {
51-
length: accessTokenRequest['pre-authorized_code'].length,
58+
length: accessTokenRequest[PRE_AUTH_CODE_LITERAL].length,
5259
input_mode: 'numeric',
5360
},
5461
},

packages/client/lib/__tests__/MetadataClient.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getIssuerFromCredentialOfferPayload, WellKnownEndpoints } from '@sphereon/oid4vci-common';
1+
import { getIssuerFromCredentialOfferPayload, PRE_AUTH_GRANT_LITERAL, WellKnownEndpoints } from '@sphereon/oid4vci-common';
22
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
33
// @ts-ignore
44
import nock from 'nock';
@@ -241,7 +241,7 @@ describe.skip('Metadataclient with SpruceId should', () => {
241241
credential_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/credential',
242242
token_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/token',
243243
jwks_uri: 'https://ngi-oidc4vci-test.spruceid.xyz/jwks',
244-
grant_types_supported: ['urn:ietf:params:oauth:grant-type:pre-authorized_code'],
244+
grant_types_supported: [PRE_AUTH_GRANT_LITERAL],
245245
credentials_supported: {
246246
OpenBadgeCredential: {
247247
formats: {
@@ -277,7 +277,7 @@ describe.skip('Metadataclient with SpruceId should', () => {
277277
credential_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/credential',
278278
token_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/token',
279279
jwks_uri: 'https://ngi-oidc4vci-test.spruceid.xyz/jwks',
280-
grant_types_supported: ['urn:ietf:params:oauth:grant-type:pre-authorized_code'],
280+
grant_types_supported: [PRE_AUTH_GRANT_LITERAL],
281281
credentials_supported: {
282282
OpenBadgeCredential: {
283283
formats: {

packages/client/lib/__tests__/MetadataMocks.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AuthzFlowType, CredentialOfferPayloadV1_0_13, CredentialOfferRequestWithBaseUrl } from '@sphereon/oid4vci-common';
1+
import { AuthzFlowType, CredentialOfferPayloadV1_0_13, CredentialOfferRequestWithBaseUrl, PRE_AUTH_GRANT_LITERAL } from '@sphereon/oid4vci-common';
22

33
export const IDENTIPROOF_ISSUER_URL = 'https://issuer.research.identiproof.io';
44
export const IDENTIPROOF_AS_URL = 'https://auth.research.identiproof.io';
@@ -48,6 +48,11 @@ export const INITIATION_TEST: CredentialOfferRequestWithBaseUrl = {
4848
scheme: 'openid-credential-offer',
4949
supportedFlows: [AuthzFlowType.PRE_AUTHORIZED_CODE_FLOW],
5050
version: 1013,
51+
txCode: {
52+
description: 'Please provide the one-time code that was sent via e-mail',
53+
input_mode: 'numeric',
54+
length: 4,
55+
},
5156
userPinRequired: true, // Determined from above tx_code
5257
};
5358
export const INITIATION_TEST_V1_0_08: CredentialOfferRequestWithBaseUrl = {
@@ -84,7 +89,7 @@ export const IDENTIPROOF_AS_METADATA = {
8489
token_endpoint_auth_methods_supported: ['client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt'],
8590
jwks_uri: 'https://auth.research.identiproof.io/oauth2/jwks',
8691
response_types_supported: ['code'],
87-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code', 'client_credentials', 'refresh_token'],
92+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL, 'client_credentials', 'refresh_token'],
8893
revocation_endpoint: 'https://auth.research.identiproof.io/oauth2/revoke',
8994
revocation_endpoint_auth_methods_supported: ['client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt'],
9095
introspection_endpoint: 'https://auth.research.identiproof.io/oauth2/introspect',
@@ -168,7 +173,7 @@ export const SPRUCE_OID4VCI_METADATA = {
168173
credential_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/credential',
169174
token_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/token',
170175
jwks_uri: 'https://ngi-oidc4vci-test.spruceid.xyz/jwks',
171-
grant_types_supported: ['urn:ietf:params:oauth:grant-type:pre-authorized_code'],
176+
grant_types_supported: [PRE_AUTH_GRANT_LITERAL],
172177
credentials_supported: {
173178
OpenBadgeCredential: {
174179
formats: {
@@ -232,7 +237,7 @@ export const DANUBE_OIDC_METADATA = {
232237
],
233238
},
234239
code_challenge_methods_supported: ['plain', 'S256'],
235-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
240+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
236241
token_endpoint_auth_methods_supported: ['client_secret_post', 'client_secret_basic'],
237242
authorization_endpoint: 'https://oidc4vc.uniissuer.io/authorize',
238243
token_endpoint: 'https://oidc4vc.uniissuer.io/token',
@@ -245,7 +250,7 @@ export const WALT_OID4VCI_METADATA = {
245250
pushed_authorization_request_endpoint: 'https://jff.walt.id/issuer-api/oidc/par',
246251
issuer: 'https://jff.walt.id/issuer-api',
247252
jwks_uri: 'https://jff.walt.id/issuer-api/oidc',
248-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
253+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
249254
request_uri_parameter_supported: true,
250255
credentials_supported: {
251256
VerifiableDiploma: {

packages/client/lib/__tests__/data/VciDataFixtures.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
IssuerCredentialSubjectDisplay,
44
IssuerMetadataV1_0_08,
55
IssuerMetadataV1_0_13,
6+
PRE_AUTH_GRANT_LITERAL,
67
} from '@sphereon/oid4vci-common';
78
import { ICredentialStatus, W3CVerifiableCredential } from '@sphereon/ssi-types';
89

@@ -76,7 +77,7 @@ const mockData: VciMockDataStructure = {
7677
credential_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/credential',
7778
token_endpoint: 'https://ngi-oidc4vci-test.spruceid.xyz/token',
7879
jwks_uri: 'https://ngi-oidc4vci-test.spruceid.xyz/jwks',
79-
grant_types_supported: ['urn:ietf:params:oauth:grant-type:pre-authorized_code'],
80+
grant_types_supported: [PRE_AUTH_GRANT_LITERAL],
8081
credentials_supported: {
8182
OpenBadgeCredential: {
8283
formats: {
@@ -100,7 +101,7 @@ const mockData: VciMockDataStructure = {
100101
method: 'POST',
101102
request: {
102103
client_id: 'sphereon:ssi-wallet',
103-
grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',
104+
grant_type: PRE_AUTH_GRANT_LITERAL,
104105
'pre-authorized_code':
105106
'eyJhbGciOiJFUzI1NiJ9.eyJjcmVkZW50aWFsX3R5cGUiOlsiT3BlbkJhZGdlQ3JlZGVudGlhbCJdLCJleHAiOiIyMDIzLTA0LTE5VDExOjUzOjM4WiIsIm5vbmNlIjoiN3F4YldMcktpNTZjNjRlWjljaHJZeVUxbFVVQzMzV1YifQ.tDxAC8CsqN-DALOmY5ANEVf96fZfTzqHL4Aiq4IZzMJ-zSCrNkNBeuOK5D3RsJhSZcDMu2XvuG1RrSXJV0zHRg',
106107
},
@@ -141,7 +142,7 @@ const mockData: VciMockDataStructure = {
141142
pushed_authorization_request_endpoint: 'https://jff.walt.id/issuer-api/default/oidc/par',
142143
issuer: 'https://jff.walt.id/issuer-api/default',
143144
jwks_uri: 'https://jff.walt.id/issuer-api/default/oidc',
144-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
145+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
145146
request_uri_parameter_supported: true,
146147
credentials_supported: {
147148
VerifiableId: {
@@ -343,7 +344,7 @@ const mockData: VciMockDataStructure = {
343344
method: 'POST',
344345
request: {
345346
client_id: 'sphereon:ssi-wallet',
346-
grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',
347+
grant_type: PRE_AUTH_GRANT_LITERAL,
347348
'pre-authorized_code':
348349
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1NzhkZWZjOS0wMTFlLTQ3ZTAtYmQ5YS03MWFlOGU4ZTJjYzYiLCJwcmUtYXV0aG9yaXplZCI6dHJ1ZX0.uh1rX4qVqlp-YW-itLON8Zmov8t-xugCFDXlUSPuTSQ',
349350
},
@@ -450,7 +451,7 @@ const mockData: VciMockDataStructure = {
450451
],
451452
},
452453
code_challenge_methods_supported: ['plain', 'S256'],
453-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
454+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
454455
token_endpoint_auth_methods_supported: ['client_secret_post', 'client_secret_basic'],
455456
issuer: 'https: //oidc4vc.uniissuer.io/',
456457
authorization_endpoint: 'https://oidc4vc.uniissuer.io/1.0/authorize',
@@ -463,7 +464,7 @@ const mockData: VciMockDataStructure = {
463464
method: 'POST',
464465
request: {
465466
client_id: 'sphereon:ssi-wallet',
466-
grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',
467+
grant_type: PRE_AUTH_GRANT_LITERAL,
467468
'pre-authorized_code': 'rQhxqvmEQef2pFChuedmDWlp6iIifUVI',
468469
},
469470
response: {
@@ -505,7 +506,7 @@ const mockData: VciMockDataStructure = {
505506
jwks_uri: 'https://launchpad.vii.electron.mattrlabs.io/oidc/v1/auth/jwks',
506507
token_endpoint_auth_methods_supported: ['none', 'client_secret_basic', 'client_secret_jwt', 'client_secret_post', 'private_key_jwt'],
507508
code_challenge_methods_supported: ['S256'],
508-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
509+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
509510
response_modes_supported: ['form_post', 'fragment', 'query'],
510511
response_types_supported: ['code id_token', 'code', 'id_token', 'none'],
511512
scopes_supported: ['PermanentResidentCard', 'AcademicAward', 'LearnerProfile', 'OpenBadgeCredential'],
@@ -564,7 +565,7 @@ const mockData: VciMockDataStructure = {
564565
method: 'POST',
565566
request: {
566567
client_id: 'sphereon:ssi-wallet',
567-
grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',
568+
grant_type: PRE_AUTH_GRANT_LITERAL,
568569
'pre-authorized_code': 'kI_19c0PtisCJBG-ngd9mA47UCKx4uoKglUp0gqmxKt',
569570
},
570571
response: {
@@ -658,7 +659,7 @@ const mockData: VciMockDataStructure = {
658659
credential_endpoint: 'https://oidc4vc.diwala.io/credential',
659660
token_endpoint: 'https://oidc4vc.diwala.io/token',
660661
jwks_uri: 'https://oidc4vc.diwala.io/jwks',
661-
grant_types_supported: ['urn:ietf:params:oauth:grant-type:pre-authorized_code'],
662+
grant_types_supported: [PRE_AUTH_GRANT_LITERAL],
662663
credentials_supported: {
663664
OpenBadgeCredential: {
664665
formats: {
@@ -677,7 +678,7 @@ const mockData: VciMockDataStructure = {
677678
method: 'POST',
678679
request: {
679680
client_id: 'sphereon:ssi-wallet',
680-
grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',
681+
grant_type: PRE_AUTH_GRANT_LITERAL,
681682
'pre-authorized_code':
682683
'eyJhbGciOiJIUzI1NiJ9.eyJjcmVkZW50aWFsX3R5cGUiOiJPcGVuQmFkZ2VDcmVkZW50aWFsIiwiZXhwIjoxNjgxOTE1NzI5fQ.JmhU1jhMfw3f_DaIqnxurPyIW1makcwUs49Fm253z5Q',
683684
},
@@ -1408,7 +1409,7 @@ const mockData: VciMockDataStructure = {
14081409
name: 'Chamber of Commerce',
14091410
},
14101411
],
1411-
grant_types_supported: ['authorization_code', 'urn:ietf:params:oauth:grant-type:pre-authorized_code'],
1412+
grant_types_supported: ['authorization_code', PRE_AUTH_GRANT_LITERAL],
14121413
id_token_signing_alg_values_supported: ['ES256'],
14131414
issuer: 'https://mijnkvk.acc.credenco.com',
14141415
jwks_uri: 'https://mijnkvk.acc.credenco.com/jwks',

0 commit comments

Comments
 (0)