@sphereon/oid4vci-client 0.10.4-unstable.98 → 0.12.0
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.
- package/README.md +7 -7
- package/dist/AccessTokenClient.d.ts.map +1 -1
- package/dist/AccessTokenClient.js +5 -6
- package/dist/AccessTokenClient.js.map +1 -1
- package/dist/AccessTokenClientV1_0_11.d.ts.map +1 -1
- package/dist/AccessTokenClientV1_0_11.js +3 -5
- package/dist/AccessTokenClientV1_0_11.js.map +1 -1
- package/dist/AuthorizationCodeClient.d.ts +4 -1
- package/dist/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/AuthorizationCodeClient.js +47 -8
- package/dist/AuthorizationCodeClient.js.map +1 -1
- package/dist/AuthorizationCodeClientV1_0_11.d.ts.map +1 -1
- package/dist/AuthorizationCodeClientV1_0_11.js +5 -3
- package/dist/AuthorizationCodeClientV1_0_11.js.map +1 -1
- package/dist/CredentialOfferClient.d.ts.map +1 -1
- package/dist/CredentialOfferClient.js +26 -12
- package/dist/CredentialOfferClient.js.map +1 -1
- package/dist/CredentialOfferClientV1_0_11.js +6 -7
- package/dist/CredentialOfferClientV1_0_11.js.map +1 -1
- package/dist/CredentialOfferClientV1_0_13.d.ts +10 -0
- package/dist/CredentialOfferClientV1_0_13.d.ts.map +1 -0
- package/dist/CredentialOfferClientV1_0_13.js +94 -0
- package/dist/CredentialOfferClientV1_0_13.js.map +1 -0
- package/dist/CredentialRequestClient.js +1 -1
- package/dist/CredentialRequestClient.js.map +1 -1
- package/dist/CredentialRequestClientBuilderV1_0_11.d.ts +3 -1
- package/dist/CredentialRequestClientBuilderV1_0_11.d.ts.map +1 -1
- package/dist/CredentialRequestClientBuilderV1_0_11.js +4 -0
- package/dist/CredentialRequestClientBuilderV1_0_11.js.map +1 -1
- package/dist/CredentialRequestClientV1_0_11.d.ts +9 -3
- package/dist/CredentialRequestClientV1_0_11.d.ts.map +1 -1
- package/dist/CredentialRequestClientV1_0_11.js +2 -1
- package/dist/CredentialRequestClientV1_0_11.js.map +1 -1
- package/dist/MetadataClient.d.ts +5 -5
- package/dist/MetadataClient.d.ts.map +1 -1
- package/dist/MetadataClient.js +30 -13
- package/dist/MetadataClient.js.map +1 -1
- package/dist/MetadataClientV1_0_13.d.ts +31 -0
- package/dist/MetadataClientV1_0_13.d.ts.map +1 -0
- package/dist/MetadataClientV1_0_13.js +181 -0
- package/dist/MetadataClientV1_0_13.js.map +1 -0
- package/dist/OpenID4VCIClient.d.ts +13 -24
- package/dist/OpenID4VCIClient.d.ts.map +1 -1
- package/dist/OpenID4VCIClient.js +126 -103
- package/dist/OpenID4VCIClient.js.map +1 -1
- package/dist/OpenID4VCIClientV1_0_11.d.ts +3 -2
- package/dist/OpenID4VCIClientV1_0_11.d.ts.map +1 -1
- package/dist/OpenID4VCIClientV1_0_11.js +5 -18
- package/dist/OpenID4VCIClientV1_0_11.js.map +1 -1
- package/dist/OpenID4VCIClientV1_0_13.d.ts +112 -0
- package/dist/OpenID4VCIClientV1_0_13.d.ts.map +1 -0
- package/dist/OpenID4VCIClientV1_0_13.js +478 -0
- package/dist/OpenID4VCIClientV1_0_13.js.map +1 -0
- package/dist/ProofOfPossessionBuilder.d.ts +14 -3
- package/dist/ProofOfPossessionBuilder.d.ts.map +1 -1
- package/dist/ProofOfPossessionBuilder.js +20 -20
- package/dist/ProofOfPossessionBuilder.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/lib/AccessTokenClient.ts +5 -11
- package/lib/AccessTokenClientV1_0_11.ts +3 -9
- package/lib/AuthorizationCodeClient.ts +47 -8
- package/lib/AuthorizationCodeClientV1_0_11.ts +8 -6
- package/lib/CredentialOfferClient.ts +31 -9
- package/lib/CredentialOfferClientV1_0_11.ts +6 -6
- package/lib/CredentialOfferClientV1_0_13.ts +103 -0
- package/lib/CredentialRequestClient.ts +1 -1
- package/lib/CredentialRequestClientBuilderV1_0_11.ts +7 -0
- package/lib/CredentialRequestClientV1_0_11.ts +9 -4
- package/lib/MetadataClient.ts +49 -14
- package/lib/MetadataClientV1_0_13.ts +188 -0
- package/lib/OpenID4VCIClient.ts +131 -115
- package/lib/OpenID4VCIClientV1_0_11.ts +9 -19
- package/lib/OpenID4VCIClientV1_0_13.ts +677 -0
- package/lib/ProofOfPossessionBuilder.ts +40 -9
- package/lib/__tests__/CredentialRequestClientV1_0_11.spec.ts +2 -2
- package/lib/__tests__/MetadataClient.spec.ts +3 -4
- package/lib/__tests__/MetadataMocks.ts +1 -0
- package/lib/__tests__/OpenID4VCIClient.spec.ts +42 -9
- package/lib/__tests__/OpenID4VCIClientV1_0_11.spec.ts +24 -0
- package/lib/__tests__/OpenID4VCIClientV1_0_13.spec.ts +204 -0
- package/lib/__tests__/SdJwt.spec.ts +2 -2
- package/lib/__tests__/SphereonE2E.spec.test.ts +4 -3
- package/lib/index.ts +8 -0
- package/package.json +4 -4
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { AccessTokenResponse, Alg, AuthorizationRequestOpts, AuthorizationResponse, AuthzFlowType, CredentialConfigurationSupportedV1_0_13, CredentialOfferRequestWithBaseUrl, CredentialResponse, EndpointMetadataResultV1_0_13, JWK, NotificationRequest, NotificationResult, OID4VCICredentialFormat, OpenId4VCIVersion, PKCEOpts, ProofOfPossessionCallbacks } from '@sphereon/oid4vci-common';
|
|
2
|
+
import { CredentialFormat } from '@sphereon/ssi-types';
|
|
3
|
+
import { CredentialRequestOpts } from './CredentialRequestClient';
|
|
4
|
+
export interface OpenID4VCIClientStateV1_0_13 {
|
|
5
|
+
credentialIssuer: string;
|
|
6
|
+
credentialOffer?: CredentialOfferRequestWithBaseUrl;
|
|
7
|
+
clientId?: string;
|
|
8
|
+
kid?: string;
|
|
9
|
+
jwk?: JWK;
|
|
10
|
+
alg?: Alg | string;
|
|
11
|
+
endpointMetadata?: EndpointMetadataResultV1_0_13;
|
|
12
|
+
accessTokenResponse?: AccessTokenResponse;
|
|
13
|
+
authorizationRequestOpts?: AuthorizationRequestOpts;
|
|
14
|
+
authorizationCodeResponse?: AuthorizationResponse;
|
|
15
|
+
pkce: PKCEOpts;
|
|
16
|
+
accessToken?: string;
|
|
17
|
+
authorizationURL?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class OpenID4VCIClientV1_0_13 {
|
|
20
|
+
private readonly _state;
|
|
21
|
+
private constructor();
|
|
22
|
+
static fromCredentialIssuer({ kid, alg, retrieveServerMetadata, clientId, credentialIssuer, pkce, authorizationRequest, createAuthorizationRequestURL, }: {
|
|
23
|
+
credentialIssuer: string;
|
|
24
|
+
kid?: string;
|
|
25
|
+
alg?: Alg | string;
|
|
26
|
+
retrieveServerMetadata?: boolean;
|
|
27
|
+
clientId?: string;
|
|
28
|
+
createAuthorizationRequestURL?: boolean;
|
|
29
|
+
authorizationRequest?: AuthorizationRequestOpts;
|
|
30
|
+
pkce?: PKCEOpts;
|
|
31
|
+
}): Promise<OpenID4VCIClientV1_0_13>;
|
|
32
|
+
static fromState({ state }: {
|
|
33
|
+
state: OpenID4VCIClientStateV1_0_13 | string;
|
|
34
|
+
}): Promise<OpenID4VCIClientV1_0_13>;
|
|
35
|
+
static fromURI({ uri, kid, alg, retrieveServerMetadata, clientId, pkce, createAuthorizationRequestURL, authorizationRequest, resolveOfferUri, }: {
|
|
36
|
+
uri: string;
|
|
37
|
+
kid?: string;
|
|
38
|
+
alg?: Alg | string;
|
|
39
|
+
retrieveServerMetadata?: boolean;
|
|
40
|
+
createAuthorizationRequestURL?: boolean;
|
|
41
|
+
resolveOfferUri?: boolean;
|
|
42
|
+
pkce?: PKCEOpts;
|
|
43
|
+
clientId?: string;
|
|
44
|
+
authorizationRequest?: AuthorizationRequestOpts;
|
|
45
|
+
}): Promise<OpenID4VCIClientV1_0_13>;
|
|
46
|
+
/**
|
|
47
|
+
* Allows you to create an Authorization Request URL when using an Authorization Code flow. This URL needs to be accessed using the front channel (browser)
|
|
48
|
+
*
|
|
49
|
+
* The Identity provider would present a login screen typically; after you authenticated, it would redirect to the provided redirectUri; which can be same device or cross-device
|
|
50
|
+
* @param opts
|
|
51
|
+
*/
|
|
52
|
+
createAuthorizationRequestUrl(opts?: {
|
|
53
|
+
authorizationRequest?: AuthorizationRequestOpts;
|
|
54
|
+
pkce?: PKCEOpts;
|
|
55
|
+
}): Promise<string>;
|
|
56
|
+
retrieveServerMetadata(): Promise<EndpointMetadataResultV1_0_13>;
|
|
57
|
+
private calculatePKCEOpts;
|
|
58
|
+
acquireAccessToken(opts?: {
|
|
59
|
+
pin?: string;
|
|
60
|
+
clientId?: string;
|
|
61
|
+
codeVerifier?: string;
|
|
62
|
+
authorizationResponse?: string | AuthorizationResponse;
|
|
63
|
+
code?: string;
|
|
64
|
+
redirectUri?: string;
|
|
65
|
+
}): Promise<AccessTokenResponse>;
|
|
66
|
+
acquireCredentials({ credentialIdentifier, credentialTypes, context, proofCallbacks, format, kid, jwk, alg, jti, deferredCredentialAwait, deferredCredentialIntervalInMS, }: {
|
|
67
|
+
credentialIdentifier?: string;
|
|
68
|
+
credentialTypes?: string | string[];
|
|
69
|
+
context?: string[];
|
|
70
|
+
proofCallbacks: ProofOfPossessionCallbacks<any>;
|
|
71
|
+
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
72
|
+
kid?: string;
|
|
73
|
+
jwk?: JWK;
|
|
74
|
+
alg?: Alg | string;
|
|
75
|
+
jti?: string;
|
|
76
|
+
deferredCredentialAwait?: boolean;
|
|
77
|
+
deferredCredentialIntervalInMS?: number;
|
|
78
|
+
experimentalHolderIssuanceSupported?: boolean;
|
|
79
|
+
}): Promise<CredentialResponse & {
|
|
80
|
+
access_token: string;
|
|
81
|
+
}>;
|
|
82
|
+
exportState(): Promise<string>;
|
|
83
|
+
getCredentialsSupported(format?: (OID4VCICredentialFormat | string) | (OID4VCICredentialFormat | string)[]): Record<string, CredentialConfigurationSupportedV1_0_13>;
|
|
84
|
+
sendNotification(credentialRequestOpts: Partial<CredentialRequestOpts>, request: NotificationRequest, accessToken?: string): Promise<NotificationResult>;
|
|
85
|
+
issuerSupportedFlowTypes(): AuthzFlowType[];
|
|
86
|
+
isFlowTypeSupported(flowType: AuthzFlowType): boolean;
|
|
87
|
+
hasAuthorizationURL(): boolean;
|
|
88
|
+
get authorizationURL(): string | undefined;
|
|
89
|
+
get credentialOffer(): CredentialOfferRequestWithBaseUrl | undefined;
|
|
90
|
+
version(): OpenId4VCIVersion;
|
|
91
|
+
get endpointMetadata(): EndpointMetadataResultV1_0_13;
|
|
92
|
+
get kid(): string;
|
|
93
|
+
get alg(): string;
|
|
94
|
+
set clientId(value: string | undefined);
|
|
95
|
+
get clientId(): string | undefined;
|
|
96
|
+
hasAccessTokenResponse(): boolean;
|
|
97
|
+
get accessTokenResponse(): AccessTokenResponse;
|
|
98
|
+
getIssuer(): string;
|
|
99
|
+
getAccessTokenEndpoint(): string;
|
|
100
|
+
getCredentialEndpoint(): string;
|
|
101
|
+
hasDeferredCredentialEndpoint(): boolean;
|
|
102
|
+
getDeferredCredentialEndpoint(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Too bad we need a method like this, but EBSI is not exposing metadata
|
|
105
|
+
*/
|
|
106
|
+
isEBSI(): boolean;
|
|
107
|
+
private assertIssuerData;
|
|
108
|
+
private assertServerMetadata;
|
|
109
|
+
private assertAccessToken;
|
|
110
|
+
private syncAuthorizationRequestOpts;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=OpenID4VCIClientV1_0_13.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenID4VCIClientV1_0_13.d.ts","sourceRoot":"","sources":["../lib/OpenID4VCIClientV1_0_13.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,GAAG,EACH,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EAEb,uCAAuC,EAEvC,iCAAiC,EACjC,kBAAkB,EAElB,6BAA6B,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AAG,OAAO;IAI9C,mBAAmB,IAAI,OAAO;IAIrC,IAAI,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEzC;IAED,IAAI,eAAe,IAAI,iCAAiC,GAAG,SAAS,CAEnE;IAEM,OAAO,IAAI,iBAAiB;IAInC,IAAW,gBAAgB,IAAI,6BAA6B,CAI3D;IAED,IAAI,GAAG,IAAI,MAAM,CAMhB;IAED,IAAI,GAAG,IAAI,MAAM,CAMhB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAErC;IAED,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAEM,sBAAsB,IAAI,OAAO;IAIxC,IAAI,mBAAmB,IAAI,mBAAmB,CAI7C;IAEM,SAAS,IAAI,MAAM;IAKnB,sBAAsB,IAAI,MAAM;IAOhC,qBAAqB,IAAI,MAAM;IAK/B,6BAA6B,IAAI,OAAO;IAIxC,6BAA6B,IAAI,MAAM;IAK9C;;OAEG;IACI,MAAM,IAAI,OAAO;IA6BxB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,4BAA4B;CAcrC"}
|
|
@@ -0,0 +1,478 @@
|
|
|
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.OpenID4VCIClientV1_0_13 = void 0;
|
|
16
|
+
const oid4vci_common_1 = require("@sphereon/oid4vci-common");
|
|
17
|
+
const debug_1 = __importDefault(require("debug"));
|
|
18
|
+
const AccessTokenClient_1 = require("./AccessTokenClient");
|
|
19
|
+
const AuthorizationCodeClient_1 = require("./AuthorizationCodeClient");
|
|
20
|
+
const CredentialOfferClient_1 = require("./CredentialOfferClient");
|
|
21
|
+
const CredentialRequestClientBuilder_1 = require("./CredentialRequestClientBuilder");
|
|
22
|
+
const MetadataClientV1_0_13_1 = require("./MetadataClientV1_0_13");
|
|
23
|
+
const ProofOfPossessionBuilder_1 = require("./ProofOfPossessionBuilder");
|
|
24
|
+
const functions_1 = require("./functions");
|
|
25
|
+
const functions_2 = require("./functions");
|
|
26
|
+
const debug = (0, debug_1.default)('sphereon:oid4vci');
|
|
27
|
+
class OpenID4VCIClientV1_0_13 {
|
|
28
|
+
constructor({ credentialOffer, clientId, kid, alg, credentialIssuer, pkce, authorizationRequest, accessToken, jwk, endpointMetadata, accessTokenResponse, authorizationRequestOpts, authorizationCodeResponse, authorizationURL, }) {
|
|
29
|
+
var _a;
|
|
30
|
+
const issuer = credentialIssuer !== null && credentialIssuer !== void 0 ? credentialIssuer : (credentialOffer ? (0, oid4vci_common_1.getIssuerFromCredentialOfferPayload)(credentialOffer.credential_offer) : undefined);
|
|
31
|
+
if (!issuer) {
|
|
32
|
+
throw Error('No credential issuer supplied or deduced from offer');
|
|
33
|
+
}
|
|
34
|
+
this._state = {
|
|
35
|
+
credentialOffer,
|
|
36
|
+
credentialIssuer: issuer,
|
|
37
|
+
kid,
|
|
38
|
+
alg,
|
|
39
|
+
// TODO: We need to refactor this and always explicitly call createAuthorizationRequestUrl, so we can have a credential selection first and use the kid as a default for the client id
|
|
40
|
+
clientId: (_a = clientId !== null && clientId !== void 0 ? clientId : (credentialOffer && (0, oid4vci_common_1.getClientIdFromCredentialOfferPayload)(credentialOffer.credential_offer))) !== null && _a !== void 0 ? _a : kid === null || kid === void 0 ? void 0 : kid.split('#')[0],
|
|
41
|
+
pkce: Object.assign({ disabled: false, codeChallengeMethod: oid4vci_common_1.CodeChallengeMethod.S256 }, pkce),
|
|
42
|
+
authorizationRequestOpts,
|
|
43
|
+
authorizationCodeResponse,
|
|
44
|
+
accessToken,
|
|
45
|
+
jwk,
|
|
46
|
+
endpointMetadata,
|
|
47
|
+
accessTokenResponse,
|
|
48
|
+
authorizationURL,
|
|
49
|
+
};
|
|
50
|
+
// Running syncAuthorizationRequestOpts later as it is using the state
|
|
51
|
+
if (!this._state.authorizationRequestOpts) {
|
|
52
|
+
this._state.authorizationRequestOpts = this.syncAuthorizationRequestOpts(authorizationRequest);
|
|
53
|
+
}
|
|
54
|
+
debug(`Authorization req options: ${JSON.stringify(this._state.authorizationRequestOpts, null, 2)}`);
|
|
55
|
+
}
|
|
56
|
+
static fromCredentialIssuer({ kid, alg, retrieveServerMetadata, clientId, credentialIssuer, pkce, authorizationRequest, createAuthorizationRequestURL, }) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const client = new OpenID4VCIClientV1_0_13({
|
|
59
|
+
kid,
|
|
60
|
+
alg,
|
|
61
|
+
clientId: clientId !== null && clientId !== void 0 ? clientId : authorizationRequest === null || authorizationRequest === void 0 ? void 0 : authorizationRequest.clientId,
|
|
62
|
+
credentialIssuer,
|
|
63
|
+
pkce,
|
|
64
|
+
authorizationRequest,
|
|
65
|
+
});
|
|
66
|
+
if (retrieveServerMetadata === undefined || retrieveServerMetadata) {
|
|
67
|
+
yield client.retrieveServerMetadata();
|
|
68
|
+
}
|
|
69
|
+
if (createAuthorizationRequestURL === undefined || createAuthorizationRequestURL) {
|
|
70
|
+
yield client.createAuthorizationRequestUrl({ authorizationRequest, pkce });
|
|
71
|
+
}
|
|
72
|
+
return client;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
static fromState({ state }) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const clientState = typeof state === 'string' ? JSON.parse(state) : state;
|
|
78
|
+
return new OpenID4VCIClientV1_0_13(clientState);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
static fromURI({ uri, kid, alg, retrieveServerMetadata, clientId, pkce, createAuthorizationRequestURL, authorizationRequest, resolveOfferUri, }) {
|
|
82
|
+
var _a;
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const credentialOfferClient = yield CredentialOfferClient_1.CredentialOfferClient.fromURI(uri, { resolve: resolveOfferUri });
|
|
85
|
+
const client = new OpenID4VCIClientV1_0_13({
|
|
86
|
+
credentialOffer: credentialOfferClient,
|
|
87
|
+
kid,
|
|
88
|
+
alg,
|
|
89
|
+
clientId: (_a = clientId !== null && clientId !== void 0 ? clientId : authorizationRequest === null || authorizationRequest === void 0 ? void 0 : authorizationRequest.clientId) !== null && _a !== void 0 ? _a : credentialOfferClient.clientId,
|
|
90
|
+
pkce,
|
|
91
|
+
authorizationRequest,
|
|
92
|
+
});
|
|
93
|
+
if (retrieveServerMetadata === undefined || retrieveServerMetadata) {
|
|
94
|
+
yield client.retrieveServerMetadata();
|
|
95
|
+
}
|
|
96
|
+
if (credentialOfferClient.supportedFlows.includes(oid4vci_common_1.AuthzFlowType.AUTHORIZATION_CODE_FLOW) &&
|
|
97
|
+
(createAuthorizationRequestURL === undefined || createAuthorizationRequestURL)) {
|
|
98
|
+
yield client.createAuthorizationRequestUrl({ authorizationRequest, pkce });
|
|
99
|
+
debug(`Authorization Request URL: ${client._state.authorizationURL}`);
|
|
100
|
+
}
|
|
101
|
+
return client;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Allows you to create an Authorization Request URL when using an Authorization Code flow. This URL needs to be accessed using the front channel (browser)
|
|
106
|
+
*
|
|
107
|
+
* The Identity provider would present a login screen typically; after you authenticated, it would redirect to the provided redirectUri; which can be same device or cross-device
|
|
108
|
+
* @param opts
|
|
109
|
+
*/
|
|
110
|
+
createAuthorizationRequestUrl(opts) {
|
|
111
|
+
var _a;
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
if (!this._state.authorizationURL) {
|
|
114
|
+
this.calculatePKCEOpts(opts === null || opts === void 0 ? void 0 : opts.pkce);
|
|
115
|
+
this._state.authorizationRequestOpts = this.syncAuthorizationRequestOpts(opts === null || opts === void 0 ? void 0 : opts.authorizationRequest);
|
|
116
|
+
if (!this._state.authorizationRequestOpts) {
|
|
117
|
+
throw Error(`No Authorization Request options present or provided in this call`);
|
|
118
|
+
}
|
|
119
|
+
// todo: Probably can go with current logic in MetadataClientV1_0_13 who will always set the authorization_endpoint when found
|
|
120
|
+
// handling this because of the support for v1_0-08
|
|
121
|
+
if (((_a = this._state.endpointMetadata) === null || _a === void 0 ? void 0 : _a.credentialIssuerMetadata) &&
|
|
122
|
+
'authorization_endpoint' in this._state.endpointMetadata.credentialIssuerMetadata) {
|
|
123
|
+
this._state.endpointMetadata.authorization_endpoint = this._state.endpointMetadata.credentialIssuerMetadata.authorization_endpoint;
|
|
124
|
+
}
|
|
125
|
+
this._state.authorizationURL = yield (0, AuthorizationCodeClient_1.createAuthorizationRequestUrl)({
|
|
126
|
+
pkce: this._state.pkce,
|
|
127
|
+
endpointMetadata: this.endpointMetadata,
|
|
128
|
+
authorizationRequest: this._state.authorizationRequestOpts,
|
|
129
|
+
credentialOffer: this.credentialOffer,
|
|
130
|
+
credentialConfigurationSupported: this.getCredentialsSupported(),
|
|
131
|
+
version: this.version(),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return this._state.authorizationURL;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
retrieveServerMetadata() {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
this.assertIssuerData();
|
|
140
|
+
if (!this._state.endpointMetadata) {
|
|
141
|
+
if (this.credentialOffer) {
|
|
142
|
+
this._state.endpointMetadata = yield MetadataClientV1_0_13_1.MetadataClientV1_0_13.retrieveAllMetadataFromCredentialOffer(this.credentialOffer);
|
|
143
|
+
}
|
|
144
|
+
else if (this._state.credentialIssuer) {
|
|
145
|
+
this._state.endpointMetadata = yield MetadataClientV1_0_13_1.MetadataClientV1_0_13.retrieveAllMetadata(this._state.credentialIssuer);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw Error(`Cannot retrieve issuer metadata without either a credential offer, or issuer value`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return this.endpointMetadata;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
calculatePKCEOpts(pkce) {
|
|
155
|
+
this._state.pkce = (0, functions_1.generateMissingPKCEOpts)(Object.assign(Object.assign({}, this._state.pkce), pkce));
|
|
156
|
+
}
|
|
157
|
+
acquireAccessToken(opts) {
|
|
158
|
+
var _a, _b, _c, _d, _e, _f;
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const { pin, clientId } = opts !== null && opts !== void 0 ? opts : {};
|
|
161
|
+
let { redirectUri } = opts !== null && opts !== void 0 ? opts : {};
|
|
162
|
+
if (opts === null || opts === void 0 ? void 0 : opts.authorizationResponse) {
|
|
163
|
+
this._state.authorizationCodeResponse = Object.assign({}, (0, oid4vci_common_1.toAuthorizationResponsePayload)(opts.authorizationResponse));
|
|
164
|
+
}
|
|
165
|
+
else if (opts === null || opts === void 0 ? void 0 : opts.code) {
|
|
166
|
+
this._state.authorizationCodeResponse = { code: opts.code };
|
|
167
|
+
}
|
|
168
|
+
const code = (_a = this._state.authorizationCodeResponse) === null || _a === void 0 ? void 0 : _a.code;
|
|
169
|
+
if (opts === null || opts === void 0 ? void 0 : opts.codeVerifier) {
|
|
170
|
+
this._state.pkce.codeVerifier = opts.codeVerifier;
|
|
171
|
+
}
|
|
172
|
+
this.assertIssuerData();
|
|
173
|
+
if (clientId) {
|
|
174
|
+
this._state.clientId = clientId;
|
|
175
|
+
}
|
|
176
|
+
if (!this._state.accessTokenResponse) {
|
|
177
|
+
const accessTokenClient = new AccessTokenClient_1.AccessTokenClient();
|
|
178
|
+
if (redirectUri && redirectUri !== ((_b = this._state.authorizationRequestOpts) === null || _b === void 0 ? void 0 : _b.redirectUri)) {
|
|
179
|
+
console.log(`Redirect URI mismatch between access-token (${redirectUri}) and authorization request (${(_c = this._state.authorizationRequestOpts) === null || _c === void 0 ? void 0 : _c.redirectUri}). According to the specification that is not allowed.`);
|
|
180
|
+
}
|
|
181
|
+
if (((_d = this._state.authorizationRequestOpts) === null || _d === void 0 ? void 0 : _d.redirectUri) && !redirectUri) {
|
|
182
|
+
redirectUri = this._state.authorizationRequestOpts.redirectUri;
|
|
183
|
+
}
|
|
184
|
+
const response = yield accessTokenClient.acquireAccessToken(Object.assign(Object.assign({ credentialOffer: this.credentialOffer, metadata: this.endpointMetadata, credentialIssuer: this.getIssuer(), pin }, (!this._state.pkce.disabled && { codeVerifier: this._state.pkce.codeVerifier })), { code,
|
|
185
|
+
redirectUri, asOpts: { clientId: this.clientId } }));
|
|
186
|
+
if (response.errorBody) {
|
|
187
|
+
debug(`Access token error:\r\n${JSON.stringify(response.errorBody)}`);
|
|
188
|
+
throw Error(`Retrieving an access token from ${(_e = this._state.endpointMetadata) === null || _e === void 0 ? void 0 : _e.token_endpoint} for issuer ${this.getIssuer()} failed with status: ${response.origResponse.status}`);
|
|
189
|
+
}
|
|
190
|
+
else if (!response.successBody) {
|
|
191
|
+
debug(`Access token error. No success body`);
|
|
192
|
+
throw Error(`Retrieving an access token from ${(_f = this._state.endpointMetadata) === null || _f === void 0 ? void 0 : _f.token_endpoint} for issuer ${this.getIssuer()} failed as there was no success response body`);
|
|
193
|
+
}
|
|
194
|
+
this._state.accessTokenResponse = response.successBody;
|
|
195
|
+
this._state.accessToken = response.successBody.access_token;
|
|
196
|
+
}
|
|
197
|
+
return this.accessTokenResponse;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
acquireCredentials({ credentialIdentifier, credentialTypes, context, proofCallbacks, format, kid, jwk, alg, jti, deferredCredentialAwait, deferredCredentialIntervalInMS, }) {
|
|
201
|
+
var _a, _b, _c;
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
if ([jwk, kid].filter((v) => v !== undefined).length > 1) {
|
|
204
|
+
throw new Error(oid4vci_common_1.KID_JWK_X5C_ERROR + `. jwk: ${jwk !== undefined}, kid: ${kid !== undefined}`);
|
|
205
|
+
}
|
|
206
|
+
if (alg)
|
|
207
|
+
this._state.alg = alg;
|
|
208
|
+
if (jwk)
|
|
209
|
+
this._state.jwk = jwk;
|
|
210
|
+
if (kid)
|
|
211
|
+
this._state.kid = kid;
|
|
212
|
+
const requestBuilder = this.credentialOffer
|
|
213
|
+
? CredentialRequestClientBuilder_1.CredentialRequestClientBuilder.fromCredentialOffer({
|
|
214
|
+
credentialOffer: this.credentialOffer,
|
|
215
|
+
metadata: this.endpointMetadata,
|
|
216
|
+
})
|
|
217
|
+
: CredentialRequestClientBuilder_1.CredentialRequestClientBuilder.fromCredentialIssuer({
|
|
218
|
+
credentialIssuer: this.getIssuer(),
|
|
219
|
+
credentialIdentifier: credentialIdentifier,
|
|
220
|
+
metadata: this.endpointMetadata,
|
|
221
|
+
version: this.version(),
|
|
222
|
+
});
|
|
223
|
+
requestBuilder.withTokenFromResponse(this.accessTokenResponse);
|
|
224
|
+
requestBuilder.withDeferredCredentialAwait(deferredCredentialAwait !== null && deferredCredentialAwait !== void 0 ? deferredCredentialAwait : false, deferredCredentialIntervalInMS);
|
|
225
|
+
let subjectIssuance;
|
|
226
|
+
if ((_a = this.endpointMetadata) === null || _a === void 0 ? void 0 : _a.credentialIssuerMetadata) {
|
|
227
|
+
const metadata = this.endpointMetadata.credentialIssuerMetadata;
|
|
228
|
+
const types = credentialTypes ? (Array.isArray(credentialTypes) ? credentialTypes : [credentialTypes]) : undefined;
|
|
229
|
+
if (credentialIdentifier) {
|
|
230
|
+
if (typeof metadata.credential_configurations_supported !== 'object') {
|
|
231
|
+
throw Error(`Credentials_supported should be an object, current ${typeof metadata.credential_configurations_supported} when credential_identifier is used`);
|
|
232
|
+
}
|
|
233
|
+
const credentialsSupported = metadata.credential_configurations_supported;
|
|
234
|
+
if (!metadata.credential_configurations_supported || !credentialsSupported[credentialIdentifier]) {
|
|
235
|
+
throw new Error(`Credential type ${credentialIdentifier} is not supported by issuer ${this.getIssuer()}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else if (!types) {
|
|
239
|
+
throw Error(`If no credential_identifier is used, we expect types`);
|
|
240
|
+
}
|
|
241
|
+
else if (metadata.credentials_supported && Array.isArray(metadata.credentials_supported)) {
|
|
242
|
+
let typeSupported = false;
|
|
243
|
+
metadata.credentials_supported.forEach((supportedCredential) => {
|
|
244
|
+
const subTypes = (0, oid4vci_common_1.getTypesFromCredentialSupported)(supportedCredential);
|
|
245
|
+
if (subTypes.every((t, i) => types[i] === t) ||
|
|
246
|
+
(types.length === 1 && (types[0] === supportedCredential.id || subTypes.includes(types[0])))) {
|
|
247
|
+
typeSupported = true;
|
|
248
|
+
if (supportedCredential.credential_subject_issuance) {
|
|
249
|
+
subjectIssuance = { credential_subject_issuance: supportedCredential.credential_subject_issuance };
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
if (!typeSupported) {
|
|
254
|
+
console.log(`Not all credential types ${JSON.stringify(credentialTypes)} are present in metadata for ${this.getIssuer()}`);
|
|
255
|
+
// throw Error(`Not all credential types ${JSON.stringify(credentialTypes)} are supported by issuer ${this.getIssuer()}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if (metadata.credential_configurations_supported && !Array.isArray(metadata.credential_configurations_supported)) {
|
|
259
|
+
const credentialsSupported = metadata.credential_configurations_supported;
|
|
260
|
+
if (types.some((type) => !metadata.credential_configurations_supported || !credentialsSupported[type])) {
|
|
261
|
+
throw Error(`Not all credential types ${JSON.stringify(credentialTypes)} are supported by issuer ${this.getIssuer()}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// todo: Format check? We might end up with some disjoint type / format combinations supported by the server
|
|
265
|
+
}
|
|
266
|
+
if (subjectIssuance) {
|
|
267
|
+
requestBuilder.withSubjectIssuance(subjectIssuance);
|
|
268
|
+
}
|
|
269
|
+
const credentialRequestClient = requestBuilder.build();
|
|
270
|
+
const proofBuilder = ProofOfPossessionBuilder_1.ProofOfPossessionBuilder.fromAccessTokenResponse({
|
|
271
|
+
accessTokenResponse: this.accessTokenResponse,
|
|
272
|
+
callbacks: proofCallbacks,
|
|
273
|
+
version: this.version(),
|
|
274
|
+
})
|
|
275
|
+
.withIssuer(this.getIssuer())
|
|
276
|
+
.withAlg(this.alg);
|
|
277
|
+
if (this._state.jwk) {
|
|
278
|
+
proofBuilder.withJWK(this._state.jwk);
|
|
279
|
+
}
|
|
280
|
+
if (this._state.kid) {
|
|
281
|
+
proofBuilder.withKid(this._state.kid);
|
|
282
|
+
}
|
|
283
|
+
if (this.clientId) {
|
|
284
|
+
proofBuilder.withClientId(this.clientId);
|
|
285
|
+
}
|
|
286
|
+
if (jti) {
|
|
287
|
+
proofBuilder.withJti(jti);
|
|
288
|
+
}
|
|
289
|
+
const response = yield credentialRequestClient.acquireCredentialsUsingProof(Object.assign({ proofInput: proofBuilder }, (credentialIdentifier ? { credentialIdentifier, subjectIssuance } : { format, context, credentialTypes, subjectIssuance })));
|
|
290
|
+
if (response.errorBody) {
|
|
291
|
+
debug(`Credential request error:\r\n${JSON.stringify(response.errorBody)}`);
|
|
292
|
+
throw Error(`Retrieving a credential from ${(_b = this._state.endpointMetadata) === null || _b === void 0 ? void 0 : _b.credential_endpoint} for issuer ${this.getIssuer()} failed with status: ${response.origResponse.status}`);
|
|
293
|
+
}
|
|
294
|
+
else if (!response.successBody) {
|
|
295
|
+
debug(`Credential request error. No success body`);
|
|
296
|
+
throw Error(`Retrieving a credential from ${(_c = this._state.endpointMetadata) === null || _c === void 0 ? void 0 : _c.credential_endpoint} for issuer ${this.getIssuer()} failed as there was no success response body`);
|
|
297
|
+
}
|
|
298
|
+
return Object.assign(Object.assign({}, response.successBody), { access_token: response.access_token });
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
exportState() {
|
|
302
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
return JSON.stringify(this._state);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
getCredentialsSupported(format) {
|
|
307
|
+
return (0, oid4vci_common_1.getSupportedCredentials)({
|
|
308
|
+
issuerMetadata: this.endpointMetadata.credentialIssuerMetadata,
|
|
309
|
+
version: this.version(),
|
|
310
|
+
format: format,
|
|
311
|
+
types: undefined,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
sendNotification(credentialRequestOpts, request, accessToken) {
|
|
315
|
+
var _a, _b;
|
|
316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
+
return (0, functions_2.sendNotification)(credentialRequestOpts, request, (_a = accessToken !== null && accessToken !== void 0 ? accessToken : this._state.accessToken) !== null && _a !== void 0 ? _a : (_b = this._state.accessTokenResponse) === null || _b === void 0 ? void 0 : _b.access_token);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
/* getCredentialOfferTypes(): string[][] {
|
|
321
|
+
if (!this.credentialOffer) {
|
|
322
|
+
return [];
|
|
323
|
+
} else if (this.credentialOffer.version < OpenId4VCIVersion.VER_1_0_11) {
|
|
324
|
+
const orig = this.credentialOffer.original_credential_offer as CredentialOfferPayloadV1_0_08;
|
|
325
|
+
const types: string[] = typeof orig.credential_type === 'string' ? [orig.credential_type] : orig.credential_type;
|
|
326
|
+
const result: string[][] = [];
|
|
327
|
+
result[0] = types;
|
|
328
|
+
return result;
|
|
329
|
+
} else {
|
|
330
|
+
return this.credentialOffer.credential_offer.credentials.map((c) => {
|
|
331
|
+
if (typeof c === 'string') {
|
|
332
|
+
return [c];
|
|
333
|
+
} else if ('types' in c) {
|
|
334
|
+
return c.types;
|
|
335
|
+
} else if ('vct' in c) {
|
|
336
|
+
return [c.vct];
|
|
337
|
+
} else {
|
|
338
|
+
return c.credential_definition.types;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}*/
|
|
343
|
+
issuerSupportedFlowTypes() {
|
|
344
|
+
var _a, _b, _c, _d;
|
|
345
|
+
return ((_b = (_a = this.credentialOffer) === null || _a === void 0 ? void 0 : _a.supportedFlows) !== null && _b !== void 0 ? _b : (((_d = (_c = this._state.endpointMetadata) === null || _c === void 0 ? void 0 : _c.credentialIssuerMetadata) === null || _d === void 0 ? void 0 : _d.authorization_endpoint) ? [oid4vci_common_1.AuthzFlowType.AUTHORIZATION_CODE_FLOW] : []));
|
|
346
|
+
}
|
|
347
|
+
isFlowTypeSupported(flowType) {
|
|
348
|
+
return this.issuerSupportedFlowTypes().includes(flowType);
|
|
349
|
+
}
|
|
350
|
+
hasAuthorizationURL() {
|
|
351
|
+
return !!this.authorizationURL;
|
|
352
|
+
}
|
|
353
|
+
get authorizationURL() {
|
|
354
|
+
return this._state.authorizationURL;
|
|
355
|
+
}
|
|
356
|
+
get credentialOffer() {
|
|
357
|
+
return this._state.credentialOffer;
|
|
358
|
+
}
|
|
359
|
+
version() {
|
|
360
|
+
var _a, _b;
|
|
361
|
+
return (_b = (_a = this.credentialOffer) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : oid4vci_common_1.OpenId4VCIVersion.VER_1_0_13;
|
|
362
|
+
}
|
|
363
|
+
get endpointMetadata() {
|
|
364
|
+
this.assertServerMetadata();
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
366
|
+
return this._state.endpointMetadata;
|
|
367
|
+
}
|
|
368
|
+
get kid() {
|
|
369
|
+
this.assertIssuerData();
|
|
370
|
+
if (!this._state.kid) {
|
|
371
|
+
throw new Error('No value for kid is supplied');
|
|
372
|
+
}
|
|
373
|
+
return this._state.kid;
|
|
374
|
+
}
|
|
375
|
+
get alg() {
|
|
376
|
+
this.assertIssuerData();
|
|
377
|
+
if (!this._state.alg) {
|
|
378
|
+
throw new Error('No value for alg is supplied');
|
|
379
|
+
}
|
|
380
|
+
return this._state.alg;
|
|
381
|
+
}
|
|
382
|
+
set clientId(value) {
|
|
383
|
+
this._state.clientId = value;
|
|
384
|
+
}
|
|
385
|
+
get clientId() {
|
|
386
|
+
return this._state.clientId;
|
|
387
|
+
}
|
|
388
|
+
hasAccessTokenResponse() {
|
|
389
|
+
return !!this._state.accessTokenResponse;
|
|
390
|
+
}
|
|
391
|
+
get accessTokenResponse() {
|
|
392
|
+
this.assertAccessToken();
|
|
393
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
394
|
+
return this._state.accessTokenResponse;
|
|
395
|
+
}
|
|
396
|
+
getIssuer() {
|
|
397
|
+
this.assertIssuerData();
|
|
398
|
+
return this._state.credentialIssuer;
|
|
399
|
+
}
|
|
400
|
+
getAccessTokenEndpoint() {
|
|
401
|
+
this.assertIssuerData();
|
|
402
|
+
return this.endpointMetadata
|
|
403
|
+
? this.endpointMetadata.token_endpoint
|
|
404
|
+
: AccessTokenClient_1.AccessTokenClient.determineTokenURL({ issuerOpts: { issuer: this.getIssuer() } });
|
|
405
|
+
}
|
|
406
|
+
getCredentialEndpoint() {
|
|
407
|
+
this.assertIssuerData();
|
|
408
|
+
return this.endpointMetadata ? this.endpointMetadata.credential_endpoint : `${this.getIssuer()}/credential`;
|
|
409
|
+
}
|
|
410
|
+
hasDeferredCredentialEndpoint() {
|
|
411
|
+
return !!this.getAccessTokenEndpoint();
|
|
412
|
+
}
|
|
413
|
+
getDeferredCredentialEndpoint() {
|
|
414
|
+
this.assertIssuerData();
|
|
415
|
+
return this.endpointMetadata ? this.endpointMetadata.credential_endpoint : `${this.getIssuer()}/credential`;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Too bad we need a method like this, but EBSI is not exposing metadata
|
|
419
|
+
*/
|
|
420
|
+
isEBSI() {
|
|
421
|
+
var _a, _b, _c, _d, _e;
|
|
422
|
+
const credentialOffer = (_a = this.credentialOffer) === null || _a === void 0 ? void 0 : _a.credential_offer;
|
|
423
|
+
if (credentialOffer === null || credentialOffer === void 0 ? void 0 : credentialOffer.credential_configuration_ids) {
|
|
424
|
+
const credentialConfigurations = (_b = this.endpointMetadata.credentialIssuerMetadata) === null || _b === void 0 ? void 0 : _b.credential_configurations_supported;
|
|
425
|
+
if (credentialConfigurations) {
|
|
426
|
+
const isEBSITrustFramework = credentialOffer.credential_configuration_ids
|
|
427
|
+
.map((id) => credentialConfigurations[id])
|
|
428
|
+
.filter((config) =>
|
|
429
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
430
|
+
// @ts-ignore
|
|
431
|
+
config !== undefined && 'trust_framework' in config && 'name' in config.trust_framework)
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
433
|
+
// @ts-ignore
|
|
434
|
+
.some((config) => config.trust_framework.name.includes('ebsi'));
|
|
435
|
+
if (isEBSITrustFramework) {
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
this.assertIssuerData();
|
|
441
|
+
return (_e = (_d = (_c = this.endpointMetadata.credentialIssuerMetadata) === null || _c === void 0 ? void 0 : _c.authorization_endpoint) === null || _d === void 0 ? void 0 : _d.includes('ebsi.eu')) !== null && _e !== void 0 ? _e : false;
|
|
442
|
+
}
|
|
443
|
+
assertIssuerData() {
|
|
444
|
+
if (!this._state.credentialIssuer) {
|
|
445
|
+
throw Error(`No credential issuer value present`);
|
|
446
|
+
}
|
|
447
|
+
else if (!this._state.credentialOffer && this._state.endpointMetadata && this.issuerSupportedFlowTypes().length === 0) {
|
|
448
|
+
throw Error(`No issuance initiation or credential offer present`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
assertServerMetadata() {
|
|
452
|
+
if (!this._state.endpointMetadata) {
|
|
453
|
+
throw Error('No server metadata');
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
assertAccessToken() {
|
|
457
|
+
if (!this._state.accessTokenResponse) {
|
|
458
|
+
throw Error(`No access token present`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
syncAuthorizationRequestOpts(opts) {
|
|
462
|
+
var _a, _b;
|
|
463
|
+
let authorizationRequestOpts = Object.assign(Object.assign({}, (_a = this._state) === null || _a === void 0 ? void 0 : _a.authorizationRequestOpts), opts);
|
|
464
|
+
if (!authorizationRequestOpts) {
|
|
465
|
+
// We only set a redirectUri if no options are provided.
|
|
466
|
+
// Note that this only works for mobile apps, that can handle a code query param on the default openid-credential-offer deeplink.
|
|
467
|
+
// Provide your own options if that is not desired!
|
|
468
|
+
authorizationRequestOpts = { redirectUri: `${oid4vci_common_1.DefaultURISchemes.CREDENTIAL_OFFER}://` };
|
|
469
|
+
}
|
|
470
|
+
const clientId = (_b = authorizationRequestOpts.clientId) !== null && _b !== void 0 ? _b : this._state.clientId;
|
|
471
|
+
// sync clientId
|
|
472
|
+
this._state.clientId = clientId;
|
|
473
|
+
authorizationRequestOpts.clientId = clientId;
|
|
474
|
+
return authorizationRequestOpts;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
exports.OpenID4VCIClientV1_0_13 = OpenID4VCIClientV1_0_13;
|
|
478
|
+
//# sourceMappingURL=OpenID4VCIClientV1_0_13.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenID4VCIClientV1_0_13.js","sourceRoot":"","sources":["../lib/OpenID4VCIClientV1_0_13.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DA2BkC;AAElC,kDAA0B;AAE1B,2DAAwD;AACxD,uEAA0E;A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