@sphereon/oid4vci-client 0.10.3 → 0.10.4-unstable.15

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 (105) hide show
  1. package/dist/AccessTokenClient.d.ts +5 -5
  2. package/dist/AccessTokenClient.d.ts.map +1 -1
  3. package/dist/AccessTokenClient.js +45 -25
  4. package/dist/AccessTokenClient.js.map +1 -1
  5. package/dist/AccessTokenClientV1_0_11.d.ts +29 -0
  6. package/dist/AccessTokenClientV1_0_11.d.ts.map +1 -0
  7. package/dist/AccessTokenClientV1_0_11.js +212 -0
  8. package/dist/AccessTokenClientV1_0_11.js.map +1 -0
  9. package/dist/AuthorizationCodeClient.d.ts +5 -5
  10. package/dist/AuthorizationCodeClient.d.ts.map +1 -1
  11. package/dist/AuthorizationCodeClient.js +19 -8
  12. package/dist/AuthorizationCodeClient.js.map +1 -1
  13. package/dist/AuthorizationCodeClientV1_0_11.d.ts +9 -0
  14. package/dist/AuthorizationCodeClientV1_0_11.d.ts.map +1 -0
  15. package/dist/AuthorizationCodeClientV1_0_11.js +132 -0
  16. package/dist/AuthorizationCodeClientV1_0_11.js.map +1 -0
  17. package/dist/CredentialOfferClient.d.ts.map +1 -1
  18. package/dist/CredentialOfferClient.js +14 -25
  19. package/dist/CredentialOfferClient.js.map +1 -1
  20. package/dist/CredentialOfferClientV1_0_11.d.ts +10 -0
  21. package/dist/CredentialOfferClientV1_0_11.d.ts.map +1 -0
  22. package/dist/CredentialOfferClientV1_0_11.js +103 -0
  23. package/dist/CredentialOfferClientV1_0_11.js.map +1 -0
  24. package/dist/CredentialRequestClient.d.ts +1 -1
  25. package/dist/CredentialRequestClient.d.ts.map +1 -1
  26. package/dist/CredentialRequestClient.js +11 -8
  27. package/dist/CredentialRequestClient.js.map +1 -1
  28. package/dist/CredentialRequestClientBuilder.d.ts +3 -3
  29. package/dist/CredentialRequestClientBuilder.d.ts.map +1 -1
  30. package/dist/CredentialRequestClientBuilder.js +4 -4
  31. package/dist/CredentialRequestClientBuilder.js.map +1 -1
  32. package/dist/CredentialRequestClientBuilderV1_0_11.d.ts +46 -0
  33. package/dist/CredentialRequestClientBuilderV1_0_11.d.ts.map +1 -0
  34. package/dist/CredentialRequestClientBuilderV1_0_11.js +117 -0
  35. package/dist/CredentialRequestClientBuilderV1_0_11.js.map +1 -0
  36. package/dist/CredentialRequestClientV1_0_11.d.ts +44 -0
  37. package/dist/CredentialRequestClientV1_0_11.d.ts.map +1 -0
  38. package/dist/CredentialRequestClientV1_0_11.js +151 -0
  39. package/dist/CredentialRequestClientV1_0_11.js.map +1 -0
  40. package/dist/MetadataClient.d.ts +5 -15
  41. package/dist/MetadataClient.d.ts.map +1 -1
  42. package/dist/MetadataClient.js +13 -33
  43. package/dist/MetadataClient.js.map +1 -1
  44. package/dist/MetadataClientV1_0_11.d.ts +31 -0
  45. package/dist/MetadataClientV1_0_11.d.ts.map +1 -0
  46. package/dist/MetadataClientV1_0_11.js +182 -0
  47. package/dist/MetadataClientV1_0_11.js.map +1 -0
  48. package/dist/OpenID4VCIClient.d.ts +5 -17
  49. package/dist/OpenID4VCIClient.d.ts.map +1 -1
  50. package/dist/OpenID4VCIClient.js +19 -90
  51. package/dist/OpenID4VCIClient.js.map +1 -1
  52. package/dist/OpenID4VCIClientV1_0_11.d.ts +107 -0
  53. package/dist/OpenID4VCIClientV1_0_11.d.ts.map +1 -0
  54. package/dist/OpenID4VCIClientV1_0_11.js +462 -0
  55. package/dist/OpenID4VCIClientV1_0_11.js.map +1 -0
  56. package/dist/ProofOfPossessionBuilder.js +1 -1
  57. package/dist/ProofOfPossessionBuilder.js.map +1 -1
  58. package/dist/functions/OpenIDUtils.d.ts +12 -0
  59. package/dist/functions/OpenIDUtils.d.ts.map +1 -0
  60. package/dist/functions/OpenIDUtils.js +37 -0
  61. package/dist/functions/OpenIDUtils.js.map +1 -0
  62. package/dist/functions/ProofUtil.d.ts.map +1 -1
  63. package/dist/index.d.ts +8 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +8 -1
  66. package/dist/index.js.map +1 -1
  67. package/lib/AccessTokenClient.ts +277 -245
  68. package/lib/AccessTokenClientV1_0_11.ts +255 -0
  69. package/lib/AuthorizationCodeClient.ts +183 -163
  70. package/lib/AuthorizationCodeClientV1_0_11.ts +167 -0
  71. package/lib/CredentialOfferClient.ts +99 -111
  72. package/lib/CredentialOfferClientV1_0_11.ts +112 -0
  73. package/lib/CredentialRequestClient.ts +212 -208
  74. package/lib/CredentialRequestClientBuilder.ts +156 -155
  75. package/lib/CredentialRequestClientBuilderV1_0_11.ts +156 -0
  76. package/lib/CredentialRequestClientV1_0_11.ts +190 -0
  77. package/lib/MetadataClient.ts +186 -208
  78. package/lib/MetadataClientV1_0_11.ts +186 -0
  79. package/lib/OpenID4VCIClient.ts +547 -629
  80. package/lib/OpenID4VCIClientV1_0_11.ts +644 -0
  81. package/lib/ProofOfPossessionBuilder.ts +204 -204
  82. package/lib/__tests__/AccessTokenClient.spec.ts +239 -211
  83. package/lib/__tests__/CredentialRequestClient.spec.ts +328 -311
  84. package/lib/__tests__/CredentialRequestClientBuilder.spec.ts +131 -131
  85. package/lib/__tests__/CredentialRequestClientV1_0_11.spec.ts +316 -0
  86. package/lib/__tests__/EBSIE2E.spec.test.ts +145 -145
  87. package/lib/__tests__/IT.spec.ts +382 -171
  88. package/lib/__tests__/IssuanceInitiation.spec.ts +64 -61
  89. package/lib/__tests__/IssuanceInitiationV1_0_11.spec.ts +62 -0
  90. package/lib/__tests__/JsonURIConversions.spec.ts +146 -146
  91. package/lib/__tests__/MattrE2E.spec.test.ts +104 -104
  92. package/lib/__tests__/MetadataClient.spec.ts +324 -260
  93. package/lib/__tests__/MetadataMocks.ts +483 -444
  94. package/lib/__tests__/OpenID4VCIClient.spec.ts +202 -202
  95. package/lib/__tests__/{OpenID4VCIClientPAR.spec.ts → OpenID4VCIClientPARV1_0_11.spec.ts} +122 -122
  96. package/lib/__tests__/OpenID4VCIClientV1_0_11.spec.ts +202 -0
  97. package/lib/__tests__/ProofOfPossessionBuilder.spec.ts +110 -110
  98. package/lib/__tests__/SdJwt.spec.ts +170 -163
  99. package/lib/__tests__/SphereonE2E.spec.test.ts +169 -169
  100. package/lib/__tests__/data/VciDataFixtures.ts +1382 -745
  101. package/lib/functions/AuthorizationUtil.ts +18 -18
  102. package/lib/functions/OpenIDUtils.ts +25 -0
  103. package/lib/functions/ProofUtil.ts +128 -128
  104. package/lib/index.ts +16 -9
  105. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientBuilderV1_0_11.d.ts","sourceRoot":"","sources":["../lib/CredentialRequestClientBuilderV1_0_11.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EAGxB,iCAAiC,EAEjC,gBAAgB,EAGhB,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,qCAAqC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,uBAAuB,UAAS;IAChC,8BAA8B,SAAQ;IACtC,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;WAEd,oBAAoB,CAAC,EACjC,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,eAAe,GAChB,EAAE;QACD,gBAAgB,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAC5B,eAAe,EAAE,MAAM,GAAG,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 -0,0 +1,117 @@
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.CredentialRequestClientBuilderV1_0_11 = void 0;
13
+ const oid4vci_common_1 = require("@sphereon/oid4vci-common");
14
+ const CredentialOfferClientV1_0_11_1 = require("./CredentialOfferClientV1_0_11");
15
+ const CredentialRequestClientV1_0_11_1 = require("./CredentialRequestClientV1_0_11");
16
+ class CredentialRequestClientBuilderV1_0_11 {
17
+ constructor() {
18
+ this.deferredCredentialAwait = false;
19
+ this.deferredCredentialIntervalInMS = 5000;
20
+ this.credentialTypes = [];
21
+ }
22
+ static fromCredentialIssuer({ credentialIssuer, metadata, version, credentialTypes, }) {
23
+ var _a;
24
+ const issuer = credentialIssuer;
25
+ const builder = new CredentialRequestClientBuilderV1_0_11();
26
+ builder.withVersion(version !== null && version !== void 0 ? version : oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11);
27
+ builder.withCredentialEndpoint((_a = metadata === null || metadata === void 0 ? void 0 : metadata.credential_endpoint) !== null && _a !== void 0 ? _a : (issuer.endsWith('/') ? `${issuer}credential` : `${issuer}/credential`));
28
+ if (metadata === null || metadata === void 0 ? void 0 : metadata.deferred_credential_endpoint) {
29
+ builder.withDeferredCredentialEndpoint(metadata.deferred_credential_endpoint);
30
+ }
31
+ builder.withCredentialType(credentialTypes);
32
+ return builder;
33
+ }
34
+ static fromURI(_a) {
35
+ return __awaiter(this, arguments, void 0, function* ({ uri, metadata }) {
36
+ const offer = yield CredentialOfferClientV1_0_11_1.CredentialOfferClientV1_0_11.fromURI(uri);
37
+ return CredentialRequestClientBuilderV1_0_11.fromCredentialOfferRequest(Object.assign(Object.assign({ request: offer }, offer), { metadata, version: offer.version }));
38
+ });
39
+ }
40
+ static fromCredentialOfferRequest(opts) {
41
+ var _a, _b, _c, _d;
42
+ const { request, metadata } = opts;
43
+ 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);
44
+ const builder = new CredentialRequestClientBuilderV1_0_11();
45
+ 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;
46
+ builder.withVersion(version);
47
+ builder.withCredentialEndpoint((_d = metadata === null || metadata === void 0 ? void 0 : metadata.credential_endpoint) !== null && _d !== void 0 ? _d : (issuer.endsWith('/') ? `${issuer}credential` : `${issuer}/credential`));
48
+ if (metadata === null || metadata === void 0 ? void 0 : metadata.deferred_credential_endpoint) {
49
+ builder.withDeferredCredentialEndpoint(metadata.deferred_credential_endpoint);
50
+ }
51
+ if (version <= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_08) {
52
+ //todo: This basically sets all types available during initiation. Probably the user only wants a subset. So do we want to do this?
53
+ builder.withCredentialType(request.original_credential_offer.credential_type);
54
+ }
55
+ else if (version <= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11) {
56
+ // todo: look whether this is correct
57
+ builder.withCredentialType((0, oid4vci_common_1.getTypesFromOfferV1_0_11)(request.credential_offer));
58
+ }
59
+ return builder;
60
+ }
61
+ static fromCredentialOffer({ credentialOffer, metadata, }) {
62
+ return CredentialRequestClientBuilderV1_0_11.fromCredentialOfferRequest({
63
+ request: credentialOffer,
64
+ metadata,
65
+ version: credentialOffer.version,
66
+ });
67
+ }
68
+ withCredentialEndpointFromMetadata(metadata) {
69
+ this.credentialEndpoint = metadata.credential_endpoint;
70
+ return this;
71
+ }
72
+ withCredentialEndpoint(credentialEndpoint) {
73
+ this.credentialEndpoint = credentialEndpoint;
74
+ return this;
75
+ }
76
+ withDeferredCredentialEndpointFromMetadata(metadata) {
77
+ this.deferredCredentialEndpoint = metadata.deferred_credential_endpoint;
78
+ return this;
79
+ }
80
+ withDeferredCredentialEndpoint(deferredCredentialEndpoint) {
81
+ this.deferredCredentialEndpoint = deferredCredentialEndpoint;
82
+ return this;
83
+ }
84
+ withDeferredCredentialAwait(deferredCredentialAwait, deferredCredentialIntervalInMS) {
85
+ this.deferredCredentialAwait = deferredCredentialAwait;
86
+ this.deferredCredentialIntervalInMS = deferredCredentialIntervalInMS !== null && deferredCredentialIntervalInMS !== void 0 ? deferredCredentialIntervalInMS : 5000;
87
+ return this;
88
+ }
89
+ withCredentialType(credentialTypes) {
90
+ this.credentialTypes = Array.isArray(credentialTypes) ? credentialTypes : [credentialTypes];
91
+ return this;
92
+ }
93
+ withFormat(format) {
94
+ this.format = format;
95
+ return this;
96
+ }
97
+ withToken(accessToken) {
98
+ this.token = accessToken;
99
+ return this;
100
+ }
101
+ withTokenFromResponse(response) {
102
+ this.token = response.access_token;
103
+ return this;
104
+ }
105
+ withVersion(version) {
106
+ this.version = version;
107
+ return this;
108
+ }
109
+ build() {
110
+ if (!this.version) {
111
+ this.withVersion(oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11);
112
+ }
113
+ return new CredentialRequestClientV1_0_11_1.CredentialRequestClientV1_0_11(this);
114
+ }
115
+ }
116
+ exports.CredentialRequestClientBuilderV1_0_11 = CredentialRequestClientBuilderV1_0_11;
117
+ //# sourceMappingURL=CredentialRequestClientBuilderV1_0_11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientBuilderV1_0_11.js","sourceRoot":"","sources":["../lib/CredentialRequestClientBuilderV1_0_11.ts"],"names":[],"mappings":";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I,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,CAAC;YAClB,IAAI,CAAC,WAAW,CAAC,kCAAiB,CAAC,UAAU,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,IAAI,+DAA8B,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AAxID,sFAwIC"}
@@ -0,0 +1,44 @@
1
+ import { CredentialResponse, OID4VCICredentialFormat, OpenId4VCIVersion, OpenIDResponse, ProofOfPossession, UniformCredentialRequest } from '@sphereon/oid4vci-common';
2
+ import { CredentialFormat } from '@sphereon/ssi-types';
3
+ import { CredentialRequestClientBuilderV1_0_11 } from './CredentialRequestClientBuilderV1_0_11';
4
+ import { ProofOfPossessionBuilder } from './ProofOfPossessionBuilder';
5
+ export interface CredentialRequestOptsV1_0_11 {
6
+ deferredCredentialAwait?: boolean;
7
+ deferredCredentialIntervalInMS?: number;
8
+ credentialEndpoint: string;
9
+ deferredCredentialEndpoint?: string;
10
+ credentialTypes: string[];
11
+ format?: CredentialFormat | OID4VCICredentialFormat;
12
+ proof: ProofOfPossession;
13
+ token: string;
14
+ version: OpenId4VCIVersion;
15
+ }
16
+ export declare class CredentialRequestClientV1_0_11 {
17
+ private readonly _credentialRequestOpts;
18
+ private _isDeferred;
19
+ get credentialRequestOpts(): CredentialRequestOptsV1_0_11;
20
+ isDeferred(): boolean;
21
+ getCredentialEndpoint(): string;
22
+ getDeferredCredentialEndpoint(): string | undefined;
23
+ constructor(builder: CredentialRequestClientBuilderV1_0_11);
24
+ acquireCredentialsUsingProof<DIDDoc>(opts: {
25
+ proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
26
+ credentialTypes?: string | string[];
27
+ context?: string[];
28
+ format?: CredentialFormat | OID4VCICredentialFormat;
29
+ }): Promise<OpenIDResponse<CredentialResponse>>;
30
+ acquireCredentialsUsingRequest(uniformRequest: UniformCredentialRequest): Promise<OpenIDResponse<CredentialResponse>>;
31
+ acquireDeferredCredential(response: Pick<CredentialResponse, 'transaction_id' | 'acceptance_token' | 'c_nonce'>, opts?: {
32
+ bearerToken?: string;
33
+ }): Promise<OpenIDResponse<CredentialResponse>>;
34
+ createCredentialRequest<DIDDoc>(opts: {
35
+ proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
36
+ credentialTypes?: string | string[];
37
+ context?: string[];
38
+ format?: CredentialFormat | OID4VCICredentialFormat;
39
+ version: OpenId4VCIVersion;
40
+ }): Promise<UniformCredentialRequest>;
41
+ private version;
42
+ private isV11OrHigher;
43
+ }
44
+ //# sourceMappingURL=CredentialRequestClientV1_0_11.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientV1_0_11.d.ts","sourceRoot":"","sources":["../lib/CredentialRequestClientV1_0_11.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAIlB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,4BAA4B;IAC3C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0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AC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACpC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,MAAM,CAAC,EAAE,gBAAgB,GAAG,uBAAuB,CAAC;QACpD,OAAO,EAAE,iBAAiB,CAAC;KAC5B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA6DrC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;CAGtB"}
@@ -0,0 +1,151 @@
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.CredentialRequestClientV1_0_11 = void 0;
16
+ const oid4vci_common_1 = require("@sphereon/oid4vci-common");
17
+ const debug_1 = __importDefault(require("debug"));
18
+ const CredentialRequestClient_1 = require("./CredentialRequestClient");
19
+ const functions_1 = require("./functions");
20
+ const debug = (0, debug_1.default)('sphereon:oid4vci:credential');
21
+ class CredentialRequestClientV1_0_11 {
22
+ get credentialRequestOpts() {
23
+ return this._credentialRequestOpts;
24
+ }
25
+ isDeferred() {
26
+ return this._isDeferred;
27
+ }
28
+ getCredentialEndpoint() {
29
+ return this.credentialRequestOpts.credentialEndpoint;
30
+ }
31
+ getDeferredCredentialEndpoint() {
32
+ return this.credentialRequestOpts.deferredCredentialEndpoint;
33
+ }
34
+ constructor(builder) {
35
+ this._isDeferred = false;
36
+ this._credentialRequestOpts = Object.assign({}, builder);
37
+ }
38
+ acquireCredentialsUsingProof(opts) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const { credentialTypes, proofInput, format, context } = opts;
41
+ const request = yield this.createCredentialRequest({ proofInput, credentialTypes, context, format, version: this.version() });
42
+ return yield this.acquireCredentialsUsingRequest(request);
43
+ });
44
+ }
45
+ acquireCredentialsUsingRequest(uniformRequest) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const request = (0, oid4vci_common_1.getCredentialRequestForVersion)(uniformRequest, this.version());
48
+ const credentialEndpoint = this.credentialRequestOpts.credentialEndpoint;
49
+ if (!(0, functions_1.isValidURL)(credentialEndpoint)) {
50
+ debug(`Invalid credential endpoint: ${credentialEndpoint}`);
51
+ throw new Error(oid4vci_common_1.URL_NOT_VALID);
52
+ }
53
+ debug(`Acquiring credential(s) from: ${credentialEndpoint}`);
54
+ debug(`request\n: ${JSON.stringify(request, null, 2)}`);
55
+ const requestToken = this.credentialRequestOpts.token;
56
+ let response = yield (0, functions_1.post)(credentialEndpoint, JSON.stringify(request), { bearerToken: requestToken });
57
+ this._isDeferred = (0, oid4vci_common_1.isDeferredCredentialResponse)(response);
58
+ if (this.isDeferred() && this.credentialRequestOpts.deferredCredentialAwait && response.successBody) {
59
+ response = yield this.acquireDeferredCredential(response.successBody, { bearerToken: this.credentialRequestOpts.token });
60
+ }
61
+ debug(`Credential endpoint ${credentialEndpoint} response:\r\n${JSON.stringify(response, null, 2)}`);
62
+ return response;
63
+ });
64
+ }
65
+ acquireDeferredCredential(response, opts) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ var _a;
68
+ const transactionId = response.transaction_id;
69
+ const bearerToken = (_a = response.acceptance_token) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.bearerToken;
70
+ const deferredCredentialEndpoint = this.getDeferredCredentialEndpoint();
71
+ if (!deferredCredentialEndpoint) {
72
+ throw Error(`No deferred credential endpoint supplied.`);
73
+ }
74
+ else if (!bearerToken) {
75
+ throw Error(`No bearer token present and refresh for defered endpoint not supported yet`);
76
+ // todo updated bearer token with new c_nonce
77
+ }
78
+ return yield (0, oid4vci_common_1.acquireDeferredCredential)({
79
+ bearerToken,
80
+ transactionId,
81
+ deferredCredentialEndpoint,
82
+ deferredCredentialAwait: this.credentialRequestOpts.deferredCredentialAwait,
83
+ deferredCredentialIntervalInMS: this.credentialRequestOpts.deferredCredentialIntervalInMS,
84
+ });
85
+ });
86
+ }
87
+ createCredentialRequest(opts) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ var _a;
90
+ const { proofInput } = opts;
91
+ const formatSelection = (_a = opts.format) !== null && _a !== void 0 ? _a : this.credentialRequestOpts.format;
92
+ if (!formatSelection) {
93
+ throw Error(`Format of credential to be issued is missing`);
94
+ }
95
+ const format = (0, oid4vci_common_1.getUniformFormat)(formatSelection);
96
+ const typesSelection = (opts === null || opts === void 0 ? void 0 : opts.credentialTypes) && (typeof opts.credentialTypes === 'string' || opts.credentialTypes.length > 0)
97
+ ? opts.credentialTypes
98
+ : this.credentialRequestOpts.credentialTypes;
99
+ const types = Array.isArray(typesSelection) ? typesSelection : [typesSelection];
100
+ if (types.length === 0) {
101
+ throw Error(`Credential type(s) need to be provided`);
102
+ }
103
+ // FIXME: this is mixing up the type (as id) from v8/v9 and the types (from the vc.type) from v11
104
+ else if (!this.isV11OrHigher() && types.length !== 1) {
105
+ throw Error('Only a single credential type is supported for V8/V9');
106
+ }
107
+ const proof = yield (0, CredentialRequestClient_1.buildProof)(proofInput, opts);
108
+ // TODO: we should move format specific logic
109
+ if (format === 'jwt_vc_json' || format === 'jwt_vc') {
110
+ return {
111
+ types,
112
+ format,
113
+ proof,
114
+ };
115
+ }
116
+ else if (format === 'jwt_vc_json-ld' || format === 'ldp_vc') {
117
+ if (this.version() >= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_12 && !opts.context) {
118
+ throw Error('No @context value present, but it is required');
119
+ }
120
+ return {
121
+ format,
122
+ proof,
123
+ // Ignored because v11 does not have the context value, but it is required in v12
124
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
125
+ // @ts-ignore
126
+ credential_definition: Object.assign({ types }, (opts.context && { '@context': opts.context })),
127
+ };
128
+ }
129
+ else if (format === 'vc+sd-jwt') {
130
+ if (types.length > 1) {
131
+ throw Error(`Only a single credential type is supported for ${format}`);
132
+ }
133
+ return {
134
+ format,
135
+ proof,
136
+ vct: types[0],
137
+ };
138
+ }
139
+ throw new Error(`Unsupported format: ${format}`);
140
+ });
141
+ }
142
+ version() {
143
+ var _a, _b;
144
+ return (_b = (_a = this.credentialRequestOpts) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11;
145
+ }
146
+ isV11OrHigher() {
147
+ return this.version() >= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_11;
148
+ }
149
+ }
150
+ exports.CredentialRequestClientV1_0_11 = CredentialRequestClientV1_0_11;
151
+ //# sourceMappingURL=CredentialRequestClientV1_0_11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialRequestClientV1_0_11.js","sourceRoot":"","sources":["../lib/CredentialRequestClientV1_0_11.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAYkC;AAElC,kDAA0B;AAE1B,uEAAuD;AAGvD,2CAA+C;AAE/C,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,6BAA6B,CAAC,CAAC;AAcnD,MAAa,8BAA8B;IAIzC,IAAI,qBAAqB;QACvB,OAAO,IAAI,CAAC,sBAAsD,CAAC;IACrE,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEM,qBAAqB;QAC1B,OAAO,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC;IACvD,CAAC;IAEM,6BAA6B;QAClC,OAAO,IAAI,CAAC,qBAAqB,CAAC,0BAA0B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;iBAAM,IAAI,MAAM,KAAK,gBAAgB,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC9D,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,kCAAiB,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBACpE,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBAC/D,CAAC;gBAED,OAAO;oBACL,MAAM;oBACN,KAAK;oBAEL,iFAAiF;oBACjF,6DAA6D;oBAC7D,aAAa;oBACb,qBAAqB,kBACnB,KAAK,IACF,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAClD;iBACF,CAAC;YACJ,CAAC;iBAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,MAAM,KAAK,CAAC,kDAAkD,MAAM,EAAE,CAAC,CAAC;gBAC1E,CAAC;gBAED,OAAO;oBACL,MAAM;oBACN,KAAK;oBACL,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;iBACd,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;KAAA;IAEO,OAAO;;QACb,OAAO,MAAA,MAAA,IAAI,CAAC,qBAAqB,0CAAE,OAAO,mCAAI,kCAAiB,CAAC,UAAU,CAAC;IAC7E,CAAC;IAEO,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,kCAAiB,CAAC,UAAU,CAAC;IACxD,CAAC;CACF;AA1JD,wEA0JC"}
@@ -1,16 +1,16 @@
1
- import { CredentialIssuerMetadata, CredentialOfferPayload, CredentialOfferRequestWithBaseUrl, EndpointMetadataResult, OpenIDResponse, WellKnownEndpoints } from '@sphereon/oid4vci-common';
1
+ import { CredentialOfferPayloadV1_0_13, CredentialOfferRequestWithBaseUrl, EndpointMetadataResultV1_0_13, IssuerMetadataV1_0_13, OpenIDResponse } from '@sphereon/oid4vci-common';
2
2
  export declare class MetadataClient {
3
3
  /**
4
4
  * Retrieve metadata using the Initiation obtained from a previous step
5
5
  *
6
6
  * @param credentialOffer
7
7
  */
8
- static retrieveAllMetadataFromCredentialOffer(credentialOffer: CredentialOfferRequestWithBaseUrl): Promise<EndpointMetadataResult>;
8
+ static retrieveAllMetadataFromCredentialOffer(credentialOffer: CredentialOfferRequestWithBaseUrl): Promise<EndpointMetadataResultV1_0_13>;
9
9
  /**
10
10
  * Retrieve the metada using the initiation request obtained from a previous step
11
11
  * @param request
12
12
  */
13
- static retrieveAllMetadataFromCredentialOfferRequest(request: CredentialOfferPayload): Promise<EndpointMetadataResult>;
13
+ static retrieveAllMetadataFromCredentialOfferRequest(request: CredentialOfferPayloadV1_0_13): Promise<EndpointMetadataResultV1_0_13>;
14
14
  /**
15
15
  * Retrieve all metadata from an issuer
16
16
  * @param issuer The issuer URL
@@ -18,7 +18,7 @@ export declare class MetadataClient {
18
18
  */
19
19
  static retrieveAllMetadata(issuer: string, opts?: {
20
20
  errorOnNotFound: boolean;
21
- }): Promise<EndpointMetadataResult>;
21
+ }): Promise<EndpointMetadataResultV1_0_13>;
22
22
  /**
23
23
  * Retrieve only the OID4VCI metadata for the issuer. So no OIDC/OAuth2 metadata
24
24
  *
@@ -26,16 +26,6 @@ export declare class MetadataClient {
26
26
  */
