@sphereon/oid4vci-client 0.2.0 → 0.4.1-next.285

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 (107) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +494 -371
  3. package/dist/AccessTokenClient.d.ts +30 -0
  4. package/dist/AccessTokenClient.d.ts.map +1 -0
  5. package/dist/AccessTokenClient.js +222 -0
  6. package/dist/AccessTokenClient.js.map +1 -0
  7. package/dist/AuthorizationDetailsBuilder.d.ts +11 -0
  8. package/dist/AuthorizationDetailsBuilder.d.ts.map +1 -0
  9. package/dist/AuthorizationDetailsBuilder.js +44 -0
  10. package/dist/AuthorizationDetailsBuilder.js.map +1 -0
  11. package/dist/CredentialOfferClient.d.ts +10 -0
  12. package/dist/CredentialOfferClient.d.ts.map +1 -0
  13. package/dist/CredentialOfferClient.js +101 -0
  14. package/dist/CredentialOfferClient.js.map +1 -0
  15. package/dist/CredentialRequestClient.d.ts +33 -0
  16. package/dist/CredentialRequestClient.d.ts.map +1 -0
  17. package/dist/CredentialRequestClient.js +118 -0
  18. package/dist/CredentialRequestClient.js.map +1 -0
  19. package/dist/CredentialRequestClientBuilder.d.ts +34 -0
  20. package/dist/CredentialRequestClientBuilder.d.ts.map +1 -0
  21. package/dist/CredentialRequestClientBuilder.js +87 -0
  22. package/dist/CredentialRequestClientBuilder.js.map +1 -0
  23. package/dist/{main/lib/MetadataClient.d.ts → MetadataClient.d.ts} +39 -38
  24. package/dist/MetadataClient.d.ts.map +1 -0
  25. package/dist/MetadataClient.js +148 -0
  26. package/dist/MetadataClient.js.map +1 -0
  27. package/dist/OpenID4VCIClient.d.ts +75 -0
  28. package/dist/OpenID4VCIClient.d.ts.map +1 -0
  29. package/dist/OpenID4VCIClient.js +403 -0
  30. package/dist/OpenID4VCIClient.js.map +1 -0
  31. package/dist/ProofOfPossessionBuilder.d.ts +38 -0
  32. package/dist/ProofOfPossessionBuilder.d.ts.map +1 -0
  33. package/dist/ProofOfPossessionBuilder.js +129 -0
  34. package/dist/ProofOfPossessionBuilder.js.map +1 -0
  35. package/dist/functions/ProofUtil.d.ts +29 -0
  36. package/dist/functions/ProofUtil.d.ts.map +1 -0
  37. package/dist/functions/ProofUtil.js +104 -0
  38. package/dist/functions/ProofUtil.js.map +1 -0
  39. package/dist/functions/index.d.ts +4 -0
  40. package/dist/functions/index.d.ts.map +1 -0
  41. package/dist/{main → functions}/index.js +20 -18
  42. package/dist/functions/index.js.map +1 -0
  43. package/dist/index.d.ts +9 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/{main/lib/index.js → index.js} +25 -24
  46. package/dist/index.js.map +1 -0
  47. package/lib/AccessTokenClient.ts +249 -0
  48. package/lib/AuthorizationDetailsBuilder.ts +46 -0
  49. package/lib/CredentialOfferClient.ts +108 -0
  50. package/lib/CredentialRequestClient.ts +137 -0
  51. package/lib/CredentialRequestClientBuilder.ts +110 -0
  52. package/lib/MetadataClient.ts +147 -0
  53. package/lib/OpenID4VCIClient.ts +523 -0
  54. package/lib/ProofOfPossessionBuilder.ts +181 -0
  55. package/lib/__tests__/AccessTokenClient.spec.ts +225 -0
  56. package/lib/__tests__/AuthorizationDetailsBuilder.spec.ts +65 -0
  57. package/lib/__tests__/AuthzFlowType.spec.ts +39 -0
  58. package/lib/__tests__/CredentialRequestClient.spec.ts +291 -0
  59. package/lib/__tests__/CredentialRequestClientBuilder.spec.ts +121 -0
  60. package/lib/__tests__/HttpUtils.spec.ts +37 -0
  61. package/lib/__tests__/IT.spec.ts +173 -0
  62. package/lib/__tests__/IssuanceInitiation.spec.ts +48 -0
  63. package/lib/__tests__/JsonURIConversions.spec.ts +146 -0
  64. package/lib/__tests__/MetadataClient.spec.ts +203 -0
  65. package/lib/__tests__/MetadataMocks.ts +444 -0
  66. package/lib/__tests__/OpenID4VCIClient.spec.ts +166 -0
  67. package/lib/__tests__/OpenID4VCIClientPAR.spec.ts +112 -0
  68. package/lib/__tests__/ProofOfPossessionBuilder.spec.ts +110 -0
  69. package/lib/__tests__/data/VciDataFixtures.ts +744 -0
  70. package/lib/functions/ProofUtil.ts +120 -0
  71. package/lib/functions/index.ts +3 -0
  72. package/{dist/main/lib/index.d.ts → lib/index.ts} +8 -7
  73. package/package.json +68 -71
  74. package/CHANGELOG.md +0 -21
  75. package/dist/main/index.d.ts +0 -1
  76. package/dist/main/lib/AccessTokenClient.d.ts +0 -20
  77. package/dist/main/lib/AccessTokenClient.js +0 -141
  78. package/dist/main/lib/CredentialRequestClient.d.ts +0 -31
  79. package/dist/main/lib/CredentialRequestClient.js +0 -66
  80. package/dist/main/lib/CredentialRequestClientBuilder.d.ts +0 -21
  81. package/dist/main/lib/CredentialRequestClientBuilder.js +0 -56
  82. package/dist/main/lib/IssuanceInitiation.d.ts +0 -5
  83. package/dist/main/lib/IssuanceInitiation.js +0 -29
  84. package/dist/main/lib/MetadataClient.js +0 -127
  85. package/dist/main/lib/functions/Encoding.d.ts +0 -17
  86. package/dist/main/lib/functions/Encoding.js +0 -138
  87. package/dist/main/lib/functions/HttpUtils.d.ts +0 -17
  88. package/dist/main/lib/functions/HttpUtils.js +0 -133
  89. package/dist/main/lib/functions/ProofUtil.d.ts +0 -9
  90. package/dist/main/lib/functions/ProofUtil.js +0 -76
  91. package/dist/main/lib/functions/index.d.ts +0 -3
  92. package/dist/main/lib/functions/index.js +0 -20
  93. package/dist/main/lib/types/Authorization.types.d.ts +0 -66
  94. package/dist/main/lib/types/Authorization.types.js +0 -35
  95. package/dist/main/lib/types/CredentialIssuance.types.d.ts +0 -88
  96. package/dist/main/lib/types/CredentialIssuance.types.js +0 -8
  97. package/dist/main/lib/types/Generic.types.d.ts +0 -19
  98. package/dist/main/lib/types/Generic.types.js +0 -11
  99. package/dist/main/lib/types/OAuth2ASMetadata.d.ts +0 -37
  100. package/dist/main/lib/types/OAuth2ASMetadata.js +0 -3
  101. package/dist/main/lib/types/OID4VCIServerMetadata.d.ts +0 -65
  102. package/dist/main/lib/types/OID4VCIServerMetadata.js +0 -3
  103. package/dist/main/lib/types/Oidc4vciErrors.d.ts +0 -3
  104. package/dist/main/lib/types/Oidc4vciErrors.js +0 -7
  105. package/dist/main/lib/types/index.d.ts +0 -6
  106. package/dist/main/lib/types/index.js +0 -23
  107. package/dist/main/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,34 @@
