@sphereon/ssi-sdk.mdl-mdoc 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 +2568 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +223 -0
- package/dist/index.d.ts +222 -6
- package/dist/index.js +2538 -25
- package/dist/index.js.map +1 -1
- package/package.json +35 -24
- package/src/agent/mDLMdoc.ts +49 -64
- package/src/functions/index.ts +36 -35
- package/src/types/ImDLMdoc.ts +25 -8
- package/dist/agent/mDLMdoc.d.ts +0 -68
- package/dist/agent/mDLMdoc.d.ts.map +0 -1
- package/dist/agent/mDLMdoc.js +0 -251
- package/dist/agent/mDLMdoc.js.map +0 -1
- package/dist/functions/index.d.ts +0 -47
- package/dist/functions/index.d.ts.map +0 -1
- package/dist/functions/index.js +0 -260
- package/dist/functions/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types/ImDLMdoc.d.ts +0 -75
- package/dist/types/ImDLMdoc.d.ts.map +0 -1
- package/dist/types/ImDLMdoc.js +0 -3
- package/dist/types/ImDLMdoc.js.map +0 -1
package/dist/agent/mDLMdoc.js
DELETED
|
@@ -1,251 +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.MDLMdoc = exports.mdocSupportMethods = void 0;
|
|
13
|
-
const kmp_mdoc_core_1 = require("@sphereon/kmp-mdoc-core");
|
|
14
|
-
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
15
|
-
const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
|
|
16
|
-
const __1 = require("..");
|
|
17
|
-
const functions_1 = require("../functions");
|
|
18
|
-
var CborByteString = kmp_mdoc_core_1.com.sphereon.cbor.CborByteString;
|
|
19
|
-
var CoseKeyCbor = kmp_mdoc_core_1.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
20
|
-
var CoseSign1Json = kmp_mdoc_core_1.com.sphereon.crypto.cose.CoseSign1Json;
|
|
21
|
-
var CoseCryptoServiceJS = kmp_mdoc_core_1.com.sphereon.crypto.CoseCryptoServiceJS;
|
|
22
|
-
var CoseJoseKeyMappingService = kmp_mdoc_core_1.com.sphereon.crypto.CoseJoseKeyMappingService;
|
|
23
|
-
var KeyInfo = kmp_mdoc_core_1.com.sphereon.crypto.KeyInfo;
|
|
24
|
-
var DateTimeUtils = kmp_mdoc_core_1.com.sphereon.kmp.DateTimeUtils;
|
|
25
|
-
var decodeFrom = kmp_mdoc_core_1.com.sphereon.kmp.decodeFrom;
|
|
26
|
-
var encodeTo = kmp_mdoc_core_1.com.sphereon.kmp.encodeTo;
|
|
27
|
-
var Encoding = kmp_mdoc_core_1.com.sphereon.kmp.Encoding;
|
|
28
|
-
var DeviceResponseCbor = kmp_mdoc_core_1.com.sphereon.mdoc.data.device.DeviceResponseCbor;
|
|
29
|
-
var MdocValidations = kmp_mdoc_core_1.com.sphereon.mdoc.data.MdocValidations;
|
|
30
|
-
var MdocOid4vpService = kmp_mdoc_core_1.com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs;
|
|
31
|
-
var Oid4VPPresentationSubmission = kmp_mdoc_core_1.com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission;
|
|
32
|
-
exports.mdocSupportMethods = [
|
|
33
|
-
'x509VerifyCertificateChain',
|
|
34
|
-
'x509GetCertificateInfo',
|
|
35
|
-
'mdocVerifyIssuerSigned',
|
|
36
|
-
'mdocOid4vpHolderPresent',
|
|
37
|
-
'mdocOid4vpRPVerify'
|
|
38
|
-
];
|
|
39
|
-
/**
|
|
40
|
-
* The MDLMdoc class implements the IAgentPlugin interface, providing methods for
|
|
41
|
-
* verification and information retrieval related to X.509 certificates and mDL (mobile
|
|
42
|
-
* driver's license) documents.
|
|
43
|
-
*/
|
|
44
|
-
class MDLMdoc {
|
|
45
|
-
constructor(args) {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
this.schema = __1.schema.IMDLMdoc;
|
|
48
|
-
this.methods = {
|
|
49
|
-
x509VerifyCertificateChain: this.x509VerifyCertificateChain.bind(this),
|
|
50
|
-
x509GetCertificateInfo: this.x509GetCertificateInfo.bind(this),
|
|
51
|
-
mdocVerifyIssuerSigned: this.mdocVerifyIssuerSigned.bind(this),
|
|
52
|
-
mdocOid4vpHolderPresent: this.mdocOid4vpHolderPresent.bind(this),
|
|
53
|
-
mdocOid4vpRPVerify: this.mdocOid4vpRPVerify.bind(this)
|
|
54
|
-
};
|
|
55
|
-
this.trustAnchors = (_a = args === null || args === void 0 ? void 0 : args.trustAnchors) !== null && _a !== void 0 ? _a : [];
|
|
56
|
-
this.opts = (_b = args === null || args === void 0 ? void 0 : args.opts) !== null && _b !== void 0 ? _b : { trustRootWhenNoAnchors: true };
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Processes and verifies the provided mdoc, generates device response and presentation submission tokens.
|
|
60
|
-
*
|
|
61
|
-
* @param {MdocOid4vpPresentArgs} args - An object containing arguments for mdoc oid4vp holder presentation.
|
|
62
|
-
* @param {IRequiredContext} _context - Required context for the operation.
|
|
63
|
-
* @return {Promise<MdocOid4VPPresentationAuth>} A promise that resolves to an object containing vp_token and presentation_submission.
|
|
64
|
-
*/
|
|
65
|
-
mdocOid4vpHolderPresent(args, _context) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f;
|
|
68
|
-
const { mdocs, presentationDefinition, trustAnchors, verifications, mdocHolderNonce, authorizationRequestNonce, responseUri, clientId } = args;
|
|
69
|
-
const oid4vpService = new MdocOid4vpService();
|
|
70
|
-
// const mdoc = DocumentCbor.Static.cborDecode(decodeFrom(mdocBase64Url, Encoding.BASE64URL))
|
|
71
|
-
const validate = (mdoc) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
try {
|
|
74
|
-
const result = yield MdocValidations.fromDocumentAsync(mdoc, null, trustAnchors !== null && trustAnchors !== void 0 ? trustAnchors : this.trustAnchors, DateTimeUtils.Static.DEFAULT.dateTimeLocal(((_b = (_a = verifications === null || verifications === void 0 ? void 0 : verifications.verificationTime) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : Date.now()) / 1000), verifications === null || verifications === void 0 ? void 0 : verifications.allowExpiredDocuments);
|
|
75
|
-
if (result.error) {
|
|
76
|
-
console.log(JSON.stringify(result, null, 2));
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
console.log(e);
|
|
82
|
-
return {
|
|
83
|
-
error: true,
|
|
84
|
-
verifications: [
|
|
85
|
-
{
|
|
86
|
-
name: 'mdoc',
|
|
87
|
-
error: true,
|
|
88
|
-
critical: true,
|
|
89
|
-
message: e.message
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const allMatches = oid4vpService.matchDocumentsAndDescriptors(mdocHolderNonce, mdocs, presentationDefinition);
|
|
96
|
-
const docsAndDescriptors = [];
|
|
97
|
-
let lastError = undefined;
|
|
98
|
-
for (let match of allMatches) {
|
|
99
|
-
if (match.document) {
|
|
100
|
-
const result = yield validate(match.document);
|
|
101
|
-
if (!result.error || responseUri.includes('openid.net')) {
|
|
102
|
-
// TODO: We relax for the conformance suite, as the cert would be invalid
|
|
103
|
-
try {
|
|
104
|
-
const cborKey = ((_a = result.keyInfo) === null || _a === void 0 ? void 0 : _a.key) ? CoseKeyCbor.Static.fromDTO(result.keyInfo.key) : undefined;
|
|
105
|
-
if (!cborKey) {
|
|
106
|
-
throw Error('No key found in result');
|
|
107
|
-
}
|
|
108
|
-
let jwk = CoseJoseKeyMappingService.toJoseJwk(cborKey).toJsonDTO();
|
|
109
|
-
if (!((_b = result.keyInfo) === null || _b === void 0 ? void 0 : _b.kmsKeyRef)) {
|
|
110
|
-
const keyInfo = result.keyInfo;
|
|
111
|
-
const kid = (_c = jwk.kid) !== null && _c !== void 0 ? _c : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: jwk });
|
|
112
|
-
const key = yield _context.agent.keyManagerGet({ kid });
|
|
113
|
-
const kms = key.kms;
|
|
114
|
-
const kmsKeyRef = (_d = key.meta) === null || _d === void 0 ? void 0 : _d.kmsKeyRef;
|
|
115
|
-
const updateCborKey = cborKey.copy(false, cborKey.kty, (_e = cborKey.kid) !== null && _e !== void 0 ? _e : new CborByteString(decodeFrom(kid, Encoding.UTF8)));
|
|
116
|
-
const deviceKeyInfo = KeyInfo.Static.fromDTO(keyInfo).copy(kid, updateCborKey, keyInfo.opts, keyInfo.keyVisibility, keyInfo.signatureAlgorithm, keyInfo.x5c, kmsKeyRef, kms);
|
|
117
|
-
const updateMatch = match.copy(match.inputDescriptor, match.document, match.documentError, deviceKeyInfo);
|
|
118
|
-
match = updateMatch;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
console.log(`We tied to ammend key info from the KMS, but failed. Potential trouble ahead ${e.message}`, e);
|
|
123
|
-
}
|
|
124
|
-
docsAndDescriptors.push(match);
|
|
125
|
-
}
|
|
126
|
-
else if (result.error) {
|
|
127
|
-
lastError = result;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (docsAndDescriptors.length === 0) {
|
|
132
|
-
if (lastError) {
|
|
133
|
-
return Promise.reject(Error((_f = lastError.verifications[0].message) !== null && _f !== void 0 ? _f : 'No matching documents found'));
|
|
134
|
-
}
|
|
135
|
-
return Promise.reject(Error('No matching documents found'));
|
|
136
|
-
}
|
|
137
|
-
const deviceResponse = yield oid4vpService.createDeviceResponse(docsAndDescriptors, presentationDefinition, clientId, responseUri, authorizationRequestNonce);
|
|
138
|
-
const vp_token = encodeTo(deviceResponse.cborEncode(), Encoding.BASE64URL);
|
|
139
|
-
const presentation_submission = Oid4VPPresentationSubmission.Static.fromPresentationDefinition(presentationDefinition);
|
|
140
|
-
return { vp_token, presentation_submission };
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Verifies on the Relying Party (RP) side for mdoc (mobile document) OIDC4VP (OpenID Connect for Verifiable Presentations).
|
|
145
|
-
*
|
|
146
|
-
* @param {MdocOid4vpRPVerifyArgs} args - The arguments required for verification, including the vp_token, presentation_submission, and trustAnchors.
|
|
147
|
-
* @param {IRequiredContext} _context - The required context for this method.
|
|
148
|
-
* @return {Promise<MdocOid4vpRPVerifyResult>} - A promise that resolves to an object containing error status,
|
|
149
|
-
* validated documents, and the original presentation submission.
|
|
150
|
-
*/
|
|
151
|
-
mdocOid4vpRPVerify(args, _context) {
|
|
152
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
const { vp_token, presentation_submission, trustAnchors } = args;
|
|
154
|
-
const deviceResponse = DeviceResponseCbor.Static.cborDecode(decodeFrom(vp_token, Encoding.BASE64URL));
|
|
155
|
-
if (!deviceResponse.documents) {
|
|
156
|
-
return Promise.reject(Error(`No documents found in vp_token`));
|
|
157
|
-
}
|
|
158
|
-
let error = false;
|
|
159
|
-
const documents = yield Promise.all(deviceResponse.documents.map((document) => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
try {
|
|
161
|
-
const validations = yield MdocValidations.fromDocumentAsync(document, null, trustAnchors !== null && trustAnchors !== void 0 ? trustAnchors : this.trustAnchors);
|
|
162
|
-
if (!validations || validations.error) {
|
|
163
|
-
error = true;
|
|
164
|
-
}
|
|
165
|
-
if (presentation_submission.descriptor_map.find((m) => m.id === document.docType.value) === null) {
|
|
166
|
-
error = true;
|
|
167
|
-
validations.verifications.push({
|
|
168
|
-
name: 'mdoc',
|
|
169
|
-
error,
|
|
170
|
-
critical: error,
|
|
171
|
-
message: `No descriptor map id with document type ${document.docType.value} present`
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return { document: document.toJson(), validations };
|
|
175
|
-
}
|
|
176
|
-
catch (e) {
|
|
177
|
-
error = true;
|
|
178
|
-
return {
|
|
179
|
-
document: document.toJson(),
|
|
180
|
-
validations: {
|
|
181
|
-
error: true,
|
|
182
|
-
verifications: [
|
|
183
|
-
{
|
|
184
|
-
name: 'mdoc',
|
|
185
|
-
error,
|
|
186
|
-
critical: true,
|
|
187
|
-
message: e.message
|
|
188
|
-
}
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
})));
|
|
194
|
-
if (error) {
|
|
195
|
-
console.log(JSON.stringify(documents, null, 2));
|
|
196
|
-
}
|
|
197
|
-
return { error, documents, presentation_submission };
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Verifies the issuer-signed Mobile Document (mDoc) using the provided arguments and context.
|
|
202
|
-
*
|
|
203
|
-
* @param {MdocVerifyIssuerSignedArgs} args - The arguments required for verification, including input and key information.
|
|
204
|
-
* @param {IRequiredContext} context - The context encompassing necessary dependencies and configurations.
|
|
205
|
-
* @return {Promise<IVerifySignatureResult<KeyType>>} A promise that resolves to the result of the signature verification, including key information if available.
|
|
206
|
-
*/
|
|
207
|
-
mdocVerifyIssuerSigned(args, context) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
const { input, keyInfo, requireX5Chain } = args;
|
|
210
|
-
const coseKeyInfo = keyInfo && CoseJoseKeyMappingService.toCoseKeyInfo(keyInfo);
|
|
211
|
-
const verification = yield new CoseCryptoServiceJS(new functions_1.CoseCryptoService(context)).verify1(CoseSign1Json.Static.fromDTO(input).toCbor(), coseKeyInfo, requireX5Chain);
|
|
212
|
-
return Object.assign(Object.assign({}, verification), { keyInfo: keyInfo });
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Verifies an X.509 certificate chain against a set of trust anchors.
|
|
217
|
-
*
|
|
218
|
-
* @param {VerifyCertificateChainArgs} args - The arguments required for verifying the certificate chain.
|
|
219
|
-
* This includes the certificate chain to be verified and any additional trust anchors to be used.
|
|
220
|
-
* @param {IRequiredContext} _context - The context required for verification, including necessary dependencies and settings.
|
|
221
|
-
* @return {Promise<X509ValidationResult>} A promise that resolves to the result of the validation process, indicating the success or failure of the certificate chain verification.
|
|
222
|
-
*/
|
|
223
|
-
x509VerifyCertificateChain(args, _context) {
|
|
224
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
var _a;
|
|
226
|
-
const mergedAnchors = [...this.trustAnchors, ...((_a = args.trustAnchors) !== null && _a !== void 0 ? _a : [])];
|
|
227
|
-
const trustAnchors = new Set(mergedAnchors);
|
|
228
|
-
const validationResult = yield new functions_1.X509CallbackService(Array.from(mergedAnchors)).verifyCertificateChain(Object.assign(Object.assign({}, args), { trustAnchors: Array.from(trustAnchors), opts: Object.assign(Object.assign({}, args === null || args === void 0 ? void 0 : args.opts), this.opts) }));
|
|
229
|
-
console.log(`x509 validation for ${validationResult.error ? 'Error' : 'Success'}. message: ${validationResult.message}, details: ${validationResult.detailMessage}`);
|
|
230
|
-
return validationResult;
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Extracts information from a list of X509 certificates.
|
|
235
|
-
*
|
|
236
|
-
* @param {GetX509CertificateInfoArgs} args - Arguments required to retrieve certificate information,
|
|
237
|
-
* including the certificates and optional Subject Alternative Name (SAN) type filter.
|
|
238
|
-
* @param {IRequiredContext} context - The context required for the operation, which may include
|
|
239
|
-
* logging, configuration, and other operational details.
|
|
240
|
-
* @return {Promise<CertificateInfo[]>} A promise that resolves with an array of certificate
|
|
241
|
-
* information objects, each containing details extracted from individual certificates.
|
|
242
|
-
*/
|
|
243
|
-
x509GetCertificateInfo(args, context) {
|
|
244
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
-
const certificates = args.certificates.map((cert) => (0, ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate)(cert));
|
|
246
|
-
return yield Promise.all(certificates.map((cert) => (0, ssi_sdk_ext_x509_utils_1.getCertificateInfo)(cert, args.sanTypeFilter && { sanTypeFilter: args.sanTypeFilter })));
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
exports.MDLMdoc = MDLMdoc;
|
|
251
|
-
//# sourceMappingURL=mDLMdoc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mDLMdoc.js","sourceRoot":"","sources":["../../src/agent/mDLMdoc.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAA6C;AAC7C,2EAAwE;AACxE,6EAKyC;AAGzC,0BAMW;AACX,4CAAqE;AASrE,IAAO,cAAc,GAAG,mBAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAA;AACxD,IAAO,WAAW,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAA;AACzD,IAAO,aAAa,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAA;AAC7D,IAAO,mBAAmB,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAA;AACpE,I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AAC,CAAC,sBAAsB,iCACnG,IAAI,KACP,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EACtC,IAAI,kCAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,GAAK,IAAI,CAAC,IAAI,KACnC,CAAA;YACF,OAAO,CAAC,GAAG,CACT,uBAAuB,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,cAAc,gBAAgB,CAAC,OAAO,cAAc,gBAAgB,CAAC,aAAa,EAAE,CACxJ,CAAA;YACD,OAAO,gBAAgB,CAAA;QACzB,CAAC;KAAA;IAED;;;;;;;;;OASG;IACW,sBAAsB,CAAC,IAAgC,EAAE,OAAyB;;YAC9F,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,kDAAyB,EAAC,IAAI,CAAC,CAAC,CAAA;YACrF,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,2CAAkB,EAAC,IAAI,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;QAC7I,CAAC;KAAA;CACF;AA9PD,0BA8PC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { com, Nullable } from '@sphereon/kmp-mdoc-core';
|
|
2
|
-
import { X509ValidationResult } from '@sphereon/ssi-sdk-ext.x509-utils';
|
|
3
|
-
import { IRequiredContext, VerifyCertificateChainArgs } from '../types/ImDLMdoc';
|
|
4
|
-
import CoseSign1Cbor = com.sphereon.crypto.cose.CoseSign1Cbor;
|
|
5
|
-
import ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
6
|
-
import ToBeSignedCbor = com.sphereon.crypto.cose.ToBeSignedCbor;
|
|
7
|
-
import IVerifySignatureResult = com.sphereon.crypto.generic.IVerifySignatureResult;
|
|
8
|
-
import ICoseCryptoCallbackJS = com.sphereon.crypto.ICoseCryptoCallbackJS;
|
|
9
|
-
import IKey = com.sphereon.crypto.IKey;
|
|
10
|
-
import IKeyInfo = com.sphereon.crypto.IKeyInfo;
|
|
11
|
-
import IX509ServiceJS = com.sphereon.crypto.IX509ServiceJS;
|
|
12
|
-
import IX509VerificationResult = com.sphereon.crypto.IX509VerificationResult;
|
|
13
|
-
import X509VerificationProfile = com.sphereon.crypto.X509VerificationProfile;
|
|
14
|
-
import LocalDateTimeKMP = com.sphereon.kmp.LocalDateTimeKMP;
|
|
15
|
-
export declare class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
16
|
-
private context?;
|
|
17
|
-
constructor(context?: IRequiredContext | undefined);
|
|
18
|
-
setContext(context: IRequiredContext): void;
|
|
19
|
-
signAsync(input: ToBeSignedCbor, requireX5Chain: Nullable<boolean>): Promise<Int8Array>;
|
|
20
|
-
verify1Async<CborType>(input: CoseSign1Cbor<CborType>, keyInfo: IKeyInfo<ICoseKeyCbor>, requireX5Chain: Nullable<boolean>): Promise<IVerifySignatureResult<ICoseKeyCbor>>;
|
|
21
|
-
resolvePublicKeyAsync<KT extends com.sphereon.crypto.IKey>(keyInfo: com.sphereon.crypto.IKeyInfo<KT>): Promise<com.sphereon.crypto.IResolvedKeyInfo<KT>>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* This class can be used for X509 validations.
|
|
25
|
-
* Either have an instance per trustedCerts and verification invocation or use a single instance and provide the trusted certs in the method argument
|
|
26
|
-
*
|
|
27
|
-
* The class is also registered with the low-level mDL/mdoc Kotlin Multiplatform library
|
|
28
|
-
* Next to the specific function for the library it exports a more powerful version of the same verification method as well
|
|
29
|
-
*/
|
|
30
|
-
export declare class X509CallbackService implements IX509ServiceJS {
|
|
31
|
-
private _trustedCerts?;
|
|
32
|
-
constructor(trustedCerts?: Array<string>);
|
|
33
|
-
/**
|
|
34
|
-
* A more powerful version of the method below. Allows to verify at a specific time and returns more information
|
|
35
|
-
* @param chain
|
|
36
|
-
* @param trustAnchors
|
|
37
|
-
* @param verificationTime
|
|
38
|
-
*/
|
|
39
|
-
verifyCertificateChain({ chain, trustAnchors, verificationTime, opts, }: VerifyCertificateChainArgs): Promise<X509ValidationResult>;
|
|
40
|
-
/**
|
|
41
|
-
* This method is the implementation used within the mDL/Mdoc library
|
|
42
|
-
*/
|
|
43
|
-
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<IX509VerificationResult<KeyType>>;
|
|
44
|
-
setTrustedCerts: (trustedCertsInPEM?: Array<string>) => void;
|
|
45
|
-
getTrustedCerts: () => string[] | undefined;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAOL,oBAAoB,EACrB,MAAM,kCAAkC,CAAA;AAKzC,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAEhF,OAAO,aAAa,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAA;AAC7D,OAAO,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAA;AAC3D,OAAO,cAAc,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAA;AAG/D,OAAO,sBAAsB,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,OA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C,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;CAMrD;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IACxD,OAAO,CAAC,aAAa,CAAC,CAAe;gBAEzB,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC;IAIxC;;;;;OAKG;IACG,sBAAsB,CAAC,EAC3B,KAAK,EACL,YAAqC,EACrC,gBAAgB,EAChB,IAAI,GACL,EAAE,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAS7D;;OAEG;IACG,wBAAwB,CAAC,OAAO,SAAS,IAAI,EACjD,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,EAC/B,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAC5B,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAChC,mBAAmB,CAAC,EAAE,uBAAuB,GAAG,SAAS,EACzD,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAC5C,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IA6B5C,eAAe,uBAAwB,KAAK,CAAC,MAAM,CAAC,UAQnD;IAED,eAAe,6BAA2B;CAC3C"}
|
package/dist/functions/index.js
DELETED
|
@@ -1,260 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.X509CallbackService = exports.CoseCryptoService = void 0;
|
|
36
|
-
const kmp_mdoc_core_1 = require("@sphereon/kmp-mdoc-core");
|
|
37
|
-
const ssi_sdk_ext_key_utils_1 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
38
|
-
const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils");
|
|
39
|
-
const crypto = __importStar(require("crypto"));
|
|
40
|
-
const pkijs_1 = require("pkijs");
|
|
41
|
-
const u8a = __importStar(require("uint8arrays"));
|
|
42
|
-
var CoseKeyCbor = kmp_mdoc_core_1.com.sphereon.crypto.cose.CoseKeyCbor;
|
|
43
|
-
var CoseJoseKeyMappingService = kmp_mdoc_core_1.com.sphereon.crypto.CoseJoseKeyMappingService;
|
|
44
|
-
var DefaultCallbacks = kmp_mdoc_core_1.com.sphereon.crypto.DefaultCallbacks;
|
|
45
|
-
var SignatureAlgorithm = kmp_mdoc_core_1.com.sphereon.crypto.generic.SignatureAlgorithm;
|
|
46
|
-
var KeyInfo = kmp_mdoc_core_1.com.sphereon.crypto.KeyInfo;
|
|
47
|
-
var ResolvedKeyInfo = kmp_mdoc_core_1.com.sphereon.crypto.ResolvedKeyInfo;
|
|
48
|
-
var DateTimeUtils = kmp_mdoc_core_1.com.sphereon.kmp.DateTimeUtils;
|
|
49
|
-
var decodeFrom = kmp_mdoc_core_1.com.sphereon.kmp.decodeFrom;
|
|
50
|
-
var encodeTo = kmp_mdoc_core_1.com.sphereon.kmp.encodeTo;
|
|
51
|
-
var Encoding = kmp_mdoc_core_1.com.sphereon.kmp.Encoding;
|
|
52
|
-
class CoseCryptoService {
|
|
53
|
-
constructor(context) {
|
|
54
|
-
this.context = context;
|
|
55
|
-
}
|
|
56
|
-
setContext(context) {
|
|
57
|
-
this.context = context;
|
|
58
|
-
}
|
|
59
|
-
signAsync(input, requireX5Chain) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
var _a, _b, _c;
|
|
62
|
-
if (!this.context) {
|
|
63
|
-
throw Error('No context provided. Please provide a context with the setContext method or constructor');
|
|
64
|
-
}
|
|
65
|
-
const { keyInfo, alg, value } = input;
|
|
66
|
-
let kmsKeyRef = (_a = keyInfo.kmsKeyRef) !== null && _a !== void 0 ? _a : undefined;
|
|
67
|
-
if (!kmsKeyRef) {
|
|
68
|
-
const key = keyInfo.key;
|
|
69
|
-
if (key == null) {
|
|
70
|
-
return Promise.reject(Error('No key present in keyInfo. This implementation cannot sign without a key!'));
|
|
71
|
-
}
|
|
72
|
-
const resolvedKeyInfo = ResolvedKeyInfo.Static.fromKeyInfo(keyInfo, key);
|
|
73
|
-
const jwkKeyInfo = CoseJoseKeyMappingService.toResolvedJwkKeyInfo(resolvedKeyInfo);
|
|
74
|
-
const kid = (_c = (_b = jwkKeyInfo.kid) !== null && _b !== void 0 ? _b : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprint)({ jwk: jwkKeyInfo.key.toJsonDTO() })) !== null && _c !== void 0 ? _c : jwkKeyInfo.key.getKidAsString(true);
|
|
75
|
-
if (!kid) {
|
|
76
|
-
return Promise.reject(Error('No kid present and not kmsKeyRef provided'));
|
|
77
|
-
}
|
|
78
|
-
kmsKeyRef = kid;
|
|
79
|
-
}
|
|
80
|
-
const result = yield this.context.agent.keyManagerSign({
|
|
81
|
-
algorithm: alg.jose.value,
|
|
82
|
-
data: encodeTo(value, Encoding.UTF8),
|
|
83
|
-
encoding: 'utf-8',
|
|
84
|
-
keyRef: kmsKeyRef,
|
|
85
|
-
});
|
|
86
|
-
return decodeFrom(result, Encoding.UTF8);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
verify1Async(input, keyInfo, requireX5Chain) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
92
|
-
const getCertAndKey = (x5c) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
if (requireX5Chain && (!x5c || x5c.length === 0)) {
|
|
94
|
-
// We should not be able to get here anyway, as the MLD-mdoc library already validated at this point. But let's make sure
|
|
95
|
-
return Promise.reject(new Error(`No x5chain was present in the CoseSign headers!`));
|
|
96
|
-
}
|
|
97
|
-
// TODO: According to the IETF spec there should be a x5t in case the x5chain is in the protected headers. In the Funke this does not seem to be done/used!
|
|
98
|
-
issuerCert = x5c ? (0, ssi_sdk_ext_x509_utils_1.pemOrDerToX509Certificate)(x5c[0]) : undefined;
|
|
99
|
-
let issuerJwk;
|
|
100
|
-
if (issuerCert) {
|
|
101
|
-
const info = yield (0, ssi_sdk_ext_x509_utils_1.getCertificateInfo)(issuerCert);
|
|
102
|
-
issuerJwk = info.publicKeyJWK;
|
|
103
|
-
}
|
|
104
|
-
return { issuerCert, issuerJwk };
|
|
105
|
-
});
|
|
106
|
-
const coseKeyInfo = CoseJoseKeyMappingService.toCoseKeyInfo(keyInfo);
|
|
107
|
-
if ((_a = coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.key) === null || _a === void 0 ? void 0 : _a.d) {
|
|
108
|
-
throw Error('Do not use private keys to verify!');
|
|
109
|
-
}
|
|
110
|
-
else if (!((_b = input.payload) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
111
|
-
return Promise.reject(Error('Signature validation without payload not supported'));
|
|
112
|
-
}
|
|
113
|
-
const sign1Json = input.toJson(); // Let's make it a bit easier on ourselves, instead of working with CBOR
|
|
114
|
-
const coseAlg = sign1Json.protectedHeader.alg;
|
|
115
|
-
if (!coseAlg) {
|
|
116
|
-
return Promise.reject(Error('No alg protected header present'));
|
|
117
|
-
}
|
|
118
|
-
let issuerCert;
|
|
119
|
-
let issuerCoseKey;
|
|
120
|
-
let kid = (_d = (_c = coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.kid) !== null && _c !== void 0 ? _c : sign1Json.protectedHeader.kid) !== null && _d !== void 0 ? _d : (_e = sign1Json.unprotectedHeader) === null || _e === void 0 ? void 0 : _e.kid;
|
|
121
|
-
// Please note this method does not perform chain validation. The MDL-MSO_MDOC library already performed this before this step
|
|
122
|
-
const x5c = (_j = (_g = (_f = coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.key) === null || _f === void 0 ? void 0 : _f.getX509CertificateChain()) !== null && _g !== void 0 ? _g : (_h = sign1Json.protectedHeader) === null || _h === void 0 ? void 0 : _h.x5chain) !== null && _j !== void 0 ? _j : (_k = sign1Json.unprotectedHeader) === null || _k === void 0 ? void 0 : _k.x5chain;
|
|
123
|
-
if (!coseKeyInfo || !(coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.key) || ((_l = coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.key) === null || _l === void 0 ? void 0 : _l.x5chain)) {
|
|
124
|
-
const certAndKey = yield getCertAndKey(x5c);
|
|
125
|
-
issuerCoseKey = certAndKey.issuerJwk ? CoseJoseKeyMappingService.toCoseKey(certAndKey.issuerJwk) : undefined;
|
|
126
|
-
issuerCert = certAndKey.issuerCert;
|
|
127
|
-
}
|
|
128
|
-
if (!issuerCoseKey) {
|
|
129
|
-
if (!(coseKeyInfo === null || coseKeyInfo === void 0 ? void 0 : coseKeyInfo.key)) {
|
|
130
|
-
return Promise.reject(Error(`Either a x5c needs to be in the headers, or you need to provide a key for verification`));
|
|
131
|
-
}
|
|
132
|
-
if (kid === null) {
|
|
133
|
-
kid = coseKeyInfo.key.getKidAsString(false);
|
|
134
|
-
}
|
|
135
|
-
issuerCoseKey = CoseKeyCbor.Static.fromDTO(coseKeyInfo.key);
|
|
136
|
-
}
|
|
137
|
-
const issuerCoseKeyInfo = new KeyInfo(kid, issuerCoseKey, coseKeyInfo.opts, coseKeyInfo.keyVisibility, (_m = issuerCoseKey.getSignatureAlgorithm()) !== null && _m !== void 0 ? _m : coseKeyInfo.signatureAlgorithm, x5c, coseKeyInfo.kmsKeyRef, coseKeyInfo.kms, (_o = coseKeyInfo.keyType) !== null && _o !== void 0 ? _o : issuerCoseKey.getKty());
|
|
138
|
-
const recalculatedToBeSigned = input.toBeSignedJson(issuerCoseKeyInfo, SignatureAlgorithm.Static.fromCose(coseAlg));
|
|
139
|
-
const key = CoseJoseKeyMappingService.toJoseJwk(issuerCoseKeyInfo.key).toJsonDTO();
|
|
140
|
-
const valid = yield (0, ssi_sdk_ext_key_utils_1.verifyRawSignature)({
|
|
141
|
-
data: u8a.fromString(recalculatedToBeSigned.base64UrlValue, 'base64url'),
|
|
142
|
-
signature: u8a.fromString(sign1Json.signature, 'base64url'),
|
|
143
|
-
key,
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
name: 'mdoc',
|
|
147
|
-
critical: true,
|
|
148
|
-
error: !valid,
|
|
149
|
-
message: `Signature of '${issuerCert ? (0, ssi_sdk_ext_x509_utils_1.getSubjectDN)(issuerCert).DN : kid}' was ${valid ? '' : 'in'}valid`,
|
|
150
|
-
keyInfo: issuerCoseKeyInfo,
|
|
151
|
-
};
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
resolvePublicKeyAsync(keyInfo) {
|
|
155
|
-
if (keyInfo.key) {
|
|
156
|
-
return Promise.resolve(CoseJoseKeyMappingService.toResolvedKeyInfo(keyInfo, keyInfo.key));
|
|
157
|
-
}
|
|
158
|
-
return Promise.reject(Error('No key present in keyInfo. This implementation cannot resolve public keys on its own currently!'));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.CoseCryptoService = CoseCryptoService;
|
|
162
|
-
/**
|
|
163
|
-
* This class can be used for X509 validations.
|
|
164
|
-
* Either have an instance per trustedCerts and verification invocation or use a single instance and provide the trusted certs in the method argument
|
|
165
|
-
*
|
|
166
|
-
* The class is also registered with the low-level mDL/mdoc Kotlin Multiplatform library
|
|
167
|
-
* Next to the specific function for the library it exports a more powerful version of the same verification method as well
|
|
168
|
-
*/
|
|
169
|
-
class X509CallbackService {
|
|
170
|
-
constructor(trustedCerts) {
|
|
171
|
-
this.setTrustedCerts = (trustedCertsInPEM) => {
|
|
172
|
-
this._trustedCerts = trustedCertsInPEM === null || trustedCertsInPEM === void 0 ? void 0 : trustedCertsInPEM.map((cert) => {
|
|
173
|
-
if (cert.includes('CERTIFICATE')) {
|
|
174
|
-
// PEM
|
|
175
|
-
return cert;
|
|
176
|
-
}
|
|
177
|
-
return (0, ssi_sdk_ext_x509_utils_1.derToPEM)(cert);
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
this.getTrustedCerts = () => this._trustedCerts;
|
|
181
|
-
this.setTrustedCerts(trustedCerts);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* A more powerful version of the method below. Allows to verify at a specific time and returns more information
|
|
185
|
-
* @param chain
|
|
186
|
-
* @param trustAnchors
|
|
187
|
-
* @param verificationTime
|
|
188
|
-
*/
|
|
189
|
-
verifyCertificateChain(_a) {
|
|
190
|
-
return __awaiter(this, arguments, void 0, function* ({ chain, trustAnchors = this.getTrustedCerts(), verificationTime, opts, }) {
|
|
191
|
-
return yield (0, ssi_sdk_ext_x509_utils_1.validateX509CertificateChain)({
|
|
192
|
-
chain,
|
|
193
|
-
trustAnchors,
|
|
194
|
-
verificationTime,
|
|
195
|
-
opts,
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* This method is the implementation used within the mDL/Mdoc library
|
|
201
|
-
*/
|
|
202
|
-
verifyCertificateChainJS(chainDER, chainPEM, trustedCerts, verificationProfile, verificationTime) {
|
|
203
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
var _a;
|
|
205
|
-
const verificationAt = verificationTime !== null && verificationTime !== void 0 ? verificationTime : DateTimeUtils.Static.DEFAULT.dateTimeLocal();
|
|
206
|
-
let chain = [];
|
|
207
|
-
if (chainDER && chainDER.length > 0) {
|
|
208
|
-
chain = chainDER.map((der) => Uint8Array.from(der));
|
|
209
|
-
}
|
|
210
|
-
if (chainPEM && chainPEM.length > 0) {
|
|
211
|
-
chain = (chain !== null && chain !== void 0 ? chain : []).concat(chainPEM);
|
|
212
|
-
}
|
|
213
|
-
const result = yield (0, ssi_sdk_ext_x509_utils_1.validateX509CertificateChain)({
|
|
214
|
-
chain: chain, // The function will handle an empty array
|
|
215
|
-
trustAnchors: trustedCerts !== null && trustedCerts !== void 0 ? trustedCerts : this.getTrustedCerts(),
|
|
216
|
-
verificationTime: new Date(verificationAt.toEpochSeconds().toULong() * 1000),
|
|
217
|
-
opts: { trustRootWhenNoAnchors: true },
|
|
218
|
-
});
|
|
219
|
-
const cert = result.certificateChain ? result.certificateChain[result.certificateChain.length - 1] : undefined;
|
|
220
|
-
return {
|
|
221
|
-
publicKey: cert === null || cert === void 0 ? void 0 : cert.publicKeyJWK, // fixme
|
|
222
|
-
publicKeyAlgorithm: (_a = cert === null || cert === void 0 ? void 0 : cert.publicKeyJWK) === null || _a === void 0 ? void 0 : _a.alg,
|
|
223
|
-
name: 'x.509',
|
|
224
|
-
critical: result.critical,
|
|
225
|
-
message: result.message,
|
|
226
|
-
error: result.error,
|
|
227
|
-
verificationTime: verificationAt,
|
|
228
|
-
};
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
exports.X509CallbackService = X509CallbackService;
|
|
233
|
-
const defaultCryptoEngine = () => {
|
|
234
|
-
if (typeof self !== 'undefined') {
|
|
235
|
-
if ('crypto' in self) {
|
|
236
|
-
let engineName = 'webcrypto';
|
|
237
|
-
if ('webkitSubtle' in self.crypto) {
|
|
238
|
-
engineName = 'safari';
|
|
239
|
-
}
|
|
240
|
-
// @ts-ignore
|
|
241
|
-
(0, pkijs_1.setEngine)(engineName, new pkijs_1.CryptoEngine({ name: engineName, crypto: crypto }));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else if (typeof crypto !== 'undefined' && 'webcrypto' in crypto) {
|
|
245
|
-
const name = 'NodeJS ^15';
|
|
246
|
-
const nodeCrypto = crypto.webcrypto;
|
|
247
|
-
// @ts-ignore
|
|
248
|
-
(0, pkijs_1.setEngine)(name, new pkijs_1.CryptoEngine({ name, crypto: nodeCrypto }));
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
// @ts-ignore
|
|
252
|
-
const name = 'crypto';
|
|
253
|
-
(0, pkijs_1.setEngine)(name, new pkijs_1.CryptoEngine({ name, crypto: (0, ssi_sdk_ext_key_utils_1.globalCrypto)(false) }));
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
defaultCryptoEngine();
|
|
257
|
-
// We register the services with the mDL/mdoc library. Please note that the context is not passed in, meaning we cannot sign by default.
|
|
258
|
-
DefaultCallbacks.setCoseCryptoDefault(new CoseCryptoService());
|
|
259
|
-
DefaultCallbacks.setX509Default(new X509CallbackService());
|
|
260
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAAuD;AACvD,2EAA0G;AAC1G,6EAQyC;AAEzC,+CAAgC;AAChC,iCAA4D;AAC5D,iDAAkC;AAElC,IAAO,WAAW,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAA;AAIzD,IAAO,yBAAyB,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,yBAAyB,CAAA;AAChF,IAAO,gBAAgB,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAA;AAE9D,IAAO,kBAAkB,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAA;AAO1E,IAAO,OAAO,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAA;AAC5C,IAAO,eAAe,GAAG,mBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAA;AAE5D,IAAO,aAAa,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAA;AACrD,IAAO,UAAU,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAA;AAC/C,IAAO,QAAQ,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAA;AAC3C,IAAO,QAAQ,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAA;AAG3C,MAAa,iBAAiB;IAC5B,YAAoB,OAA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