@sphereon/oid4vci-client 0.12.1-next.4 → 0.12.1-unstable.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../lib/AuthorizationCodeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAIxB,uCAAuC,EAEvC,iCAAiC,EAEjC,6BAA6B,EAK7B,iBAAiB,EAEjB,QAAQ,EAER,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAOlC,wBAAsB,iCAAiC,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,iBAAiB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAqCrI;AAeD,eAAO,MAAM,6BAA6B;UASlC,QAAQ;sBACI,6BAA6B;0BACzB,wBAAwB;;;;;MAK5C,QAAQ,MAAM,CAqIjB,CAAC"}
1
+ {"version":3,"file":"AuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../lib/AuthorizationCodeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EAIxB,uCAAuC,EAEvC,iCAAiC,EAEjC,6BAA6B,EAK7B,iBAAiB,EAEjB,QAAQ,EAER,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAOlC,wBAAsB,iCAAiC,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,iBAAiB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,iBAkCrI;AAeD,eAAO,MAAM,6BAA6B;UASlC,QAAQ;sBACI,6BAA6B;0BACzB,wBAAwB;;;;;MAK5C,QAAQ,MAAM,CAqIjB,CAAC"}
@@ -45,10 +45,7 @@ function createSignedAuthRequestWhenNeeded(requestObject, opts) {
45
45
  requestObject.aud = opts.aud;
46
46
  }
47
47
  const iss = (_d = (_c = requestObject.iss) !== null && _c !== void 0 ? _c : opts.iss) !== null && _d !== void 0 ? _d : requestObject.client_id;
