@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.32.1-next.54 → 0.33.1-feature.jose.vcdm.55
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/index.cjs +2451 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +555 -8
- package/dist/index.js +2420 -31
- package/dist/index.js.map +1 -1
- package/package.json +44 -30
- package/src/agent/DidAuthSiopOpAuthenticator.ts +132 -53
- package/src/services/Siopv2MachineService.ts +130 -20
- package/src/session/OID4VP.ts +8 -8
- package/src/session/OpSession.ts +18 -17
- package/src/types/IDidAuthSiopOpAuthenticator.ts +20 -7
- package/src/types/siop-service/index.ts +9 -6
- package/src/utils/CredentialUtils.ts +71 -0
- package/src/utils/dcql.ts +36 -0
- package/dist/agent/DidAuthSiopOpAuthenticator.d.ts +0 -31
- package/dist/agent/DidAuthSiopOpAuthenticator.d.ts.map +0 -1
- package/dist/agent/DidAuthSiopOpAuthenticator.js +0 -323
- package/dist/agent/DidAuthSiopOpAuthenticator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/link-handler/index.d.ts +0 -22
- package/dist/link-handler/index.d.ts.map +0 -1
- package/dist/link-handler/index.js +0 -57
- package/dist/link-handler/index.js.map +0 -1
- package/dist/localization/Localization.d.ts +0 -9
- package/dist/localization/Localization.d.ts.map +0 -1
- package/dist/localization/Localization.js +0 -46
- package/dist/localization/Localization.js.map +0 -1
- package/dist/localization/translations/en.json +0 -9
- package/dist/localization/translations/nl.json +0 -8
- package/dist/machine/CallbackStateListener.d.ts +0 -3
- package/dist/machine/CallbackStateListener.d.ts.map +0 -1
- package/dist/machine/CallbackStateListener.js +0 -48
- package/dist/machine/CallbackStateListener.js.map +0 -1
- package/dist/machine/Siopv2Machine.d.ts +0 -8
- package/dist/machine/Siopv2Machine.d.ts.map +0 -1
- package/dist/machine/Siopv2Machine.js +0 -364
- package/dist/machine/Siopv2Machine.js.map +0 -1
- package/dist/services/IdentifierService.d.ts +0 -3
- package/dist/services/IdentifierService.d.ts.map +0 -1
- package/dist/services/IdentifierService.js +0 -28
- package/dist/services/IdentifierService.js.map +0 -1
- package/dist/services/Siopv2MachineService.d.ts +0 -16
- package/dist/services/Siopv2MachineService.d.ts.map +0 -1
- package/dist/services/Siopv2MachineService.js +0 -201
- package/dist/services/Siopv2MachineService.js.map +0 -1
- package/dist/session/OID4VP.d.ts +0 -72
- package/dist/session/OID4VP.d.ts.map +0 -1
- package/dist/session/OID4VP.js +0 -223
- package/dist/session/OID4VP.js.map +0 -1
- package/dist/session/OpSession.d.ts +0 -39
- package/dist/session/OpSession.d.ts.map +0 -1
- package/dist/session/OpSession.js +0 -365
- package/dist/session/OpSession.js.map +0 -1
- package/dist/session/functions.d.ts +0 -37
- package/dist/session/functions.d.ts.map +0 -1
- package/dist/session/functions.js +0 -163
- package/dist/session/functions.js.map +0 -1
- package/dist/session/index.d.ts +0 -4
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js +0 -20
- package/dist/session/index.js.map +0 -1
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts +0 -116
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts.map +0 -1
- package/dist/types/IDidAuthSiopOpAuthenticator.js +0 -10
- package/dist/types/IDidAuthSiopOpAuthenticator.js.map +0 -1
- package/dist/types/error/index.d.ts +0 -8
- package/dist/types/error/index.d.ts.map +0 -1
- package/dist/types/error/index.js +0 -3
- package/dist/types/error/index.js.map +0 -1
- package/dist/types/identifier/index.d.ts +0 -53
- package/dist/types/identifier/index.d.ts.map +0 -1
- package/dist/types/identifier/index.js +0 -5
- package/dist/types/identifier/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -22
- package/dist/types/index.js.map +0 -1
- package/dist/types/machine/index.d.ts +0 -124
- package/dist/types/machine/index.d.ts.map +0 -1
- package/dist/types/machine/index.js +0 -57
- package/dist/types/machine/index.js.map +0 -1
- package/dist/types/siop-service/index.d.ts +0 -78
- package/dist/types/siop-service/index.d.ts.map +0 -1
- package/dist/types/siop-service/index.js +0 -14
- package/dist/types/siop-service/index.js.map +0 -1
|
@@ -1,365 +0,0 @@
|
|
|
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.OpSession = void 0;
|
|
16
|
-
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
17
|
-
const ssi_sdk_ext_did_utils_1 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
18
|
-
const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
|
|
19
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
20
|
-
const debug_1 = __importDefault(require("debug"));
|
|
21
|
-
const uuid_1 = require("uuid");
|
|
22
|
-
const functions_1 = require("./functions");
|
|
23
|
-
const OID4VP_1 = require("./OID4VP");
|
|
24
|
-
const pex_1 = require("@sphereon/pex");
|
|
25
|
-
const debug = (0, debug_1.default)(`sphereon:sdk:siop:op-session`);
|
|
26
|
-
class OpSession {
|
|
27
|
-
constructor(options) {
|
|
28
|
-
this.ts = new Date().getDate();
|
|
29
|
-
this.id = options.sessionId;
|
|
30
|
-
this.options = options.op;
|
|
31
|
-
this.context = options.context;
|
|
32
|
-
this.requestJwtOrUri = options.requestJwtOrUri;
|
|
33
|
-
this._providedPresentationDefinitions = options.providedPresentationDefinitions;
|
|
34
|
-
}
|
|
35
|
-
static init(options) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
return new OpSession(options);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
getAuthorizationRequest() {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
if (!this.verifiedAuthorizationRequest) {
|
|
43
|
-
const op = yield (0, functions_1.createOP)({ opOptions: this.options, context: this.context });
|
|
44
|
-
this.verifiedAuthorizationRequest = yield op.verifyAuthorizationRequest(this.requestJwtOrUri);
|
|
45
|
-
this._nonce = yield this.verifiedAuthorizationRequest.authorizationRequest.getMergedProperty('nonce');
|
|
46
|
-
this._state = yield this.verifiedAuthorizationRequest.authorizationRequest.getMergedProperty('state');
|
|
47
|
-
// only used to ensure that we have DID methods supported
|
|
48
|
-
yield this.getSupportedDIDMethods();
|
|
49
|
-
}
|
|
50
|
-
return this.verifiedAuthorizationRequest;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
getAuthorizationRequestURI() {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
return yield did_auth_siop_1.URI.fromAuthorizationRequest((yield this.getAuthorizationRequest()).authorizationRequest);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
get nonce() {
|
|
59
|
-
if (!this._nonce) {
|
|
60
|
-
throw Error('No nonce available. Please get authorization request first');
|
|
61
|
-
}
|
|
62
|
-
return this._nonce;
|
|
63
|
-
}
|
|
64
|
-
get state() {
|
|
65
|
-
if (!this._state) {
|
|
66
|
-
throw Error('No state available. Please get authorization request first');
|
|
67
|
-
}
|
|
68
|
-
return this._state;
|
|
69
|
-
}
|
|
70
|
-
clear() {
|
|
71
|
-
this._nonce = undefined;
|
|
72
|
-
this._state = undefined;
|
|
73
|
-
this.verifiedAuthorizationRequest = undefined;
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
getSupportedDIDMethods(didPrefix) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
var _a;
|
|
79
|
-
const agentMethods = this.getAgentDIDMethodsSupported({ didPrefix });
|
|
80
|
-
let rpMethods = yield this.getRPDIDMethodsSupported({ didPrefix, agentMethods });
|
|
81
|
-
debug(`RP supports subject syntax types: ${JSON.stringify(this.getSubjectSyntaxTypesSupported())}`);
|
|
82
|
-
if (rpMethods.dids.length === 0) {
|
|
83
|
-
debug(`RP does not support DIDs. Supported: ${JSON.stringify(this.getSubjectSyntaxTypesSupported())}`);
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
let intersection;
|
|
87
|
-
if (rpMethods.dids.includes('did')) {
|
|
88
|
-
intersection =
|
|
89
|
-
agentMethods && agentMethods.length > 0
|
|
90
|
-
? agentMethods
|
|
91
|
-
: (yield (0, ssi_sdk_ext_did_utils_1.getAgentDIDMethods)(this.context)).map((method) => convertDidMethod(method, didPrefix)); // fallback to the agent in case the agent methods are undefined
|
|
92
|
-
}
|
|
93
|
-
else if (!agentMethods || agentMethods.length === 0) {
|
|
94
|
-
intersection = (_a = rpMethods.dids) === null || _a === void 0 ? void 0 : _a.map((method) => convertDidMethod(method, didPrefix));
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
intersection = agentMethods.filter((value) => rpMethods.dids.includes(value));
|
|
98
|
-
}
|
|
99
|
-
if (intersection.length === 0) {
|
|
100
|
-
throw Error('No matching DID methods between agent and relying party');
|
|
101
|
-
}
|
|
102
|
-
return intersection.map((value) => convertDidMethod(value, didPrefix));
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
getAgentDIDMethodsSupported(opts) {
|
|
106
|
-
var _a;
|
|
107
|
-
const agentMethods = (_a = this.options.supportedDIDMethods) === null || _a === void 0 ? void 0 : _a.map((method) => convertDidMethod(method, opts.didPrefix));
|
|
108
|
-
debug(`agent methods: ${JSON.stringify(agentMethods)}`);
|
|
109
|
-
return agentMethods;
|
|
110
|
-
}
|
|
111
|
-
getSubjectSyntaxTypesSupported() {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
var _a;
|
|
114
|
-
const authReq = yield this.getAuthorizationRequest();
|
|
115
|
-
const subjectSyntaxTypesSupported = (_a = authReq.registrationMetadataPayload) === null || _a === void 0 ? void 0 : _a.subject_syntax_types_supported;
|
|
116
|
-
return subjectSyntaxTypesSupported !== null && subjectSyntaxTypesSupported !== void 0 ? subjectSyntaxTypesSupported : [];
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
getRPDIDMethodsSupported(opts) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
122
|
-
let keyType;
|
|
123
|
-
const agentMethods = (_c = (_b = ((_a = opts.agentMethods) !== null && _a !== void 0 ? _a : this.getAgentDIDMethodsSupported(opts))) === null || _b === void 0 ? void 0 : _b.map((method) => convertDidMethod(method, opts.didPrefix))) !== null && _c !== void 0 ? _c : [];
|
|
124
|
-
debug(`agent methods supported: ${JSON.stringify(agentMethods)}`);
|
|
125
|
-
const authReq = yield this.getAuthorizationRequest();
|
|
126
|
-
const subjectSyntaxTypesSupported = (_e = (_d = authReq.registrationMetadataPayload) === null || _d === void 0 ? void 0 : _d.subject_syntax_types_supported) === null || _e === void 0 ? void 0 : _e.map((method) => convertDidMethod(method, opts.didPrefix)).filter((val) => !val.startsWith('did'));
|
|
127
|
-
debug(`subject syntax types supported in rp method supported: ${JSON.stringify(subjectSyntaxTypesSupported)}`);
|
|
128
|
-
const aud = yield authReq.authorizationRequest.getMergedProperty('aud');
|
|
129
|
-
let rpMethods = [];
|
|
130
|
-
if (aud && aud.startsWith('did:')) {
|
|
131
|
-
const didMethod = convertDidMethod((0, ssi_types_1.parseDid)(aud).method, opts.didPrefix);
|
|
132
|
-
debug(`aud did method: ${didMethod}`);
|
|
133
|
-
// The RP knows our DID, so we can use it to determine the supported DID methods
|
|
134
|
-
// If the aud did:method is not in the supported types, there still is something wrong, unless the RP signals to support all did methods
|
|
135
|
-
if (subjectSyntaxTypesSupported &&
|
|
136
|
-
subjectSyntaxTypesSupported.length > 0 &&
|
|
137
|
-
!subjectSyntaxTypesSupported.includes('did') &&
|
|
138
|
-
!subjectSyntaxTypesSupported.includes(didMethod)) {
|
|
139
|
-
throw Error(`The aud DID method ${didMethod} is not in the supported types ${subjectSyntaxTypesSupported}`);
|
|
140
|
-
}
|
|
141
|
-
rpMethods = [didMethod];
|
|
142
|
-
}
|
|
143
|
-
else if (subjectSyntaxTypesSupported) {
|
|
144
|
-
rpMethods = (Array.isArray(subjectSyntaxTypesSupported) ? subjectSyntaxTypesSupported : [subjectSyntaxTypesSupported]).map((method) => convertDidMethod(method, opts.didPrefix));
|
|
145
|
-
}
|
|
146
|
-
const isEBSI = rpMethods.length === 0 &&
|
|
147
|
-
(((_f = authReq.issuer) === null || _f === void 0 ? void 0 : _f.includes('.ebsi.eu')) || ((_g = (yield authReq.authorizationRequest.getMergedProperty('client_id'))) === null || _g === void 0 ? void 0 : _g.includes('.ebsi.eu')));
|
|
148
|
-
let codecName = undefined;
|
|
149
|
-
if (isEBSI && (!aud || !aud.startsWith('http'))) {
|
|
150
|
-
debug(`EBSI detected, adding did:key to supported DID methods for RP`);
|
|
151
|
-
const didKeyMethod = convertDidMethod('did:key', opts.didPrefix);
|
|
152
|
-
if (!(agentMethods === null || agentMethods === void 0 ? void 0 : agentMethods.includes(didKeyMethod))) {
|
|
153
|
-
throw Error(`EBSI detected, but agent did not support did:key. Please reconfigure agent`);
|
|
154
|
-
}
|
|
155
|
-
rpMethods = [didKeyMethod];
|
|
156
|
-
keyType = 'Secp256r1';
|
|
157
|
-
codecName = 'jwk_jcs-pub';
|
|
158
|
-
}
|
|
159
|
-
return { dids: rpMethods, codecName, keyType };
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
getSupportedIdentifiers(opts) {
|
|
163
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
// todo: we also need to check signature algo
|
|
165
|
-
const methods = yield this.getSupportedDIDMethods(true);
|
|
166
|
-
debug(`supported DID methods (did: prefix = true): ${JSON.stringify(methods)}`);
|
|
167
|
-
if (methods.length === 0) {
|
|
168
|
-
throw Error(`No DID methods are supported`);
|
|
169
|
-
}
|
|
170
|
-
const identifiers = yield this.context.agent
|
|
171
|
-
.didManagerFind()
|
|
172
|
-
.then((ids) => ids.filter((id) => methods.includes(id.provider)));
|
|
173
|
-
if (identifiers.length === 0) {
|
|
174
|
-
debug(`No identifiers available in agent supporting methods ${JSON.stringify(methods)}`);
|
|
175
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.createInCaseNoDIDFound) !== false) {
|
|
176
|
-
const { codecName, keyType } = yield this.getRPDIDMethodsSupported({
|
|
177
|
-
didPrefix: true,
|
|
178
|
-
agentMethods: methods,
|
|
179
|
-
});
|
|
180
|
-
const identifier = yield this.context.agent.didManagerCreate({
|
|
181
|
-
provider: methods[0],
|
|
182
|
-
options: { codecName, keyType, type: keyType }, // both keyType and type, because not every did provider has the same param
|
|
183
|
-
});
|
|
184
|
-
debug(`Created a new identifier for the SIOP interaction: ${identifier.did}`);
|
|
185
|
-
identifiers.push(identifier);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
debug(`supported identifiers: ${JSON.stringify(identifiers.map((id) => id.did))}`);
|
|
189
|
-
return identifiers;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
getSupportedDIDs() {
|
|
193
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
return (yield this.getSupportedIdentifiers()).map((id) => id.did);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
getRedirectUri() {
|
|
198
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
return Promise.resolve(this.verifiedAuthorizationRequest.responseURI);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
hasPresentationDefinitions() {
|
|
203
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
var _a;
|
|
205
|
-
const defs = (_a = this._providedPresentationDefinitions) !== null && _a !== void 0 ? _a : (yield this.getAuthorizationRequest()).presentationDefinitions;
|
|
206
|
-
return defs !== undefined && defs.length > 0;
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
getPresentationDefinitions() {
|
|
210
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
-
var _a;
|
|
212
|
-
if (!(yield this.hasPresentationDefinitions())) {
|
|
213
|
-
throw Error(`No presentation definitions found`);
|
|
214
|
-
}
|
|
215
|
-
return (_a = this._providedPresentationDefinitions) !== null && _a !== void 0 ? _a : (yield this.getAuthorizationRequest()).presentationDefinitions;
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
getOID4VP(args) {
|
|
219
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
-
var _a;
|
|
221
|
-
return yield OID4VP_1.OID4VP.init(this, (_a = args.allIdentifiers) !== null && _a !== void 0 ? _a : [], args.hasher);
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
createPresentationVerificationCallback(context) {
|
|
225
|
-
function presentationVerificationCallback(args, presentationSubmission) {
|
|
226
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
let result;
|
|
228
|
-
if (ssi_types_1.CredentialMapper.isSdJwtEncoded(args)) {
|
|
229
|
-
try {
|
|
230
|
-
const sdJwtResult = yield context.agent.verifySdJwtPresentation({ presentation: args });
|
|
231
|
-
result = {
|
|
232
|
-
verified: 'header' in sdJwtResult,
|
|
233
|
-
error: 'header' in sdJwtResult ? undefined : { message: 'could not verify SD JWT presentation' },
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
result = {
|
|
238
|
-
verified: false,
|
|
239
|
-
error: { message: error.message },
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
// @ts-ignore TODO IVerifiablePresentation has too many union types for Veramo
|
|
245
|
-
result = yield context.agent.verifyPresentation({ presentation: args });
|
|
246
|
-
}
|
|
247
|
-
return result;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return presentationVerificationCallback;
|
|
251
|
-
}
|
|
252
|
-
createJarmResponseCallback(_a) {
|
|
253
|
-
return __awaiter(this, arguments, void 0, function* ({ responseOpts, }) {
|
|
254
|
-
const agent = this.context.agent;
|
|
255
|
-
return function jarmResponse(opts) {
|
|
256
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
-
var _a, _b;
|
|
258
|
-
const { clientMetadata, requestObjectPayload, authorizationResponsePayload: authResponse } = opts;
|
|
259
|
-
const jwk = yield did_auth_siop_1.OP.extractEncJwksFromClientMetadata(clientMetadata);
|
|
260
|
-
// @ts-ignore // FIXME: Fix jwk inference
|
|
261
|
-
const recipientKey = yield agent.identifierExternalResolveByJwk({ identifier: jwk });
|
|
262
|
-
return yield agent
|
|
263
|
-
.jwtEncryptJweCompactJwt({
|
|
264
|
-
recipientKey,
|
|
265
|
-
protectedHeader: {},
|
|
266
|
-
alg: (_a = requestObjectPayload.client_metadata.authorization_encrypted_response_alg) !== null && _a !== void 0 ? _a : 'ECDH-ES',
|
|
267
|
-
enc: (_b = requestObjectPayload.client_metadata.authorization_encrypted_response_enc) !== null && _b !== void 0 ? _b : 'A256GCM',
|
|
268
|
-
apv: (0, ssi_sdk_core_1.encodeBase64url)(opts.requestObjectPayload.nonce),
|
|
269
|
-
apu: (0, ssi_sdk_core_1.encodeBase64url)((0, uuid_1.v4)()),
|
|
270
|
-
payload: authResponse,
|
|
271
|
-
issuer: responseOpts.issuer,
|
|
272
|
-
audience: responseOpts.audience,
|
|
273
|
-
})
|
|
274
|
-
.then((result) => {
|
|
275
|
-
return { response: result.jwt };
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
};
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
sendAuthorizationResponse(args) {
|
|
282
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
-
var _a, _b, _c, _d;
|
|
284
|
-
const resolveOpts = (_a = this.options.resolveOpts) !== null && _a !== void 0 ? _a : {
|
|
285
|
-
resolver: (0, ssi_sdk_ext_did_utils_1.getAgentResolver)(this.context, {
|
|
286
|
-
uniresolverResolution: true,
|
|
287
|
-
localResolution: true,
|
|
288
|
-
resolverResolution: true,
|
|
289
|
-
}),
|
|
290
|
-
};
|
|
291
|
-
if (!resolveOpts.subjectSyntaxTypesSupported || resolveOpts.subjectSyntaxTypesSupported.length === 0) {
|
|
292
|
-
resolveOpts.subjectSyntaxTypesSupported = yield this.getSupportedDIDMethods(true);
|
|
293
|
-
}
|
|
294
|
-
//todo: populate with the right verification params. In did-auth-siop we don't have any test that actually passes this parameter
|
|
295
|
-
const verification = {
|
|
296
|
-
presentationVerificationCallback: this.createPresentationVerificationCallback(this.context),
|
|
297
|
-
};
|
|
298
|
-
const request = yield this.getAuthorizationRequest();
|
|
299
|
-
const hasDefinitions = yield this.hasPresentationDefinitions();
|
|
300
|
-
if (hasDefinitions) {
|
|
301
|
-
const totalInputDescriptors = (_b = request.presentationDefinitions) === null || _b === void 0 ? void 0 : _b.reduce((sum, pd) => {
|
|
302
|
-
return sum + pd.definition.input_descriptors.length;
|
|
303
|
-
}, 0);
|
|
304
|
-
const totalVCs = args.verifiablePresentations ? this.countVCsInAllVPs(args.verifiablePresentations, args.hasher) : 0;
|
|
305
|
-
if (!request.presentationDefinitions || !args.verifiablePresentations || totalVCs !== totalInputDescriptors) {
|
|
306
|
-
throw Error(`Amount of presentations ${(_c = args.verifiablePresentations) === null || _c === void 0 ? void 0 : _c.length}, doesn't match expected ${(_d = request.presentationDefinitions) === null || _d === void 0 ? void 0 : _d.length}`);
|
|
307
|
-
}
|
|
308
|
-
else if (!args.presentationSubmission) {
|
|
309
|
-
throw Error(`Presentation submission is required when verifiable presentations are required`);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
const verifiablePresentations = args.verifiablePresentations
|
|
313
|
-
? args.verifiablePresentations.map((vp) => ssi_types_1.CredentialMapper.storedPresentationToOriginalFormat(vp))
|
|
314
|
-
: [];
|
|
315
|
-
const op = yield (0, functions_1.createOP)({
|
|
316
|
-
opOptions: Object.assign(Object.assign({}, this.options), { resolveOpts: Object.assign({}, this.options.resolveOpts), eventEmitter: this.options.eventEmitter, presentationSignCallback: this.options.presentationSignCallback, wellknownDIDVerifyCallback: this.options.wellknownDIDVerifyCallback, supportedVersions: request.versions }),
|
|
317
|
-
idOpts: args.responseSignerOpts,
|
|
318
|
-
context: this.context,
|
|
319
|
-
});
|
|
320
|
-
//TODO change this to use the new functionalities by identifier-resolver and get the jwkIssuer for the responseOpts
|
|
321
|
-
let issuer = args.responseSignerOpts.issuer;
|
|
322
|
-
const responseOpts = Object.assign(Object.assign({ verification,
|
|
323
|
-
issuer }, (args.isFirstParty && { isFirstParty: args.isFirstParty })), (args.verifiablePresentations && {
|
|
324
|
-
presentationExchange: {
|
|
325
|
-
verifiablePresentations,
|
|
326
|
-
presentationSubmission: args.presentationSubmission,
|
|
327
|
-
},
|
|
328
|
-
}));
|
|
329
|
-
const authResponse = yield op.createAuthorizationResponse(request, responseOpts);
|
|
330
|
-
const response = yield op.submitAuthorizationResponse(authResponse, yield this.createJarmResponseCallback({ responseOpts }));
|
|
331
|
-
if (response.status >= 400) {
|
|
332
|
-
throw Error(`Error ${response.status}: ${response.statusText || (yield response.text())}`);
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
return response;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
countVCsInAllVPs(verifiablePresentations, hasher) {
|
|
340
|
-
return verifiablePresentations.reduce((sum, vp) => {
|
|
341
|
-
var _a, _b;
|
|
342
|
-
if (ssi_types_1.CredentialMapper.isMsoMdocDecodedPresentation(vp) || ssi_types_1.CredentialMapper.isMsoMdocOid4VPEncoded(vp)) {
|
|
343
|
-
return sum + 1;
|
|
344
|
-
}
|
|
345
|
-
const uvp = ssi_types_1.CredentialMapper.toUniformPresentation(vp, { hasher: hasher !== null && hasher !== void 0 ? hasher : this.options.hasher });
|
|
346
|
-
if ((_a = uvp.verifiableCredential) === null || _a === void 0 ? void 0 : _a.length) {
|
|
347
|
-
return sum + ((_b = uvp.verifiableCredential) === null || _b === void 0 ? void 0 : _b.length);
|
|
348
|
-
}
|
|
349
|
-
const isSdJWT = ssi_types_1.CredentialMapper.isSdJwtDecodedCredential(uvp);
|
|
350
|
-
if (isSdJWT ||
|
|
351
|
-
(uvp.verifiableCredential && !pex_1.PEX.allowMultipleVCsPerPresentation(uvp.verifiableCredential))) {
|
|
352
|
-
return sum + 1;
|
|
353
|
-
}
|
|
354
|
-
return sum;
|
|
355
|
-
}, 0);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
exports.OpSession = OpSession;
|
|
359
|
-
function convertDidMethod(didMethod, didPrefix) {
|
|
360
|
-
if (didPrefix === false) {
|
|
361
|
-
return didMethod.startsWith('did:') ? didMethod.toLowerCase().replace('did:', '') : didMethod.toLowerCase();
|
|
362
|
-
}
|
|
363
|
-
return didMethod.startsWith('did:') ? didMethod.toLowerCase() : `did:${didMethod.toLowerCase().replace('did:', '')}`;
|
|
364
|
-
}
|
|
365
|
-
//# sourceMappingURL=OpSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpSession.js","sourceRoot":"","sources":["../../src/session/OpSession.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAagC;AAGhC,2EAAsF;AAEtF,yDAAwD;AACxD,mDAQ4B;AAE5B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gBACrC,OAAO,GAAG,IAAG,MAAA,GAAG,CAAC,oBAAoB,0CAAE,MAAM,CAAA,CAAA;YAC/C,CAAC;YACD,MAAM,OAAO,GAAG,4BAAgB,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAA;YAC9D,IACE,OAAO;gBACP,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,SAAG,CAAC,+BAA+B,CAAC,GAAG,CAAC,oBAA2D,CAAC,CAAC,EACnI,CAAC;gBACD,OAAO,GAAG,GAAG,CAAC,CAAA;YAChB,CAAC;YACD,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,CAAC,CAAC,CAAA;IACP,CAAC;CACF;AA3WD,8BA2WC;AAED,SAAS,gBAAgB,CAAC,SAAiB,EAAE,SAAmB;IAC9D,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAA;IAC7G,CAAC;IACD,OAAO,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAA;AACtH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { OP, OPBuilder, PresentationSignCallback } from '@sphereon/did-auth-siop';
|
|
2
|
-
import { JwtHeader, JwtIssuer, SigningAlgo } from '@sphereon/oid4vc-common';
|
|
3
|
-
import { Format } from '@sphereon/pex-models';
|
|
4
|
-
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
5
|
-
import { JwsPayload } from '@sphereon/ssi-sdk-ext.jwt-service';
|
|
6
|
-
import { TKeyType } from '@veramo/core';
|
|
7
|
-
import { IOPOptions, IRequiredContext } from '../types';
|
|
8
|
-
export declare function createOID4VPPresentationSignCallback({ presentationSignCallback, idOpts, domain, fetchRemoteContexts, challenge, format, context, skipDidResolution, }: {
|
|
9
|
-
presentationSignCallback?: PresentationSignCallback;
|
|
10
|
-
idOpts: ManagedIdentifierOptsOrResult;
|
|
11
|
-
domain?: string;
|
|
12
|
-
challenge?: string;
|
|
13
|
-
fetchRemoteContexts?: boolean;
|
|
14
|
-
skipDidResolution?: boolean;
|
|
15
|
-
format?: Format;
|
|
16
|
-
context: IRequiredContext;
|
|
17
|
-
}): Promise<PresentationSignCallback>;
|
|
18
|
-
export declare function createOPBuilder({ opOptions, idOpts, context, }: {
|
|
19
|
-
opOptions: IOPOptions;
|
|
20
|
-
idOpts?: ManagedIdentifierOptsOrResult;
|
|
21
|
-
context: IRequiredContext;
|
|
22
|
-
}): Promise<OPBuilder>;
|
|
23
|
-
export declare function createJwtCallbackWithIdOpts(idOpts: ManagedIdentifierOptsOrResult, context: IRequiredContext): (jwtIssuer: JwtIssuer, jwt: {
|
|
24
|
-
header: JwtHeader;
|
|
25
|
-
payload: JwsPayload;
|
|
26
|
-
}) => Promise<string>;
|
|
27
|
-
export declare function createJwtCallbackWithOpOpts(opOpts: IOPOptions, context: IRequiredContext): (jwtIssuer: JwtIssuer, jwt: {
|
|
28
|
-
header: JwtHeader;
|
|
29
|
-
payload: JwsPayload;
|
|
30
|
-
}) => Promise<string>;
|
|
31
|
-
export declare function createOP({ opOptions, idOpts, context, }: {
|
|
32
|
-
opOptions: IOPOptions;
|
|
33
|
-
idOpts?: ManagedIdentifierOptsOrResult;
|
|
34
|
-
context: IRequiredContext;
|
|
35
|
-
}): Promise<OP>;
|
|
36
|
-
export declare function getSigningAlgo(type: TKeyType): SigningAlgo;
|
|
37
|
-
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions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O,EAAE,gBAAgB,GACxB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CA2B5F;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,gBAAgB,GACxB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAsB5F;AAmBD,wBAAsB,QAAQ,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,OAAO,GACR,EAAE;IACD,SAAS,EAAE,UAAU,CAAA;IACrB,MAAM,CAAC,EAAE,6BAA6B,CAAA;IACtC,OAAO,EAAE,gBAAgB,CAAA;CAC1B,GAAG,OAAO,CAAC,EAAE,CAAC,CAEd;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,WAAW,CAc1D"}
|
|
@@ -1,163 +0,0 @@
|
|
|
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.createOID4VPPresentationSignCallback = createOID4VPPresentationSignCallback;
|
|
13
|
-
exports.createOPBuilder = createOPBuilder;
|
|
14
|
-
exports.createJwtCallbackWithIdOpts = createJwtCallbackWithIdOpts;
|
|
15
|
-
exports.createJwtCallbackWithOpOpts = createJwtCallbackWithOpOpts;
|
|
16
|
-
exports.createOP = createOP;
|
|
17
|
-
exports.getSigningAlgo = getSigningAlgo;
|
|
18
|
-
const did_auth_siop_1 = require("@sphereon/did-auth-siop");
|
|
19
|
-
const oid4vc_common_1 = require("@sphereon/oid4vc-common");
|
|
20
|
-
const ssi_sdk_ext_identifier_resolution_1 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
21
|
-
const ssi_sdk_presentation_exchange_1 = require("@sphereon/ssi-sdk.presentation-exchange");
|
|
22
|
-
const events_1 = require("events");
|
|
23
|
-
function createOID4VPPresentationSignCallback(_a) {
|
|
24
|
-
return __awaiter(this, arguments, void 0, function* ({ presentationSignCallback, idOpts, domain, fetchRemoteContexts, challenge, format, context, skipDidResolution, }) {
|
|
25
|
-
if (typeof presentationSignCallback === 'function') {
|
|
26
|
-
return presentationSignCallback;
|
|
27
|
-
}
|
|
28
|
-
return (0, ssi_sdk_presentation_exchange_1.createPEXPresentationSignCallback)({
|
|
29
|
-
idOpts,
|
|
30
|
-
fetchRemoteContexts,
|
|
31
|
-
domain,
|
|
32
|
-
challenge,
|
|
33
|
-
format,
|
|
34
|
-
skipDidResolution,
|
|
35
|
-
}, context);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function createOPBuilder(_a) {
|
|
39
|
-
return __awaiter(this, arguments, void 0, function* ({ opOptions, idOpts, context, }) {
|
|
40
|
-
var _b, _c, _d, _e, _f;
|
|
41
|
-
const eventEmitter = (_b = opOptions.eventEmitter) !== null && _b !== void 0 ? _b : new events_1.EventEmitter();
|
|
42
|
-
const builder = did_auth_siop_1.OP.builder()
|
|
43
|
-
.withResponseMode((_c = opOptions.responseMode) !== null && _c !== void 0 ? _c : did_auth_siop_1.ResponseMode.DIRECT_POST)
|
|
44
|
-
.withSupportedVersions((_d = opOptions.supportedVersions) !== null && _d !== void 0 ? _d : [
|
|
45
|
-
did_auth_siop_1.SupportedVersion.SIOPv2_ID1,
|
|
46
|
-
did_auth_siop_1.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1,
|
|
47
|
-
did_auth_siop_1.SupportedVersion.SIOPv2_D11,
|
|
48
|
-
did_auth_siop_1.SupportedVersion.SIOPv2_D12_OID4VP_D18,
|
|
49
|
-
])
|
|
50
|
-
.withExpiresIn((_e = opOptions.expiresIn) !== null && _e !== void 0 ? _e : 300)
|
|
51
|
-
.withEventEmitter(eventEmitter)
|
|
52
|
-
.withRegistration({
|
|
53
|
-
passBy: did_auth_siop_1.PassBy.VALUE,
|
|
54
|
-
});
|
|
55
|
-
const wellknownDIDVerifyCallback = opOptions.wellknownDIDVerifyCallback
|
|
56
|
-
? opOptions.wellknownDIDVerifyCallback
|
|
57
|
-
: (args) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const result = yield context.agent.cvVerifyCredential({
|
|
59
|
-
credential: args.credential,
|
|
60
|
-
fetchRemoteContexts: true,
|
|
61
|
-
});
|
|
62
|
-
return { verified: result.result };
|
|
63
|
-
});
|
|
64
|
-
builder.withVerifyJwtCallback(opOptions.verifyJwtCallback
|
|
65
|
-
? opOptions.verifyJwtCallback
|
|
66
|
-
: getVerifyJwtCallback({
|
|
67
|
-
verifyOpts: {
|
|
68
|
-
wellknownDIDVerifyCallback,
|
|
69
|
-
checkLinkedDomain: 'if_present',
|
|
70
|
-
},
|
|
71
|
-
}, context));
|
|
72
|
-
if (idOpts) {
|
|
73
|
-
if (opOptions.skipDidResolution && (0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierDidOpts)(idOpts)) {
|
|
74
|
-
idOpts.offlineWhenNoDIDRegistered = true;
|
|
75
|
-
}
|
|
76
|
-
const createJwtCallback = createJwtCallbackWithIdOpts(idOpts, context);
|
|
77
|
-
builder.withCreateJwtCallback(createJwtCallback);
|
|
78
|
-
builder.withPresentationSignCallback(yield createOID4VPPresentationSignCallback({
|
|
79
|
-
presentationSignCallback: opOptions.presentationSignCallback,
|
|
80
|
-
skipDidResolution: (_f = opOptions.skipDidResolution) !== null && _f !== void 0 ? _f : false,
|
|
81
|
-
idOpts,
|
|
82
|
-
context,
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
const createJwtCallback = createJwtCallbackWithOpOpts(opOptions, context);
|
|
87
|
-
builder.withCreateJwtCallback(createJwtCallback);
|
|
88
|
-
}
|
|
89
|
-
return builder;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function createJwtCallbackWithIdOpts(idOpts, context) {
|
|
93
|
-
return (jwtIssuer, jwt) => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
let issuer;
|
|
95
|
-
if ((0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierDidOpts)(idOpts)) {
|
|
96
|
-
issuer = Object.assign(Object.assign({}, idOpts), { method: idOpts.method, noIdentifierInHeader: false });
|
|
97
|
-
}
|
|
98
|
-
else if ((0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierX5cOpts)(idOpts)) {
|
|
99
|
-
issuer = Object.assign(Object.assign({}, idOpts), { method: idOpts.method, noIdentifierInHeader: false });
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
return Promise.reject(Error(`JWT issuer method ${jwtIssuer.method} not yet supported`));
|
|
103
|
-
}
|
|
104
|
-
const result = yield context.agent.jwtCreateJwsCompactSignature({
|
|
105
|
-
issuer,
|
|
106
|
-
protectedHeader: jwt.header,
|
|
107
|
-
payload: jwt.payload,
|
|
108
|
-
});
|
|
109
|
-
return result.jwt;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function createJwtCallbackWithOpOpts(opOpts, context) {
|
|
113
|
-
return (jwtIssuer, jwt) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
let identifier;
|
|
115
|
-
if (jwtIssuer.method == 'did') {
|
|
116
|
-
identifier = jwtIssuer.didUrl;
|
|
117
|
-
}
|
|
118
|
-
else if (jwtIssuer.method == 'x5c') {
|
|
119
|
-
identifier = jwtIssuer.x5c;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
return Promise.reject(Error(`JWT issuer method ${jwtIssuer.method} not yet supported`));
|
|
123
|
-
}
|
|
124
|
-
const result = yield context.agent.jwtCreateJwsCompactSignature({
|
|
125
|
-
// FIXME fix cose-key inference
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
issuer: { identifier: identifier, kmsKeyRef: idOpts.kmsKeyRef, noIdentifierInHeader: false },
|
|
128
|
-
// FIXME fix JWK key_ops
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
protectedHeader: jwt.header,
|
|
131
|
-
payload: jwt.payload,
|
|
132
|
-
});
|
|
133
|
-
return result.jwt;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function getVerifyJwtCallback(_opts, context) {
|
|
137
|
-
return (_jwtVerifier, jwt) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const result = yield context.agent.jwtVerifyJwsSignature({ jws: jwt.raw });
|
|
139
|
-
console.log(result.message);
|
|
140
|
-
return !result.error;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
function createOP(_a) {
|
|
144
|
-
return __awaiter(this, arguments, void 0, function* ({ opOptions, idOpts, context, }) {
|
|
145
|
-
return (yield createOPBuilder({ opOptions, idOpts, context })).build();
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function getSigningAlgo(type) {
|
|
149
|
-
switch (type) {
|
|
150
|
-
case 'Ed25519':
|
|
151
|
-
return oid4vc_common_1.SigningAlgo.EDDSA;
|
|
152
|
-
case 'Secp256k1':
|
|
153
|
-
return oid4vc_common_1.SigningAlgo.ES256K;
|
|
154
|
-
case 'Secp256r1':
|
|
155
|
-
return oid4vc_common_1.SigningAlgo.ES256;
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
case 'RSA':
|
|
158
|
-
return oid4vc_common_1.SigningAlgo.RS256;
|
|
159
|
-
default:
|
|
160
|
-
throw Error('Key type not yet supported');
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/session/functions.ts"],"names":[],"mappings":";;;;;;;;;;;AAcA,oFAkCC;AAED,0CAmEC;AAED,kEA8BC;AAED,kEAyBC;AAmBD,4BAUC;AAED,wCAcC;AA7ND,2DAA4I;AAC5I,2DAA8F;AAE9F,mGAAmJ;AAEnJ,2FAA2F;AAK3F,mCAAqC;AAIrC,SAAsB,oCAAoC;yDAAC,EACzD,wBAAwB,EACxB,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,SAAS,EACT,MAAM,EACN,OAAO,EACP,iBAAiB,GAUlB;QACC,IAAI,OAAO,wBAAwB,KAAK,UAAU,EAAE,CAAC;YACnD,OAAO,wBAAwB,CAAA;QACjC,CAAC;QAED,OAAO,IAAA,iEAAiC,EACtC;YACE,MAAM;YACN,mBAAmB;YACnB,MAAM;YACN,SAAS;YACT,MAAM;YACN,iBAAiB;SAClB,EACD,OAAO,CACR,CAAA;IACH,CAAC;CAAA;AAED,SAAsB,eAAe;yDAAC,EACpC,SAAS,EACT,MAAM,EACN,OAAO,GAKR;;QACC,MAAM,YAAY,GAAG,MAAA,SAAS,CAAC,YAAY,mCAAI,IAAI,qBAAY,EAAE,CAAA;QACjE,MAAM,OAAO,GAAG,kBAAE,CAAC,OAAO,EAAE;aACzB,gBAAgB,CAAC,MAAA,SAAS,CAAC,YAAY,mCAAI,4BAAY,CAAC,WAAW,CAAC;aACpE,qBAAqB,CACpB,MAAA,SAAS,CAAC,iBAAiB,mCAAI;YAC7B,gCAAgB,CAAC,UAAU;YAC3B,gCAAgB,CAAC,8BAA8B;YAC/C,gCAAgB,CAAC,UAAU;YAC3B,gCAAgB,CAA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,EAAE,CAAA;IACxE,CAAC;CAAA;AAED,SAAgB,cAAc,CAAC,IAAc;IAC3C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,2BAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,WAAW;YACd,OAAO,2BAAW,CAAC,MAAM,CAAA;QAC3B,KAAK,WAAW;YACd,OAAO,2BAAW,CAAC,KAAK,CAAA;QAC1B,aAAa;QACb,KAAK,KAAK;YACR,OAAO,2BAAW,CAAC,KAAK,CAAA;QAC1B;YACE,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC"}
|
package/dist/session/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA"}
|
package/dist/session/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./functions"), exports);
|
|
18
|
-
__exportStar(require("./OID4VP"), exports);
|
|
19
|
-
__exportStar(require("./OpSession"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B"}
|