@credo-ts/openid4vc 0.6.0-pr-2195-20250223181657 → 0.6.0-pr-2195-20250225234342

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.
Files changed (65) hide show
  1. package/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +31 -28
  2. package/build/openid4vc-holder/OpenId4VcHolderApi.js +6 -4
  3. package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
  4. package/build/openid4vc-holder/OpenId4VcHolderModule.js +1 -1
  5. package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -1
  6. package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +3 -3
  7. package/build/openid4vc-holder/OpenId4VciHolderService.js +8 -8
  8. package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
  9. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +3 -3
  10. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +2 -2
  11. package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
  12. package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +24 -30
  13. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +46 -135
  14. package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
  15. package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +5 -10
  16. package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +1 -1
  17. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +1 -1
  18. package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
  19. package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +5 -5
  20. package/build/openid4vc-issuer/OpenId4VcIssuerService.js +7 -7
  21. package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
  22. package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +1 -1
  23. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +1 -1
  24. package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
  25. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +2 -2
  26. package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
  27. package/build/openid4vc-issuer/router/accessTokenEndpoint.js +1 -1
  28. package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
  29. package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +1 -1
  30. package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +1 -1
  31. package/build/openid4vc-issuer/router/credentialEndpoint.js +3 -3
  32. package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
  33. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +8 -8
  34. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +142 -101
  35. package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
  36. package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +11 -17
  37. package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +2 -2
  38. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +1 -4
  39. package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
  40. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.d.ts +19 -10
  41. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +18 -6
  42. package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
  43. package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
  44. package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js +3 -16
  45. package/build/openid4vc-verifier/router/authorizationRequestEndpoint.js.map +1 -1
  46. package/build/shared/callbacks.d.ts +6 -9
  47. package/build/shared/callbacks.js +50 -56
  48. package/build/shared/callbacks.js.map +1 -1
  49. package/build/shared/issuerMetadataUtils.d.ts +1 -1
  50. package/build/shared/models/OpenId4VcJwtIssuer.d.ts +2 -3
  51. package/build/shared/models/index.d.ts +4 -4
  52. package/build/shared/models/index.js.map +1 -1
  53. package/build/shared/router/context.d.ts +1 -1
  54. package/build/shared/router/context.js +1 -1
  55. package/build/shared/router/context.js.map +1 -1
  56. package/build/shared/utils.d.ts +3 -5
  57. package/build/shared/utils.js +23 -21
  58. package/build/shared/utils.js.map +1 -1
  59. package/package.json +6 -7
  60. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +0 -102
  61. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +0 -273
  62. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +0 -1
  63. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.d.ts +0 -49
  64. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +0 -164
  65. package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedJwaSignatureAlgorithms = getSupportedJwaSignatureAlgorithms;
4
4
  exports.getKeyFromDid = getKeyFromDid;
5
- exports.openIdTokenIssuerToJwtIssuer = openIdTokenIssuerToJwtIssuer;
5
+ exports.requestSignerToJwtIssuer = requestSignerToJwtIssuer;
6
6
  exports.getProofTypeFromKey = getProofTypeFromKey;
7
7
  exports.addSecondsToDate = addSecondsToDate;
8
8
  exports.dateToSeconds = dateToSeconds;