48
- const jwt = {
49
- header: { alg: 'ES256', kid: opts.kid, typ: 'jwt' },
50
- payload: Object.assign(Object.assign(Object.assign({}, requestObject), { iss, authorization_details }), (client_metadata && { client_metadata })),
51
- };
48
+ const jwt = { header: { alg: 'ES256', kid: opts.kid, typ: 'jwt' }, payload: Object.assign(Object.assign(Object.assign({}, requestObject), { iss, authorization_details }), (client_metadata && { client_metadata })) };
52
49
  const pop = yield ProofOfPossessionBuilder_1.ProofOfPossessionBuilder.fromJwt({
53
50
  jwt,
54
51
  callbacks: opts.signCallbacks,
@@ -1 +1 @@
1
- {"version":3,"file":"AuthorizationCodeClient.js","sourceRoot":"","sources":["../lib/AuthorizationCodeClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAqBkC;AAClC,kDAA0B;AAE1B,yEAAsE;AAEtE,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;AAExC,SAAsB,iCAAiC,CAAC,aAAkC,EAAE,IAA0C;;;QACpI,IAAI,IAAI,CAAC,iBAAiB,KAAK,wCAAuB,CAAC,WAAW,EAAE,CAAC;YACnE,MAAM,KAAK,CAAC,uBAAuB,IAAI,CAAC,iBAAiB,uBAAuB,CAAC,CAAC;QACpF,CAAC;aAAM,IAAI,IAAI,CAAC,iBAAiB,KAAK,wCAAuB,CAAC,cAAc,EAAE,CAAC;YAC7E,IAAI,OAAO,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,YAAY,CAAA,KAAK,UAAU,EAAE,CAAC;gBAC3D,MAAM,KAAK,CAAC,gFAAgF,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACxH,CAAC;iBAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACrB,MAAM,KAAK,CAAC,uDAAuD,IAAI,CAAC,iBAAiB,E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B,CAAC,SAAS,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC,CAAC"}
@@ -35,26 +35,23 @@ export async function createSignedAuthRequestWhenNeeded(requestObject: Record<st
35
35
  } else if (!opts.kid) {
36
36
  throw Error(`No kid found, whilst request object mode was set to ${opts.requestObjectMode}`);
37
37
  }
38
- let client_metadata: any;
38
+ let client_metadata: any
39
39
  if (opts.clientMetadata || opts.jwksUri) {
40
40
  client_metadata = opts.clientMetadata ?? {};
41
41
  if (opts.jwksUri) {
42
42
  client_metadata['jwks_uri'] = opts.jwksUri;
43
43
  }
44
44
  }
45
- let authorization_details = requestObject['authorization_details'];
45
+ let authorization_details = requestObject['authorization_details']
46
46
  if (typeof authorization_details === 'string') {
47
47
  authorization_details = JSON.parse(requestObject.authorization_details);
48
48
  }
49
49
  if (!requestObject.aud && opts.aud) {
50
50
  requestObject.aud = opts.aud;
51
51
  }
52
- const iss = requestObject.iss ?? opts.iss ?? requestObject.client_id;
52
+ const iss = requestObject.iss ?? opts.iss ?? requestObject.client_id
53
53
 
54
- const jwt: Jwt = {
55
- header: { alg: 'ES256', kid: opts.kid, typ: 'jwt' },
56
- payload: { ...requestObject, iss, authorization_details, ...(client_metadata && { client_metadata }) },
57
- };
54
+ const jwt: Jwt = { header: { alg: 'ES256', kid: opts.kid, typ: 'jwt' }, payload: {...requestObject, iss, authorization_details, ...(client_metadata && {client_metadata})} };
58
55
  const pop = await ProofOfPossessionBuilder.fromJwt({
59
56
  jwt,
60
57
  callbacks: opts.signCallbacks,
@@ -16,6 +16,7 @@ import { CredentialRequestClientBuilder, ProofOfPossessionBuilder } from '..';
16
16
  import { IDENTIPROOF_ISSUER_URL, IDENTIPROOF_OID4VCI_METADATA, INITIATION_TEST_URI, WALT_ISSUER_URL, WALT_OID4VCI_METADATA } from './MetadataMocks';
17
17
 
18
18
  const partialJWT = 'eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJkaWQ6ZXhhbXBsZTplYmZlYjFmN';
19
+ const partialJWT_withoutDid = 'eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJlYmZlYjFmNzEyZWJjNmYxYzI3N';
19
20
 
20
21
  /*const jwtv1_0_08: Jwt = {
21
22
  header: { alg: Alg.ES256, kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'jwt' },
@@ -27,8 +28,15 @@ const jwtv1_0_11: Jwt = {
27
28
  payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL },
28
29
  };
29
30
 
31
+ const jwtv1_0_13_withoutDid: Jwt = {
32
+ header: { alg: Alg.ES256, kid: 'ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'openid4vci-proof+jwt' },
33
+ payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL },
34
+ };
35
+
30
36
  const kid = 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1';
31
37
 
38
+ const kid_withoutDid = 'ebfeb1f712ebc6f1c276e12ec21/keys/1';
39
+
32
40
  let keypair: KeyPair;
33
41
 
34
42
  beforeAll(async () => {
@@ -115,6 +123,35 @@ describe('Credential Request Client Builder', () => {
115
123
  }
116
124
  });
117
125
 
126
+ it('should build credential request correctly without did', async () => {
127
+ const credReqClient = (await CredentialRequestClientBuilder.fromURI({ uri: INITIATION_TEST_URI }))
128
+ .withCredentialEndpoint('https://oidc4vci.demo.spruceid.com/credential')
129
+ .withFormat('jwt_vc')
130
+ .withCredentialType('OpenBadgeCredential')
131
+ .build();
132
+ const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
133
+ jwt: jwtv1_0_13_withoutDid,
134
+ callbacks: {
135
+ signCallback: proofOfPossessionCallbackFunction,
136
+ verifyCallback: proofOfPossessionVerifierCallbackFunction,
137
+ },
138
+ version: OpenId4VCIVersion.VER_1_0_13,
139
+ })
140
+ .withClientId('sphereon:wallet')
141
+ .withKid(kid_withoutDid)
142
+ .build();
143
+ await proofOfPossessionVerifierCallbackFunction({ ...proof, kid: kid_withoutDid });
144
+ const credentialRequest: CredentialRequestV1_0_13 = await credReqClient.createCredentialRequest({
145
+ proofInput: proof,
146
+ credentialTypes: 'OpenBadgeCredential',
147
+ version: OpenId4VCIVersion.VER_1_0_13,
148
+ });
149
+ expect(credentialRequest.proof?.jwt).toContain(partialJWT_withoutDid);
150
+ if ('types' in credentialRequest) {
151
+ expect(credentialRequest.types).toStrictEqual(['OpenBadgeCredential']);
152
+ }
153
+ });
154
+
118
155
  it('should build correctly from metadata', async () => {
119
156
  const credReqClient = (
120
157
  await CredentialRequestClientBuilder.fromURI({
@@ -28,14 +28,22 @@ import {
28
28
  import { getMockData } from './data/VciDataFixtures';
29
29
 
30
30
  const partialJWT = 'eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJkaWQ6ZXhhbXBsZTplYmZlYjFmN';
31
+ const partialJWT_withoutDid = 'eyJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJlYmZlYjFmNzEyZWJjNmYxYzI3N';
31
32
 
32
33
  const jwt: Jwt = {
33
34
  header: { alg: Alg.ES256, kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'jwt' },
34
35
  payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL },
35
36
  };
36
37
 
38
+ const jwt_withoutDid: Jwt = {
39
+ header: { alg: Alg.ES256, kid: 'ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'jwt' },
40
+ payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL },
41
+ };
42
+
37
43
  const kid = 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1';
38
44
 
45
+ const kid_withoutDid = 'ebfeb1f712ebc6f1c276e12ec21/keys/1';
46
+
39
47
  let keypair: KeyPair;
40
48
 
41
49
  async function proofOfPossessionCallbackFunction(args: Jwt, kid?: string): Promise<string> {
@@ -102,6 +110,36 @@ describe('Credential Request Client ', () => {
102
110
  expect(result?.errorBody?.error).toBe('unsupported_format');
103
111
  });
104
112
 
113
+ it('should get a failed credential response with an unsupported format and without did', async function () {
114
+ const basePath = 'https://sphereonjunit2022101301.com/';
115
+ nock(basePath).post(/.*/).reply(500, {
116
+ error: 'unsupported_format',
117
+ error_description: 'This is a mock error message',
118
+ });
119
+
120
+ const credReqClient = CredentialRequestClientBuilderV1_0_11.fromCredentialOffer({ credentialOffer: INITIATION_TEST_V1_0_08 })
121
+ .withCredentialEndpoint(basePath + '/credential')
122
+ .withFormat('ldp_vc')
123
+ .withCredentialType('https://imsglobal.github.io/openbadges-specification/ob_v3p0.html#OpenBadgeCredential')
124
+ .build();
125
+ const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
126
+ jwt: jwt_withoutDid,
127
+ callbacks: {
128
+ signCallback: proofOfPossessionCallbackFunction,
129
+ },
130
+ version: OpenId4VCIVersion.VER_1_0_08,
131
+ })
132
+ // .withEndpointMetadata(metadata)
133
+ .withClientId('sphereon:wallet')
134
+ .withKid(kid_withoutDid)
135
+ .build();
136
+ expect(credReqClient.getCredentialEndpoint()).toEqual(basePath + '/credential');
137
+ const credentialRequest = await credReqClient.createCredentialRequest({ proofInput: proof, version: OpenId4VCIVersion.VER_1_0_08 });
138
+ expect(credentialRequest.proof?.jwt?.includes(partialJWT_withoutDid)).toBeTruthy();
139
+ const result = await credReqClient.acquireCredentialsUsingRequest(credentialRequest);
140
+ expect(result?.errorBody?.error).toBe('unsupported_format');
141
+ });
142
+
105
143
  it('should get success credential response', async function () {
106
144
  const mockedVC =
107
145
  'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sImlkIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiVW5pdmVyc2l0eURlZ3JlZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaHR0cHM6Ly9leGFtcGxlLmVkdS9pc3N1ZXJzLzU2NTA0OSIsImlzc3VhbmNlRGF0ZSI6IjIwMTAtMDEtMDFUMDA6MDA6MDBaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZXhhbXBsZTplYmZlYjFmNzEyZWJjNmYxYzI3NmUxMmVjMjEiLCJkZWdyZWUiOnsidHlwZSI6IkJhY2hlbG9yRGVncmVlIiwibmFtZSI6IkJhY2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMifX19LCJpc3MiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwibmJmIjoxMjYyMzA0MDAwLCJqdGkiOiJodHRwOi8vZXhhbXBsZS5lZHUvY3JlZGVudGlhbHMvMzczMiIsInN1YiI6ImRpZDpleGFtcGxlOmViZmViMWY3MTJlYmM2ZjFjMjc2ZTEyZWMyMSJ9.z5vgMTK1nfizNCg5N-niCOL3WUIAL7nXy-nGhDZYO_-PNGeE-0djCpWAMH8fD8eWSID5PfkPBYkx_dfLJnQ7NA';
@@ -138,6 +176,42 @@ describe('Credential Request Client ', () => {
138
176
  expect(result?.successBody?.credential).toEqual(mockedVC);
139
177
  });
140
178
 
179
+ it('should get success credential response without did', async function () {
180
+ const mockedVC =
181
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sImlkIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiVW5pdmVyc2l0eURlZ3JlZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaHR0cHM6Ly9leGFtcGxlLmVkdS9pc3N1ZXJzLzU2NTA0OSIsImlzc3VhbmNlRGF0ZSI6IjIwMTAtMDEtMDFUMDA6MDA6MDBaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJlYmZlYjFmNzEyZWJjNmYxYzI3NmUxMmVjMjEiLCJkZWdyZWUiOnsidHlwZSI6IkJhY2hlbG9yRGVncmVlIiwibmFtZSI6IkJhY2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMifX19LCJpc3MiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwibmJmIjoxMjYyMzA0MDAwLCJqdGkiOiJodHRwOi8vZXhhbXBsZS5lZHUvY3JlZGVudGlhbHMvMzczMiIsInN1YiI6ImViZmViMWY3MTJlYmM2ZjFjMjc2ZTEyZWMyMSIsImlhdCI6MTcxODM1NzcxOH0.7iiOTuIjQRyrIincYyDW6m0nBYmDoYfXcTYFrywsKEY';
182
+ nock('https://oidc4vci.demo.spruceid.com')
183
+ .post(/credential/)
184
+ .reply(200, {
185
+ format: 'jwt-vc',
186
+ credential: mockedVC,
187
+ });
188
+ const credReqClient = CredentialRequestClientBuilderV1_0_11.fromCredentialOfferRequest({ request: INITIATION_TEST })
189
+ .withCredentialEndpoint('https://oidc4vci.demo.spruceid.com/credential')
190
+ .withFormat('jwt_vc')
191
+ .withCredentialType('https://imsglobal.github.io/openbadges-specification/ob_v3p0.html#OpenBadgeCredential')
192
+ .build();
193
+ const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
194
+ jwt: jwt_withoutDid,
195
+ callbacks: {
196
+ signCallback: proofOfPossessionCallbackFunction,
197
+ },
198
+ version: OpenId4VCIVersion.VER_1_0_08,
199
+ })
200
+ // .withEndpointMetadata(metadata)
201
+ .withKid(kid_withoutDid)
202
+ .withClientId('sphereon:wallet')
203
+ .build();
204
+ const credentialRequest = await credReqClient.createCredentialRequest({
205
+ proofInput: proof,
206
+ format: 'jwt',
207
+ version: OpenId4VCIVersion.VER_1_0_08,
208
+ });
209
+ expect(credentialRequest.proof?.jwt?.includes(partialJWT_withoutDid)).toBeTruthy();
210
+ expect(credentialRequest.format).toEqual('jwt_vc');
211
+ const result = await credReqClient.acquireCredentialsUsingRequest(credentialRequest);
212
+ expect(result?.successBody?.credential).toEqual(mockedVC);
213
+ });
214
+
141
215
  it('should fail with invalid url', async () => {
142
216
  const credReqClient = CredentialRequestClientBuilderV1_0_11.fromCredentialOfferRequest({ request: INITIATION_TEST })
143
217
  .withCredentialEndpoint('httpsf://oidc4vci.demo.spruceid.com/credential')
@@ -159,6 +233,28 @@ describe('Credential Request Client ', () => {
159
233
  Error(URL_NOT_VALID),
160
234
  );
161
235
  });
236
+
237
+ it('should fail with invalid url without did', async () => {
238
+ const credReqClient = CredentialRequestClientBuilderV1_0_11.fromCredentialOfferRequest({ request: INITIATION_TEST })
239
+ .withCredentialEndpoint('httpsf://oidc4vci.demo.spruceid.com/credential')
240
+ .withFormat('jwt_vc')
241
+ .withCredentialType('https://imsglobal.github.io/openbadges-specification/ob_v3p0.html#OpenBadgeCredential')
242
+ .build();
243
+ const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
244
+ jwt: jwt_withoutDid,
245
+ callbacks: {
246
+ signCallback: proofOfPossessionCallbackFunction,
247
+ },
248
+ version: OpenId4VCIVersion.VER_1_0_08,
249
+ })
250
+ // .withEndpointMetadata(metadata)
251
+ .withKid(kid_withoutDid)
252
+ .withClientId('sphereon:wallet')
253
+ .build();
254
+ await expect(credReqClient.acquireCredentialsUsingRequest({ format: 'jwt_vc_json', types: ['random'], proof })).rejects.toThrow(
255
+ Error(URL_NOT_VALID),
256
+ );
257
+ });
162
258
  });