27
27
  static retrieveOpenID4VCIServerMetadata(issuerHost: string, opts?: {
28
28
  errorOnNotFound?: boolean;
29
- }): Promise<OpenIDResponse<CredentialIssuerMetadata> | undefined>;
30
- /**
31
- * Allows to retrieve information from a well-known location
32
- *
33
- * @param host The host
34
- * @param endpointType The endpoint type, currently supports OID4VCI, OIDC and OAuth2 endpoint types
35
- * @param opts Options, like for instance whether an error should be thrown in case the endpoint doesn't exist
36
- */
37
- static retrieveWellknown<T>(host: string, endpointType: WellKnownEndpoints, opts?: {
38
- errorOnNotFound?: boolean;
39
- }): Promise<OpenIDResponse<T>>;
29
+ }): Promise<OpenIDResponse<IssuerMetadataV1_0_13> | undefined>;
40
30
  }
41
31
  //# sourceMappingURL=MetadataClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataClient.d.ts","sourceRoot":"","sources":["../lib/MetadataClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACxB,sBAAsB,EACtB,iCAAiC,EACjC,sBAAsB,EAEtB,cAAc,EACd,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAOlC,qBAAa,cAAc;IACzB;;;;OAIG;WACiB,sCAAsC,CAAC,eAAe,EAAE,iCAAiC,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI/I;;;OAGG;WACiB,6CAA6C,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAQnI;;;;OAIG;WACiB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,eAAe,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA8H7H;;;;OAIG;WACiB,gCAAgC,CAClD,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QACL,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GACA,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,GAAG,SAAS,CAAC;IAMhE;;;;;;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"}
