@ledgerhq/revault-sdk 0.22.10 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bake.cjs +61 -15
- package/lib/bake.cjs.map +1 -1
- package/lib/bake.d.cts +1 -1
- package/lib/bake.d.ts +1 -1
- package/lib/bake.js +48 -2
- package/lib/bake.js.map +1 -1
- package/lib/{chunk-P53CFOI6.cjs → chunk-2WGM7EWA.cjs} +14 -3
- package/lib/chunk-2WGM7EWA.cjs.map +1 -0
- package/lib/{chunk-2HKHCIKX.cjs → chunk-4ZXMEPRB.cjs} +4 -2
- package/lib/chunk-4ZXMEPRB.cjs.map +1 -0
- package/lib/{chunk-73OX5XDM.js → chunk-KV5FO7N5.js} +12 -1
- package/lib/chunk-KV5FO7N5.js.map +1 -0
- package/lib/{chunk-42CFPNWC.js → chunk-QWC3M2RL.js} +4 -2
- package/lib/{chunk-42CFPNWC.js.map → chunk-QWC3M2RL.js.map} +1 -1
- package/lib/crypto.cjs +4 -2
- package/lib/crypto.cjs.map +1 -1
- package/lib/crypto.d.cts +13 -1
- package/lib/crypto.d.ts +13 -1
- package/lib/crypto.js +3 -1
- package/lib/device.cjs +2 -2
- package/lib/device.js +1 -1
- package/lib/engine.cjs +117 -43
- package/lib/engine.cjs.map +1 -1
- package/lib/engine.d.cts +2 -2
- package/lib/engine.d.ts +2 -2
- package/lib/engine.js +90 -16
- package/lib/engine.js.map +1 -1
- package/lib/onboarding.d.cts +1 -1
- package/lib/onboarding.d.ts +1 -1
- package/lib/{types-mF8XT2Vl.d.cts → types-6nV5J9yp.d.cts} +8 -5
- package/lib/{types-BTcYWX_0.d.ts → types-BdCVJxZy.d.ts} +8 -5
- package/package.json +4 -2
- package/lib/chunk-2HKHCIKX.cjs.map +0 -1
- package/lib/chunk-73OX5XDM.js.map +0 -1
- package/lib/chunk-P53CFOI6.cjs.map +0 -1
package/lib/engine.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var _chunkLH4QQXUHcjs = require('./chunk-LH4QQXUH.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk4ZXMEPRBcjs = require('./chunk-4ZXMEPRB.cjs');
|
|
19
19
|
|
|
20
20
|
// src/engine/index.ts
|
|
21
21
|
var _invariant = require('invariant'); var _invariant2 = _interopRequireDefault(_invariant);
|
|
@@ -25,9 +25,6 @@ var _errors = require('@ledgerhq/errors');
|
|
|
25
25
|
|
|
26
26
|
var _rxjs = require('rxjs');
|
|
27
27
|
var MAX_CHUNK_LENGTH = 250;
|
|
28
|
-
var FIXME_NOT_IMPLEMENTED = (fnName) => async () => {
|
|
29
|
-
throw new Error(`Not implemented: ${fnName}`);
|
|
30
|
-
};
|
|
31
28
|
var getPathFromPathString = (pathString) => {
|
|
32
29
|
const parts = pathString.split("'/").map((part) => Number.parseInt(part, 10));
|
|
33
30
|
return parts.map((part) => (part | 2147483648) >>> 0);
|
|
@@ -39,7 +36,7 @@ var splitChunks = (chunk, buffer) => {
|
|
|
39
36
|
}
|
|
40
37
|
return chunks;
|
|
41
38
|
};
|
|
42
|
-
var removeStatus = (result) => result.slice(0, result.length -
|
|
39
|
+
var removeStatus = (result) => result.slice(0, result.length - _chunk4ZXMEPRBcjs.STATUS_LENGTH);
|
|
43
40
|
var sendByChunk = async (transport, command, data, chunkSize = MAX_CHUNK_LENGTH) => {
|
|
44
41
|
const chunks = splitChunks(chunkSize, data);
|
|
45
42
|
let response = Buffer.from([]);
|
|
@@ -49,7 +46,7 @@ var sendByChunk = async (transport, command, data, chunkSize = MAX_CHUNK_LENGTH)
|
|
|
49
46
|
apdu[2] = i && 128;
|
|
50
47
|
response = await transport.send(apdu[0], apdu[1], apdu[2], apdu[3], chunk, [
|
|
51
48
|
36864,
|
|
52
|
-
...
|
|
49
|
+
..._chunk4ZXMEPRBcjs.PAGINATED_STATUS
|
|
53
50
|
]);
|
|
54
51
|
}
|
|
55
52
|
return response;
|
|
@@ -92,7 +89,7 @@ var buildAttestation = (params) => {
|
|
|
92
89
|
};
|
|
93
90
|
var genericRetryOnError = (err) => {
|
|
94
91
|
if (err instanceof _errors.LockedDeviceError) return true;
|
|
95
|
-
if (
|
|
92
|
+
if (_chunk4ZXMEPRBcjs.isTransportStatusError.call(void 0, err) && err.statusCode === 27913) return true;
|
|
96
93
|
if (err instanceof _errors.DisconnectedDevice) return true;
|
|
97
94
|
return false;
|
|
98
95
|
};
|
|
@@ -100,7 +97,7 @@ function createRealDevice(options, logger) {
|
|
|
100
97
|
const { transportId } = options;
|
|
101
98
|
async function run(job, retryOnError = genericRetryOnError) {
|
|
102
99
|
return _rxjs.lastValueFrom.call(void 0,
|
|
103
|
-
|
|
100
|
+
_chunk4ZXMEPRBcjs.withDevicePolling.call(void 0, transportId)((transport) => _rxjs.from.call(void 0, job(transport)), retryOnError)
|
|
104
101
|
);
|
|
105
102
|
}
|
|
106
103
|
const noRetry = () => false;
|
|
@@ -113,10 +110,10 @@ function createRealDevice(options, logger) {
|
|
|
113
110
|
_nullishCoalesce(opts.retryOnError, () => ( alwaysRetry))
|
|
114
111
|
);
|
|
115
112
|
try {
|
|
116
|
-
await getPublicKey(
|
|
113
|
+
await getPublicKey(_chunk4ZXMEPRBcjs.PATHS.U2F, { secp256k1: true, retryOnError: noRetry });
|
|
117
114
|
return { isAppOpened: true };
|
|
118
115
|
} catch (err) {
|
|
119
|
-
if (
|
|
116
|
+
if (_chunk4ZXMEPRBcjs.isTransportStatusError.call(void 0, err) && genericRetryOnError(err)) {
|
|
120
117
|
return { isAppOpened: false };
|
|
121
118
|
}
|
|
122
119
|
throw err;
|
|
@@ -147,18 +144,18 @@ function createRealDevice(options, logger) {
|
|
|
147
144
|
);
|
|
148
145
|
const pubKeyLength = response.readInt8(0);
|
|
149
146
|
const pubKey = response.slice(1, pubKeyLength + 1).toString("hex").toUpperCase();
|
|
150
|
-
const signature = response.slice(pubKeyLength + 1, response.length -
|
|
147
|
+
const signature = response.slice(pubKeyLength + 1, response.length - _chunk4ZXMEPRBcjs.STATUS_LENGTH).toString("base64");
|
|
151
148
|
return { pubKey, signature };
|
|
152
149
|
};
|
|
153
150
|
const device = {
|
|
154
151
|
authenticate: async ({ challenge: { challenge, name, role, keyHandle }, workspaceName }) => {
|
|
155
152
|
logger.info(`[device] Authenticate`);
|
|
156
153
|
_invariant2.default.call(void 0, role !== "READ_ONLY_API_KEY", "Invalid role for authenticate: READ_ONLY_API_KEY");
|
|
157
|
-
const applicationBuffer = Buffer.from(
|
|
154
|
+
const applicationBuffer = Buffer.from(_chunk4ZXMEPRBcjs.APPID_VAULT_ADMINISTRATOR, "hex");
|
|
158
155
|
const nameBuffer = Buffer.from(name);
|
|
159
156
|
const workspaceBuffer = Buffer.from(workspaceName);
|
|
160
157
|
const keyHandleData = Buffer.concat([
|
|
161
|
-
Buffer.from(
|
|
158
|
+
Buffer.from(_chunk4ZXMEPRBcjs.STR_ROLES[role], "hex"),
|
|
162
159
|
Buffer.from([nameBuffer.length]),
|
|
163
160
|
nameBuffer,
|
|
164
161
|
Buffer.from([workspaceBuffer.length]),
|
|
@@ -185,8 +182,34 @@ function createRealDevice(options, logger) {
|
|
|
185
182
|
);
|
|
186
183
|
return removeStatus(bufWithStatus).toString("hex");
|
|
187
184
|
},
|
|
188
|
-
generateSeedFragment:
|
|
189
|
-
|
|
185
|
+
generateSeedFragment: async () => {
|
|
186
|
+
logger.info(`[device] generateSeedFragment`);
|
|
187
|
+
const path = getPathFromPathString(_chunk4ZXMEPRBcjs.PATHS.KEY_MATERIAL);
|
|
188
|
+
const data = Buffer.concat([
|
|
189
|
+
Buffer.from([path.length]),
|
|
190
|
+
...path.map((derivation) => {
|
|
191
|
+
const buf = Buffer.alloc(4);
|
|
192
|
+
buf.writeUInt32BE(derivation, 0);
|
|
193
|
+
return buf;
|
|
194
|
+
})
|
|
195
|
+
]);
|
|
196
|
+
const response = await run((transport) => transport.send(224, 68, 0, 0, data));
|
|
197
|
+
return removeStatus(response).toString("base64");
|
|
198
|
+
},
|
|
199
|
+
generateWrappingKeyFragment: async () => {
|
|
200
|
+
logger.info(`[device] generateWrappingKeyFragment`);
|
|
201
|
+
const path = getPathFromPathString(_chunk4ZXMEPRBcjs.PATHS.KEY_MATERIAL);
|
|
202
|
+
const data = Buffer.concat([
|
|
203
|
+
Buffer.from([path.length]),
|
|
204
|
+
...path.map((derivation) => {
|
|
205
|
+
const buf = Buffer.alloc(4);
|
|
206
|
+
buf.writeUInt32BE(derivation, 0);
|
|
207
|
+
return buf;
|
|
208
|
+
})
|
|
209
|
+
]);
|
|
210
|
+
const response = await run((transport) => transport.send(224, 68, 1, 0, data));
|
|
211
|
+
return removeStatus(response).toString("base64");
|
|
212
|
+
},
|
|
190
213
|
getAttestation: async () => {
|
|
191
214
|
const bufWithStatus = await run((transport) => transport.send(224, 65, 0, 0));
|
|
192
215
|
const buffer = removeStatus(bufWithStatus);
|
|
@@ -212,10 +235,14 @@ function createRealDevice(options, logger) {
|
|
|
212
235
|
confidentialityKeySignature: sig.toString("hex")
|
|
213
236
|
};
|
|
214
237
|
},
|
|
215
|
-
getConfidentialityPubKey: () => getPublicKey(
|
|
216
|
-
getDeviceUserId:
|
|
217
|
-
|
|
218
|
-
|
|
238
|
+
getConfidentialityPubKey: () => getPublicKey(_chunk4ZXMEPRBcjs.PATHS.CONFIDENTIALITY, { secp256k1: true }),
|
|
239
|
+
getDeviceUserId: async () => {
|
|
240
|
+
logger.info(`[device] getDeviceUserId`);
|
|
241
|
+
const response = await run((transport) => transport.send(224, 82, 0, 0));
|
|
242
|
+
return removeStatus(response).toString("hex").toUpperCase();
|
|
243
|
+
},
|
|
244
|
+
getU2FPubKey: () => getPublicKey(_chunk4ZXMEPRBcjs.PATHS.U2F, { secp256k1: false }),
|
|
245
|
+
getValidationPubKey: () => getPublicKey(_chunk4ZXMEPRBcjs.PATHS.VALIDATION, { secp256k1: true }),
|
|
219
246
|
hasPairing: async () => {
|
|
220
247
|
logger.info(`[device] hasPairing`);
|
|
221
248
|
const apdu = [224, 81, 0, 0, 181];
|
|
@@ -227,19 +254,48 @@ function createRealDevice(options, logger) {
|
|
|
227
254
|
const res = await run((transport) => transport.send(224, 70, 0, 0));
|
|
228
255
|
const pubKeyLength = res.readInt8(0);
|
|
229
256
|
const pubKey = res.slice(1, pubKeyLength + 1).toString("hex").toUpperCase();
|
|
230
|
-
const signature = res.slice(pubKeyLength + 1, res.length -
|
|
257
|
+
const signature = res.slice(pubKeyLength + 1, res.length - _chunk4ZXMEPRBcjs.STATUS_LENGTH).toString("base64");
|
|
231
258
|
return { pubKey, signature };
|
|
232
259
|
},
|
|
233
|
-
openSession:
|
|
260
|
+
openSession: async (params) => {
|
|
261
|
+
logger.info(`[device] openSession`);
|
|
262
|
+
const { secureChannel } = params;
|
|
263
|
+
const path = getPathFromPathString(_chunk4ZXMEPRBcjs.PATHS.CONFIDENTIALITY);
|
|
264
|
+
const dataDerivation = Buffer.concat([
|
|
265
|
+
Buffer.from([path.length]),
|
|
266
|
+
...path.map((derivation) => {
|
|
267
|
+
const buf = Buffer.alloc(4);
|
|
268
|
+
buf.writeUInt32BE(derivation, 0);
|
|
269
|
+
return buf;
|
|
270
|
+
})
|
|
271
|
+
]);
|
|
272
|
+
const pubKey = Buffer.from(secureChannel.pubKey, "hex");
|
|
273
|
+
const sigBuffer = Buffer.from(secureChannel.certificate.signature, "base64");
|
|
274
|
+
const attestationPubBuffer = Buffer.from(secureChannel.certificate.attestationPub, "base64");
|
|
275
|
+
const certBuffer = Buffer.from(secureChannel.certificate.certificate, "base64");
|
|
276
|
+
const attestation = Buffer.concat([
|
|
277
|
+
Buffer.from([sigBuffer.length]),
|
|
278
|
+
sigBuffer,
|
|
279
|
+
attestationPubBuffer,
|
|
280
|
+
Buffer.from([certBuffer.length]),
|
|
281
|
+
certBuffer
|
|
282
|
+
]);
|
|
283
|
+
const lengthAttestation = Buffer.alloc(2);
|
|
284
|
+
lengthAttestation.writeUInt16BE(attestation.length, 0);
|
|
285
|
+
const data = Buffer.concat([dataDerivation, pubKey, lengthAttestation, attestation]);
|
|
286
|
+
await run(
|
|
287
|
+
(transport) => sendByChunk(transport, [224, 66, 0, _chunk4ZXMEPRBcjs.SCRIPT_IDS.INIT_SESSION], data)
|
|
288
|
+
);
|
|
289
|
+
},
|
|
234
290
|
register: async (params) => {
|
|
235
291
|
const { challenge: strChallenge, u2fRegisterData: _, name, role } = params;
|
|
236
292
|
const challenge = Buffer.from(strChallenge, "hex");
|
|
237
293
|
_invariant2.default.call(void 0, challenge.length === 32, "challenge hex is expected to have 32 bytes");
|
|
238
|
-
const applicationBuf = Buffer.from(
|
|
294
|
+
const applicationBuf = Buffer.from(_chunk4ZXMEPRBcjs.APPID_VAULT_ADMINISTRATOR, "hex");
|
|
239
295
|
_invariant2.default.call(void 0, applicationBuf.length === 32, "application hex is expected to have 32 bytes");
|
|
240
296
|
const userNameBuff = Buffer.from(name);
|
|
241
297
|
const keyHandleData = Buffer.concat([
|
|
242
|
-
Buffer.from(
|
|
298
|
+
Buffer.from(_chunk4ZXMEPRBcjs.STR_ROLES[role], "hex"),
|
|
243
299
|
Buffer.from([userNameBuff.length]),
|
|
244
300
|
userNameBuff
|
|
245
301
|
]);
|
|
@@ -280,17 +336,29 @@ function createRealDevice(options, logger) {
|
|
|
280
336
|
const final = Buffer.concat([length, psdPayload]);
|
|
281
337
|
await run((transport) => sendByChunk(transport, [224, 78, 0, 0], final));
|
|
282
338
|
},
|
|
283
|
-
startKKPatternAsResponder:
|
|
339
|
+
startKKPatternAsResponder: async (params) => {
|
|
340
|
+
logger.info(`[device] startKKPatternAsResponder`);
|
|
341
|
+
const data = buildAttestation(params);
|
|
342
|
+
const bufWithStatus = await run(
|
|
343
|
+
(transport) => sendByChunk(transport, [224, 76, 0, _chunk4ZXMEPRBcjs.SCRIPT_IDS.ACCOUNT_MANAGER_SESSION], data)
|
|
344
|
+
);
|
|
345
|
+
const buffer = removeStatus(bufWithStatus);
|
|
346
|
+
const dataLength = buffer.readInt8(0);
|
|
347
|
+
return {
|
|
348
|
+
handshake: buffer.slice(1, dataLength + 1).toString("base64"),
|
|
349
|
+
signature: buffer.slice(dataLength + 1).toString("base64")
|
|
350
|
+
};
|
|
351
|
+
},
|
|
284
352
|
startKPatternAsResponder: async (params) => {
|
|
285
353
|
logger.info(`[device] startKPatternAsResponder`);
|
|
286
354
|
const data = buildAttestation(params);
|
|
287
355
|
await run(
|
|
288
|
-
(transport) => sendByChunk(transport, [224, 73, 0,
|
|
356
|
+
(transport) => sendByChunk(transport, [224, 73, 0, _chunk4ZXMEPRBcjs.SCRIPT_IDS.ACCOUNT_MANAGER_SESSION], data)
|
|
289
357
|
);
|
|
290
358
|
},
|
|
291
359
|
validateVaultOperation: async (params) => {
|
|
292
360
|
logger.info(`[device] validateVaultOperation`);
|
|
293
|
-
const path = getPathFromPathString(
|
|
361
|
+
const path = getPathFromPathString(_chunk4ZXMEPRBcjs.PATHS.VALIDATION);
|
|
294
362
|
const paths = Buffer.concat([
|
|
295
363
|
Buffer.from([path.length]),
|
|
296
364
|
...path.map((derivation) => {
|
|
@@ -312,10 +380,10 @@ function createRealDevice(options, logger) {
|
|
|
312
380
|
const responseType = response.readInt8(0);
|
|
313
381
|
let responseStatus = response.readUInt16BE(response.length - 2);
|
|
314
382
|
switch (responseType) {
|
|
315
|
-
case
|
|
383
|
+
case _chunk4ZXMEPRBcjs.STREAMING_NEXT_ACTION:
|
|
316
384
|
nextActionId = response.readUIntBE(1, 2);
|
|
317
385
|
break;
|
|
318
|
-
case
|
|
386
|
+
case _chunk4ZXMEPRBcjs.STREAMING_RESPONSE:
|
|
319
387
|
finalResponse = response.slice(3, response.length - 2);
|
|
320
388
|
while (responseStatus !== 36864) {
|
|
321
389
|
{
|
|
@@ -382,7 +450,8 @@ async function genericRegister({
|
|
|
382
450
|
name,
|
|
383
451
|
role,
|
|
384
452
|
getChallenge,
|
|
385
|
-
submitChallenge
|
|
453
|
+
submitChallenge,
|
|
454
|
+
onScreenDisplayed
|
|
386
455
|
}) {
|
|
387
456
|
const [attestation, u2fPubKey, confidentialityKey] = await Promise.all([
|
|
388
457
|
device.getAttestation(),
|
|
@@ -407,6 +476,7 @@ async function genericRegister({
|
|
|
407
476
|
partitionId: challenge.ciphertext,
|
|
408
477
|
handshakeAttestation: challenge.handshakeAttestation
|
|
409
478
|
});
|
|
479
|
+
await _optionalChain([onScreenDisplayed, 'optionalCall', _5 => _5()]);
|
|
410
480
|
const register = await device.register({
|
|
411
481
|
challenge: challenge.challenge,
|
|
412
482
|
u2fRegisterData: challenge.u2fRegisterData,
|
|
@@ -440,7 +510,7 @@ function createEngine(options, logger) {
|
|
|
440
510
|
baseUrl: options.baseUrl
|
|
441
511
|
};
|
|
442
512
|
const client = createClient(clientOptions);
|
|
443
|
-
const apiDevice =
|
|
513
|
+
const apiDevice = _chunk4ZXMEPRBcjs.createApiDevice.call(void 0, options, logger);
|
|
444
514
|
const base = {
|
|
445
515
|
client,
|
|
446
516
|
createClient: (overrides) => createClient({ ...clientOptions, ...overrides }),
|
|
@@ -528,7 +598,7 @@ function createEngine(options, logger) {
|
|
|
528
598
|
claim: { role, pubKey, deviceName, confidentialityKey }
|
|
529
599
|
});
|
|
530
600
|
},
|
|
531
|
-
collectWrappingKeyFragment: async (wrappingKey) => {
|
|
601
|
+
collectWrappingKeyFragment: async (wrappingKey, params) => {
|
|
532
602
|
const [{ pubKey }, confidentialityKey] = await Promise.all([
|
|
533
603
|
device.getU2FPubKey(),
|
|
534
604
|
device.getConfidentialityPubKey()
|
|
@@ -540,6 +610,7 @@ function createEngine(options, logger) {
|
|
|
540
610
|
}
|
|
541
611
|
});
|
|
542
612
|
const { attestation } = await device.getAttestation();
|
|
613
|
+
await _optionalChain([params, 'optionalAccess', _6 => _6.onScreenDisplayed, 'optionalCall', _7 => _7()]);
|
|
543
614
|
const blob = await device.generateWrappingKeyFragment();
|
|
544
615
|
await client2.onboarding.submitWrappingKeyFragment.mutate({
|
|
545
616
|
pubKey,
|
|
@@ -554,8 +625,8 @@ function createEngine(options, logger) {
|
|
|
554
625
|
}
|
|
555
626
|
});
|
|
556
627
|
},
|
|
557
|
-
registerDevice: async (params) => {
|
|
558
|
-
const { role, name } =
|
|
628
|
+
registerDevice: async (registerParams, params) => {
|
|
629
|
+
const { role, name } = registerParams;
|
|
559
630
|
const getChallengeMutation = role === "ADMIN" ? client2.onboarding.generateMasterAdminRegistrationChallenge : client2.onboarding.generateSharedOwnerRegistrationChallenge;
|
|
560
631
|
const submitChallengeMutation = role === "ADMIN" ? client2.onboarding.submitMasterAdminRegistration : client2.onboarding.submitSharedOwnerRegistration;
|
|
561
632
|
await genericRegister({
|
|
@@ -572,10 +643,11 @@ function createEngine(options, logger) {
|
|
|
572
643
|
pubKey,
|
|
573
644
|
// FIXME this should be renamed to `challengeResponse` on backend side
|
|
574
645
|
response: challengeResponse
|
|
575
|
-
})
|
|
646
|
+
}),
|
|
647
|
+
onScreenDisplayed: _optionalChain([params, 'optionalAccess', _8 => _8.onScreenDisplayed])
|
|
576
648
|
});
|
|
577
649
|
},
|
|
578
|
-
reviewSharedOwner: async (challenge) => {
|
|
650
|
+
reviewSharedOwner: async (challenge, params) => {
|
|
579
651
|
await enforcePairing();
|
|
580
652
|
const { pubKey } = await device.getU2FPubKey();
|
|
581
653
|
await device.startKPatternAsResponder({
|
|
@@ -583,6 +655,7 @@ function createEngine(options, logger) {
|
|
|
583
655
|
handshakeAttestation: challenge.handshakeAttestation,
|
|
584
656
|
partitionId: challenge.partitionId
|
|
585
657
|
});
|
|
658
|
+
await _optionalChain([params, 'optionalAccess', _9 => _9.onScreenDisplayed, 'optionalCall', _10 => _10()]);
|
|
586
659
|
const signature = await device.validateVaultOperation({
|
|
587
660
|
actions: challenge.wActions
|
|
588
661
|
});
|
|
@@ -592,7 +665,7 @@ function createEngine(options, logger) {
|
|
|
592
665
|
signature
|
|
593
666
|
});
|
|
594
667
|
},
|
|
595
|
-
collectSeedFragment: async (challenge) => {
|
|
668
|
+
collectSeedFragment: async (challenge, params) => {
|
|
596
669
|
await enforcePairing();
|
|
597
670
|
const [{ pubKey }, { attestation }] = await Promise.all([
|
|
598
671
|
device.getU2FPubKey(),
|
|
@@ -603,6 +676,7 @@ function createEngine(options, logger) {
|
|
|
603
676
|
handshakeAttestation: challenge.handshakeAttestation,
|
|
604
677
|
partitionId: challenge.partitionId
|
|
605
678
|
});
|
|
679
|
+
await _optionalChain([params, 'optionalAccess', _11 => _11.onScreenDisplayed, 'optionalCall', _12 => _12()]);
|
|
606
680
|
const challengeResponse = await device.validateVaultOperation({
|
|
607
681
|
actions: challenge.wActions
|
|
608
682
|
});
|
|
@@ -641,9 +715,9 @@ function createEngine(options, logger) {
|
|
|
641
715
|
pubKey,
|
|
642
716
|
workspaceName: __workspaceName
|
|
643
717
|
},
|
|
644
|
-
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess',
|
|
718
|
+
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess', _13 => _13.correlationId]) })
|
|
645
719
|
);
|
|
646
|
-
await _optionalChain([opts, 'optionalAccess',
|
|
720
|
+
await _optionalChain([opts, 'optionalAccess', _14 => _14.onScreenDisplayed, 'optionalCall', _15 => _15()]);
|
|
647
721
|
const authentication = await device.authenticate({
|
|
648
722
|
challenge,
|
|
649
723
|
workspaceName: __workspaceName
|
|
@@ -652,11 +726,11 @@ function createEngine(options, logger) {
|
|
|
652
726
|
workspaceName: __workspaceName,
|
|
653
727
|
pubKey,
|
|
654
728
|
authentication,
|
|
655
|
-
validityDurationSecs: _optionalChain([opts, 'optionalAccess',
|
|
729
|
+
validityDurationSecs: _optionalChain([opts, 'optionalAccess', _16 => _16.validityDurationSecs])
|
|
656
730
|
};
|
|
657
731
|
const { token } = await client2.auth.psd.authenticate.mutate(
|
|
658
732
|
{ ...authPayload },
|
|
659
|
-
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess',
|
|
733
|
+
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess', _17 => _17.correlationId]) })
|
|
660
734
|
);
|
|
661
735
|
const withPsdAuth = {
|
|
662
736
|
__psdToken: token
|
|
@@ -701,7 +775,7 @@ function createEngine(options, logger) {
|
|
|
701
775
|
apiKeySecret: credentials.apiKeySecret,
|
|
702
776
|
workspace: __workspaceName
|
|
703
777
|
},
|
|
704
|
-
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess',
|
|
778
|
+
_chunkLH4QQXUHcjs.buildTrpcContext.call(void 0, { correlationId: _optionalChain([opts, 'optionalAccess', _18 => _18.correlationId]) })
|
|
705
779
|
);
|
|
706
780
|
const withApiAuth = {
|
|
707
781
|
__apiAuth: res
|
|
@@ -732,7 +806,7 @@ function createEngine(options, logger) {
|
|
|
732
806
|
handshakeAttestation: challenge.handshakeAttestation,
|
|
733
807
|
partitionId: challenge.partitionId
|
|
734
808
|
});
|
|
735
|
-
await _optionalChain([params, 'optionalAccess',
|
|
809
|
+
await _optionalChain([params, 'optionalAccess', _19 => _19.onScreenDisplayed, 'optionalCall', _20 => _20()]);
|
|
736
810
|
const signature = await device.validateVaultOperation({
|
|
737
811
|
actions: challenge.wActions
|
|
738
812
|
});
|
|
@@ -743,7 +817,7 @@ function createEngine(options, logger) {
|
|
|
743
817
|
const { challenge } = await client2.requests.getChallenge.query({ id: request.id });
|
|
744
818
|
if (challenge.challengeType === "PSD") {
|
|
745
819
|
const signature = await approveChallenge(challenge, params);
|
|
746
|
-
await _optionalChain([params, 'optionalAccess',
|
|
820
|
+
await _optionalChain([params, 'optionalAccess', _21 => _21.onPsdChallengeSigned, 'optionalCall', _22 => _22()]);
|
|
747
821
|
return client2.requests.approve.mutate(
|
|
748
822
|
{
|
|
749
823
|
id: request.id,
|