163
259
 
164
260
  describe('Credential Request Client with Walt.id ', () => {
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  AccessTokenResponse,
3
3
  Alg,
4
- CredentialOfferPayloadV1_0_13,
5
4
  CredentialOfferRequestWithBaseUrl,
6
5
  Jwt,
7
6
  OpenId4VCIVersion,
8
7
  ProofOfPossession,
9
- resolveCredentialOfferURI,
10
8
  WellKnownEndpoints,
11
9
  } from '@sphereon/oid4vci-common';
12
10
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -14,26 +12,34 @@ import {
14
12
  import nock from 'nock';
15
13
 
16
14
  import {
17
- AccessTokenClient,
18
- AccessTokenClientV1_0_11,
19
- CredentialOfferClientV1_0_11,
20
- CredentialRequestClientBuilder,
21
- CredentialRequestClientBuilderV1_0_11,
22
- OpenID4VCIClientV1_0_11,
23
- ProofOfPossessionBuilder,
24
- } from '..';
15
+ AccessTokenClient, AccessTokenClientV1_0_11, CredentialOfferClientV1_0_13,
16
+ CredentialRequestClientBuilder, CredentialRequestClientBuilderV1_0_11,
17
+ OpenID4VCIClient, OpenID4VCIClientV1_0_13,
18
+ ProofOfPossessionBuilder
19
+ } from '..'
25
20
  import { CredentialOfferClient } from '../CredentialOfferClient';
26
21
 
27
- import { IDENTIPROOF_AS_METADATA, IDENTIPROOF_AS_URL, IDENTIPROOF_ISSUER_URL, IDENTIPROOF_OID4VCI_METADATA } from './MetadataMocks';
22
+ import {
23
+ IDENTIPROOF_AS_METADATA,
24
+ IDENTIPROOF_AS_URL,
25
+ IDENTIPROOF_ISSUER_URL,
26
+ IDENTIPROOF_OID4VCI_METADATA,
27
+ IDENTIPROOF_OID4VCI_METADATA_v13
28
+ } from './MetadataMocks'
28
29
 
29
30
  export const UNIT_TEST_TIMEOUT = 30000;
30
31
 
31
32
  const ISSUER_URL = 'https://issuer.research.identiproof.io';
32
- const jwt = {
33
+ const jwtDid = {
33
34
  header: { alg: Alg.ES256, kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'openid4vci-proof+jwt' },
34
35
  payload: { iss: 'test-clientId', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: ISSUER_URL },
35
36
  };
36
37
 
38
+ const jwtWithoutDid = {
39
+ header: { alg: Alg.ES256, kid: 'ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'openid4vci-proof+jwt' },
40
+ payload: { iss: 'test-clientId', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: ISSUER_URL },
41
+ };
42
+
37
43
  describe('OID4VCI-Client should', () => {
38
44
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
45
  async function proofOfPossessionCallbackFunction(_args: Jwt, _kid?: string): Promise<string> {
@@ -67,6 +73,8 @@ describe('OID4VCI-Client should', () => {
67
73
  'https://issuer.research.identiproof.io?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%22issuer_state%22%3A%22eyJhbGciOiJSU0Et...FYUaBy%22%7D%7D%7D';
68
74
  const HTTPS_OFFER_QR_PRE_AUTHORIZED =
69
75
  'https://issuer.research.identiproof.io?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D';
76
+ const HTTPS_OFFER_QR_PRE_AUTHORIZED_v13 =
77
+ 'https://issuer.research.identiproof.io?credential_offer=%7B%0A%20%20%20%20%22credential_issuer%22%3A%20%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%0A%20%20%20%20%22credential_configuration_ids%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%22UniversityDegreeCredential%22%0A%20%20%20%20%5D%2C%0A%20%20%20%20%22grants%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22pre-authorized_code%22%3A%20%22adhjhdjajkdkhjhdj%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22tx_code%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22length%22%3A%204%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22input_mode%22%3A%20%22numeric%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22description%22%3A%20%22Please%20provide%20the%20one-time%20code%20that%20was%20sent%20via%20e-mail%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D';
70
78
 
71
79
  const INITIATE_QR_V1_0_13 =
72
80
  'openid-credential-offer://?credential_offer=%7B%22credential_issuer%22:%22https://issuer.research.identiproof.io%22,%22credential_configuration_ids%22:%5B%22OpenBadgeCredentialUrl%22%5D,%22grants%22:%7B%22urn:ietf:params:oauth:grant-type:pre-authorized_code%22:%7B%22pre-authorized_code%22:%22oaKazRN8I0IbtZ0C7JuMn5%22,%22tx_code%22:%7B%22input_mode%22:%22text%22,%22length%22:22,%22description%22:%22Please%20enter%20the%20serial%20number%20of%20your%20physical%20drivers%20license%22%7D%7D%7D%7D';
@@ -75,6 +83,7 @@ describe('OID4VCI-Client should', () => {
75
83
  nock(IDENTIPROOF_ISSUER_URL).get('/.well-known/openid-credential-issuer').reply(200, JSON.stringify(IDENTIPROOF_OID4VCI_METADATA));
76
84
  nock(IDENTIPROOF_AS_URL).get('/.well-known/oauth-authorization-server').reply(200, JSON.stringify(IDENTIPROOF_AS_METADATA));
77
85
  nock(IDENTIPROOF_AS_URL).get(WellKnownEndpoints.OPENID_CONFIGURATION).reply(404, {});
86
+ nock(IDENTIPROOF_ISSUER_URL).get(WellKnownEndpoints.OPENID_CONFIGURATION).reply(200, {});
78
87
  nock(IDENTIPROOF_AS_URL)
79
88
  .post(/oauth2\/token.*/)
80
89
  .reply(200, JSON.stringify(mockedAccessTokenResponse));
@@ -88,7 +97,7 @@ describe('OID4VCI-Client should', () => {
88
97
 
89
98
  it('succeed with a full flow with the client using OpenID4VCI version 9', async () => {
90
99
  succeedWithAFullFlowWithClientSetup();
91
- const client = await OpenID4VCIClientV1_0_11.fromURI({
100
+ const client = await OpenID4VCIClient.fromURI({
92
101
  uri: INITIATE_QR_V1_0_08,
93
102
  kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
94
103
  alg: Alg.ES256,
@@ -99,7 +108,7 @@ describe('OID4VCI-Client should', () => {
99
108
 
100
109
  it('succeed with a full flow with the client using OpenID4VCI version 11 and deeplink', async () => {
101
110
  succeedWithAFullFlowWithClientSetup();
102
- const client = await OpenID4VCIClientV1_0_11.fromURI({
111
+ const client = await OpenID4VCIClient.fromURI({
103
112
  uri: OFFER_QR_V1_0_08,
104
113
  kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
105
114
  alg: Alg.ES256,
@@ -109,8 +118,8 @@ describe('OID4VCI-Client should', () => {
109
118
  });
110
119
 
111
120
  it('succeed with a full flow with the client using OpenID4VCI draft < 9 and https', async () => {
112
- succeedWithAFullFlowWithClientSetup();
113
- const client = await OpenID4VCIClientV1_0_11.fromURI({
121
+ succeedWithAFullFlowWithClientSetup()
122
+ const client = await OpenID4VCIClient.fromURI({
114
123
  uri: HTTPS_INITIATE_QR,
115
124
  kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
116
125
  alg: Alg.ES256,
@@ -120,8 +129,8 @@ describe('OID4VCI-Client should', () => {
120
129
  });
121
130
 
122
131
  it('should succeed with a full flow with the client using OpenID4VCI draft > 11, https and authorization_code flow', async () => {
123
- succeedWithAFullFlowWithClientSetup();
124
- const client = await OpenID4VCIClientV1_0_11.fromURI({
132
+ succeedWithAFullFlowWithClientSetup()
133
+ const client = await OpenID4VCIClient.fromURI({
125
134
  uri: HTTPS_OFFER_QR_AUTHORIZATION_CODE,
126
135
  kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
127
136
  alg: Alg.ES256,
@@ -131,8 +140,64 @@ describe('OID4VCI-Client should', () => {
131
140
  });
132
141
 
133
142
  it('should succeed with a full flow with the client using OpenID4VCI draft > 11, https and preauthorized_code flow', async () => {
134
- succeedWithAFullFlowWithClientSetup();
135
- const client = await OpenID4VCIClientV1_0_11.fromURI({
143
+ succeedWithAFullFlowWithClientSetup()
144
+ const client = await OpenID4VCIClient.fromURI({
145
+ uri: HTTPS_OFFER_QR_PRE_AUTHORIZED,
146
+ kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
147
+ alg: Alg.ES256,
148
+ clientId: 'test-clientId',
149
+ });
150
+ await assertionOfsucceedWithAFullFlowWithClient(client);
151
+ });
152
+
153
+ it('should succeed with a full flow with the client using OpenID4VCI draft >= 13, https and preauthorized_code flow without did', async () => {
154
+ nock(IDENTIPROOF_ISSUER_URL).get(WellKnownEndpoints.OPENID_CONFIGURATION).reply(200, {
155
+ token_endpoint: `${IDENTIPROOF_ISSUER_URL}/token`,
156
+ authorization_endpoint: `${IDENTIPROOF_ISSUER_URL}/authorize`,
157
+ });
158
+ nock(IDENTIPROOF_ISSUER_URL).post('/token').reply(200, {
159
+ access_token: 'ey6546.546654.64565',
160
+ authorization_pending: false,
161
+ c_nonce: 'c_nonce2022101300',
162
+ c_nonce_expires_in: 2025101300,
163
+ interval: 2025101300,
164
+ token_type: 'Bearer',
165
+ })
166
+ nock(IDENTIPROOF_ISSUER_URL).get('/.well-known/openid-credential-issuer').reply(200, JSON.stringify(IDENTIPROOF_OID4VCI_METADATA_v13));
167
+ nock(ISSUER_URL)
168
+ .post(/credential/)
169
+ .reply(200, {
170
+ format: 'jwt-vc',
171
+ credential: mockedVC,
172
+ });
173
+ const client = await OpenID4VCIClientV1_0_13.fromURI({
174
+ uri: HTTPS_OFFER_QR_PRE_AUTHORIZED_v13,
175
+ kid: 'ebfeb1f712ebc6f1c276e12ec21/keys/1',
176
+ alg: Alg.ES256,
177
+ clientId: 'test-clientId',
178
+ });
179
+ expect(client.credentialOffer).toBeDefined();
180
+ expect(client.endpointMetadata).toBeDefined();
181
+ expect(client.getIssuer()).toEqual('https://issuer.research.identiproof.io');
182
+ expect(client.getCredentialEndpoint()).toEqual('https://issuer.research.identiproof.io/credential');
183
+ expect(client.getAccessTokenEndpoint()).toEqual('https://issuer.research.identiproof.io/token');
184
+
185
+ const accessToken = await client.acquireAccessToken({ pin: '1234', code: 'ABCD' });
186
+ expect(accessToken).toEqual(mockedAccessTokenResponse);
187
+
188
+ const credentialResponse = await client.acquireCredentials({
189
+ credentialIdentifier: 'OpenBadgeCredential',
190
+ format: 'jwt_vc_json-ld',
191
+ proofCallbacks: {
192
+ signCallback: proofOfPossessionCallbackFunction,
193
+ },
194
+ });
195
+ expect(credentialResponse.credential).toEqual(mockedVC);
196
+ });
197
+
198
+ it('should succeed with a full flow with the client using OpenID4VCI draft > 11, https and preauthorized_code flow', async () => {
199
+ succeedWithAFullFlowWithClientSetup()
200
+ const client = await OpenID4VCIClient.fromURI({
136
201
  uri: HTTPS_OFFER_QR_PRE_AUTHORIZED,
137
202
  kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1',
138
203
  alg: Alg.ES256,
@@ -141,7 +206,7 @@ describe('OID4VCI-Client should', () => {
141
206
  await assertionOfsucceedWithAFullFlowWithClient(client);
142
207
  });
143
208
 
144
- async function assertionOfsucceedWithAFullFlowWithClient(client: OpenID4VCIClientV1_0_11) {
209
+ async function assertionOfsucceedWithAFullFlowWithClient(client: OpenID4VCIClient) {
145
210
  expect(client.credentialOffer).toBeDefined();
146
211
  expect(client.endpointMetadata).toBeDefined();
147
212
  expect(client.getIssuer()).toEqual('https://issuer.research.identiproof.io');
@@ -162,10 +227,10 @@ describe('OID4VCI-Client should', () => {
162
227
  }
163
228
 
164
229
  it(
165
- 'succeed with a full flow without the client v1_0_11',
230
+ 'succeed with a full flow without the client',
166
231
  async () => {
167
232
  /* Convert the URI into an object */
168
- const credentialOffer: CredentialOfferRequestWithBaseUrl = await CredentialOfferClientV1_0_11.fromURI(INITIATE_QR_V1_0_08);
233
+ const credentialOffer: CredentialOfferRequestWithBaseUrl = await CredentialOfferClient.fromURI(INITIATE_QR_V1_0_08);
169
234
 
170
235
  expect(credentialOffer.baseUrl).toEqual('openid-initiate-issuance://');
171
236
  expect(credentialOffer.original_credential_offer).toEqual({
@@ -202,7 +267,7 @@ describe('OID4VCI-Client should', () => {
202
267
  // Types of parameters 'args' and 'args' are incompatible.
203
268
  // Property 'kid' is missing in type '{ header: unknown; payload: unknown; }' but required in type 'ProofOfPossessionCallbackArgs'.
204
269
  const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
205
- jwt,
270
+ jwt: jwtDid,
206
271
  callbacks: {
207
272
  signCallback: proofOfPossessionCallbackFunction,
208
273
  },
@@ -222,164 +287,36 @@ describe('OID4VCI-Client should', () => {
222
287
  );
223
288
 
224
289
  it(
225
- 'succeed with a full flow without the client v1_0_13',
290
+ 'succeed with a full flow without the client and without did',
226
291
  async () => {
227
292
  /* Convert the URI into an object */
228
- const credentialOffer: CredentialOfferRequestWithBaseUrl = await CredentialOfferClient.fromURI(INITIATE_QR_V1_0_13);
229
- const preAuthorizedCode = 'oaKazRN8I0IbtZ0C7JuMn5';
293
+ const credentialOffer: CredentialOfferRequestWithBaseUrl = await CredentialOfferClientV1_0_13.fromURI(INITIATE_QR_V1_0_13);
294
+
230
295
  expect(credentialOffer.baseUrl).toEqual('openid-credential-offer://');
231
- expect((credentialOffer.credential_offer as CredentialOfferPayloadV1_0_13).credential_configuration_ids).toEqual(['OpenBadgeCredentialUrl']);
232
- expect(credentialOffer.original_credential_offer.grants).toEqual({
233
- 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
234
- 'pre-authorized_code': preAuthorizedCode,
235
- tx_code: {
236
- input_mode: 'text',
237
- description: 'Please enter the serial number of your physical drivers license',
238
- length: preAuthorizedCode.length,
296
+ expect(credentialOffer.original_credential_offer).toEqual({
297
+ credential_configuration_ids: ['OpenBadgeCredentialUrl'],
298
+ credential_issuer: ISSUER_URL,
299
+ grants: {
300
+ 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
301
+ 'pre-authorized_code': "oaKazRN8I0IbtZ0C7JuMn5",
302
+ tx_code: {
303
+ description: 'Please enter the serial number of your physical drivers license',
304
+ input_mode: 'text',
305
+ length: 22,
306
+ },
239
307
  },
240
- },
308
+ }
241
309
  });
242
310
 
243
311
  nock(ISSUER_URL)
244
- .post(/token.*/)
245
- .reply(200, JSON.stringify(mockedAccessTokenResponse));
312
+ .post(/token.*/)
313
+ .reply(200, JSON.stringify(mockedAccessTokenResponse));
246
314
 
247
315
  /* The actual access token calls */
248
316
  const accessTokenClient: AccessTokenClient = new AccessTokenClient();
249
317
  const accessTokenResponse = await accessTokenClient.acquireAccessToken({ credentialOffer: credentialOffer, pin: '1234' });
250
318
  expect(accessTokenResponse.successBody).toEqual(mockedAccessTokenResponse);
251
319
  // Get the credential
252
- nock(ISSUER_URL)
253
- .post(/credential/)
254
- .reply(200, {
255
- format: 'jwt-vc',
256
- credential: mockedVC,
257
- });
258
- const credReqClient = CredentialRequestClientBuilder.fromCredentialOffer({ credentialOffer: credentialOffer })
259
- .withFormat('jwt_vc')
260
-
261
- .withTokenFromResponse(accessTokenResponse.successBody!)
262
- .build();
263
-
264
- //TS2322: Type '(args: ProofOfPossessionCallbackArgs) => Promise<string>'
265
- // is not assignable to type 'ProofOfPossessionCallback'.
266
- // Types of parameters 'args' and 'args' are incompatible.
267
- // Property 'kid' is missing in type '{ header: unknown; payload: unknown; }' but required in type 'ProofOfPossessionCallbackArgs'.
268
- const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
269
- jwt,
270
- callbacks: {
271
- signCallback: proofOfPossessionCallbackFunction,
272
- },
273
- version: OpenId4VCIVersion.VER_1_0_11,
274
- })
275
- .withEndpointMetadata({
276
- issuer: 'https://issuer.research.identiproof.io',
277
- credential_endpoint: 'https://issuer.research.identiproof.io/credential',
278
- token_endpoint: 'https://issuer.research.identiproof.io/token',
279
- })
280
- .withKid('did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1')
281
- .build();
282
- const credResponse = await credReqClient.acquireCredentialsUsingProof({
283
- proofInput: proof,
284
- credentialTypes: credentialOffer.original_credential_offer.credential_configuration_ids[0],
285
- });
286
- expect(credResponse.successBody?.credential).toEqual(mockedVC);
287
- },
288
- UNIT_TEST_TIMEOUT,
289
- );
290
- });
291
-
292
- describe('OIDVCI-Client for v1_0_13 should', () => {
293
- const INITIATE_QR_V1_0_13_CREDENCO =
294
- 'openid-credential-offer://mijnkvk.acc.credenco.com/?credential_offer_uri=https%3A%2F%2Fmijnkvk.acc.credenco.com%2Fopenid4vc%2FcredentialOffer%3Fid%3D32fc4ebf-9e31-4149-9877-e3c0b602d559';
295
-
296
- const mockedCredentialOffer = {
297
- credential_issuer: 'https://mijnkvk.acc.credenco.com',
298
- credential_configuration_ids: ['BevoegdheidUittreksel_jwt_vc_json'],
299
- grants: {
300
- authorization_code: {
301
- issuer_state: '32fc4ebf-9e31-4149-9877-e3c0b602d559',
302
- },
303
- 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
304
- 'pre-authorized_code':
305
- 'eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiIzMmZjNGViZi05ZTMxLTQxNDktOTg3Ny1lM2MwYjYwMmQ1NTkiLCJpc3MiOiJodHRwczovL21pam5rdmsuYWNjLmNyZWRlbmNvLmNvbSIsImF1ZCI6IlRPS0VOIn0.754aiQ87O0vHYSpRvPqAS9cLOgf-pewdeXbpLziRwsxEp9mENfaXpY62muYpzOaWcYmTOydkzhFul-NDYXJZCA',
306
- },
307
- },
308
- };
309
-
310
- beforeEach(() => {
311
- // Mock the HTTP GET request to the credential offer URI
312
- nock('https://mijnkvk.acc.credenco.com')
313
- .get('/openid4vc/credentialOffer?id=32fc4ebf-9e31-4149-9877-e3c0b602d559')
314
- .reply(200, mockedCredentialOffer)
315
- .persist(); // Use .persist() if you want the mock to remain active for multiple tests
316
- });
317
-
318
- afterEach(() => {
319
- // Clean up all mocks
320
- nock.cleanAll();
321
- });
322
-
323
- /*function succeedWithAFullFlowWithClientSetup() {
324
- nock(IDENTIPROOF_ISSUER_URL).get('/.well-known/openid-credential-issuer').reply(200, JSON.stringify(IDENTIPROOF_OID4VCI_METADATA));
325
- nock(IDENTIPROOF_AS_URL).get('/.well-known/oauth-authorization-server').reply(200, JSON.stringify(IDENTIPROOF_AS_METADATA));
326
- nock(IDENTIPROOF_AS_URL).get(WellKnownEndpoints.OPENID_CONFIGURATION).reply(404, {});
327
- nock(IDENTIPROOF_AS_URL)
328
- .post(/oauth2\/token.*!/)
329
- .reply(200, JSON.stringify(mockedAccessTokenResponse));
330
- nock(ISSUER_URL)
331
- .post(/credential/)
332
- .reply(200, {
333
- format: 'jwt-vc',
334
- credential: mockedVC,
335
- });
336
- }*/
337
-
338
- it('should successfully resolve the credential offer URI', async () => {
339
- const uri = 'https://mijnkvk.acc.credenco.com/openid4vc/credentialOffer?id=32fc4ebf-9e31-4149-9877-e3c0b602d559';
340
-
341
- const credentialOffer = await resolveCredentialOfferURI(uri);
342
-
343
- expect(credentialOffer).toEqual(mockedCredentialOffer);
344
- });
345
-
346
- // TODO: ksadjad remove the skipped test
347
- it.skip(
348
- 'succeed credenco with a full flow without the client v1_0_13',
349
- async () => {
350
- /* Convert the URI into an object */
351
- // openid-credential-offer://?credential_offer%3D%7B%22credential_issuer%22%3A%22https%3A%2F%2Fissuer.research.identiproof.io%22%2C%22credentials%22%3A%5B%7B%22format%22%3A%22jwt_vc_json%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22UniversityDegreeCredential%22%5D%7D%5D%2C%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22adhjhdjajkdkhjhdj%22%2C%22user_pin_required%22%3Atrue%7D%7D%7D
352
- const credentialOffer: CredentialOfferRequestWithBaseUrl = await CredentialOfferClient.fromURI(INITIATE_QR_V1_0_13_CREDENCO);
353
- /**
354
- * {"credential_issuer":"https://mijnkvk.acc.credenco.com","credential_configuration_ids":["BevoegdheidUittreksel_jwt_vc_json"],"grants":{"authorization_code":{"issuer_state":"32fc4ebf-9e31-4149-9877-e3c0b602d559"},"urn:ietf:params:oauth:grant-type:pre-authorized_code":{"pre-authorized_code":"eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiIzMmZjNGViZi05ZTMxLTQxNDktOTg3Ny1lM2MwYjYwMmQ1NTkiLCJpc3MiOiJodHRwczovL21pam5rdmsuYWNjLmNyZWRlbmNvLmNvbSIsImF1ZCI6IlRPS0VOIn0.754aiQ87O0vHYSpRvPqAS9cLOgf-pewdeXbpLziRwsxEp9mENfaXpY62muYpzOaWcYmTOydkzhFul-NDYXJZCA"}}}
355
- */
356
- const preAuthorizedCode =
357
- 'eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiIzMmZjNGViZi05ZTMxLTQxNDktOTg3Ny1lM2MwYjYwMmQ1NTkiLCJpc3MiOiJodHRwczovL21pam5rdmsuYWNjLmNyZWRlbmNvLmNvbSIsImF1ZCI6IlRPS0VOIn0.754aiQ87O0vHYSpRvPqAS9cLOgf-pewdeXbpLziRwsxEp9mENfaXpY62muYpzOaWcYmTOydkzhFul-NDYXJZCA';
358
- expect(credentialOffer.baseUrl).toEqual('openid-credential-offer://mijnkvk.acc.credenco.com/');
359
- expect((credentialOffer.credential_offer as CredentialOfferPayloadV1_0_13).credential_configuration_ids).toEqual([
360
- 'BevoegdheidUittreksel_jwt_vc_json',
361
- ]);
362
- expect(credentialOffer.original_credential_offer.grants).toEqual({
363
- authorization_code: {
364
- issuer_state: '32fc4ebf-9e31-4149-9877-e3c0b602d559',
365
- },
366
- 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
367
- 'pre-authorized_code': preAuthorizedCode,
368
- },
369
- });
370
-
371
- /*nock(ISSUER_URL)
372
- .post(/token.*!/)
373
- .reply(200, JSON.stringify(mockedAccessTokenResponse));*/
374
-
375
- /* The actual access token calls */
376
- const accessTokenClient: AccessTokenClient = new AccessTokenClient();
377
- const accessTokenResponse = await accessTokenClient.acquireAccessToken({
378
- credentialOffer: credentialOffer,
379
- pin: preAuthorizedCode /*, metadata: {}*/,
380
- });
381
- expect(accessTokenResponse.successBody).toEqual({});
382
- /*// Get the credential
383
320
  nock(ISSUER_URL)
384
321
  .post(/credential/)
385
322
  .reply(200, {
@@ -397,24 +334,21 @@ describe('OIDVCI-Client for v1_0_13 should', () => {
397
334
  // Types of parameters 'args' and 'args' are incompatible.
398
335
  // Property 'kid' is missing in type '{ header: unknown; payload: unknown; }' but required in type 'ProofOfPossessionCallbackArgs'.
399
336
  const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
400
- jwt,
337
+ jwt: jwtWithoutDid,
401
338
  callbacks: {
402
339
  signCallback: proofOfPossessionCallbackFunction,
403
340
  },
404
- version: OpenId4VCIVersion.VER_1_0_11,
341
+ version: OpenId4VCIVersion.VER_1_0_13,
405
342
  })
406
343
  .withEndpointMetadata({
407
344
  issuer: 'https://issuer.research.identiproof.io',
408
345
  credential_endpoint: 'https://issuer.research.identiproof.io/credential',
409
346
  token_endpoint: 'https://issuer.research.identiproof.io/token',
410
347
  })
411
- .withKid('did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1')
348
+ .withKid('ebfeb1f712ebc6f1c276e12ec21/keys/1')
412
349
  .build();
413
- const credResponse = await credReqClient.acquireCredentialsUsingProof({
414
- proofInput: proof,
415
- credentialTypes: credentialOffer.original_credential_offer.credential_configuration_ids,
416
- });
417
- expect(credResponse.successBody?.credential).toEqual(mockedVC);*/
350
+ const credResponse = await credReqClient.acquireCredentialsUsingProof({ proofInput: proof, credentialIdentifier: 'OpenBadgeCredentialUrl'});
351
+ expect(credResponse.successBody?.credential).toEqual(mockedVC);
418
352
  },
419
353
  UNIT_TEST_TIMEOUT,
420
354
  );
@@ -127,6 +127,41 @@ export const IDENTIPROOF_OID4VCI_METADATA = {
127
127
  },
128
128
  },
129
129
  };
130
+ export const IDENTIPROOF_OID4VCI_METADATA_v13 = {
131
+ issuer: 'https://issuer.research.identiproof.io',
132
+ authorization_server: 'https://auth.research.identiproof.io',
133
+ credential_endpoint: 'https://issuer.research.identiproof.io/credential',
134
+ jwks_uri: 'https://issuer.research.identiproof.io/.well-known/did.json',
135
+ credential_configurations_supported: {
136
+ 'Cyber Security Certificate': {
137
+ formats: {
138
+ jwt_vc: {
139
+ types: ['VerifiableCredential', 'Cyber Security Certificate'],
140
+ cryptographic_binding_methods_supported: ['did'],
141
+ cryptographic_suites_supported: ['ES256'],
142
+ },
143
+ },
144
+ },
145
+ OpenBadgeCredential: {
146
+ formats: {
147
+ jwt_vc: {
148
+ types: ['VerifiableCredential', 'OpenBadgeCredential'],
149
+ cryptographic_binding_methods_supported: ['did'],
150
+ cryptographic_suites_supported: ['ES256'],
151
+ },
152
+ },
153
+ },
154
+ OpenBadgeExtendedCredential: {
155
+ formats: {
156
+ jwt_vc: {
157
+ types: ['VerifiableCredential', 'OpenBadgeExtendedCredential'],
158
+ cryptographic_binding_methods_supported: ['did'],
159
+ cryptographic_suites_supported: ['ES256'],
160
+ },
161
+ },
162
+ },
163
+ },
164
+ };
130
165
 
131
166
  export const SPRUCE_OID4VCI_METADATA = {
132
167
  issuer: 'https://ngi-oidc4vci-test.spruceid.xyz',
@@ -12,8 +12,15 @@ const jwt: Jwt = {
12
12
  payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL, iat: Date.now() / 1000 },
13
13
  };
14
14
 
15
+ const jwt_withoutDid: Jwt = {
16
+ header: { alg: Alg.ES256, kid: 'ebfeb1f712ebc6f1c276e12ec21/keys/1', typ: 'jwt' },
17
+ payload: { iss: 'sphereon:wallet', nonce: 'tZignsnFbp', jti: 'tZignsnFbp223', aud: IDENTIPROOF_ISSUER_URL, iat: Date.now() / 1000 },
18
+ };
19
+
15
20
  const kid = 'did:example:ebfeb1f712ebc6f1c276e12ec21/keys/1';
16
21
 
22
+ const kid_withoutDid = 'ebfeb1f712ebc6f1c276e12ec21/keys/1';
23
+
17
24
  let keypair: KeyPair;
18
25
 
19
26
  async function proofOfPossessionCallbackFunction(args: Jwt, kid?: string): Promise<string> {
@@ -52,6 +59,16 @@ describe('ProofOfPossession Builder ', () => {
52
59
  ).rejects.toThrow(Error(PROOF_CANT_BE_CONSTRUCTED));
53
60
  });
54
61
 
62
+ it('should fail without supplied proof or callbacks and with kid without did', async function () {
63
+ await expect(
64
+ ProofOfPossessionBuilder.fromProof(undefined as never, OpenId4VCIVersion.VER_1_0_13)
65
+ .withIssuer(IDENTIPROOF_ISSUER_URL)
66
+ .withClientId('sphereon:wallet')
67
+ .withKid(kid_withoutDid)
68
+ .build(),
69
+ ).rejects.toThrow(Error(PROOF_CANT_BE_CONSTRUCTED));
70
+ });
71
+
55
72
  it('should fail wit undefined jwt supplied', async function () {
56
73
  await expect(() =>
57
74
  ProofOfPossessionBuilder.fromJwt({ jwt, callbacks: { signCallback: proofOfPossessionCallbackFunction }, version: OpenId4VCIVersion.VER_1_0_08 })
@@ -63,6 +80,21 @@ describe('ProofOfPossession Builder ', () => {
63
80
  ).toThrow(Error(NO_JWT_PROVIDED));
64
81
  });
65
82
 
83
+ it('should fail with undefined jwt supplied and kid without did', async function () {
84
+ await expect(() =>
85
+ ProofOfPossessionBuilder.fromJwt({
86
+ jwt: jwt_withoutDid,
87
+ callbacks: { signCallback: proofOfPossessionCallbackFunction },
88
+ version: OpenId4VCIVersion.VER_1_0_08,
89
+ })
90
+ .withJwt(undefined as never)
91
+ .withIssuer(IDENTIPROOF_ISSUER_URL)
92
+ .withClientId('sphereon:wallet')
93
+ .withKid(kid_withoutDid)
94
+ .build(),
95
+ ).toThrow(Error(NO_JWT_PROVIDED));
96
+ });
97
+
66
98
  it('should build a proof with all required params present', async function () {
67
99
  const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
68
100
  jwt,
@@ -78,6 +110,21 @@ describe('ProofOfPossession Builder ', () => {
78
110
  expect(proof).toBeDefined();
79
111
  });
80
112
 
113
+ it('should build a proof with all required params present without did', async function () {
114
+ const proof: ProofOfPossession = await ProofOfPossessionBuilder.fromJwt({
115
+ jwt: jwt_withoutDid,
116
+ callbacks: {
117
+ signCallback: proofOfPossessionCallbackFunction,
118
+ },
119
+ version: OpenId4VCIVersion.VER_1_0_08,
120
+ })
121
+ .withIssuer(IDENTIPROOF_ISSUER_URL)
122
+ .withKid(kid_withoutDid)
123
+ .withClientId('sphereon:wallet')
124
+ .build();
125
+ expect(proof).toBeDefined();
126
+ });
127
+
81
128
  it('should fail creating a proof of possession with simple verification', async () => {
82
129
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
130
  async function proofOfPossessionCallbackFunction(_args: Jwt, _kid?: string): Promise<string> {
@@ -93,6 +140,25 @@ describe('ProofOfPossession Builder ', () => {
93
140
  ).rejects.toThrow(Error(JWS_NOT_VALID));
94
141
  });
95
142
 
143
+ it('should fail creating a proof of possession with simple verification and without did', async () => {
144
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
145
+ async function proofOfPossessionCallbackFunction(_args: Jwt, _kid?: string): Promise<string> {
146
+ throw new Error(JWS_NOT_VALID);
147
+ }
148
+
149
+ await expect(
150
+ ProofOfPossessionBuilder.fromJwt({
151
+ jwt: jwt_withoutDid,
152
+ callbacks: { signCallback: proofOfPossessionCallbackFunction },
153
+ version: OpenId4VCIVersion.VER_1_0_08,
154
+ })
155
+ .withIssuer(IDENTIPROOF_ISSUER_URL)
156
+ .withClientId('sphereon:wallet')
157
+ .withKid(kid_withoutDid)
158
+ .build(),
159
+ ).rejects.toThrow(Error(JWS_NOT_VALID));
160
+ });
161
+
96
162
  it('should fail creating a proof of possession without verify callback', async () => {
97
163
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
164
  async function proofOfPossessionCallbackFunction(_args: Jwt, _kid?: string): Promise<string> {
@@ -107,4 +173,23 @@ describe('ProofOfPossession Builder ', () => {
107
173
  .build(),
108
174
  ).rejects.toThrow(Error(JWS_NOT_VALID));
109
175
  });
176
+
177
+ it('should fail creating a proof of possession without verify callback and without did', async () => {
178
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
179
+ async function proofOfPossessionCallbackFunction(_args: Jwt, _kid?: string): Promise<string> {
180
+ throw new Error(JWS_NOT_VALID);
181
+ }
182
+
183
+ await expect(
184
+ ProofOfPossessionBuilder.fromJwt({
185
+ jwt: jwt_withoutDid,
186
+ callbacks: { signCallback: proofOfPossessionCallbackFunction },
187
+ version: OpenId4VCIVersion.VER_1_0_08,
188
+ })
189
+ .withIssuer(IDENTIPROOF_ISSUER_URL)
190
+ .withClientId('sphereon:wallet')
191
+ .withKid(kid_withoutDid)
192
+ .build(),
193
+ ).rejects.toThrow(Error(JWS_NOT_VALID));
194
+ });
110
195
  });
@@ -166,4 +166,107 @@ describe('sd-jwt vc', () => {
166
166
  },
167
167
  UNIT_TEST_TIMEOUT,
168
168
  );
169
+
170
+ it(
171
+ 'succeed with a full flow without did',
172
+ async () => {
173
+ const offerUri = await vcIssuer.createCredentialOfferURI({
174
+ grants: {
175
+ 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
176
+ tx_code: {
177
+ input_mode: 'text',
178
+ length: 3,
179
+ },
180
+ 'pre-authorized_code': '123',
181
+ },
182
+ },
183
+ credential_configuration_ids: ['SdJwtCredential'],
184
+ });
185
+
186
+ nock(vcIssuer.issuerMetadata.credential_issuer).get('/.well-known/openid-credential-issuer').reply(200, JSON.stringify(issuerMetadata));
187
+ nock(vcIssuer.issuerMetadata.credential_issuer).get('/.well-known/openid-configuration').reply(404);
188
+ nock(vcIssuer.issuerMetadata.credential_issuer).get('/.well-known/oauth-authorization-server').reply(404);
189
+
190
+ expect(offerUri.uri).toEqual(
191
+ 'openid-credential-offer://?credential_offer=%7B%22grants%22%3A%7B%22urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Apre-authorized_code%22%3A%7B%22pre-authorized_code%22%3A%22123%22%2C%22tx_code%22%3A%7B%22input_mode%22%3A%22text%22%2C%22length%22%3A3%7D%7D%7D%2C%22credential_configuration_ids%22%3A%5B%22SdJwtCredential%22%5D%2C%22credential_issuer%22%3A%22https%3A%2F%2Fexample.com%22%7D',
192
+ );
193
+
194
+ const client = await OpenID4VCIClientV1_0_13.fromURI({
195
+ uri: offerUri.uri,
196
+ });
197
+
198
+ expect(client.credentialOffer?.credential_offer).toEqual({
199
+ credential_issuer: 'https://example.com',
200
+ credential_configuration_ids: ['SdJwtCredential'],
201
+ grants: {
202
+ 'urn:ietf:params:oauth:grant-type:pre-authorized_code': {
203
+ 'pre-authorized_code': '123',
204
+ tx_code: {
205
+ input_mode: 'text',
206
+ length: 3,
207
+ },
208
+ },
209
+ },
210
+ });
211
+
212
+ const supported = client.getCredentialsSupported('vc+sd-jwt');
213
+ expect(supported).toEqual({ SdJwtCredentialId: { format: 'vc+sd-jwt', id: 'SdJwtCredentialId', vct: 'SdJwtCredentialId' } });
214
+
215
+ const offered = supported['SdJwtCredentialId'] as CredentialSupportedSdJwtVc;
216
+
217
+ nock(issuerMetadata.token_endpoint as string)
218
+ .post('/')
219
+ .reply(200, async (_, body: string) => {
220
+ const parsedBody = Object.fromEntries(body.split('&').map((x) => x.split('=')));
221
+ return createAccessTokenResponse(parsedBody as AccessTokenRequest, {
222
+ credentialOfferSessions: vcIssuer.credentialOfferSessions,
223
+ accessTokenIssuer: 'https://issuer.example.com',
224
+ cNonces: vcIssuer.cNonces,
225
+ cNonce: 'a-c-nonce',
226
+ accessTokenSignerCallback: async () => 'ey.val.ue',
227
+ tokenExpiresIn: 500,
228
+ });
229
+ });
230
+
231
+ await client.acquireAccessToken({ pin: '123' });
232
+ nock(issuerMetadata.credential_endpoint as string)
233
+ .post('/')
234
+ .reply(200, async (_, body) =>
235
+ vcIssuer.issueCredential({
236
+ credentialRequest: { ...(body as CredentialRequestV1_0_13), credential_identifier: offered.vct },
237
+ credential: {
238
+ vct: 'Hello',
239
+ iss: 'example.com',
240
+ iat: 123,
241
+ // Defines what can be disclosed (optional)
242
+ __disclosureFrame: {
243
+ name: true,
244
+ },
245
+ },
246
+ newCNonce: 'new-c-nonce',
247
+ }),
248
+ );
249
+
250
+ const credentials = await client.acquireCredentials({
251
+ credentialIdentifier: offered.vct,
252
+ // format: 'vc+sd-jwt',
253
+ alg,
254
+ jwk,
255
+ proofCallbacks: {
256
+ // When using sd-jwt for real, this jwt should include a jwk
257
+ signCallback: async () => 'ey.ja.ja',
258
+ },
259
+ });
260
+
261
+ expect(credentials).toEqual({
262
+ notification_id: expect.any(String),
263
+ access_token: 'ey.val.ue',
264
+ c_nonce: 'new-c-nonce',
265
+ c_nonce_expires_in: 300,
266
+ credential: 'sd-jwt',
267
+ // format: 'vc+sd-jwt',
268
+ });
269
+ },
270
+ UNIT_TEST_TIMEOUT,
271
+ );
169
272
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/oid4vci-client",
3
- "version": "0.12.1-next.4+40ad1de",
3
+ "version": "0.12.1-unstable.3+5439a02",
4
4
  "description": "OpenID for Verifiable Credential Issuance (OpenID4VCI) client",
5
5
  "source": "lib/index.ts",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "build": "tsc"
16
16
  },
17
17
  "dependencies": {
18
- "@sphereon/oid4vci-common": "0.12.1-next.4+40ad1de",
18
+ "@sphereon/oid4vci-common": "0.12.1-unstable.3+5439a02",
19
19
  "@sphereon/ssi-types": "0.25.1-unstable.87",
20
20
  "cross-fetch": "^3.1.8",
21
21
  "debug": "^4.3.4"
@@ -69,5 +69,5 @@
69
69
  "OIDC4VCI",
70
70
  "OID4VCI"
71
71
  ],
72
- "gitHead": "40ad1ded998168e2703daeddc3a3afc78c9b19a1"
72
+ "gitHead": "5439a02483c16666629912152dd3618536f51bf2"
73
73
  }