1
+ {"version":3,"file":"MetadataClient.d.ts","sourceRoot":"","sources":["../lib/MetadataClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,6BAA6B,EAC7B,iCAAiC,EACjC,6BAA6B,EAE7B,qBAAqB,EACrB,cAAc,EAEf,MAAM,0BAA0B,CAAA;AAOjC,qBAAa,cAAc;IACzB;;;;OAIG;WACiB,sCAAsC,CAAC,eAAe,EAAE,iCAAiC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAItJ;;;OAGG;WACiB,6CAA6C,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAQjJ;;;;OAIG;WACiB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,eAAe,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC;IA6HpI;;;;OAIG;WACiB,gCAAgC,CAClD,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QACL,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GACA,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;CAK9D"}
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.MetadataClient = void 0;
16
16
  const oid4vci_common_1 = require("@sphereon/oid4vci-common");
17
17
  const debug_1 = __importDefault(require("debug"));
18
- const functions_1 = require("./functions");
18
+ const OpenIDUtils_1 = require("./functions/OpenIDUtils");
19
19
  const debug = (0, debug_1.default)('sphereon:oid4vci:metadata');
20
20
  class MetadataClient {
21
21
  /**
@@ -53,7 +53,7 @@ class MetadataClient {
53
53
  let deferred_credential_endpoint;
54
54
  let authorization_endpoint;
55
55
  let authorizationServerType = 'OID4VCI';
56
- let authorization_server = issuer;
56
+ let authorization_servers = [issuer];
57
57
  const oid4vciResponse = yield MetadataClient.retrieveOpenID4VCIServerMetadata(issuer, { errorOnNotFound: false }); // We will handle errors later, given we will also try other metadata locations
58
58
  let credentialIssuerMetadata = oid4vciResponse === null || oid4vciResponse === void 0 ? void 0 : oid4vciResponse.successBody;
59
59
  if (credentialIssuerMetadata) {
@@ -63,15 +63,13 @@ class MetadataClient {
63
63
  if (credentialIssuerMetadata.token_endpoint) {
64
64
  token_endpoint = credentialIssuerMetadata.token_endpoint;
65
65
  }
66
- if (credentialIssuerMetadata.authorization_server) {
67
- authorization_server = credentialIssuerMetadata.authorization_server;
68
- }
69
- if (credentialIssuerMetadata.authorization_endpoint) {
70
- authorization_endpoint = credentialIssuerMetadata.authorization_endpoint;
66
+ if (credentialIssuerMetadata.authorization_servers) {
67
+ authorization_servers = credentialIssuerMetadata.authorization_servers;
71
68
  }
72
69
  }
73
70
  // No specific OID4VCI endpoint. Either can be an OAuth2 AS or an OIDC IDP. Let's start with OIDC first
74
- let response = yield MetadataClient.retrieveWellknown(authorization_server, oid4vci_common_1.WellKnownEndpoints.OPENID_CONFIGURATION, {
71
+ // TODO: for now we're taking just the first one
72
+ let response = yield (0, OpenIDUtils_1.retrieveWellknown)(authorization_servers[0], oid4vci_common_1.WellKnownEndpoints.OPENID_CONFIGURATION, {
75
73
  errorOnNotFound: false,
76
74
  });
77
75
  let authMetadata = response.successBody;
@@ -81,13 +79,14 @@ class MetadataClient {
81
79
  }
82
80
  else {
83
81
  // Now let's do OAuth2
84
- response = yield MetadataClient.retrieveWellknown(authorization_server, oid4vci_common_1.WellKnownEndpoints.OAUTH_AS, { errorOnNotFound: false });
82
+ // TODO: for now we're taking just the first one
83
+ response = yield (0, OpenIDUtils_1.retrieveWellknown)(authorization_servers[0], oid4vci_common_1.WellKnownEndpoints.OAUTH_AS, { errorOnNotFound: false });
85
84
  authMetadata = response.successBody;
86
85
  }
87
86
  if (!authMetadata) {
88
87
  // We will always throw an error, no matter whether the user provided the option not to, because this is bad.
89
- if (issuer !== authorization_server) {
90
- throw Error(`Issuer ${issuer} provided a separate authorization server ${authorization_server}, but that server did not provide metadata`);
88
+ if (!authorization_servers.includes(issuer)) {
89
+ throw Error(`Issuer ${issuer} provided a separate authorization server ${authorization_servers}, but that server did not provide metadata`);
91
90
  }
92
91
  }
93
92
  else {
@@ -103,7 +102,7 @@ class MetadataClient {
103
102
  }
104
103
  authorization_endpoint = authMetadata.authorization_endpoint;
105
104
  if (!authMetadata.token_endpoint) {
106
- throw Error(`Authorization Sever ${authorization_server} did not provide a token_endpoint`);
105
+ throw Error(`Authorization Sever ${authorization_servers} did not provide a token_endpoint`);
107
106
  }
108
107
  else if (token_endpoint && authMetadata.token_endpoint !== token_endpoint) {
109
108
  throw Error(`Credential issuer has a different token_endpoint (${token_endpoint}) from the Authorization Server (${authMetadata.token_endpoint})`);
@@ -157,7 +156,7 @@ class MetadataClient {
157
156
  token_endpoint,
158
157
  credential_endpoint,
159
158
  deferred_credential_endpoint,
160
- authorization_server,
159
+ authorization_server: authorization_servers[0],
161
160
  authorization_endpoint,
162
161
  authorizationServerType,
163
162
  credentialIssuerMetadata: credentialIssuerMetadata,
@@ -172,30 +171,11 @@ class MetadataClient {
172
171
  */
173
172
  static retrieveOpenID4VCIServerMetadata(issuerHost, opts) {
174
173
  return __awaiter(this, void 0, void 0, function* () {
175
- return MetadataClient.retrieveWellknown(issuerHost, oid4vci_common_1.WellKnownEndpoints.OPENID4VCI_ISSUER, {
174
+ return (0, OpenIDUtils_1.retrieveWellknown)(issuerHost, oid4vci_common_1.WellKnownEndpoints.OPENID4VCI_ISSUER, {
176
175
  errorOnNotFound: (opts === null || opts === void 0 ? void 0 : opts.errorOnNotFound) === undefined ? true : opts.errorOnNotFound,
177
176
  });
178
177
  });
179
178
  }
180
- /**
181
- * Allows to retrieve information from a well-known location
182
- *
183
- * @param host The host
184
- * @param endpointType The endpoint type, currently supports OID4VCI, OIDC and OAuth2 endpoint types
185
- * @param opts Options, like for instance whether an error should be thrown in case the endpoint doesn't exist
186
- */
187
- static retrieveWellknown(host, endpointType, opts) {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- const result = yield (0, functions_1.getJson)(`${host.endsWith('/') ? host.slice(0, -1) : host}${endpointType}`, {
190
- exceptionOnHttpErrorStatus: opts === null || opts === void 0 ? void 0 : opts.errorOnNotFound,
191
- });
192
- if (result.origResponse.status >= 400) {
193
- // We only get here when error on not found is false
194
- debug(`host ${host} with endpoint type ${endpointType} status: ${result.origResponse.status}, ${result.origResponse.statusText}`);
195
- }
196
- return result;
197
- });
198
- }
199
179
  }
200
180
  exports.MetadataClient = MetadataClient;
201
181
  //# sourceMappingURL=MetadataClient.js.map
@@ -1 +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,MAAM,MAAM,GAAG,IAAA,oDAAmC,EAAC,OAAO,CAAC,CAAC;YAC5D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,cAAc,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;QACrG,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,mBAAmB,CAAC,MAAc,EAAE,IAAmC;;YACzF,IAAI,cAAkC,CAAC;YACvC,IAAI,mBAAuC,CAAC;YAC5C,IAAI,4BAAgD,CAAC;YACrD,IAAI,sBAA0C,CAAC;YAC/C,IAAI,uBAAuB,GAA4B,SAAS,CAAC;YACjE,IAAI,oBAAoB,GAAW,MAAM,CAAC;YAC1C,MAAM,eAAe,GAAG,MAAM,cAAc,CAAC,gCAAgC,CAAC,MAAM,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,+EAA+E;Y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CAAC;qBAAM,CAAC;oBACN,mBAAmB,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;gBAC1F,CAAC;YACH,CAAC;YAED,IAAI,CAAC,wBAAwB,IAAI,YAAY,EAAE,CAAC;gBAC9C,+JAA+J;gBAC/J,wBAAwB,GAAG,YAA+C,CAAC;YAC7E,CAAC;YACD,KAAK,CAAC,UAAU,MAAM,mBAAmB,cAAc,yBAAyB,mBAAmB,EAAE,CAAC,CAAC;YACvG,OAAO;gBACL,MAAM;gBACN,cAAc;gBACd,mBAAmB;gBACnB,4BAA4B;gBAC5B,oBAAoB,EAAE,qBAAqB,CAAC,CAAC,CAAC;gBAC9C,sBAAsB;gBACtB,uBAAuB;gBACvB,wBAAwB,EAAE,wBAAwB;gBAClD,2BAA2B,EAAE,YAAY;aAC1C,CAAC;QACJ,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,gCAAgC,CAClD,UAAkB,EAClB,IAEC;;YAED,OAAO,IAAA,+BAAiB,EAAC,UAAU,EAAE,mCAAkB,CAAC,iBAAiB,EAAE;gBACzE,eAAe,EAAE,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,eAAe,MAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe;aACnF,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAvKD,wCAuKC"}
@@ -0,0 +1,31 @@
1
+ import { CredentialIssuerMetadataV1_0_11, CredentialOfferPayload, CredentialOfferRequestWithBaseUrl, EndpointMetadataResultV1_0_11, OpenIDResponse } from '@sphereon/oid4vci-common';
2
+ export declare class MetadataClientV1_0_11 {
3
+ /**
4
+ * Retrieve metadata using the Initiation obtained from a previous step
5
+ *
6
+ * @param credentialOffer
7
+ */
8
+ static retrieveAllMetadataFromCredentialOffer(credentialOffer: CredentialOfferRequestWithBaseUrl): Promise<EndpointMetadataResultV1_0_11>;
9
+ /**
10
+ * Retrieve the metada using the initiation request obtained from a previous step
11
+ * @param request
12
+ */
13
+ static retrieveAllMetadataFromCredentialOfferRequest(request: CredentialOfferPayload): Promise<EndpointMetadataResultV1_0_11>;
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<EndpointMetadataResultV1_0_11>;
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, opts?: {
28
+ errorOnNotFound?: boolean;
29
+ }): Promise<OpenIDResponse<CredentialIssuerMetadataV1_0_11> | undefined>;
30
+ }
31
+ //# sourceMappingURL=MetadataClientV1_0_11.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetadataClientV1_0_11.d.ts","sourceRoot":"","sources":["../lib/MetadataClientV1_0_11.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,+BAA+B,EAC/B,sBAAsB,EACtB,iCAAiC,EACjC,6BAA6B,EAE7B,cAAc,EAEf,MAAM,0BAA0B,CAAA;AAOjC,qBAAa,qBAAqB;IAChC;;;;OAIG;WACiB,sCAAsC,CAAC,eAAe,EAAE,iCAAiC,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAItJ;;;OAGG;WACiB,6CAA6C,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,6BAA6B,CAAC;IAQ1I;;;;OAIG;WACiB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,eAAe,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC;IA8HpI;;;;OAIG;WACiB,gCAAgC,CAClD,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE;QACL,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GACA,OAAO,CAAC,cAAc,CAAC,+BAA+B,CAAC,GAAG,SAAS,CAAC;CAKxE"}