@sphereon/oid4vci-client 0.16.1-next.15 → 0.16.1-next.24
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/dist/CredentialRequestClient.d.ts +35 -11
- package/dist/CredentialRequestClient.d.ts.map +1 -1
- package/dist/CredentialRequestClient.js +51 -15
- package/dist/CredentialRequestClient.js.map +1 -1
- package/dist/ProofOfPossessionBuilder.d.ts +1 -1
- package/dist/ProofOfPossessionBuilder.d.ts.map +1 -1
- package/lib/CredentialRequestClient.ts +84 -20
- package/lib/ProofOfPossessionBuilder.ts +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateDPoPClientOpts } from '@sphereon/oid4vc-common';
|
|
2
|
-
import { CredentialRequestV1_0_13, CredentialResponse, DPoPResponseParams, OID4VCICredentialFormat, OpenId4VCIVersion, OpenIDResponse, ProofOfPossession, UniformCredentialRequest } from '@sphereon/oid4vci-common';
|
|
2
|
+
import { CredentialRequestV1_0_13, CredentialRequestWithoutProofV1_0_13, CredentialResponse, DPoPResponseParams, OID4VCICredentialFormat, OpenId4VCIVersion, OpenIDResponse, ProofOfPossession, UniformCredentialRequest } from '@sphereon/oid4vci-common';
|
|
3
3
|
import { ExperimentalSubjectIssuance } from '@sphereon/oid4vci-common';
|
|
4
|
-
import { CredentialFormat } from '@sphereon/ssi-types';
|
|
4
|
+
import { CredentialFormat, DIDDocument } from '@sphereon/ssi-types';
|
|
5
5
|
import { CredentialRequestClientBuilderV1_0_11 } from './CredentialRequestClientBuilderV1_0_11';
|
|
6
6
|
import { CredentialRequestClientBuilderV1_0_13 } from './CredentialRequestClientBuilderV1_0_13';
|
|
7
7
|
import { ProofOfPossessionBuilder } from './ProofOfPossessionBuilder';
|
|
@@ -19,7 +19,15 @@ export interface CredentialRequestOpts {
|
|
|
19
19
|
version: OpenId4VCIVersion;
|
|
20
20
|
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type CreateCredentialRequestOpts<DIDDoc = DIDDocument> = {
|
|
23
|
+
credentialIdentifier?: string;
|
|
24
|
+
credentialTypes?: string | string[];
|
|
25
|
+
context?: string[];
|
|
26
|
+
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
27
|
+
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
28
|
+
version: OpenId4VCIVersion;
|
|
29
|
+
};
|
|
30
|
+
export declare function buildProof<DIDDoc = DIDDocument>(proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession, opts: {
|
|
23
31
|
version: OpenId4VCIVersion;
|
|
24
32
|
cNonce?: string;
|
|
25
33
|
}): Promise<ProofOfPossession>;
|
|
@@ -31,7 +39,23 @@ export declare class CredentialRequestClient {
|
|
|
31
39
|
getCredentialEndpoint(): string;
|
|
32
40
|
getDeferredCredentialEndpoint(): string | undefined;
|
|
33
41
|
constructor(builder: CredentialRequestClientBuilderV1_0_13 | CredentialRequestClientBuilderV1_0_11);
|
|
34
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Typically you should not use this method, as it omits a proof from the request.
|
|
44
|
+
* There are certain issuers that in specific circumstances can do without this proof, because they have other means of user binding
|
|
45
|
+
* like using DPoP together with an authorization code flow. These are however rare, so you should be using the acquireCredentialsUsingProof normally
|
|
46
|
+
* @param opts
|
|
47
|
+
*/
|
|
48
|
+
acquireCredentialsWithoutProof<DIDDoc = DIDDocument>(opts: {
|
|
49
|
+
credentialIdentifier?: string;
|
|
50
|
+
credentialTypes?: string | string[];
|
|
51
|
+
context?: string[];
|
|
52
|
+
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
53
|
+
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
54
|
+
createDPoPOpts?: CreateDPoPClientOpts;
|
|
55
|
+
}): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & {
|
|
56
|
+
access_token: string;
|
|
57
|
+
}>;
|
|
58
|
+
acquireCredentialsUsingProof<DIDDoc = DIDDocument>(opts: {
|
|
35
59
|
proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
|
|
36
60
|
credentialIdentifier?: string;
|
|
37
61
|
credentialTypes?: string | string[];
|
|
@@ -42,23 +66,23 @@ export declare class CredentialRequestClient {
|
|
|
42
66
|
}): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & {
|
|
43
67
|
access_token: string;
|
|
44
68
|
}>;
|
|
69
|
+
acquireCredentialsUsingRequestWithoutProof(uniformRequest: UniformCredentialRequest, createDPoPOpts?: CreateDPoPClientOpts): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & {
|
|
70
|
+
access_token: string;
|
|
71
|
+
}>;
|
|
45
72
|
acquireCredentialsUsingRequest(uniformRequest: UniformCredentialRequest, createDPoPOpts?: CreateDPoPClientOpts): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & {
|
|
46
73
|
access_token: string;
|
|
47
74
|
}>;
|
|
75
|
+
private acquireCredentialsUsingRequestImpl;
|
|
48
76
|
acquireDeferredCredential(response: Pick<CredentialResponse, 'transaction_id' | 'acceptance_token' | 'c_nonce'>, opts?: {
|
|
49
77
|
bearerToken?: string;
|
|
50
78
|
}): Promise<OpenIDResponse<CredentialResponse> & {
|
|
51
79
|
access_token: string;
|
|
52
80
|
}>;
|
|
53
|
-
|
|
81
|
+
createCredentialRequestWithoutProof<DIDDoc = DIDDocument>(opts: CreateCredentialRequestOpts<DIDDoc>): Promise<CredentialRequestWithoutProofV1_0_13>;
|
|
82
|
+
createCredentialRequest<DIDDoc = DIDDocument>(opts: CreateCredentialRequestOpts<DIDDoc> & {
|
|
54
83
|
proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
|
|
55
|
-
credentialIdentifier?: string;
|
|
56
|
-
credentialTypes?: string | string[];
|
|
57
|
-
context?: string[];
|
|
58
|
-
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
59
|
-
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
60
|
-
version: OpenId4VCIVersion;
|
|
61
84
|
}): Promise<CredentialRequestV1_0_13>;
|
|
85
|
+
private createCredentialRequestImpl;
|
|
62
86
|
private version;
|
|
63
87
|
}
|
|
64
88
|
//# sourceMappingURL=CredentialRequestClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialRequestClient.d.ts","sourceRoot":"","sources":["../lib/CredentialRequestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,oBAAoB,EAAwB,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAKlB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EAEd,iBAAiB,EACjB,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"CredentialRequestClient.d.ts","sourceRoot":"","sources":["../lib/CredentialRequestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,oBAAoB,EAAwB,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAEL,wBAAwB,EACxB,oCAAoC,EACpC,kBAAkB,EAClB,kBAAkB,EAKlB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EAEd,iBAAiB,EACjB,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAKtE,MAAM,WAAW,qBAAqB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AAc,CAAC,EAAE,oBAAoB,GACpC,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;YAI/E,kCAAkC;IA8DnC,yBAAyB,CACpC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,SAAS,CAAC,EACrF,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GACA,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAmB5D,mCAAmC,CAAC,MAAM,GAAG,WAAW,EACnE,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,GACxC,OAAO,CAAC,oCAAoC,CAAC;IAInC,uBAAuB,CAAC,MAAM,GAAG,WAAW,EACvD,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAAG;QAC1C,UAAU,EAAE,wBAAwB,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAC;KAClE,GACA,OAAO,CAAC,wBAAwB,CAAC;YAItB,2BAA2B;IAuFzC,OAAO,CAAC,OAAO;CAGhB"}
|
|
@@ -51,6 +51,26 @@ class CredentialRequestClient {
|
|
|
51
51
|
this._isDeferred = false;
|
|
52
52
|
this._credentialRequestOpts = Object.assign({}, builder);
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Typically you should not use this method, as it omits a proof from the request.
|
|
56
|
+
* There are certain issuers that in specific circumstances can do without this proof, because they have other means of user binding
|
|
57
|
+
* like using DPoP together with an authorization code flow. These are however rare, so you should be using the acquireCredentialsUsingProof normally
|
|
58
|
+
* @param opts
|
|
59
|
+
*/
|
|
60
|
+
acquireCredentialsWithoutProof(opts) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const { credentialIdentifier, credentialTypes, format, context, subjectIssuance } = opts;
|
|
63
|
+
const request = yield this.createCredentialRequestWithoutProof({
|
|
64
|
+
credentialTypes,
|
|
65
|
+
context,
|
|
66
|
+
format,
|
|
67
|
+
version: this.version(),
|
|
68
|
+
credentialIdentifier,
|
|
69
|
+
subjectIssuance,
|
|
70
|
+
});
|
|
71
|
+
return yield this.acquireCredentialsUsingRequestWithoutProof(request, opts.createDPoPOpts);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
54
74
|
acquireCredentialsUsingProof(opts) {
|
|
55
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
76
|
const { credentialIdentifier, credentialTypes, proofInput, format, context, subjectIssuance } = opts;
|
|
@@ -66,7 +86,17 @@ class CredentialRequestClient {
|
|
|
66
86
|
return yield this.acquireCredentialsUsingRequest(request, opts.createDPoPOpts);
|
|
67
87
|
});
|
|
68
88
|
}
|
|
89
|
+
acquireCredentialsUsingRequestWithoutProof(uniformRequest, createDPoPOpts) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return yield this.acquireCredentialsUsingRequestImpl(uniformRequest, createDPoPOpts);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
69
94
|
acquireCredentialsUsingRequest(uniformRequest, createDPoPOpts) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
return yield this.acquireCredentialsUsingRequestImpl(uniformRequest, createDPoPOpts);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
acquireCredentialsUsingRequestImpl(uniformRequest, createDPoPOpts) {
|
|
70
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
101
|
var _a, _b;
|
|
72
102
|
if (this.version() < oid4vci_common_1.OpenId4VCIVersion.VER_1_0_13) {
|
|
@@ -128,19 +158,29 @@ class CredentialRequestClient {
|
|
|
128
158
|
});
|
|
129
159
|
});
|
|
130
160
|
}
|
|
161
|
+
createCredentialRequestWithoutProof(opts) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return yield this.createCredentialRequestImpl(opts);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
131
166
|
createCredentialRequest(opts) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
return yield this.createCredentialRequestImpl(opts);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
createCredentialRequestImpl(opts) {
|
|
132
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
173
|
var _a;
|
|
134
174
|
const { proofInput, credentialIdentifier: credential_identifier } = opts;
|
|
135
|
-
|
|
175
|
+
let proof = undefined;
|
|
176
|
+
if (proofInput) {
|
|
177
|
+
proof = yield buildProof(proofInput, opts);
|
|
178
|
+
}
|
|
136
179
|
if (credential_identifier) {
|
|
137
180
|
if (opts.format || opts.credentialTypes || opts.context) {
|
|
138
181
|
throw Error(`You cannot mix credential_identifier with format, credential types and/or context`);
|
|
139
182
|
}
|
|
140
|
-
return {
|
|
141
|
-
credential_identifier,
|
|
142
|
-
proof,
|
|
143
|
-
};
|
|
183
|
+
return Object.assign({ credential_identifier }, (proof && { proof }));
|
|
144
184
|
}
|
|
145
185
|
const formatSelection = (_a = opts.format) !== null && _a !== void 0 ? _a : this.credentialRequestOpts.format;
|
|
146
186
|
if (!formatSelection) {
|
|
@@ -159,17 +199,15 @@ class CredentialRequestClient {
|
|
|
159
199
|
}
|
|
160
200
|
// TODO: we should move format specific logic
|
|
161
201
|
if (format === 'jwt_vc_json' || format === 'jwt_vc') {
|
|
162
|
-
return Object.assign({ credential_definition: {
|
|
202
|
+
return Object.assign(Object.assign({ credential_definition: {
|
|
163
203
|
type: types,
|
|
164
|
-
}, format,
|
|
165
|
-
proof }, opts.subjectIssuance);
|
|
204
|
+
}, format }, (proof && { proof })), opts.subjectIssuance);
|
|
166
205
|
}
|
|
167
206
|
else if (format === 'jwt_vc_json-ld' || format === 'ldp_vc') {
|
|
168
207
|
if (this.version() >= oid4vci_common_1.OpenId4VCIVersion.VER_1_0_12 && !opts.context) {
|
|
169
208
|
throw Error('No @context value present, but it is required');
|
|
170
209
|
}
|
|
171
|
-
return Object.assign(Object.assign({ format,
|
|
172
|
-
proof }, opts.subjectIssuance), { credential_definition: {
|
|
210
|
+
return Object.assign(Object.assign(Object.assign({ format }, (proof && { proof })), opts.subjectIssuance), { credential_definition: {
|
|
173
211
|
type: types,
|
|
174
212
|
'@context': opts.context,
|
|
175
213
|
} });
|
|
@@ -178,17 +216,15 @@ class CredentialRequestClient {
|
|
|
178
216
|
if (types.length > 1) {
|
|
179
217
|
throw Error(`Only a single credential type is supported for ${format}`);
|
|
180
218
|
}
|
|
181
|
-
return Object.assign({ format,
|
|
182
|
-
proof, vct: types[0] }, opts.subjectIssuance);
|
|
219
|
+
return Object.assign(Object.assign(Object.assign({ format }, (proof && { proof })), { vct: types[0] }), opts.subjectIssuance);
|
|
183
220
|
}
|
|
184
221
|
else if (format === 'mso_mdoc') {
|
|
185
222
|
if (types.length > 1) {
|
|
186
223
|
throw Error(`Only a single credential type is supported for ${format}`);
|
|
187
224
|
}
|
|
188
|
-
return Object.assign({ format,
|
|
189
|
-
proof, doctype: types[0] }, opts.subjectIssuance);
|
|
225
|
+
return Object.assign(Object.assign(Object.assign({ format }, (proof && { proof })), { doctype: types[0] }), opts.subjectIssuance);
|
|
190
226
|
}
|
|
191
|
-
throw new Error(`Unsupported format: ${format}`);
|
|
227
|
+
throw new Error(`Unsupported credential format: ${format}`);
|
|
192
228
|
});
|
|
193
229
|
}
|
|
194
230
|
version() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialRequestClient.js","sourceRoot":"","sources":["../lib/CredentialRequestClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CredentialRequestClient.js","sourceRoot":"","sources":["../lib/CredentialRequestClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsDA,gCAiBC;AAvED,2DAAiG;AACjG,6DAiBkC;AAGlC,kDAA0B;AAI1B,yEAAs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BAC1E,CAAC;gBACD,mDACE,MAAM,IACH,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC,KACvB,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,KACd,IAAI,CAAC,eAAe,EACvB;YACJ,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;KAAA;IAEO,OAAO;;QACb,OAAO,MAAA,MAAA,IAAI,CAAC,qBAAqB,0CAAE,OAAO,mCAAI,kCAAiB,CAAC,UAAU,CAAC;IAC7E,CAAC;CACF;AAtRD,0DAsRC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JWK } from '@sphereon/oid4vc-common';
|
|
2
2
|
import { AccessTokenResponse, Alg, EndpointMetadata, Jwt, OpenId4VCIVersion, PoPMode, ProofOfPossession, ProofOfPossessionCallbacks, Typ } from '@sphereon/oid4vci-common';
|
|
3
|
-
export declare class ProofOfPossessionBuilder<DIDDoc> {
|
|
3
|
+
export declare class ProofOfPossessionBuilder<DIDDoc = never> {
|
|
4
4
|
private readonly proof?;
|
|
5
5
|
private readonly callbacks?;
|
|
6
6
|
private readonly version;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProofOfPossessionBuilder.d.ts","sourceRoot":"","sources":["../lib/ProofOfPossessionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,GAAG,EAEH,gBAAgB,EAChB,GAAG,EAEH,iBAAiB,EACjB,OAAO,EAEP,iBAAiB,EACjB,0BAA0B,EAC1B,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAElC,qBAAa,wBAAwB,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"ProofOfPossessionBuilder.d.ts","sourceRoot":"","sources":["../lib/ProofOfPossessionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE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C,iBAAiB,CAAC;CAuBjD"}
|
|
@@ -2,6 +2,7 @@ import { createDPoP, CreateDPoPClientOpts, getCreateDPoPOptions } from '@sphereo
|
|
|
2
2
|
import {
|
|
3
3
|
acquireDeferredCredential,
|
|
4
4
|
CredentialRequestV1_0_13,
|
|
5
|
+
CredentialRequestWithoutProofV1_0_13,
|
|
5
6
|
CredentialResponse,
|
|
6
7
|
DPoPResponseParams,
|
|
7
8
|
getCredentialRequestForVersion,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
URL_NOT_VALID,
|
|
18
19
|
} from '@sphereon/oid4vci-common';
|
|
19
20
|
import { ExperimentalSubjectIssuance } from '@sphereon/oid4vci-common';
|
|
20
|
-
import { CredentialFormat } from '@sphereon/ssi-types';
|
|
21
|
+
import { CredentialFormat, DIDDocument } from '@sphereon/ssi-types';
|
|
21
22
|
import Debug from 'debug';
|
|
22
23
|
|
|
23
24
|
import { CredentialRequestClientBuilderV1_0_11 } from './CredentialRequestClientBuilderV1_0_11';
|
|
@@ -42,7 +43,16 @@ export interface CredentialRequestOpts {
|
|
|
42
43
|
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export
|
|
46
|
+
export type CreateCredentialRequestOpts<DIDDoc = DIDDocument> = {
|
|
47
|
+
credentialIdentifier?: string;
|
|
48
|
+
credentialTypes?: string | string[];
|
|
49
|
+
context?: string[];
|
|
50
|
+
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
51
|
+
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
52
|
+
version: OpenId4VCIVersion;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export async function buildProof<DIDDoc = DIDDocument>(
|
|
46
56
|
proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession,
|
|
47
57
|
opts: {
|
|
48
58
|
version: OpenId4VCIVersion;
|
|
@@ -85,7 +95,34 @@ export class CredentialRequestClient {
|
|
|
85
95
|
this._credentialRequestOpts = { ...builder };
|
|
86
96
|
}
|
|
87
97
|
|
|
88
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Typically you should not use this method, as it omits a proof from the request.
|
|
100
|
+
* There are certain issuers that in specific circumstances can do without this proof, because they have other means of user binding
|
|
101
|
+
* like using DPoP together with an authorization code flow. These are however rare, so you should be using the acquireCredentialsUsingProof normally
|
|
102
|
+
* @param opts
|
|
103
|
+
*/
|
|
104
|
+
public async acquireCredentialsWithoutProof<DIDDoc = DIDDocument>(opts: {
|
|
105
|
+
credentialIdentifier?: string;
|
|
106
|
+
credentialTypes?: string | string[];
|
|
107
|
+
context?: string[];
|
|
108
|
+
format?: CredentialFormat | OID4VCICredentialFormat;
|
|
109
|
+
subjectIssuance?: ExperimentalSubjectIssuance;
|
|
110
|
+
createDPoPOpts?: CreateDPoPClientOpts;
|
|
111
|
+
}): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & { access_token: string }> {
|
|
112
|
+
const { credentialIdentifier, credentialTypes, format, context, subjectIssuance } = opts;
|
|
113
|
+
|
|
114
|
+
const request = await this.createCredentialRequestWithoutProof<DIDDoc>({
|
|
115
|
+
credentialTypes,
|
|
116
|
+
context,
|
|
117
|
+
format,
|
|
118
|
+
version: this.version(),
|
|
119
|
+
credentialIdentifier,
|
|
120
|
+
subjectIssuance,
|
|
121
|
+
});
|
|
122
|
+
return await this.acquireCredentialsUsingRequestWithoutProof(request, opts.createDPoPOpts);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public async acquireCredentialsUsingProof<DIDDoc = DIDDocument>(opts: {
|
|
89
126
|
proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
|
|
90
127
|
credentialIdentifier?: string;
|
|
91
128
|
credentialTypes?: string | string[];
|
|
@@ -96,7 +133,7 @@ export class CredentialRequestClient {
|
|
|
96
133
|
}): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & { access_token: string }> {
|
|
97
134
|
const { credentialIdentifier, credentialTypes, proofInput, format, context, subjectIssuance } = opts;
|
|
98
135
|
|
|
99
|
-
const request = await this.createCredentialRequest({
|
|
136
|
+
const request = await this.createCredentialRequest<DIDDoc>({
|
|
100
137
|
proofInput,
|
|
101
138
|
credentialTypes,
|
|
102
139
|
context,
|
|
@@ -108,9 +145,23 @@ export class CredentialRequestClient {
|
|
|
108
145
|
return await this.acquireCredentialsUsingRequest(request, opts.createDPoPOpts);
|
|
109
146
|
}
|
|
110
147
|
|
|
148
|
+
public async acquireCredentialsUsingRequestWithoutProof(
|
|
149
|
+
uniformRequest: UniformCredentialRequest,
|
|
150
|
+
createDPoPOpts?: CreateDPoPClientOpts,
|
|
151
|
+
): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & { access_token: string }> {
|
|
152
|
+
return await this.acquireCredentialsUsingRequestImpl(uniformRequest, createDPoPOpts);
|
|
153
|
+
}
|
|
154
|
+
|
|
111
155
|
public async acquireCredentialsUsingRequest(
|
|
112
156
|
uniformRequest: UniformCredentialRequest,
|
|
113
157
|
createDPoPOpts?: CreateDPoPClientOpts,
|
|
158
|
+
): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & { access_token: string }> {
|
|
159
|
+
return await this.acquireCredentialsUsingRequestImpl(uniformRequest, createDPoPOpts);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private async acquireCredentialsUsingRequestImpl(
|
|
163
|
+
uniformRequest: UniformCredentialRequest & { proof?: ProofOfPossession },
|
|
164
|
+
createDPoPOpts?: CreateDPoPClientOpts,
|
|
114
165
|
): Promise<OpenIDResponse<CredentialResponse, DPoPResponseParams> & { access_token: string }> {
|
|
115
166
|
if (this.version() < OpenId4VCIVersion.VER_1_0_13) {
|
|
116
167
|
throw new Error('Versions below v1.0.13 (draft 13) are not supported by the V13 credential request client.');
|
|
@@ -194,24 +245,37 @@ export class CredentialRequestClient {
|
|
|
194
245
|
});
|
|
195
246
|
}
|
|
196
247
|
|
|
197
|
-
public async
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
248
|
+
public async createCredentialRequestWithoutProof<DIDDoc = DIDDocument>(
|
|
249
|
+
opts: CreateCredentialRequestOpts<DIDDoc>,
|
|
250
|
+
): Promise<CredentialRequestWithoutProofV1_0_13> {
|
|
251
|
+
return await this.createCredentialRequestImpl(opts);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
public async createCredentialRequest<DIDDoc = DIDDocument>(
|
|
255
|
+
opts: CreateCredentialRequestOpts<DIDDoc> & {
|
|
256
|
+
proofInput: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
|
|
257
|
+
},
|
|
258
|
+
): Promise<CredentialRequestV1_0_13> {
|
|
259
|
+
return await this.createCredentialRequestImpl(opts);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
private async createCredentialRequestImpl<DIDDoc = DIDDocument>(
|
|
263
|
+
opts: CreateCredentialRequestOpts<DIDDoc> & {
|
|
264
|
+
proofInput?: ProofOfPossessionBuilder<DIDDoc> | ProofOfPossession;
|
|
265
|
+
},
|
|
266
|
+
): Promise<CredentialRequestV1_0_13> {
|
|
206
267
|
const { proofInput, credentialIdentifier: credential_identifier } = opts;
|
|
207
|
-
|
|
268
|
+
let proof: ProofOfPossession | undefined = undefined;
|
|
269
|
+
if (proofInput) {
|
|
270
|
+
proof = await buildProof(proofInput, opts);
|
|
271
|
+
}
|
|
208
272
|
if (credential_identifier) {
|
|
209
273
|
if (opts.format || opts.credentialTypes || opts.context) {
|
|
210
274
|
throw Error(`You cannot mix credential_identifier with format, credential types and/or context`);
|
|
211
275
|
}
|
|
212
276
|
return {
|
|
213
277
|
credential_identifier,
|
|
214
|
-
proof,
|
|
278
|
+
...(proof && { proof }),
|
|
215
279
|
};
|
|
216
280
|
}
|
|
217
281
|
const formatSelection = opts.format ?? this.credentialRequestOpts.format;
|
|
@@ -239,7 +303,7 @@ export class CredentialRequestClient {
|
|
|
239
303
|
type: types,
|
|
240
304
|
},
|
|
241
305
|
format,
|
|
242
|
-
proof,
|
|
306
|
+
...(proof && { proof }),
|
|
243
307
|
...opts.subjectIssuance,
|
|
244
308
|
};
|
|
245
309
|
} else if (format === 'jwt_vc_json-ld' || format === 'ldp_vc') {
|
|
@@ -249,7 +313,7 @@ export class CredentialRequestClient {
|
|
|
249
313
|
|
|
250
314
|
return {
|
|
251
315
|
format,
|
|
252
|
-
proof,
|
|
316
|
+
...(proof && { proof }),
|
|
253
317
|
...opts.subjectIssuance,
|
|
254
318
|
|
|
255
319
|
credential_definition: {
|
|
@@ -263,7 +327,7 @@ export class CredentialRequestClient {
|
|
|
263
327
|
}
|
|
264
328
|
return {
|
|
265
329
|
format,
|
|
266
|
-
proof,
|
|
330
|
+
...(proof && { proof }),
|
|
267
331
|
vct: types[0],
|
|
268
332
|
...opts.subjectIssuance,
|
|
269
333
|
};
|
|
@@ -273,13 +337,13 @@ export class CredentialRequestClient {
|
|
|
273
337
|
}
|
|
274
338
|
return {
|
|
275
339
|
format,
|
|
276
|
-
proof,
|
|
340
|
+
...(proof && { proof }),
|
|
277
341
|
doctype: types[0],
|
|
278
342
|
...opts.subjectIssuance,
|
|
279
343
|
};
|
|
280
344
|
}
|
|
281
345
|
|
|
282
|
-
throw new Error(`Unsupported format: ${format}`);
|
|
346
|
+
throw new Error(`Unsupported credential format: ${format}`);
|
|
283
347
|
}
|
|
284
348
|
|
|
285
349
|
private version(): OpenId4VCIVersion {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
Typ,
|
|
15
15
|
} from '@sphereon/oid4vci-common';
|
|
16
16
|
|
|
17
|
-
export class ProofOfPossessionBuilder<DIDDoc> {
|
|
17
|
+
export class ProofOfPossessionBuilder<DIDDoc = never> {
|
|
18
18
|
private readonly proof?: ProofOfPossession;
|
|
19
19
|
private readonly callbacks?: ProofOfPossessionCallbacks<DIDDoc>;
|
|
20
20
|
private readonly version: OpenId4VCIVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/oid4vci-client",
|
|
3
|
-
"version": "0.16.1-next.
|
|
3
|
+
"version": "0.16.1-next.24+f696867",
|
|
4
4
|
"description": "OpenID for Verifiable Credential Issuance (OpenID4VCI) client",
|
|
5
5
|
"source": "lib/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"build": "tsc"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@sphereon/oid4vc-common": "0.16.1-next.
|
|
19
|
-
"@sphereon/oid4vci-common": "0.16.1-next.
|
|
20
|
-
"@sphereon/ssi-types": "0.29.
|
|
18
|
+
"@sphereon/oid4vc-common": "0.16.1-next.24+f696867",
|
|
19
|
+
"@sphereon/oid4vci-common": "0.16.1-next.24+f696867",
|
|
20
|
+
"@sphereon/ssi-types": "0.29.1-unstable.208",
|
|
21
21
|
"cross-fetch": "^3.1.8",
|
|
22
22
|
"debug": "^4.3.5"
|
|
23
23
|
},
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"OIDC4VCI",
|
|
71
71
|
"OID4VCI"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "f6968677ccd10c2ce8eb8484443971102547e8a2"
|
|
74
74
|
}
|