@sphereon/ssi-sdk.mdl-mdoc 0.33.1-feature.vcdm2.tsup.31 → 0.33.1-next.2
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/agent/mDLMdoc.d.ts +68 -0
- package/dist/agent/mDLMdoc.d.ts.map +1 -0
- package/dist/agent/mDLMdoc.js +251 -0
- package/dist/agent/mDLMdoc.js.map +1 -0
- package/dist/functions/index.d.ts +47 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +260 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/index.d.ts +6 -222
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -2538
- package/dist/index.js.map +1 -1
- package/dist/types/ImDLMdoc.d.ts +75 -0
- package/dist/types/ImDLMdoc.d.ts.map +1 -0
- package/dist/types/ImDLMdoc.js +3 -0
- package/dist/types/ImDLMdoc.js.map +1 -0
- package/package.json +25 -35
- package/src/agent/mDLMdoc.ts +21 -18
- package/src/functions/index.ts +34 -35
- package/src/types/ImDLMdoc.ts +8 -25
- package/dist/index.cjs +0 -2568
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -223
|
@@ -0,0 +1,260 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CA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AA;IACjE,CAAC;SAAM,CAAC;QACN,aAAa;QACb,MAAM,IAAI,GAAG,QAAQ,CAAA;QACrB,IAAA,iBAAS,EAAC,IAAI,EAAE,IAAI,oBAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAA,oCAAY,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC,CAAA;AAED,mBAAmB,EAAE,CAAA;AAErB,wIAAwI;AACxI,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAA;AAC9D,gBAAgB,CAAC,cAAc,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,223 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { IPluginMethodMap, IAgentContext, IDIDManager, IResolver, IAgentPlugin } from '@veramo/core';
|
|
3
|
-
import * as _sphereon_kmp_mdoc_core from '@sphereon/kmp-mdoc-core';
|
|
4
|
-
import { com, Nullable } from '@sphereon/kmp-mdoc-core';
|
|
5
|
-
import { PresentationDefinitionV2, PresentationSubmission } from '@sphereon/pex-models';
|
|
6
|
-
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager';
|
|
7
|
-
import { X509ValidationResult, SubjectAlternativeGeneralName, CertificateInfo } from '@sphereon/ssi-sdk-ext.x509-utils';
|
|
8
|
-
|
|
9
|
-
type IKey$1 = com.sphereon.crypto.IKey;
|
|
10
|
-
type CoseSign1Json = com.sphereon.crypto.cose.CoseSign1Json;
|
|
11
|
-
type CoseSign1Cbor<Any> = com.sphereon.crypto.cose.CoseSign1Cbor<Any>;
|
|
12
|
-
type ICoseKeyCbor$1 = com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
13
|
-
type ICoseKeyJson = com.sphereon.crypto.cose.ICoseKeyJson;
|
|
14
|
-
type IKeyInfo<KT extends IKey$1 = IKey$1> = com.sphereon.crypto.IKeyInfo<KT>;
|
|
15
|
-
type IVerifyResults<KT extends IKey$1> = com.sphereon.crypto.generic.IVerifyResults<KT>;
|
|
16
|
-
type IVerifySignatureResult<KT extends IKey$1> = com.sphereon.crypto.generic.IVerifySignatureResult<KT>;
|
|
17
|
-
type DocumentJson = com.sphereon.mdoc.data.device.DocumentJson;
|
|
18
|
-
type DocumentCbor = com.sphereon.mdoc.data.device.DocumentCbor;
|
|
19
|
-
declare const CborByteString: typeof com.sphereon.cbor.CborByteString;
|
|
20
|
-
declare const CoseKeyCbor: typeof com.sphereon.crypto.cose.CoseKeyCbor;
|
|
21
|
-
declare const CoseCryptoServiceJS: typeof com.sphereon.crypto.CoseCryptoServiceJS;
|
|
22
|
-
declare const CoseJoseKeyMappingService: {
|
|
23
|
-
toJoseJwk(key: com.sphereon.crypto.IKey): com.sphereon.crypto.jose.Jwk;
|
|
24
|
-
toCoseKey(key: com.sphereon.crypto.IKey): com.sphereon.crypto.cose.CoseKeyCbor;
|
|
25
|
-
getJoseX5c(key: com.sphereon.crypto.IKey): _sphereon_kmp_mdoc_core.Nullable<Array<string>>;
|
|
26
|
-
toJoseX5c(x5c: _sphereon_kmp_mdoc_core.Nullable<Array<any>>): _sphereon_kmp_mdoc_core.Nullable<Array<string>>;
|
|
27
|
-
toJwkKeyInfo(keyInfo: com.sphereon.crypto.IKeyInfo<any>): com.sphereon.crypto.KeyInfo<com.sphereon.crypto.jose.Jwk>;
|
|
28
|
-
toResolvedJwkKeyInfo(resolvedKeyInfo: com.sphereon.crypto.IResolvedKeyInfo<any>): com.sphereon.crypto.ResolvedKeyInfo<com.sphereon.crypto.jose.Jwk>;
|
|
29
|
-
toCoseKeyInfo(keyInfo: com.sphereon.crypto.IKeyInfo<any>): com.sphereon.crypto.KeyInfo<com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
30
|
-
toResolvedCoseKeyInfo(resolvedKeyInfo: com.sphereon.crypto.IResolvedKeyInfo<any>): com.sphereon.crypto.ResolvedKeyInfo<com.sphereon.crypto.cose.CoseKeyCbor>;
|
|
31
|
-
isResolvedKeyInfo(keyInfo: com.sphereon.crypto.IKeyInfo<any>): boolean;
|
|
32
|
-
toResolvedKeyInfo<KeyType extends com.sphereon.crypto.IKey>(keyInfo: com.sphereon.crypto.IKeyInfo<any>, key?: _sphereon_kmp_mdoc_core.Nullable<KeyType>): com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
33
|
-
toResolvedKeyInfoWithResolver<KeyType extends com.sphereon.crypto.IKey>(keyInfo: com.sphereon.crypto.IKeyInfo<KeyType>, resolveCallback: _sphereon_kmp_mdoc_core.Nullable<(p0: com.sphereon.crypto.IKeyInfo<KeyType>) => com.sphereon.crypto.ResolvedKeyInfo<KeyType>>): com.sphereon.crypto.ResolvedKeyInfo<KeyType>;
|
|
34
|
-
getCoseX5chain(key: com.sphereon.crypto.IKey): _sphereon_kmp_mdoc_core.Nullable<com.sphereon.cbor.CborArray<com.sphereon.cbor.CborByteString>>;
|
|
35
|
-
toCoseX5chain(x5c: _sphereon_kmp_mdoc_core.Nullable<Array<any>>): _sphereon_kmp_mdoc_core.Nullable<com.sphereon.cbor.CborArray<com.sphereon.cbor.CborByteString>>;
|
|
36
|
-
};
|
|
37
|
-
declare const KeyInfo: typeof com.sphereon.crypto.KeyInfo;
|
|
38
|
-
declare const DateTimeUtils: typeof com.sphereon.kmp.DateTimeUtils;
|
|
39
|
-
declare const decodeFrom: typeof com.sphereon.kmp.decodeFrom;
|
|
40
|
-
declare const encodeTo: typeof com.sphereon.kmp.encodeTo;
|
|
41
|
-
declare const Encoding: typeof com.sphereon.kmp.Encoding;
|
|
42
|
-
declare const MdocValidations: {
|
|
43
|
-
fromDocumentAsync(document: com.sphereon.mdoc.data.device.DocumentCbor, keyInfo?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.crypto.IKeyInfo<com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: _sphereon_kmp_mdoc_core.Nullable<Array<string>>, verificationTime?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: _sphereon_kmp_mdoc_core.Nullable<boolean>, dateTimeUtils?: com.sphereon.kmp.DateTimeUtils, timeZoneId?: _sphereon_kmp_mdoc_core.Nullable<string>, clockSkewAllowedInSec?: number): Promise<com.sphereon.crypto.generic.IVerifyResults<com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
44
|
-
fromIssuerAuthAsync(issuerAuth: com.sphereon.crypto.cose.CoseSign1Cbor<com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>, keyInfo?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.crypto.IKeyInfo<com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: _sphereon_kmp_mdoc_core.Nullable<Array<string>>, verificationTime?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: _sphereon_kmp_mdoc_core.Nullable<boolean>, dateTimeUtils?: com.sphereon.kmp.DateTimeUtils, timeZoneId?: _sphereon_kmp_mdoc_core.Nullable<string>, clockSkewAllowedInSec?: number): Promise<com.sphereon.crypto.generic.IVerifyResults<com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
45
|
-
withParamsAsync(issuerAuth?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.crypto.cose.CoseSign1Cbor<com.sphereon.mdoc.data.mso.MobileSecurityObjectCbor>>, document?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.mdoc.data.device.DocumentCbor>, mdocVerificationTypes?: _sphereon_kmp_mdoc_core.kotlin.collections.KtSet<com.sphereon.mdoc.data.MdocVerification>, keyInfo?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.crypto.IKeyInfo<com.sphereon.crypto.cose.ICoseKeyCbor>>, trustedCerts?: _sphereon_kmp_mdoc_core.Nullable<Array<string>>, verificationTime?: _sphereon_kmp_mdoc_core.Nullable<com.sphereon.kmp.LocalDateTimeKMP>, allowExpiredDocuments?: _sphereon_kmp_mdoc_core.Nullable<boolean>, dateTimeUtils?: com.sphereon.kmp.DateTimeUtils, timeZoneId?: _sphereon_kmp_mdoc_core.Nullable<string>, clockSkewAllowedInSec?: number): Promise<com.sphereon.crypto.generic.IVerifyResults<com.sphereon.crypto.cose.ICoseKeyCbor>>;
|
|
46
|
-
};
|
|
47
|
-
declare const MdocOid4vpService: typeof com.sphereon.mdoc.oid4vp.MdocOid4vpServiceJs;
|
|
48
|
-
declare const Jwk: typeof com.sphereon.crypto.jose.Jwk;
|
|
49
|
-
type DocumentDescriptorMatchResult = com.sphereon.mdoc.oid4vp.DocumentDescriptorMatchResult;
|
|
50
|
-
type IOid4VPPresentationDefinition = com.sphereon.mdoc.oid4vp.IOid4VPPresentationDefinition;
|
|
51
|
-
declare const Oid4VPPresentationSubmission: typeof com.sphereon.mdoc.oid4vp.Oid4VPPresentationSubmission;
|
|
52
|
-
interface ImDLMdoc extends IPluginMethodMap {
|
|
53
|
-
x509VerifyCertificateChain(args: VerifyCertificateChainArgs, context: IRequiredContext): Promise<X509ValidationResult>;
|
|
54
|
-
x509GetCertificateInfo(args: GetX509CertificateInfoArgs, context: IRequiredContext): Promise<CertificateInfo[]>;
|
|
55
|
-
mdocVerifyIssuerSigned(args: MdocVerifyIssuerSignedArgs, context: IRequiredContext): Promise<IVerifySignatureResult<KeyType>>;
|
|
56
|
-
mdocOid4vpHolderPresent(args: MdocOid4vpPresentArgs, context: IRequiredContext): Promise<MdocOid4VPPresentationAuth>;
|
|
57
|
-
mdocOid4vpRPVerify(args: MdocOid4vpRPVerifyArgs, _context: IRequiredContext): Promise<MdocOid4vpRPVerifyResult>;
|
|
58
|
-
}
|
|
59
|
-
type IRequiredContext = IAgentContext<ISphereonKeyManager & IDIDManager & IResolver>;
|
|
60
|
-
type VerifyCertificateChainArgs = {
|
|
61
|
-
chain: Array<string | Uint8Array>;
|
|
62
|
-
trustAnchors?: string[];
|
|
63
|
-
verificationTime?: Date;
|
|
64
|
-
opts?: {
|
|
65
|
-
allowNoTrustAnchorsFound?: boolean;
|
|
66
|
-
trustRootWhenNoAnchors?: boolean;
|
|
67
|
-
allowSingleNoCAChainElement?: boolean;
|
|
68
|
-
blindlyTrustedAnchors?: string[];
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
type GetX509CertificateInfoArgs = {
|
|
72
|
-
certificates: (string | Uint8Array)[];
|
|
73
|
-
sanTypeFilter?: SubjectAlternativeGeneralName | SubjectAlternativeGeneralName[];
|
|
74
|
-
};
|
|
75
|
-
type KeyType = ICoseKeyJson;
|
|
76
|
-
type MdocVerifyIssuerSignedArgs = {
|
|
77
|
-
input: CoseSign1Json;
|
|
78
|
-
keyInfo?: IKeyInfo<KeyType>;
|
|
79
|
-
requireX5Chain?: boolean;
|
|
80
|
-
};
|
|
81
|
-
interface MdocOid4VPPresentationAuth {
|
|
82
|
-
vp_token: string;
|
|
83
|
-
presentation_submission: PresentationSubmission;
|
|
84
|
-
}
|
|
85
|
-
interface MdocOid4vpPresentArgs {
|
|
86
|
-
mdocs: DocumentCbor[];
|
|
87
|
-
mdocHolderNonce?: string;
|
|
88
|
-
presentationDefinition: PresentationDefinitionV2;
|
|
89
|
-
trustAnchors?: string[];
|
|
90
|
-
verifications?: VerificationOptions;
|
|
91
|
-
clientId: string;
|
|
92
|
-
responseUri: string;
|
|
93
|
-
authorizationRequestNonce: string;
|
|
94
|
-
}
|
|
95
|
-
type VerificationOptions = {
|
|
96
|
-
allowExpiredDocuments?: boolean;
|
|
97
|
-
verificationTime?: Date;
|
|
98
|
-
};
|
|
99
|
-
type DocumentVerifyResult = {
|
|
100
|
-
document: DocumentJson;
|
|
101
|
-
validations: IVerifyResults<ICoseKeyCbor$1>;
|
|
102
|
-
};
|
|
103
|
-
type MdocOid4vpRPVerifyResult = {
|
|
104
|
-
error: boolean;
|
|
105
|
-
documents: Array<DocumentVerifyResult>;
|
|
106
|
-
presentation_submission: PresentationSubmission;
|
|
107
|
-
};
|
|
108
|
-
interface MdocOid4vpRPVerifyArgs {
|
|
109
|
-
vp_token: string;
|
|
110
|
-
presentation_submission: PresentationSubmission;
|
|
111
|
-
trustAnchors?: string[];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
declare const mdocSupportMethods: Array<string>;
|
|
115
|
-
/**
|
|
116
|
-
* The MDLMdoc class implements the IAgentPlugin interface, providing methods for
|
|
117
|
-
* verification and information retrieval related to X.509 certificates and mDL (mobile
|
|
118
|
-
* driver's license) documents.
|
|
119
|
-
*/
|
|
120
|
-
declare class MDLMdoc implements IAgentPlugin {
|
|
121
|
-
readonly schema: any;
|
|
122
|
-
readonly methods: ImDLMdoc;
|
|
123
|
-
private readonly trustAnchors;
|
|
124
|
-
private opts;
|
|
125
|
-
constructor(args?: {
|
|
126
|
-
trustAnchors?: string[];
|
|
127
|
-
opts?: {
|
|
128
|
-
trustRootWhenNoAnchors?: boolean;
|
|
129
|
-
allowSingleNoCAChainElement?: boolean;
|
|
130
|
-
blindlyTrustedAnchors?: string[];
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
/**
|
|
134
|
-
* Processes and verifies the provided mdoc, generates device response and presentation submission tokens.
|
|
135
|
-
*
|
|
136
|
-
* @param {MdocOid4vpPresentArgs} args - An object containing arguments for mdoc oid4vp holder presentation.
|
|
137
|
-
* @param {IRequiredContext} _context - Required context for the operation.
|
|
138
|
-
* @return {Promise<MdocOid4VPPresentationAuth>} A promise that resolves to an object containing vp_token and presentation_submission.
|
|
139
|
-
*/
|
|
140
|
-
private mdocOid4vpHolderPresent;
|
|
141
|
-
/**
|
|
142
|
-
* Verifies on the Relying Party (RP) side for mdoc (mobile document) OIDC4VP (OpenID Connect for Verifiable Presentations).
|
|
143
|
-
*
|
|
144
|
-
* @param {MdocOid4vpRPVerifyArgs} args - The arguments required for verification, including the vp_token, presentation_submission, and trustAnchors.
|
|
145
|
-
* @param {IRequiredContext} _context - The required context for this method.
|
|
146
|
-
* @return {Promise<MdocOid4vpRPVerifyResult>} - A promise that resolves to an object containing error status,
|
|
147
|
-
* validated documents, and the original presentation submission.
|
|
148
|
-
*/
|
|
149
|
-
private mdocOid4vpRPVerify;
|
|
150
|
-
/**
|
|
151
|
-
* Verifies the issuer-signed Mobile Document (mDoc) using the provided arguments and context.
|
|
152
|
-
*
|
|
153
|
-
* @param {MdocVerifyIssuerSignedArgs} args - The arguments required for verification, including input and key information.
|
|
154
|
-
* @param {IRequiredContext} context - The context encompassing necessary dependencies and configurations.
|
|
155
|
-
* @return {Promise<IVerifySignatureResult<KeyType>>} A promise that resolves to the result of the signature verification, including key information if available.
|
|
156
|
-
*/
|
|
157
|
-
private mdocVerifyIssuerSigned;
|
|
158
|
-
/**
|
|
159
|
-
* Verifies an X.509 certificate chain against a set of trust anchors.
|
|
160
|
-
*
|
|
161
|
-
* @param {VerifyCertificateChainArgs} args - The arguments required for verifying the certificate chain.
|
|
162
|
-
* This includes the certificate chain to be verified and any additional trust anchors to be used.
|
|
163
|
-
* @param {IRequiredContext} _context - The context required for verification, including necessary dependencies and settings.
|
|
164
|
-
* @return {Promise<X509ValidationResult>} A promise that resolves to the result of the validation process, indicating the success or failure of the certificate chain verification.
|
|
165
|
-
*/
|
|
166
|
-
private x509VerifyCertificateChain;
|
|
167
|
-
/**
|
|
168
|
-
* Extracts information from a list of X509 certificates.
|
|
169
|
-
*
|
|
170
|
-
* @param {GetX509CertificateInfoArgs} args - Arguments required to retrieve certificate information,
|
|
171
|
-
* including the certificates and optional Subject Alternative Name (SAN) type filter.
|
|
172
|
-
* @param {IRequiredContext} context - The context required for the operation, which may include
|
|
173
|
-
* logging, configuration, and other operational details.
|
|
174
|
-
* @return {Promise<CertificateInfo[]>} A promise that resolves with an array of certificate
|
|
175
|
-
* information objects, each containing details extracted from individual certificates.
|
|
176
|
-
*/
|
|
177
|
-
private x509GetCertificateInfo;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
type ICoseKeyCbor = com.sphereon.crypto.cose.ICoseKeyCbor;
|
|
181
|
-
type ToBeSignedCbor = com.sphereon.crypto.cose.ToBeSignedCbor;
|
|
182
|
-
type ICoseCryptoCallbackJS = com.sphereon.crypto.ICoseCryptoCallbackJS;
|
|
183
|
-
type IKey = com.sphereon.crypto.IKey;
|
|
184
|
-
type IX509ServiceJS = com.sphereon.crypto.IX509ServiceJS;
|
|
185
|
-
type X509VerificationProfile = com.sphereon.crypto.X509VerificationProfile;
|
|
186
|
-
type LocalDateTimeKMP = com.sphereon.kmp.LocalDateTimeKMP;
|
|
187
|
-
declare class CoseCryptoService implements ICoseCryptoCallbackJS {
|
|
188
|
-
private context?;
|
|
189
|
-
constructor(context?: IRequiredContext | undefined);
|
|
190
|
-
setContext(context: IRequiredContext): void;
|
|
191
|
-
signAsync(input: ToBeSignedCbor, requireX5Chain: Nullable<boolean>): Promise<Int8Array>;
|
|
192
|
-
verify1Async<CborType>(input: com.sphereon.crypto.cose.CoseSign1Cbor<CborType>, keyInfo: com.sphereon.crypto.IKeyInfo<ICoseKeyCbor>, requireX5Chain: Nullable<boolean>): Promise<com.sphereon.crypto.generic.IVerifySignatureResult<ICoseKeyCbor>>;
|
|
193
|
-
resolvePublicKeyAsync<KT extends com.sphereon.crypto.IKey>(keyInfo: com.sphereon.crypto.IKeyInfo<KT>): Promise<com.sphereon.crypto.IResolvedKeyInfo<KT>>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* This class can be used for X509 validations.
|
|
197
|
-
* Either have an instance per trustedCerts and verification invocation or use a single instance and provide the trusted certs in the method argument
|
|
198
|
-
*
|
|
199
|
-
* The class is also registered with the low-level mDL/mdoc Kotlin Multiplatform library
|
|
200
|
-
* Next to the specific function for the library it exports a more powerful version of the same verification method as well
|
|
201
|
-
*/
|
|
202
|
-
declare class X509CallbackService implements IX509ServiceJS {
|
|
203
|
-
private _trustedCerts?;
|
|
204
|
-
constructor(trustedCerts?: Array<string>);
|
|
205
|
-
/**
|
|
206
|
-
* A more powerful version of the method below. Allows to verify at a specific time and returns more information
|
|
207
|
-
* @param chain
|
|
208
|
-
* @param trustAnchors
|
|
209
|
-
* @param verificationTime
|
|
210
|
-
*/
|
|
211
|
-
verifyCertificateChain({ chain, trustAnchors, verificationTime, opts, }: VerifyCertificateChainArgs): Promise<X509ValidationResult>;
|
|
212
|
-
/**
|
|
213
|
-
* This method is the implementation used within the mDL/Mdoc library
|
|
214
|
-
*/
|
|
215
|
-
verifyCertificateChainJS<KeyType extends IKey>(chainDER: Nullable<Int8Array[]>, chainPEM: Nullable<string[]>, trustedCerts: Nullable<string[]>, verificationProfile?: X509VerificationProfile | undefined, verificationTime?: Nullable<LocalDateTimeKMP>): Promise<com.sphereon.crypto.IX509VerificationResult<KeyType>>;
|
|
216
|
-
setTrustedCerts: (trustedCertsInPEM?: Array<string>) => void;
|
|
217
|
-
getTrustedCerts: () => string[] | undefined;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
declare const logger: _sphereon_ssi_types.ISimpleLogger<unknown>;
|
|
1
|
+
export declare const logger: import("@sphereon/ssi-types").ISimpleLogger<unknown>;
|
|
221
2
|
declare const schema: any;
|
|
222
|
-
|
|
223
|
-
export {
|
|
3
|
+
export { schema };
|
|
4
|
+
export { MDLMdoc, mdocSupportMethods } from './agent/mDLMdoc';
|
|
5
|
+
export * from './types/ImDLMdoc';
|
|
6
|
+
export * from './functions';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,sDAAuC,CAAA;AAC1D,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAC7D,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA"}
|