1
+ import { AccessTokenResponse, CredentialIssuerMetadata, CredentialOfferRequestWithBaseUrl, EndpointMetadata, OID4VCICredentialFormat, OpenId4VCIVersion, UniformCredentialOfferRequest } from '@sphereon/oid4vci-common';
2
+ import { CredentialFormat } from '@sphereon/ssi-types';
3
+ import { CredentialRequestClient } from './CredentialRequestClient';
4
+ export declare class CredentialRequestClientBuilder {
5
+ credentialEndpoint?: string;
6
+ credentialTypes: string[];
7
+ format?: CredentialFormat | OID4VCICredentialFormat;
8
+ token?: string;
9
+ version?: OpenId4VCIVersion;
10
+ static fromURI({ uri, metadata }: {
11
+ uri: string;
12
+ metadata?: EndpointMetadata;
13
+ }): Promise<CredentialRequestClientBuilder>;
14
+ static fromCredentialOfferRequest(opts: {
15
+ request: UniformCredentialOfferRequest;
16
+ scheme?: string;
17
+ baseUrl?: string;
18
+ version?: OpenId4VCIVersion;
19
+ metadata?: EndpointMetadata;
20
+ }): CredentialRequestClientBuilder;
21
+ static fromCredentialOffer({ credentialOffer, metadata, }: {
22
+ credentialOffer: CredentialOfferRequestWithBaseUrl;
23
+ metadata?: EndpointMetadata;
24
+ }): CredentialRequestClientBuilder;
25
+ withCredentialEndpointFromMetadata(metadata: CredentialIssuerMetadata): CredentialRequestClientBuilder;
26
+ withCredentialEndpoint(credentialEndpoint: string): CredentialRequestClientBuilder;
27
+ withCredentialType(credentialTypes: string | string[]): CredentialRequestClientBuilder;
28
+ withFormat(format: CredentialFormat | OID4VCICredentialFormat): CredentialRequestClientBuilder;
29
+ withToken(accessToken: string): CredentialRequestClientBuilder;
30
+ withTokenFromResponse(response: AccessTokenResponse): CredentialRequestClientBuilder;
31
+ withVersion(version: OpenId4VCIVersion): CredentialRequestClientBuilder;
32
+ build(): CredentialRequestClient;
33
+ }
34
+ //# sourceMappingURL=CredentialRequestClientBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientBuilder.d.ts","sourceRoot":"","sources":["../lib/CredentialRequestClientBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EAExB,iCAAiC,EAEjC,gBAAgB,EAEhB,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,qBAAa,8BAA8B;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,EAAE,CAAM;IAC/B,MAAM,CAAC,EAAE,gBAAgB,GAAG,uBAAuB,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,CAAC;WAER,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAA;KAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC;WAKvH,0BAA0B,CAAC,IAAI,EAAE;QAC7C,OAAO,EAAE,6BAA6B,CAAC;QACvC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;KAC7B,GAAG,8BAA8B;WAmBpB,mBAAmB,CAAC,EAChC,eAAe,EACf,QAAQ,GACT,EAAE;QACD,eAAe,EAAE,iCAAiC,CAAC;QACnD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;KAC7B,GAAG,8BAA8B;IAQ3B,kCAAkC,CAAC,QAAQ,EAAE,wBAAwB,GAAG,8BAA8B;IAKtG,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,GAAG,8BAA8B;IAKlF,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,8BAA8B;IAKtF,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,8BAA8B;IAK9F,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,8BAA8B;IAK9D,qBAAqB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,8BAA8B;IAKpF,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,8BAA8B;IAKvE,KAAK,IAAI,uBAAuB;CAMxC"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CredentialRequestClientBuilder = void 0;
13
+ const oid4vci_common_1 = require("@sphereon/oid4vci-common");
14
+ const CredentialOfferClient_1 = require("./CredentialOfferClient");
15
+ const CredentialRequestClient_1 = require("./CredentialRequestClient");
16
+ class CredentialRequestClientBuilder {
17
+ constructor() {
18
+ this.credentialTypes = [];
19
+ }
20
+ static fromURI({ uri, metadata }) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const offer = yield CredentialOfferClient_1.CredentialOfferClient.fromURI(uri);
23
+ return CredentialRequestClientBuilder.fromCredentialOfferRequest(Object.assign(Object.assign({ request: offer }, offer), { metadata, version: offer.version }));
24
+ });
25
+ }
26
+ static fromCredentialOfferRequest(opts) {
27
+ var _a, _b, _c, _d;
28
+ const { request, metadata } = opts;
29
+ const version = (_b = (_a = opts.version) !== null && _a !== void 0 ? _a : request.version) !== null && _b !== void 0 ? _b : (0, oid4vci_common_1.determineSpecVersionFromOffer)(request.original_credential_offer);
30
+ const builder = new CredentialRequestClientBuilder();
31
+ const issuer = (_c = (0, oid4vci_common_1.getIssuerFromCredentialOfferPayload)(request.credential_offer)) !== null && _c !== void 0 ? _c : metadata === null || metadata === void 0 ? void 0 : metadata.issuer;
32
+ builder.withVersion(version);
33
+ builder.withCredentialEndpoint((_d = metadata === null || metadata === void 0 ? void 0 : metadata.credential_endpoint) !== null && _d !== void 0 ? _d : (issuer.endsWith('/') ? `${issuer}credential` : `${issuer}/credential`));
34
+ if (version <= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_08) {
35
+ //todo: This basically sets all types available during initiation. Probably the user only wants a subset. So do we want to do this?
36
+ builder.withCredentialType(request.original_credential_offer.credential_type);
37
+ }
38
+ else {
39
+ // todo: look whether this is correct
40
+ builder.withCredentialType(request.credential_offer.credentials.flatMap((c) => (typeof c === 'string' ? c : c.types)));
41
+ }
42
+ return builder;
43
+ }
44
+ static fromCredentialOffer({ credentialOffer, metadata, }) {
45
+ return CredentialRequestClientBuilder.fromCredentialOfferRequest({
46
+ request: credentialOffer,
47
+ metadata,
48
+ version: credentialOffer.version,
49
+ });
50
+ }
51
+ withCredentialEndpointFromMetadata(metadata) {
52
+ this.credentialEndpoint = metadata.credential_endpoint;
53
+ return this;
54
+ }
55
+ withCredentialEndpoint(credentialEndpoint) {
56
+ this.credentialEndpoint = credentialEndpoint;
57
+ return this;
58
+ }
59
+ withCredentialType(credentialTypes) {
60
+ this.credentialTypes = Array.isArray(credentialTypes) ? credentialTypes : [credentialTypes];
61
+ return this;
62
+ }
63
+ withFormat(format) {
64
+ this.format = format;
65
+ return this;
66
+ }
67
+ withToken(accessToken) {
68
+ this.token = accessToken;
69
+ return this;
70
+ }
71
+ withTokenFromResponse(response) {
72
+ this.token = response.access_token;
73
+ return this;
74
+ }
75
+ withVersion(version) {
76
+ this.version = version;
77
+ return this;
78
+ }
79
+ build() {
80
+ if (!this.version) {
81
+ this.withVersion(oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11);
82
+ }
83
+ return new CredentialRequestClient_1.CredentialRequestClient(this);
84
+ }
85
+ }
86
+ exports.CredentialRequestClientBuilder = CredentialRequestClientBuilder;
87
+ //# sourceMappingURL=CredentialRequestClientBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientBuilder.js","sourceRoot":"","sources":["../lib/CredentialRequestClientBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAWkC;AAGlC,mEAAgE;AAChE,uEAAoE;AAEpE,MAAa,8BAA8B;IAA3C;QAEE,oBAAe,GAAa,EAAE,CAAC;IA0FjC,CAAC;IArFQ,MAAM,CAAO,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAgD;;YACzF,MAAM,KAAK,GAAG,MAAM,6CAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACvD,OAAO,8BAA8B,CAAC,0BAA0B,+BAAG,OAAO,EAAE,KAAK,IAAK,KAAK,KAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAG,CAAC;QACnI,CAAC;KAAA;IAEM,MAAM,CAAC,0BAA0B,CAAC,IAMxC;;QACC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,OAAO,GAAG,MAAA,MAAA,IAAI,CAAC,OAAO,mCAAI,OAAO,CAAC,OAAO,mCAAI,IAAA,8CAA6B,EAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACpH,MAAM,OAAO,GAAG,IAAI,8BAA8B,EAAE,CAAC;QACrD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kB,GAAG,kBAAkB,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,kBAAkB,CAAC,eAAkC;QAC1D,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,MAAkD;QAClE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,SAAS,CAAC,WAAmB;QAClC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,qBAAqB,CAAC,QAA6B;QACxD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW,CAAC,OAA0B;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,WAAW,CAAC,kCAAiB,CAAC,UAAU,CAAC,CAAC;SAChD;QACD,OAAO,IAAI,iDAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;AA5FD,wEA4FC"}
@@ -1,38 +1,39 @@
1
- import { EndpointMetadata, IssuanceInitiationRequestPayload, IssuanceInitiationWithBaseUrl, OID4VCIServerMetadata, WellKnownEndpoints } from './types';
2
- export declare class MetadataClient {
3
- static async: any;
4
- /**
5
- * Retrieve metadata using the Initiation obtained from a previous step
6
- *
7
- * @param initiation
8
- */
9
- static retrieveAllMetadataFromInitiation(initiation: IssuanceInitiationWithBaseUrl): Promise<EndpointMetadata>;
10
- /**
11
- * Retrieve the metada using the initiation request obtained from a previous step
12
- * @param initiationRequest
13
- */
14
- static retrieveAllMetadataFromInitiationRequest(initiationRequest: IssuanceInitiationRequestPayload): Promise<EndpointMetadata>;
15
- /**
16
- * Retrieve all metadata from an issuer
17
- * @param issuer The issuer URL
18
- */
19
- static retrieveAllMetadata(issuer: string, opts?: {
20
- errorOnNotFound: boolean;
21
- }): Promise<EndpointMetadata | undefined>;
22
- /**
23
- * Retrieve only the OID4VCI metadata for the issuer. So no OIDC/OAuth2 metadata
24
- *
25
- * @param issuerHost The issuer hostname
26
- */
27
- static retrieveOID4VCIServerMetadata(issuerHost: string): Promise<OID4VCIServerMetadata | undefined>;
28
- /**
29
- * Allows to retrieve information from a well-known location
30
- *
31
- * @param host The host
32
- * @param endpointType The endpoint type, currently supports OID4VCI, OIDC and OAuth2 endpoint types
33
- * @param opts Options, like for instance whether an error should be thrown in case the endpoint doesn't exist
34
- */
35
- static retrieveWellknown<T>(host: string, endpointType: WellKnownEndpoints, opts?: {
36
- errorOnNotFound?: boolean;
37
- }): Promise<T | undefined>;
38
- }
1
+ import { CredentialIssuerMetadata, CredentialOfferPayload, CredentialOfferRequestWithBaseUrl, EndpointMetadata, OpenIDResponse, WellKnownEndpoints } from '@sphereon/oid4vci-common';
2
+ export declare class MetadataClient {
3
+ /**
4
+ * Retrieve metadata using the Initiation obtained from a previous step
5
+ *
6
+ * @param credentialOffer
7
+ */
8
+ static retrieveAllMetadataFromCredentialOffer(credentialOffer: CredentialOfferRequestWithBaseUrl): Promise<EndpointMetadata>;
9
+ /**
10
+ * Retrieve the metada using the initiation request obtained from a previous step
11
+ * @param request
12
+ */
13
+ static retrieveAllMetadataFromCredentialOfferRequest(request: CredentialOfferPayload): Promise<EndpointMetadata>;
14
+ /**
15
+ * Retrieve all metadata from an issuer
16
+ * @param issuer The issuer URL
17
+ * @param opts
18
+ */
19
+ static retrieveAllMetadata(issuer: string, opts?: {
20
+ errorOnNotFound: boolean;
21
+ }): Promise<EndpointMetadata>;
22
+ /**
23
+ * Retrieve only the OID4VCI metadata for the issuer. So no OIDC/OAuth2 metadata
24
+ *
25
+ * @param issuerHost The issuer hostname
26
+ */
27
+ static retrieveOpenID4VCIServerMetadata(issuerHost: string): Promise<OpenIDResponse<CredentialIssuerMetadata> | undefined>;
28
+ /**
29
+ * Allows to retrieve information from a well-known location
30
+ *
31
+ * @param host The host
32
+ * @param endpointType The endpoint type, currently supports OID4VCI, OIDC and OAuth2 endpoint types
33
+ * @param opts Options, like for instance whether an error should be thrown in case the endpoint doesn't exist
34
+ */
35
+ static retrieveWellknown<T>(host: string, endpointType: WellKnownEndpoints, opts?: {
36
+ errorOnNotFound?: boolean;
37
+ }): Promise<OpenIDResponse<T>>;
38
+ }
39
+ //# sourceMappingURL=MetadataClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetadataClient.d.ts","sourceRoot":"","sources":["../lib/MetadataClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,iCAAiC,EACjC,gBAAgB,EAIhB,cAAc,EACd,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAOlC,qBAAa,cAAc;IACzB;;;;OAIG;WACiB,sCAAsC,CAAC,eAAe,EAAE,iCAAiC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIzI;;;OAGG;WACiB,6CAA6C,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAO7H;;;;OAIG;WACiB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,eAAe,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwEvH;;;;OAIG;WACiB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,GAAG,SAAS,CAAC;IAKvI;;;;;;OAMG;WACiB,iBAAiB,CAAC,CAAC,EACrC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,kBAAkB,EAChC,IAAI,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GACnC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CAU9B"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MetadataClient = void 0;
16
+ const oid4vci_common_1 = require("@sphereon/oid4vci-common");
17
+ const debug_1 = __importDefault(require("debug"));
18
+ const functions_1 = require("./functions");
19
+ const debug = (0, debug_1.default)('sphereon:oid4vci:metadata');
20
+ class MetadataClient {
21
+ /**
22
+ * Retrieve metadata using the Initiation obtained from a previous step
23
+ *
24
+ * @param credentialOffer
25
+ */
26
+ static retrieveAllMetadataFromCredentialOffer(credentialOffer) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return MetadataClient.retrieveAllMetadataFromCredentialOfferRequest(credentialOffer.credential_offer);
29
+ });
30
+ }
31
+ /**
32
+ * Retrieve the metada using the initiation request obtained from a previous step
33
+ * @param request
34
+ */
35
+ static retrieveAllMetadataFromCredentialOfferRequest(request) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ if ((0, oid4vci_common_1.getIssuerFromCredentialOfferPayload)(request)) {
38
+ return MetadataClient.retrieveAllMetadata((0, oid4vci_common_1.getIssuerFromCredentialOfferPayload)(request));
39
+ }
40
+ throw new Error("can't retrieve metadata from CredentialOfferRequest. No issuer field is present");
41
+ });
42
+ }
43
+ /**
44
+ * Retrieve all metadata from an issuer
45
+ * @param issuer The issuer URL
46
+ * @param opts
47
+ */
48
+ static retrieveAllMetadata(issuer, opts) {
49
+ var _a;
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ let token_endpoint;
52
+ let credential_endpoint;
53
+ const response = yield MetadataClient.retrieveOpenID4VCIServerMetadata(issuer);
54
+ let issuerMetadata = response === null || response === void 0 ? void 0 : response.successBody;
55
+ if (issuerMetadata) {
56
+ debug(`Issuer ${issuer} OID4VCI well-known server metadata\r\n${issuerMetadata}`);
57
+ credential_endpoint = issuerMetadata.credential_endpoint;
58
+ token_endpoint = issuerMetadata.token_endpoint;
59
+ if (!token_endpoint && issuerMetadata.authorization_server) {
60
+ debug(`Issuer ${issuer} OID4VCI metadata has separate authorization_server ${issuerMetadata.authorization_server} that contains the token endpoint`);
61
+ // Crossword uses this to separate the AS metadata. We fail when not found, since we now have no way of getting the token endpoint
62
+ const response = yield this.retrieveWellknown(issuerMetadata.authorization_server, oid4vci_common_1.WellKnownEndpoints.OAUTH_AS, {
63
+ errorOnNotFound: true,
64
+ });
65
+ token_endpoint = (_a = response.successBody) === null || _a === void 0 ? void 0 : _a.token_endpoint;
66
+ }
67
+ }
68
+ else {
69
+ // No specific OID4VCI endpoint. Either can be an OAuth2 AS or an OpenID IDP. Let's start with OIDC first
70
+ let response = yield MetadataClient.retrieveWellknown(issuer, oid4vci_common_1.WellKnownEndpoints.OPENID_CONFIGURATION, {
71
+ errorOnNotFound: false,
72
+ });
73
+ let asConfig = response.successBody;
74
+ if (asConfig) {
75
+ debug(`Issuer ${issuer} has OpenID Connect Server metadata in well-known location`);
76
+ }
77
+ else {
78
+ // Now oAuth2
79
+ response = yield MetadataClient.retrieveWellknown(issuer, oid4vci_common_1.WellKnownEndpoints.OAUTH_AS, { errorOnNotFound: false });
80
+ asConfig = response.successBody;
81
+ }
82
+ if (asConfig) {
83
+ debug(`Issuer ${issuer} has oAuth2 Server metadata in well-known location`);
84
+ issuerMetadata = asConfig;
85
+ credential_endpoint = issuerMetadata.credential_endpoint;
86
+ token_endpoint = issuerMetadata.token_endpoint;
87
+ }
88
+ }
89
+ if (!token_endpoint) {
90
+ debug(`Issuer ${issuer} does not have a token_endpoint listed in well-known locations!`);
91
+ if (opts === null || opts === void 0 ? void 0 : opts.errorOnNotFound) {
92
+ throw new Error(`Could not deduce the token endpoint for ${issuer}`);
93
+ }
94
+ else {
95
+ token_endpoint = `${issuer}${issuer.endsWith('/') ? '' : '/'}token`;
96
+ }
97
+ }
98
+ if (!credential_endpoint) {
99
+ debug(`Issuer ${issuer} does not have a credential_endpoint listed in well-known locations!`);
100
+ if (opts === null || opts === void 0 ? void 0 : opts.errorOnNotFound) {
101
+ throw new Error(`Could not deduce the credential endpoint for ${issuer}`);
102
+ }
103
+ else {
104
+ credential_endpoint = `${issuer}${issuer.endsWith('/') ? '' : '/'}credential`;
105
+ }
106
+ }
107
+ debug(`Issuer ${issuer} token endpoint ${token_endpoint}, credential endpoint ${credential_endpoint}`);
108
+ return {
109
+ issuer,
110
+ token_endpoint,
111
+ credential_endpoint,
112
+ issuerMetadata,
113
+ };
114
+ });
115
+ }
116
+ /**
117
+ * Retrieve only the OID4VCI metadata for the issuer. So no OIDC/OAuth2 metadata
118
+ *
119
+ * @param issuerHost The issuer hostname
120
+ */
121
+ static retrieveOpenID4VCIServerMetadata(issuerHost) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ // Since the server metadata endpoint is optional we are not going to throw an error.
124
+ return MetadataClient.retrieveWellknown(issuerHost, oid4vci_common_1.WellKnownEndpoints.OPENID4VCI_ISSUER, { errorOnNotFound: false });
125
+ });
126
+ }
127
+ /**
128
+ * Allows to retrieve information from a well-known location
129
+ *
130
+ * @param host The host
131
+ * @param endpointType The endpoint type, currently supports OID4VCI, OIDC and OAuth2 endpoint types
132
+ * @param opts Options, like for instance whether an error should be thrown in case the endpoint doesn't exist
133
+ */
134
+ static retrieveWellknown(host, endpointType, opts) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ const result = yield (0, functions_1.getJson)(`${host.endsWith('/') ? host.slice(0, -1) : host}${endpointType}`, {
137
+ exceptionOnHttpErrorStatus: opts === null || opts === void 0 ? void 0 : opts.errorOnNotFound,
138
+ });
139
+ if (result.origResponse.status === 404) {
140
+ // We only get here when error on not found is false
141
+ debug(`host ${host} with endpoint type ${endpointType} was not found (404)`);
142
+ }
143
+ return result;
144
+ });
145
+ }
146
+ }
147
+ exports.MetadataClient = MetadataClient;
148
+ //# sourceMappingURL=MetadataClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetadataClient.js","sourceRoot":"","sources":["../lib/MetadataClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAUkC;AAClC,kDAA0B;AAE1B,2CAAsC;AAEtC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,2BAA2B,CAAC,CAAC;AAEjD,MAAa,cAAc;IACzB;;;;OAIG;IACI,MAAM,CAAO,sCAAsC,CAAC,eAAkD;;YAC3G,OAAO,cAAc,CAAC,6CAA6C,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QACxG,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,6CAA6C,CAAC,OAA+B;;YAC/F,IAAI,IAAA,oDAAmC,EAAC,OAAO,CAAC,EAAE;gBAChD,OAAO,cAAc,CAAC,mBAAmB,CAAC,IAAA,oDAAmC,EAAC,OAAO,CAAW,CAAC,CAAC;aACnG;YACD,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;QACrG,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,mBAAmB,CAAC,MAAc,EAAE,IAAmC;;;YACzF,IAAI,cAAc,CAAC;YACnB,IAAI,mBAAmB,CAAC;YACxB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,gCAAgC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,KAAK,EAAE,CAAC,CAAC;QACxH,CAAC;KAAA;IAED;;;;;;OAMG;IACI,MAAM,CAAO,iBAAiB,CACnC,IAAY,EACZ,YAAgC,EAChC,IAAoC;;YAEpC,MAAM,MAAM,GAAsB,MAAM,IAAA,mBAAO,EAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,EAAE,EAAE;gBACjH,0BAA0B,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe;aAClD,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,GAAG,EAAE;gBACtC,oDAAoD;gBACpD,KAAK,CAAC,QAAQ,IAAI,uBAAuB,YAAY,sBAAsB,CAAC,CAAC;aAC9E;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF;AAjID,wCAiIC"}
@@ -0,0 +1,75 @@
1
+ import { AccessTokenResponse, Alg, AuthzFlowType, CodeChallengeMethod, CredentialOfferRequestWithBaseUrl, CredentialResponse, CredentialSupported, EndpointMetadata, OID4VCICredentialFormat, OpenId4VCIVersion, OpenIDResponse, ProofOfPossessionCallbacks, PushedAuthorizationResponse } from '@sphereon/oid4vci-common';
2
+ import { CredentialFormat } from '@sphereon/ssi-types';
3
+ interface AuthDetails {
4
+ type: 'openid_credential' | string;
5
+ locations?: string | string[];
6
+ format: CredentialFormat | CredentialFormat[];
7
+ [s: string]: unknown;
8
+ }
9
+ interface AuthRequestOpts {
10
+ clientId: string;
11
+ codeChallenge: string;
12
+ codeChallengeMethod: CodeChallengeMethod;
13
+ authorizationDetails?: AuthDetails | AuthDetails[];
14
+ redirectUri: string;
15
+ scope?: string;
16
+ }
17
+ export declare class OpenID4VCIClient {
18
+ private readonly _flowType;
19
+ private readonly _credentialOffer;
20
+ private _clientId?;
21
+ private _kid;
22
+ private _alg;
23
+ private _endpointMetadata;
24
+ private _accessTokenResponse;
25
+ private constructor();
26
+ static fromURI({ uri, flowType, kid, alg, retrieveServerMetadata, clientId, resolveOfferUri, }: {
27
+ uri: string;
28
+ flowType: AuthzFlowType;
29
+ kid?: string;
30
+ alg?: Alg | string;
31
+ retrieveServerMetadata?: boolean;
32
+ resolveOfferUri?: boolean;
33
+ clientId?: string;
34
+ }): Promise<OpenID4VCIClient>;
35
+ retrieveServerMetadata(): Promise<EndpointMetadata>;
36
+ createAuthorizationRequestUrl({ clientId, codeChallengeMethod, codeChallenge, authorizationDetails, redirectUri, scope, }: AuthRequestOpts): string;
37
+ acquirePushedAuthorizationRequestURI({ clientId, codeChallengeMethod, codeChallenge, authorizationDetails, redirectUri, scope, }: AuthRequestOpts): Promise<OpenIDResponse<PushedAuthorizationResponse>>;
38
+ handleAuthorizationDetails(authorizationDetails?: AuthDetails | AuthDetails[]): AuthDetails | AuthDetails[] | undefined;
39
+ private handleLocations;
40
+ acquireAccessToken(opts?: {
41
+ pin?: string;
42
+ clientId?: string;
43
+ codeVerifier?: string;
44
+ code?: string;
45
+ redirectUri?: string;
46
+ }): Promise<AccessTokenResponse>;
47
+ acquireCredentials({ credentialTypes, proofCallbacks, format, kid, alg, jti, }: {
48
+ credentialTypes: string | string[];
49
+ proofCallbacks: ProofOfPossessionCallbacks;
50
+ format?: CredentialFormat | OID4VCICredentialFormat;
51
+ kid?: string;
52
+ alg?: Alg | string;
53
+ jti?: string;
54
+ }): Promise<CredentialResponse>;
55
+ getCredentialsSupported(restrictToInitiationTypes: boolean, supportedType?: string): CredentialSupported[];
56
+ getCredentialMetadata(type: string): CredentialSupported[];
57
+ getCredentialTypes(): string[];
58
+ get flowType(): AuthzFlowType;
59
+ issuerSupportedFlowTypes(): AuthzFlowType[];
60
+ get credentialOffer(): CredentialOfferRequestWithBaseUrl;
61
+ version(): OpenId4VCIVersion;
62
+ get endpointMetadata(): EndpointMetadata;
63
+ get kid(): string;
64
+ get alg(): string;
65
+ get clientId(): string | undefined;
66
+ get accessTokenResponse(): AccessTokenResponse;
67
+ getIssuer(): string;
68
+ getAccessTokenEndpoint(): string;
69
+ getCredentialEndpoint(): string;
70
+ private assertIssuerData;
71
+ private assertServerMetadata;
72
+ private assertAccessToken;
73
+ }
74
+ export {};
75
+ //# sourceMappingURL=OpenID4VCIClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenID4VCIClient.d.ts","sourceRoot":"","sources":["../lib/OpenID4VCIClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,GAAG,EAEH,aAAa,EACb,mBAAmB,EAEnB,iCAAiC,EACjC,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,2BAA2B,EAE5B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAYvD,UAAU,WAAW;IACnB,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IAE9C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,oBAAoB,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoC;IACrE,OAAO,CAAC,SAAS,CAAC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