@@ -34,58 +34,58 @@ async function getKeyFromDid(agentContext, didUrl, allowedPurposes = ['authentic
34
34
  const verificationMethod = didDocument.dereferenceKey(didUrl, allowedPurposes);
35
35
  return (0, core_1.getKeyFromVerificationMethod)(verificationMethod);
36
36
  }
37
- async function openIdTokenIssuerToJwtIssuer(agentContext, openId4VcTokenIssuer) {
38
- if (openId4VcTokenIssuer.method === 'did') {
39
- const key = await getKeyFromDid(agentContext, openId4VcTokenIssuer.didUrl);
37
+ async function requestSignerToJwtIssuer(agentContext, requestSigner) {
38
+ if (requestSigner.method === 'did') {
39
+ const key = await getKeyFromDid(agentContext, requestSigner.didUrl);
40
40
  const alg = (0, core_1.getJwkClassFromKeyType)(key.keyType)?.supportedSignatureAlgorithms[0];
41
41
  if (!alg)
42
42
  throw new core_1.CredoError(`No supported signature algorithms for key type: ${key.keyType}`);
43
43
  return {
44
- method: openId4VcTokenIssuer.method,
45
- didUrl: openId4VcTokenIssuer.didUrl,
44
+ method: requestSigner.method,
45
+ didUrl: requestSigner.didUrl,
46
46
  alg,
47
47
  };
48
48
  }
49
- else if (openId4VcTokenIssuer.method === 'x5c') {
49
+ else if (requestSigner.method === 'x5c') {
50
50
  const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, {
51
- certificateChain: openId4VcTokenIssuer.x5c,
51
+ certificateChain: requestSigner.x5c,
52
52
  });
53
53
  const jwk = (0, core_1.getJwkFromKey)(leafCertificate.publicKey);
54
54
  const alg = jwk.supportedSignatureAlgorithms[0];
55
55
  if (!alg) {
56
56
  throw new core_1.CredoError(`No supported signature algorithms found key type: '${jwk.keyType}'`);
57
57
  }
58
- if (!openId4VcTokenIssuer.issuer.startsWith('https://') &&
59
- !(openId4VcTokenIssuer.issuer.startsWith('http://') && agentContext.config.allowInsecureHttpUrls)) {
58
+ if (!requestSigner.issuer.startsWith('https://') &&
59
+ !(requestSigner.issuer.startsWith('http://') && agentContext.config.allowInsecureHttpUrls)) {
60
60
  throw new core_1.CredoError('The X509 certificate issuer must be a HTTPS URI.');
61
61
  }
62
- if (!leafCertificate.sanUriNames.includes(openId4VcTokenIssuer.issuer) &&
63
- !leafCertificate.sanDnsNames.includes((0, core_1.getDomainFromUrl)(openId4VcTokenIssuer.issuer))) {
62
+ if (!leafCertificate.sanUriNames.includes(requestSigner.issuer) &&
63
+ !leafCertificate.sanDnsNames.includes((0, core_1.getDomainFromUrl)(requestSigner.issuer))) {
64
64
  const sanUriMessage = leafCertificate.sanUriNames.length > 0
65
65
  ? `SAN-URI names are ${leafCertificate.sanUriNames.join(', ')}`
66
66
  : 'there are no SAN-URI names';
67
67
  const sanDnsMessage = leafCertificate.sanDnsNames.length > 0
68
68
  ? `SAN-DNS names are ${leafCertificate.sanDnsNames.join(', ')}`
69
69
  : 'there are no SAN-DNS names';
70
- throw new Error(`The 'iss' claim in the payload does not match a 'SAN-URI' or 'SAN-DNS' name in the x5c certificate. 'iss' value is '${openId4VcTokenIssuer.issuer}', ${sanUriMessage}, ${sanDnsMessage} (for SAN-DNS only domain has to match)`);
70
+ throw new Error(`The 'iss' claim in the payload does not match a 'SAN-URI' or 'SAN-DNS' name in the x5c certificate. 'iss' value is '${requestSigner.issuer}', ${sanUriMessage}, ${sanDnsMessage} (for SAN-DNS only domain has to match)`);
71
71
  }
72
72
  return {
73
- ...openId4VcTokenIssuer,
73
+ ...requestSigner,
74
74
  alg,
75
75
  };
76
76
  }
77
- else if (openId4VcTokenIssuer.method === 'jwk') {
78
- const alg = openId4VcTokenIssuer.jwk.supportedSignatureAlgorithms[0];
77
+ else if (requestSigner.method === 'jwk') {
78
+ const alg = requestSigner.jwk.supportedSignatureAlgorithms[0];
79
79
  if (!alg) {
80
- throw new core_1.CredoError(`No supported signature algorithms for key type: '${openId4VcTokenIssuer.jwk.keyType}'`);
80
+ throw new core_1.CredoError(`No supported signature algorithms for key type: '${requestSigner.jwk.keyType}'`);
81
81
  }
82
82
  return {
83
- ...openId4VcTokenIssuer,
84
- publicJwk: openId4VcTokenIssuer.jwk.toJson(),
83
+ ...requestSigner,
84
+ publicJwk: requestSigner.jwk.toJson(),
85
85
  alg,
86
86
  };
87
87
  }
88
- throw new core_1.CredoError(`Unsupported jwt issuer method '${openId4VcTokenIssuer.method}'`);
88
+ throw new core_1.CredoError(`Unsupported jwt issuer method '${requestSigner.method}'`);
89
89
  }
90
90
  function getProofTypeFromKey(agentContext, key) {
91
91
  const signatureSuiteRegistry = agentContext.dependencyManager.resolve(core_1.SignatureSuiteRegistry);
@@ -109,7 +109,9 @@ function parseIfJson(input) {
109
109
  // Try to parse the string as JSON
110
110
  return JSON.parse(input);
111
111
  }
112
- catch (error) { }
112
+ catch (error) {
113
+ /* empty */
114
+ }
113
115
  return input;
114
116
  }
115
117
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":";;AAuBA,gFAaC;AAED,sCAUC;AAED,oEAkEC;AAED,kDASC;AAED,4CAEC;AAED,sCAEC;AAED,kCAWC;AAhJD,yCASuB;AAEvB;;;;;;;GAOG;AACH,SAAgB,kCAAkC,CAAC,YAA0B;IAC3E,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAA;IAE/D,4EAA4E;IAC5E,MAAM,+BAA+B,GAAG,iBAAiB;QACvD,yDAAyD;SACxD,GAAG,CAAC,6BAAsB,CAAC;QAC5B,kCAAkC;SACjC,MAAM,CAAC,CAAC,QAAQ,EAAmD,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC;QAC9F,oEAAoE;SACnE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAA;IAE/D,OAAO,+BAA+B,CAAA;AACxC,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,YAA0B,EAC1B,MAAc,EACd,kBAAgC,CAAC,gBAAgB,CAAC;IAElD,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,cAAO,CAAC,CAAA;IAC/D,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAC5D,MAAM,kBAAkB,GAAG,WAAW,CAAC,cAAc,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAE9E,OAAO,IAAA,mCAA4B,EAAC,kBAAkB,CAAC,CA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1D,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,GAAG,IAAI,CAAC,CAAA;AAClD,CAAC;AAED,SAAgB,aAAa,CAAC,IAAU;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;AAC1C,CAAC;AAED,SAAgB,WAAW,CAAI,KAAQ;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,CAAC;QACH,kCAAkC;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@credo-ts/openid4vc",
3
3
  "main": "build/index",
4
4
  "types": "build/index",
5
- "version": "0.6.0-pr-2195-20250223181657",
5
+ "version": "0.6.0-pr-2195-20250225234342",
6
6
  "files": [
7
7
  "build"
8
8
  ],
@@ -17,14 +17,13 @@
17
17
  "directory": "packages/openid4vc"
18
18
  },
19
19
  "dependencies": {
20
- "@sphereon/ssi-types": "0.30.2-next.135",
21
20
  "class-transformer": "^0.5.1",
22
21
  "rxjs": "^7.8.0",
23
22
  "zod": "^3.23.8",
24
- "@openid4vc/oid4vci": "link:../../../Code/oid4vc-ts/packages/oid4vci",
25
- "@openid4vc/oauth2": "link:../../../Code/oid4vc-ts/packages/oauth2",
26
- "@openid4vc/oid4vp": "link:../../../Code/oid4vc-ts/packages/openid4vp",
27
- "@credo-ts/core": "0.6.0-pr-2195-20250223181657"
23
+ "@openid4vc/openid4vci": "0.3.0-alpha-20250225204254",
24
+ "@openid4vc/oauth2": "0.3.0-alpha-20250225204254",
25
+ "@openid4vc/openid4vp": "0.3.0-alpha-20250225204254",
26
+ "@credo-ts/core": "0.6.0-pr-2195-20250225234342"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@types/express": "^4.17.21",
@@ -32,7 +31,7 @@
32
31
  "nock": "^14.0.0-beta.19",
33
32
  "rimraf": "^4.4.0",
34
33
  "typescript": "~5.5.2",
35
- "@credo-ts/tenants": "0.6.0-pr-2195-20250223181657"
34
+ "@credo-ts/tenants": "0.6.0-pr-2195-20250225234342"
36
35
  },
37
36
  "scripts": {
38
37
  "build": "pnpm run clean && pnpm run compile",
@@ -1,102 +0,0 @@
1
- import type { AgentContext } from '@credo-ts/core';
2
- import { AgentContextProvider, AgentDependencies } from '@credo-ts/core';
3
- import { EventEmitter as NativeEventEmitter } from 'events';
4
- import { OpenId4VcVerificationSessionState } from '../OpenId4VcVerificationSessionState';
5
- import { Openid4vpAuthorizationResponse, Openid4vpAuthorizationResponseDcApi } from '@openid4vc/oid4vp';
6
- import { OpenId4VcVerificationSessionRecord } from './OpenId4VcVerificationSessionRecord';
7
- export declare enum AuthorizationEvents {
8
- ON_AUTH_REQUEST_CREATED_SUCCESS = "onAuthRequestCreatedSuccess",
9
- ON_AUTH_REQUEST_CREATED_FAILED = "onAuthRequestCreatedFailed",
10
- ON_AUTH_REQUEST_SENT_SUCCESS = "onAuthRequestSentSuccess",
11
- ON_AUTH_REQUEST_SENT_FAILED = "onAuthRequestSentFailed",
12
- ON_AUTH_REQUEST_RECEIVED_SUCCESS = "onAuthRequestReceivedSuccess",
13
- ON_AUTH_REQUEST_RECEIVED_FAILED = "onAuthRequestReceivedFailed",
14
- ON_AUTH_REQUEST_VERIFIED_SUCCESS = "onAuthRequestVerifiedSuccess",
15
- ON_AUTH_REQUEST_VERIFIED_FAILED = "onAuthRequestVerifiedFailed",
16
- ON_AUTH_RESPONSE_CREATE_SUCCESS = "onAuthResponseCreateSuccess",
17
- ON_AUTH_RESPONSE_CREATE_FAILED = "onAuthResponseCreateFailed",
18
- ON_AUTH_RESPONSE_SENT_SUCCESS = "onAuthResponseSentSuccess",
19
- ON_AUTH_RESPONSE_SENT_FAILED = "onAuthResponseSentFailed",
20
- ON_AUTH_RESPONSE_RECEIVED_SUCCESS = "onAuthResponseReceivedSuccess",
21
- ON_AUTH_RESPONSE_RECEIVED_FAILED = "onAuthResponseReceivedFailed",
22
- ON_AUTH_RESPONSE_VERIFIED_SUCCESS = "onAuthResponseVerifiedSuccess",
23
- ON_AUTH_RESPONSE_VERIFIED_FAILED = "onAuthResponseVerifiedFailed"
24
- }
25
- export declare class AuthorizationEvent<T> {
26
- private readonly _subject;
27
- private readonly _error?;
28
- private readonly _timestamp;
29
- private readonly _correlationId;
30
- constructor(args: {
31
- correlationId: string;
32
- subject?: T;
33
- error?: Error;
34
- });
35
- get subject(): T | undefined;
36
- get timestamp(): number;
37
- get error(): Error | undefined;
38
- hasError(): boolean;
39
- get correlationId(): string;
40
- }
41
- export declare class OpenId4VcRelyingPartyEventHandler {
42
- private agentContextProvider;
43
- readonly nativeEventEmitter: NativeEventEmitter;
44
- constructor(agentContextProvider: AgentContextProvider, agentDependencies: AgentDependencies);
45
- getEventEmitterForVerifier(contextCorrelationId: string, verifierId: string): OpenId4VcRelyingPartyEventEmitter;
46
- authorizationRequestCreatedSuccess: (agentContext: AgentContext, options: {
47
- verifierId: string;
48
- correlationId: string;
49
- authorizationRequestJwt?: string;
50
- authorizationRequestUri?: string;
51
- }) => Promise<OpenId4VcVerificationSessionRecord>;
52
- private onAuthorizationRequestSentSuccess;
53
- authorizationResponseReceivedFailed: (agentContext: AgentContext, options: {
54
- verifierId: string;
55
- correlationId: string;
56
- authorizationResponsePayload: Openid4vpAuthorizationResponse;
57
- errorMessage: string;
58
- }) => Promise<void>;
59
- authorizationResponseVerifiedSuccess: (agentContext: AgentContext, options: {
60
- verifierId: string;
61
- correlationId: string;
62
- authorizationResponsePayload: Openid4vpAuthorizationResponse | Openid4vpAuthorizationResponseDcApi;
63
- }) => Promise<void>;
64
- authorizationResponseVerifiedFailed: (agentContext: AgentContext, options: {
65
- verifierId: string;
66
- correlationId: string;
67
- errorMessage: string;
68
- }) => Promise<void>;
69
- private withSession;
70
- protected emitStateChangedEvent(agentContext: AgentContext, verificationSession: OpenId4VcVerificationSessionRecord, previousState: OpenId4VcVerificationSessionState | null): void;
71
- }
72
- /**
73
- * Custom implementation of the event emitter so we can associate the contextCorrelationId
74
- * and the verifierId with the events that are emitted. This allows us to only create one
75
- * event emitter and thus not have endless event emitters and listeners for each active RP.
76
- *
77
- * We only modify the emit method, and add the verifierId and contextCorrelationId to the event
78
- * this allows the listener to know which tenant and which verifier the event is associated with.
79
- */
80
- declare class OpenId4VcRelyingPartyEventEmitter implements NativeEventEmitter {
81
- private nativeEventEmitter;
82
- private contextCorrelationId;
83
- private verifierId;
84
- constructor(nativeEventEmitter: NativeEventEmitter, contextCorrelationId: string, verifierId: string);
85
- emit(eventName: string | symbol, ...args: any[]): boolean;
86
- [NativeEventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
87
- addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
88
- on(eventName: string | symbol, listener: (...args: any[]) => void): this;
89
- once(eventName: string | symbol, listener: (...args: any[]) => void): this;
90
- removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
91
- off(eventName: string | symbol, listener: (...args: any[]) => void): this;
92
- removeAllListeners(event?: string | symbol | undefined): this;
93
- setMaxListeners(n: number): this;
94
- getMaxListeners(): number;
95
- listeners(eventName: string | symbol): Function[];
96
- rawListeners(eventName: string | symbol): Function[];
97
- listenerCount(eventName: string | symbol, listener?: Function | undefined): number;
98
- prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
99
- prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
100
- eventNames(): (string | symbol)[];
101
- }
102
- export {};
@@ -1,273 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.OpenId4VcRelyingPartyEventHandler = exports.AuthorizationEvent = exports.AuthorizationEvents = void 0;
16
- const core_1 = require("@credo-ts/core");
17
- const events_1 = require("events");
18
- const OpenId4VcVerificationSessionState_1 = require("../OpenId4VcVerificationSessionState");
19
- const OpenId4VcVerifierEvents_1 = require("../OpenId4VcVerifierEvents");
20
- const oid4vp_1 = require("@openid4vc/oid4vp");
21
- const OpenId4VcVerificationSessionRecord_1 = require("./OpenId4VcVerificationSessionRecord");
22
- const OpenId4VcVerificationSessionRepository_1 = require("./OpenId4VcVerificationSessionRepository");
23
- var AuthorizationEvents;
24
- (function (AuthorizationEvents) {
25
- AuthorizationEvents["ON_AUTH_REQUEST_CREATED_SUCCESS"] = "onAuthRequestCreatedSuccess";
26
- AuthorizationEvents["ON_AUTH_REQUEST_CREATED_FAILED"] = "onAuthRequestCreatedFailed";
27
- AuthorizationEvents["ON_AUTH_REQUEST_SENT_SUCCESS"] = "onAuthRequestSentSuccess";
28
- AuthorizationEvents["ON_AUTH_REQUEST_SENT_FAILED"] = "onAuthRequestSentFailed";
29
- AuthorizationEvents["ON_AUTH_REQUEST_RECEIVED_SUCCESS"] = "onAuthRequestReceivedSuccess";
30
- AuthorizationEvents["ON_AUTH_REQUEST_RECEIVED_FAILED"] = "onAuthRequestReceivedFailed";
31
- AuthorizationEvents["ON_AUTH_REQUEST_VERIFIED_SUCCESS"] = "onAuthRequestVerifiedSuccess";
32
- AuthorizationEvents["ON_AUTH_REQUEST_VERIFIED_FAILED"] = "onAuthRequestVerifiedFailed";
33
- AuthorizationEvents["ON_AUTH_RESPONSE_CREATE_SUCCESS"] = "onAuthResponseCreateSuccess";
34
- AuthorizationEvents["ON_AUTH_RESPONSE_CREATE_FAILED"] = "onAuthResponseCreateFailed";
35
- AuthorizationEvents["ON_AUTH_RESPONSE_SENT_SUCCESS"] = "onAuthResponseSentSuccess";
36
- AuthorizationEvents["ON_AUTH_RESPONSE_SENT_FAILED"] = "onAuthResponseSentFailed";
37
- AuthorizationEvents["ON_AUTH_RESPONSE_RECEIVED_SUCCESS"] = "onAuthResponseReceivedSuccess";
38
- AuthorizationEvents["ON_AUTH_RESPONSE_RECEIVED_FAILED"] = "onAuthResponseReceivedFailed";
39
- AuthorizationEvents["ON_AUTH_RESPONSE_VERIFIED_SUCCESS"] = "onAuthResponseVerifiedSuccess";
40
- AuthorizationEvents["ON_AUTH_RESPONSE_VERIFIED_FAILED"] = "onAuthResponseVerifiedFailed";
41
- })(AuthorizationEvents || (exports.AuthorizationEvents = AuthorizationEvents = {}));
42
- class AuthorizationEvent {
43
- constructor(args) {
44
- //fixme: Create correlationId if not provided. Might need to be deferred to registry though
45
- this._correlationId = args.correlationId;
46
- this._timestamp = Date.now();
47
- this._subject = args.subject;
48
- this._error = args.error;
49
- }
50
- get subject() {
51
- return this._subject;
52
- }
53
- get timestamp() {
54
- return this._timestamp;
55
- }
56
- get error() {
57
- return this._error;
58
- }
59
- hasError() {
60
- return !!this._error;
61
- }
62
- get correlationId() {
63
- return this._correlationId;
64
- }
65
- }
66
- exports.AuthorizationEvent = AuthorizationEvent;
67
- let OpenId4VcRelyingPartyEventHandler = class OpenId4VcRelyingPartyEventHandler {
68
- constructor(agentContextProvider, agentDependencies) {
69
- this.agentContextProvider = agentContextProvider;
70
- this.authorizationRequestCreatedSuccess = async (agentContext, options) => {
71
- const { verifierId, correlationId, authorizationRequestJwt, authorizationRequestUri } = options;
72
- if (!authorizationRequestJwt) {
73
- throw new core_1.CredoError('Authorization request object JWT is missing');
74
- }
75
- if (!authorizationRequestUri) {
76
- throw new core_1.CredoError('Authorization request URI is missing');
77
- }
78
- const verificationSession = new OpenId4VcVerificationSessionRecord_1.OpenId4VcVerificationSessionRecord({
79
- id: correlationId,
80
- authorizationRequestJwt,
81
- authorizationRequestUri,
82
- state: OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated,
83
- verifierId: verifierId,
84
- });
85
- await this.withSession(agentContext.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
86
- await verificationSessionRepository.save(agentContext, verificationSession);
87
- this.emitStateChangedEvent(agentContext, verificationSession, null);
88
- });
89
- return verificationSession;
90
- };
91
- this.onAuthorizationRequestSentSuccess = async (event, context) => {
92
- await this.withSession(context.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
93
- const verificationSession = await verificationSessionRepository.getById(agentContext, event.correlationId);
94
- // In all other cases it doesn't make sense to update the state, as the state is already advanced beyond
95
- // this state.
96
- if (verificationSession.state === OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated) {
97
- verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestUriRetrieved;
98
- await verificationSessionRepository.update(agentContext, verificationSession);
99
- this.emitStateChangedEvent(agentContext, verificationSession, OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.RequestCreated);
100
- }
101
- });
102
- };
103
- this.authorizationResponseReceivedFailed = async (agentContext, options) => {
104
- await this.withSession(agentContext.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
105
- const verificationSession = await verificationSessionRepository.getById(agentContext, options.correlationId);
106
- const previousState = verificationSession.state;
107
- verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.Error;
108
- verificationSession.authorizationResponsePayload = options.authorizationResponsePayload;
109
- verificationSession.errorMessage = options.errorMessage;
110
- await verificationSessionRepository.update(agentContext, verificationSession);
111
- this.emitStateChangedEvent(agentContext, verificationSession, previousState);
112
- });
113
- };
114
- this.authorizationResponseVerifiedSuccess = async (agentContext, options) => {
115
- await this.withSession(agentContext.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
116
- const verificationSession = await verificationSessionRepository.getById(agentContext, options.correlationId);
117
- if (verificationSession.state !== OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.Error &&
118
- verificationSession.state !== OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.ResponseVerified) {
119
- const previousState = verificationSession.state;
120
- verificationSession.authorizationResponsePayload = (0, oid4vp_1.isOpenid4vpAuthorizationResponseDcApi)(options.authorizationResponsePayload) ? options.authorizationResponsePayload.data : options.authorizationResponsePayload;
121
- verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.ResponseVerified;
122
- await verificationSessionRepository.update(agentContext, verificationSession);
123
- this.emitStateChangedEvent(agentContext, verificationSession, previousState);
124
- }
125
- });
126
- };
127
- this.authorizationResponseVerifiedFailed = async (agentContext, options) => {
128
- await this.withSession(agentContext.contextCorrelationId, async (agentContext, verificationSessionRepository) => {
129
- const verificationSession = await verificationSessionRepository.getById(agentContext, options.correlationId);
130
- const previousState = verificationSession.state;
131
- verificationSession.state = OpenId4VcVerificationSessionState_1.OpenId4VcVerificationSessionState.Error;
132
- verificationSession.errorMessage = options.errorMessage;
133
- await verificationSessionRepository.update(agentContext, verificationSession);
134
- this.emitStateChangedEvent(agentContext, verificationSession, previousState);
135
- });
136
- };
137
- this.nativeEventEmitter = new agentDependencies.EventEmitterClass();
138
- this.nativeEventEmitter.on(AuthorizationEvents.ON_AUTH_REQUEST_CREATED_SUCCESS, this.authorizationRequestCreatedSuccess);
139
- // We don't want to do anything currently when a request creation failed, as then the method that
140
- // is called to create it will throw and we won't create a session
141
- // AuthorizationEvents.ON_AUTH_REQUEST_CREATED_FAILED,
142
- this.nativeEventEmitter.on(AuthorizationEvents.ON_AUTH_REQUEST_SENT_SUCCESS, this.onAuthorizationRequestSentSuccess);
143
- // We manually call when the request is retrieved, and there's not really a case where it can fail, and
144
- // not really sure how to represent it in the verification session. So not doing anything here.
145
- // AuthorizationEvents.ON_AUTH_REQUEST_SENT_FAILED
146
- // NOTE: the response received and response verified states are fired in such rapid succession
147
- // that the verification session record is not updated yet to received before the verified event is
148
- // emitted. For now we only track the verified / failed event. Otherwise we need to use record locking, which we don't have in-place yet
149
- // AuthorizationEvents.ON_AUTH_RESPONSE_RECEIVED_SUCCESS,
150
- this.nativeEventEmitter.on(AuthorizationEvents.ON_AUTH_RESPONSE_RECEIVED_FAILED, this.authorizationResponseReceivedFailed);
151
- this.nativeEventEmitter.on(AuthorizationEvents.ON_AUTH_RESPONSE_VERIFIED_SUCCESS, this.authorizationResponseVerifiedSuccess);
152
- this.nativeEventEmitter.on(AuthorizationEvents.ON_AUTH_RESPONSE_VERIFIED_FAILED, this.authorizationResponseVerifiedFailed);
153
- }
154
- getEventEmitterForVerifier(contextCorrelationId, verifierId) {
155
- return new OpenId4VcRelyingPartyEventEmitter(this.nativeEventEmitter, contextCorrelationId, verifierId);
156
- }
157
- async withSession(contextCorrelationId, callback) {
158
- const agentContext = await this.agentContextProvider.getAgentContextForContextCorrelationId(contextCorrelationId);
159
- try {
160
- const verificationSessionRepository = agentContext.dependencyManager.resolve(OpenId4VcVerificationSessionRepository_1.OpenId4VcVerificationSessionRepository);
161
- const result = await callback(agentContext, verificationSessionRepository);
162
- return result;
163
- }
164
- finally {
165
- await agentContext.endSession();
166
- }
167
- }
168
- emitStateChangedEvent(agentContext, verificationSession, previousState) {
169
- const eventEmitter = agentContext.dependencyManager.resolve(core_1.EventEmitter);
170
- eventEmitter.emit(agentContext, {
171
- type: OpenId4VcVerifierEvents_1.OpenId4VcVerifierEvents.VerificationSessionStateChanged,
172
- payload: {
173
- verificationSession: verificationSession.clone(),
174
- previousState,
175
- },
176
- });
177
- }
178
- };
179
- exports.OpenId4VcRelyingPartyEventHandler = OpenId4VcRelyingPartyEventHandler;
180
- exports.OpenId4VcRelyingPartyEventHandler = OpenId4VcRelyingPartyEventHandler = __decorate([
181
- (0, core_1.injectable)(),
182
- __param(0, (0, core_1.inject)(core_1.InjectionSymbols.AgentContextProvider)),
183
- __param(1, (0, core_1.inject)(core_1.InjectionSymbols.AgentDependencies)),
184
- __metadata("design:paramtypes", [Object, Object])
185
- ], OpenId4VcRelyingPartyEventHandler);
186
- /**
187
- * Custom implementation of the event emitter so we can associate the contextCorrelationId
188
- * and the verifierId with the events that are emitted. This allows us to only create one
189
- * event emitter and thus not have endless event emitters and listeners for each active RP.
190
- *
191
- * We only modify the emit method, and add the verifierId and contextCorrelationId to the event
192
- * this allows the listener to know which tenant and which verifier the event is associated with.
193
- */
194
- class OpenId4VcRelyingPartyEventEmitter {
195
- constructor(nativeEventEmitter, contextCorrelationId, verifierId) {
196
- this.nativeEventEmitter = nativeEventEmitter;
197
- this.contextCorrelationId = contextCorrelationId;
198
- this.verifierId = verifierId;
199
- }
200
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
- emit(eventName, ...args) {
202
- return this.nativeEventEmitter.emit(eventName, ...args, {
203
- contextCorrelationId: this.contextCorrelationId,
204
- verifierId: this.verifierId,
205
- });
206
- }
207
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
208
- [events_1.EventEmitter.captureRejectionSymbol](error, event, ...args) {
209
- return this.nativeEventEmitter[events_1.EventEmitter.captureRejectionSymbol]?.(error, event, ...args);
210
- }
211
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
212
- addListener(eventName, listener) {
213
- this.nativeEventEmitter.addListener(eventName, listener);
214
- return this;
215
- }
216
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
217
- on(eventName, listener) {
218
- this.nativeEventEmitter.on(eventName, listener);
219
- return this;
220
- }
221
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
222
- once(eventName, listener) {
223
- this.nativeEventEmitter.once(eventName, listener);
224
- return this;
225
- }
226
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
227
- removeListener(eventName, listener) {
228
- this.nativeEventEmitter.removeListener(eventName, listener);
229
- return this;
230
- }
231
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
- off(eventName, listener) {
233
- this.nativeEventEmitter.off(eventName, listener);
234
- return this;
235
- }
236
- removeAllListeners(event) {
237
- this.nativeEventEmitter.removeAllListeners(event);
238
- return this;
239
- }
240
- setMaxListeners(n) {
241
- this.nativeEventEmitter.setMaxListeners(n);
242
- return this;
243
- }
244
- getMaxListeners() {
245
- return this.nativeEventEmitter.getMaxListeners();
246
- }
247
- // eslint-disable-next-line @typescript-eslint/ban-types
248
- listeners(eventName) {
249
- return this.nativeEventEmitter.listeners(eventName);
250
- }
251
- // eslint-disable-next-line @typescript-eslint/ban-types
252
- rawListeners(eventName) {
253
- return this.nativeEventEmitter.rawListeners(eventName);
254
- }
255
- // eslint-disable-next-line @typescript-eslint/ban-types
256
- listenerCount(eventName, listener) {
257
- return this.nativeEventEmitter.listenerCount(eventName, listener);
258
- }
259
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
- prependListener(eventName, listener) {
261
- this.nativeEventEmitter.prependListener(eventName, listener);
262
- return this;
263
- }
264
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
265
- prependOnceListener(eventName, listener) {
266
- this.nativeEventEmitter.prependOnceListener(eventName, listener);
267
- return this;
268
- }
269
- eventNames() {
270
- return this.nativeEventEmitter.eventNames();
271
- }
272
- }
273
- //# sourceMappingURL=OpenId4VcRelyingPartyEventEmitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OpenId4VcRelyingPartyEventEmitter.js","sourceRoot":"","sources":["../../../src/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,yCAQuB;AACvB,mCAA2D;AAE3D,4FAAwF;AACxF,wEAAoE;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kB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAA;IAClD,CAAC;IAED,wDAAwD;IACjD,SAAS,CAAC,SAA0B;QACzC,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IACrD,CAAC;IAED,wDAAwD;IACjD,YAAY,CAAC,SAA0B;QAC5C,OAAO,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;IACxD,CAAC;IAED,wDAAwD;IACjD,aAAa,CAAC,SAA0B,EAAE,QAA+B;QAC9E,OAAO,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IACnE,CAAC;IAED,8DAA8D;IACvD,eAAe,CAAC,SAA0B,EAAE,QAAkC;QACnF,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAC5D,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8DAA8D;IACvD,mBAAmB,CAAC,SAA0B,EAAE,QAAkC;QACvF,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAChE,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAA;IAC7C,CAAC;CACF"}
@@ -1,49 +0,0 @@
1
- import type { AgentContext } from '@credo-ts/core';
2
- import { OpenId4VcSiopAuthorizationRequestPayload, OpenId4VcSiopAuthorizationResponsePayload } from '../../shared/index';
3
- export interface AuthorizationRequestState {
4
- correlationId?: string;
5
- request: OpenId4VcSiopAuthorizationRequestPayload;
6
- status: AuthorizationRequestStateStatus;
7
- timestamp: number;
8
- lastUpdated: number;
9
- error?: Error;
10
- }
11
- export interface AuthorizationResponseState {
12
- correlationId?: string;
13
- response: OpenId4VcSiopAuthorizationResponsePayload;
14
- status: AuthorizationResponseStateStatus;
15
- timestamp: number;
16
- lastUpdated: number;
17
- error?: Error;
18
- }
19
- export declare enum AuthorizationRequestStateStatus {
20
- CREATED = "created",
21
- SENT = "sent",
22
- RECEIVED = "received",
23
- VERIFIED = "verified",
24
- ERROR = "error"
25
- }
26
- export declare enum AuthorizationResponseStateStatus {
27
- CREATED = "created",
28
- SENT = "sent",
29
- RECEIVED = "received",
30
- VERIFIED = "verified",
31
- ERROR = "error"
32
- }
33
- export declare class OpenId4VcRelyingPartySessionManager {
34
- private agentContext;
35
- private verifierId;
36
- private openId4VcVerificationSessionRepository;
37
- constructor(agentContext: AgentContext, verifierId: string);
38
- getRequestStateByCorrelationId(correlationId: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
39
- getRequestStateByNonce(nonce: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
40
- getRequestStateByState(state: string, errorOnNotFound?: boolean): Promise<AuthorizationRequestState | undefined>;
41
- getResponseStateByCorrelationId(correlationId: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
42
- getResponseStateByNonce(nonce: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
43
- getResponseStateByState(state: string, errorOnNotFound?: boolean): Promise<AuthorizationResponseState | undefined>;
44
- getCorrelationIdByNonce(nonce: string, errorOnNotFound?: boolean): Promise<string | undefined>;
45
- getCorrelationIdByState(state: string, errorOnNotFound?: boolean): Promise<string | undefined>;
46
- deleteStateForCorrelationId(): Promise<void>;
47
- private getRequestStateFromSessionRecord;
48
- private getResponseStateFromSessionRecord;
49
- }