@bsv/wallet-toolbox 2.9.0 → 2.10.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/CHANGELOG.md +17 -0
- package/README.md +42 -0
- package/out/src/CWIStyleWalletManager.d.ts +37 -27
- package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
- package/out/src/CWIStyleWalletManager.js +157 -151
- package/out/src/CWIStyleWalletManager.js.map +1 -1
- package/out/src/WalletAuthenticationManager.d.ts +20 -0
- package/out/src/WalletAuthenticationManager.d.ts.map +1 -1
- package/out/src/WalletAuthenticationManager.js +180 -47
- package/out/src/WalletAuthenticationManager.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js +5 -2
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +15 -9
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +6 -1
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/remoting/StorageClientBase.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClientBase.js +29 -0
- package/out/src/storage/remoting/StorageClientBase.js.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.d.ts +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.js +5 -5
- package/out/src/storage/schema/entities/EntitySyncState.js.map +1 -1
- package/out/src/utility/beefForTxids.d.ts +12 -3
- package/out/src/utility/beefForTxids.d.ts.map +1 -1
- package/out/src/utility/beefForTxids.js +69 -21
- package/out/src/utility/beefForTxids.js.map +1 -1
- package/out/src/wab-client/WABClient.d.ts.map +1 -1
- package/out/src/wab-client/WABClient.js +13 -13
- package/out/src/wab-client/WABClient.js.map +1 -1
- package/out/src/wab-client/WABTransport.d.ts +17 -23
- package/out/src/wab-client/WABTransport.d.ts.map +1 -1
- package/out/src/wab-client/WABTransport.js +129 -141
- package/out/src/wab-client/WABTransport.js.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +6 -0
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ exports.CWIStyleWalletManager = exports.OverlayUMPTokenInteractor = exports.UMPT
|
|
|
4
4
|
const sdk_1 = require("@bsv/sdk");
|
|
5
5
|
const PrivilegedKeyManager_1 = require("./sdk/PrivilegedKeyManager");
|
|
6
6
|
const hashWasm_1 = require("./utility/hashWasm");
|
|
7
|
+
const CWI_COMPONENT = 'wallet-toolbox.cwi-manager';
|
|
7
8
|
/**
|
|
8
9
|
* Number of rounds used in PBKDF2 for deriving password keys.
|
|
9
10
|
*/
|
|
@@ -40,14 +41,10 @@ function isValidKdfConfig(kdf) {
|
|
|
40
41
|
isPositiveIntegerInRange(kdf.hashLength, exports.KDF_MAX_HASH_LENGTH));
|
|
41
42
|
}
|
|
42
43
|
function findKdfVersionFieldIndex(protocolFields) {
|
|
43
|
-
const hasMetadataWithProfiles = protocolFields.length >= 15 &&
|
|
44
|
-
protocolFields[12]?.length === 1 &&
|
|
45
|
-
protocolFields[12][0] === 3;
|
|
44
|
+
const hasMetadataWithProfiles = protocolFields.length >= 15 && protocolFields[12]?.length === 1 && protocolFields[12][0] === 3;
|
|
46
45
|
if (hasMetadataWithProfiles)
|
|
47
46
|
return 12;
|
|
48
|
-
const hasMetadataWithoutProfiles = protocolFields.length >= 14 &&
|
|
49
|
-
protocolFields[11]?.length === 1 &&
|
|
50
|
-
protocolFields[11][0] === 3;
|
|
47
|
+
const hasMetadataWithoutProfiles = protocolFields.length >= 14 && protocolFields[11]?.length === 1 && protocolFields[11][0] === 3;
|
|
51
48
|
return hasMetadataWithoutProfiles ? 11 : -1;
|
|
52
49
|
}
|
|
53
50
|
function addProfilesField(token, protocolFields, kdfVersionFieldIndex) {
|
|
@@ -284,11 +281,11 @@ class OverlayUMPTokenInteractor {
|
|
|
284
281
|
* @param hash The 32-byte SHA-256 hash of the presentation key.
|
|
285
282
|
* @returns A UMPToken object (including currentOutpoint) if found, otherwise undefined.
|
|
286
283
|
*/
|
|
287
|
-
async findByPresentationKeyHash(hash) {
|
|
288
|
-
return
|
|
284
|
+
async findByPresentationKeyHash(hash, options) {
|
|
285
|
+
return this.findToken({
|
|
289
286
|
service: 'ls_users',
|
|
290
287
|
query: { presentationHash: sdk_1.Utils.toHex(hash) }
|
|
291
|
-
}, 'presentation');
|
|
288
|
+
}, 'presentation', options);
|
|
292
289
|
}
|
|
293
290
|
/**
|
|
294
291
|
* Finds a UMP token on-chain by the given recovery key hash, if it exists.
|
|
@@ -297,13 +294,13 @@ class OverlayUMPTokenInteractor {
|
|
|
297
294
|
* @param hash The 32-byte SHA-256 hash of the recovery key.
|
|
298
295
|
* @returns A UMPToken object (including currentOutpoint) if found, otherwise undefined.
|
|
299
296
|
*/
|
|
300
|
-
async findByRecoveryKeyHash(hash) {
|
|
301
|
-
return
|
|
297
|
+
async findByRecoveryKeyHash(hash, options) {
|
|
298
|
+
return this.findToken({
|
|
302
299
|
service: 'ls_users',
|
|
303
300
|
query: { recoveryHash: sdk_1.Utils.toHex(hash) }
|
|
304
|
-
}, 'recovery');
|
|
301
|
+
}, 'recovery', options);
|
|
305
302
|
}
|
|
306
|
-
async findToken(question, lookupKind) {
|
|
303
|
+
async findToken(question, lookupKind, options) {
|
|
307
304
|
const correlationId = this.telemetry.enabled === true ? this.telemetry.createCorrelationId() : undefined;
|
|
308
305
|
const startedAt = Date.now();
|
|
309
306
|
this.telemetry.capture({
|
|
@@ -321,11 +318,11 @@ class OverlayUMPTokenInteractor {
|
|
|
321
318
|
});
|
|
322
319
|
}
|
|
323
320
|
catch (error) {
|
|
324
|
-
const diagnostics = this.
|
|
325
|
-
this.
|
|
321
|
+
const diagnostics = this.emptyStats(correlationId);
|
|
322
|
+
this.lookupFailed(lookupKind, 'lookup-unavailable', diagnostics, startedAt, error);
|
|
326
323
|
throw new UMPTokenLookupError('lookup-unavailable', diagnostics, { cause: error });
|
|
327
324
|
}
|
|
328
|
-
const diagnostics = this.
|
|
325
|
+
const diagnostics = this.diagnosticsFor(resolution);
|
|
329
326
|
const tokens = this.parseLookupAnswers(resolution.answer);
|
|
330
327
|
const expectedHash = question.query[lookupKind === 'presentation' ? 'presentationHash' : 'recoveryHash'].toLowerCase();
|
|
331
328
|
const matchingTokens = tokens.filter(token => sdk_1.Utils.toHex(lookupKind === 'presentation' ? token.presentationHash : token.recoveryHash).toLowerCase() ===
|
|
@@ -340,28 +337,35 @@ class OverlayUMPTokenInteractor {
|
|
|
340
337
|
if (matchingTokens.length > 1) {
|
|
341
338
|
const newest = this.resolveNewestToken(matchingTokens, resolution.answer.outputs);
|
|
342
339
|
if (newest != null) {
|
|
343
|
-
this.
|
|
340
|
+
this.lookupDone(lookupKind, 'found', diagnostics, startedAt, {
|
|
344
341
|
supersededTokens: matchingTokens.length - 1
|
|
345
342
|
});
|
|
346
343
|
return newest;
|
|
347
344
|
}
|
|
345
|
+
const pinned = options?.pinnedOutpoint
|
|
346
|
+
? matchingTokens.find(token => token.currentOutpoint === options.pinnedOutpoint)
|
|
347
|
+
: undefined;
|
|
348
|
+
if (pinned != null) {
|
|
349
|
+
this.lookupDone(lookupKind, 'found', diagnostics, startedAt);
|
|
350
|
+
return pinned;
|
|
351
|
+
}
|
|
348
352
|
const reason = 'token-ambiguous';
|
|
349
|
-
this.
|
|
353
|
+
this.lookupFailed(lookupKind, reason, diagnostics, startedAt);
|
|
350
354
|
throw new UMPTokenLookupError(reason, diagnostics);
|
|
351
355
|
}
|
|
352
356
|
if (matchingTokens.length === 1) {
|
|
353
|
-
this.
|
|
357
|
+
this.lookupDone(lookupKind, 'found', diagnostics, startedAt);
|
|
354
358
|
return matchingTokens[0];
|
|
355
359
|
}
|
|
356
360
|
// A clean empty response is sufficient negative evidence once no verified
|
|
357
361
|
// token exists. Malformed outputs and failed peers are ignored so they cannot
|
|
358
362
|
// deny onboarding by advertising corrupt data or remaining unavailable.
|
|
359
363
|
if (resolution.progress.emptyHosts > 0) {
|
|
360
|
-
this.
|
|
364
|
+
this.lookupDone(lookupKind, 'not-found', diagnostics, startedAt);
|
|
361
365
|
return undefined;
|
|
362
366
|
}
|
|
363
367
|
const reason = resolution.answer.outputs.length > 0 ? 'token-malformed' : 'lookup-incomplete';
|
|
364
|
-
this.
|
|
368
|
+
this.lookupFailed(lookupKind, reason, diagnostics, startedAt);
|
|
365
369
|
throw new UMPTokenLookupError(reason, diagnostics);
|
|
366
370
|
}
|
|
367
371
|
/**
|
|
@@ -395,7 +399,7 @@ class OverlayUMPTokenInteractor {
|
|
|
395
399
|
continue;
|
|
396
400
|
const evidence = evidenceByCandidate.get(outpoint) ?? { txs: [], spent: new Set() };
|
|
397
401
|
evidence.txs.push(tx);
|
|
398
|
-
this.
|
|
402
|
+
this.collectSpends(tx, evidence.spent, new Set());
|
|
399
403
|
evidenceByCandidate.set(outpoint, evidence);
|
|
400
404
|
}
|
|
401
405
|
catch {
|
|
@@ -418,7 +422,7 @@ class OverlayUMPTokenInteractor {
|
|
|
418
422
|
const provenContinuations = survivors.filter(outpoint => {
|
|
419
423
|
const evidence = evidenceByCandidate.get(outpoint);
|
|
420
424
|
const token = candidates.get(outpoint);
|
|
421
|
-
return
|
|
425
|
+
return evidence != null && token != null && evidence.txs.some(tx => this.consumesIdentity(tx, token));
|
|
422
426
|
});
|
|
423
427
|
if (provenContinuations.length !== 1)
|
|
424
428
|
return undefined;
|
|
@@ -430,7 +434,7 @@ class OverlayUMPTokenInteractor {
|
|
|
430
434
|
* hash — on-chain proof that the candidate is an update of a same-identity
|
|
431
435
|
* predecessor rather than an independently minted token.
|
|
432
436
|
*/
|
|
433
|
-
|
|
437
|
+
consumesIdentity(tx, token) {
|
|
434
438
|
const presentationHash = sdk_1.Utils.toHex(token.presentationHash);
|
|
435
439
|
const recoveryHash = sdk_1.Utils.toHex(token.recoveryHash);
|
|
436
440
|
for (const input of tx.inputs) {
|
|
@@ -463,7 +467,7 @@ class OverlayUMPTokenInteractor {
|
|
|
463
467
|
* renditions are absent from the lookup answer. Iterative so arbitrarily
|
|
464
468
|
* long update chains cannot exhaust the call stack.
|
|
465
469
|
*/
|
|
466
|
-
|
|
470
|
+
collectSpends(tx, spent, visited) {
|
|
467
471
|
const pending = [tx];
|
|
468
472
|
while (pending.length > 0) {
|
|
469
473
|
const current = pending.pop();
|
|
@@ -482,7 +486,7 @@ class OverlayUMPTokenInteractor {
|
|
|
482
486
|
}
|
|
483
487
|
}
|
|
484
488
|
}
|
|
485
|
-
|
|
489
|
+
emptyStats(correlationId) {
|
|
486
490
|
return {
|
|
487
491
|
hostCount: 0,
|
|
488
492
|
completedHosts: 0,
|
|
@@ -495,7 +499,7 @@ class OverlayUMPTokenInteractor {
|
|
|
495
499
|
...(correlationId !== undefined ? { correlationId } : {})
|
|
496
500
|
};
|
|
497
501
|
}
|
|
498
|
-
|
|
502
|
+
diagnosticsFor(resolution) {
|
|
499
503
|
const progress = resolution.progress;
|
|
500
504
|
return {
|
|
501
505
|
hostCount: progress.hostCount,
|
|
@@ -509,7 +513,7 @@ class OverlayUMPTokenInteractor {
|
|
|
509
513
|
...(progress.correlationId !== undefined ? { correlationId: progress.correlationId } : {})
|
|
510
514
|
};
|
|
511
515
|
}
|
|
512
|
-
|
|
516
|
+
lookupAttrs(diagnostics) {
|
|
513
517
|
return {
|
|
514
518
|
hostCount: diagnostics.hostCount,
|
|
515
519
|
completedHosts: diagnostics.completedHosts,
|
|
@@ -521,7 +525,7 @@ class OverlayUMPTokenInteractor {
|
|
|
521
525
|
outputCount: diagnostics.outputCount
|
|
522
526
|
};
|
|
523
527
|
}
|
|
524
|
-
|
|
528
|
+
lookupDone(lookupKind, result, diagnostics, startedAt, extraAttributes = {}) {
|
|
525
529
|
this.telemetry.capture({
|
|
526
530
|
name: 'wallet-toolbox.ump.lookup.completed',
|
|
527
531
|
component: 'wallet-toolbox.ump',
|
|
@@ -531,12 +535,12 @@ class OverlayUMPTokenInteractor {
|
|
|
531
535
|
lookupKind,
|
|
532
536
|
result,
|
|
533
537
|
durationMs: Date.now() - startedAt,
|
|
534
|
-
...this.
|
|
538
|
+
...this.lookupAttrs(diagnostics),
|
|
535
539
|
...extraAttributes
|
|
536
540
|
}
|
|
537
541
|
});
|
|
538
542
|
}
|
|
539
|
-
|
|
543
|
+
lookupFailed(lookupKind, reason, diagnostics, startedAt, error) {
|
|
540
544
|
this.telemetry.capture({
|
|
541
545
|
name: 'wallet-toolbox.ump.lookup.indeterminate',
|
|
542
546
|
component: 'wallet-toolbox.ump',
|
|
@@ -546,7 +550,7 @@ class OverlayUMPTokenInteractor {
|
|
|
546
550
|
lookupKind,
|
|
547
551
|
reason,
|
|
548
552
|
durationMs: Date.now() - startedAt,
|
|
549
|
-
...this.
|
|
553
|
+
...this.lookupAttrs(diagnostics)
|
|
550
554
|
},
|
|
551
555
|
error
|
|
552
556
|
});
|
|
@@ -566,13 +570,13 @@ class OverlayUMPTokenInteractor {
|
|
|
566
570
|
async buildAndSend(wallet, // This wallet MUST be the one built for the default profile
|
|
567
571
|
adminOriginator, token, oldTokenToConsume) {
|
|
568
572
|
// 1) Construct the data fields and PushDrop locking script for the new UMP token.
|
|
569
|
-
const fields = this.
|
|
573
|
+
const fields = this.tokenFields(token);
|
|
570
574
|
const script = await new sdk_1.PushDrop(wallet, adminOriginator).lock(fields, [2, 'admin user management token'], '1', 'self',
|
|
571
575
|
/* forSelf= */ true,
|
|
572
576
|
/* includeSignature= */ true);
|
|
573
577
|
const tokenOutput = [{ lockingScript: script.toHex(), satoshis: 1, outputDescription: 'New UMP token output' }];
|
|
574
578
|
// 2) Resolve the old-token input (if provided) and create the action.
|
|
575
|
-
const { resolvedOldToken, inputToken } = await this.
|
|
579
|
+
const { resolvedOldToken, inputToken } = await this.resolveOldInput(oldTokenToConsume);
|
|
576
580
|
const inputs = resolvedOldToken?.currentOutpoint
|
|
577
581
|
? [
|
|
578
582
|
{
|
|
@@ -582,21 +586,21 @@ class OverlayUMPTokenInteractor {
|
|
|
582
586
|
}
|
|
583
587
|
]
|
|
584
588
|
: [];
|
|
585
|
-
const createResult = await this.
|
|
589
|
+
const createResult = await this.createAction(wallet, adminOriginator, inputs, tokenOutput, inputToken, resolvedOldToken);
|
|
586
590
|
// 3) If the wallet fully processed it (no signable tx), broadcast and return.
|
|
587
591
|
if (!createResult.signableTransaction) {
|
|
588
|
-
return
|
|
592
|
+
return this.broadcastFinal(createResult);
|
|
589
593
|
}
|
|
590
594
|
// 4) Sign and broadcast: with old token input or without.
|
|
591
595
|
const reference = createResult.signableTransaction.reference;
|
|
592
596
|
const partialTx = sdk_1.Transaction.fromBEEF(createResult.signableTransaction.tx);
|
|
593
597
|
if (resolvedOldToken?.currentOutpoint) {
|
|
594
|
-
return
|
|
598
|
+
return this.renewToken(wallet, adminOriginator, reference, partialTx);
|
|
595
599
|
}
|
|
596
|
-
return
|
|
600
|
+
return this.broadcastNew(wallet, adminOriginator, reference);
|
|
597
601
|
}
|
|
598
602
|
/** Assembles the ordered number[][] fields array from a UMPToken. */
|
|
599
|
-
|
|
603
|
+
tokenFields(token) {
|
|
600
604
|
const fields = [];
|
|
601
605
|
fields[0] = token.passwordSalt;
|
|
602
606
|
fields[1] = token.passwordPresentationPrimary;
|
|
@@ -627,17 +631,17 @@ class OverlayUMPTokenInteractor {
|
|
|
627
631
|
return fields;
|
|
628
632
|
}
|
|
629
633
|
/** Looks up the old token on the overlay; returns undefined resolved token if not found. */
|
|
630
|
-
async
|
|
634
|
+
async resolveOldInput(oldTokenToConsume) {
|
|
631
635
|
if (!oldTokenToConsume?.currentOutpoint)
|
|
632
636
|
return { resolvedOldToken: undefined, inputToken: undefined };
|
|
633
637
|
const inputToken = await this.findByOutpoint(oldTokenToConsume.currentOutpoint);
|
|
634
638
|
if (inputToken == null) {
|
|
635
|
-
throw new Error('
|
|
639
|
+
throw new Error('Previous UMP token unavailable; update refused.');
|
|
636
640
|
}
|
|
637
641
|
return { resolvedOldToken: oldTokenToConsume, inputToken };
|
|
638
642
|
}
|
|
639
643
|
/** Creates the UMP action without dropping a required old-token input on failure. */
|
|
640
|
-
async
|
|
644
|
+
async createAction(wallet, adminOriginator, inputs, outputs, inputToken, resolvedOldToken) {
|
|
641
645
|
try {
|
|
642
646
|
return await wallet.createAction({
|
|
643
647
|
description: resolvedOldToken == null ? 'Create new UMP token' : 'Renew UMP token (consume old, create new)',
|
|
@@ -662,44 +666,44 @@ class OverlayUMPTokenInteractor {
|
|
|
662
666
|
}
|
|
663
667
|
}
|
|
664
668
|
/** Handles a fully-finalized (no signable tx) createAction result — broadcasts and returns outpoint. */
|
|
665
|
-
async
|
|
669
|
+
async broadcastFinal(createResult) {
|
|
666
670
|
const finalTxid = createResult.txid || (createResult.tx != null ? sdk_1.Transaction.fromAtomicBEEF(createResult.tx).id('hex') : undefined);
|
|
667
671
|
if (!finalTxid)
|
|
668
|
-
throw new Error('
|
|
672
|
+
throw new Error('UMP transaction was not finalized.');
|
|
669
673
|
if (createResult.tx == null)
|
|
670
|
-
throw new Error('
|
|
674
|
+
throw new Error('UMP transaction data missing.');
|
|
671
675
|
const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(createResult.tx);
|
|
672
676
|
const result = await this.broadcaster.broadcast(broadcastTx);
|
|
673
|
-
this.
|
|
677
|
+
this.assertBroadcast(result, 'create-finalized');
|
|
674
678
|
return `${finalTxid}.0`;
|
|
675
679
|
}
|
|
676
680
|
/** Signs the old-token input and broadcasts — used during UMP token renewal. */
|
|
677
|
-
async
|
|
681
|
+
async renewToken(wallet, adminOriginator, reference, partialTx) {
|
|
678
682
|
const unlocker = new sdk_1.PushDrop(wallet, adminOriginator).unlock([2, 'admin user management token'], '1', 'self');
|
|
679
683
|
const unlockingScript = await unlocker.sign(partialTx, 0);
|
|
680
684
|
const signResult = await wallet.signAction({ reference, spends: { 0: { unlockingScript: unlockingScript.toHex() } } }, adminOriginator);
|
|
681
685
|
const finalTxid = signResult.txid || (signResult.tx == null ? '' : sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex'));
|
|
682
686
|
if (!finalTxid)
|
|
683
|
-
throw new Error('Could not finalize
|
|
687
|
+
throw new Error('Could not finalize renewed UMP token.');
|
|
684
688
|
if (signResult.tx == null)
|
|
685
|
-
throw new Error('
|
|
689
|
+
throw new Error('Renewed UMP token transaction data missing.');
|
|
686
690
|
const result = await this.broadcaster.broadcast(sdk_1.Transaction.fromAtomicBEEF(signResult.tx));
|
|
687
|
-
this.
|
|
691
|
+
this.assertBroadcast(result, 'renew');
|
|
688
692
|
return `${finalTxid}.0`;
|
|
689
693
|
}
|
|
690
694
|
/** Signs without input spending and broadcasts — used when creating a brand-new UMP token. */
|
|
691
|
-
async
|
|
695
|
+
async broadcastNew(wallet, adminOriginator, reference) {
|
|
692
696
|
const signResult = await wallet.signAction({ reference, spends: {} }, adminOriginator);
|
|
693
697
|
const finalTxid = signResult.txid || (signResult.tx == null ? '' : sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex'));
|
|
694
698
|
if (!finalTxid)
|
|
695
|
-
throw new Error('
|
|
699
|
+
throw new Error('Could not finalize new UMP token.');
|
|
696
700
|
if (signResult.tx == null)
|
|
697
|
-
throw new Error('
|
|
701
|
+
throw new Error('New UMP token transaction data missing.');
|
|
698
702
|
const result = await this.broadcaster.broadcast(sdk_1.Transaction.fromAtomicBEEF(signResult.tx));
|
|
699
|
-
this.
|
|
703
|
+
this.assertBroadcast(result, 'create');
|
|
700
704
|
return `${finalTxid}.0`;
|
|
701
705
|
}
|
|
702
|
-
|
|
706
|
+
assertBroadcast(result, operation) {
|
|
703
707
|
const succeeded = result.status === 'success';
|
|
704
708
|
this.telemetry.capture({
|
|
705
709
|
name: succeeded ? 'wallet-toolbox.ump.broadcast.completed' : 'wallet-toolbox.ump.broadcast.failed',
|
|
@@ -731,13 +735,13 @@ class OverlayUMPTokenInteractor {
|
|
|
731
735
|
return [];
|
|
732
736
|
const tokens = [];
|
|
733
737
|
for (const output of answer.outputs) {
|
|
734
|
-
const token = this.
|
|
738
|
+
const token = this.parseOutput(output);
|
|
735
739
|
if (token != null)
|
|
736
740
|
tokens.push(token);
|
|
737
741
|
}
|
|
738
742
|
return tokens;
|
|
739
743
|
}
|
|
740
|
-
|
|
744
|
+
parseOutput(output) {
|
|
741
745
|
try {
|
|
742
746
|
const tx = sdk_1.Transaction.fromBEEF(output.beef);
|
|
743
747
|
const txOutput = tx.outputs[output.outputIndex];
|
|
@@ -800,15 +804,15 @@ class OverlayUMPTokenInteractor {
|
|
|
800
804
|
});
|
|
801
805
|
}
|
|
802
806
|
catch (error) {
|
|
803
|
-
const diagnostics = this.
|
|
804
|
-
this.
|
|
807
|
+
const diagnostics = this.emptyStats(correlationId);
|
|
808
|
+
this.lookupFailed('outpoint', 'lookup-unavailable', diagnostics, startedAt, error);
|
|
805
809
|
throw new UMPTokenLookupError('lookup-unavailable', diagnostics, { cause: error });
|
|
806
810
|
}
|
|
807
811
|
if (resolution.answer.outputs.length === 0) {
|
|
808
812
|
const p = resolution.progress;
|
|
809
813
|
if (p.emptyHosts === 0) {
|
|
810
|
-
const diagnostics = this.
|
|
811
|
-
this.
|
|
814
|
+
const diagnostics = this.diagnosticsFor(resolution);
|
|
815
|
+
this.lookupFailed('outpoint', 'lookup-incomplete', diagnostics, startedAt);
|
|
812
816
|
throw new UMPTokenLookupError('lookup-incomplete', diagnostics);
|
|
813
817
|
}
|
|
814
818
|
return undefined;
|
|
@@ -955,21 +959,21 @@ class CWIStyleWalletManager {
|
|
|
955
959
|
if (this._initSnapshot !== undefined) {
|
|
956
960
|
this.telemetry.capture({
|
|
957
961
|
name: 'wallet-toolbox.snapshot.initialization.started',
|
|
958
|
-
component:
|
|
962
|
+
component: CWI_COMPONENT,
|
|
959
963
|
severity: 'debug'
|
|
960
964
|
});
|
|
961
965
|
try {
|
|
962
966
|
await this.loadSnapshot(this._initSnapshot);
|
|
963
967
|
this.telemetry.capture({
|
|
964
968
|
name: 'wallet-toolbox.snapshot.initialization.completed',
|
|
965
|
-
component:
|
|
969
|
+
component: CWI_COMPONENT,
|
|
966
970
|
severity: 'info'
|
|
967
971
|
});
|
|
968
972
|
}
|
|
969
973
|
catch (error) {
|
|
970
974
|
this.telemetry.capture({
|
|
971
975
|
name: 'wallet-toolbox.snapshot.initialization.failed',
|
|
972
|
-
component:
|
|
976
|
+
component: CWI_COMPONENT,
|
|
973
977
|
severity: 'error',
|
|
974
978
|
error
|
|
975
979
|
});
|
|
@@ -979,9 +983,11 @@ class CWIStyleWalletManager {
|
|
|
979
983
|
}
|
|
980
984
|
// --- Authentication Methods ---
|
|
981
985
|
/**
|
|
982
|
-
* Provides the presentation key.
|
|
986
|
+
* Provides the presentation key. A WAB operator pin may be supplied by the
|
|
987
|
+
* authentication manager; normal lookup and lineage resolution always run
|
|
988
|
+
* before this ambiguity-only fallback.
|
|
983
989
|
*/
|
|
984
|
-
async providePresentationKey(key) {
|
|
990
|
+
async providePresentationKey(key, lookupOptions) {
|
|
985
991
|
if (this.authenticated) {
|
|
986
992
|
throw new Error('User is already authenticated');
|
|
987
993
|
}
|
|
@@ -996,18 +1002,18 @@ class CWIStyleWalletManager {
|
|
|
996
1002
|
const startedAt = Date.now();
|
|
997
1003
|
this.telemetry.capture({
|
|
998
1004
|
name: 'wallet-toolbox.authentication.account-lookup.started',
|
|
999
|
-
component:
|
|
1005
|
+
component: CWI_COMPONENT,
|
|
1000
1006
|
severity: 'debug',
|
|
1001
1007
|
attributes: { lookupKind: 'presentation' }
|
|
1002
1008
|
});
|
|
1003
1009
|
let token;
|
|
1004
1010
|
try {
|
|
1005
|
-
token = await this.UMPTokenInteractor.findByPresentationKeyHash(hash);
|
|
1011
|
+
token = await this.UMPTokenInteractor.findByPresentationKeyHash(hash, lookupOptions);
|
|
1006
1012
|
}
|
|
1007
1013
|
catch (error) {
|
|
1008
1014
|
this.telemetry.capture({
|
|
1009
1015
|
name: 'wallet-toolbox.authentication.account-lookup.failed',
|
|
1010
|
-
component:
|
|
1016
|
+
component: CWI_COMPONENT,
|
|
1011
1017
|
severity: 'warn',
|
|
1012
1018
|
attributes: {
|
|
1013
1019
|
lookupKind: 'presentation',
|
|
@@ -1030,7 +1036,7 @@ class CWIStyleWalletManager {
|
|
|
1030
1036
|
}
|
|
1031
1037
|
this.telemetry.capture({
|
|
1032
1038
|
name: 'wallet-toolbox.authentication.account-lookup.completed',
|
|
1033
|
-
component:
|
|
1039
|
+
component: CWI_COMPONENT,
|
|
1034
1040
|
severity: 'info',
|
|
1035
1041
|
attributes: {
|
|
1036
1042
|
lookupKind: 'presentation',
|
|
@@ -1052,14 +1058,14 @@ class CWIStyleWalletManager {
|
|
|
1052
1058
|
throw new Error('Determine account status with a presentation or recovery key before providing a password.');
|
|
1053
1059
|
}
|
|
1054
1060
|
if (this.authenticationFlow === 'existing-user') {
|
|
1055
|
-
await this.
|
|
1061
|
+
await this.unlockExisting(password);
|
|
1056
1062
|
}
|
|
1057
1063
|
else {
|
|
1058
|
-
await this.
|
|
1064
|
+
await this.createNewUser(password);
|
|
1059
1065
|
}
|
|
1060
1066
|
}
|
|
1061
1067
|
/** Handles the password step for an existing user — derives keys, sets up infrastructure. */
|
|
1062
|
-
async
|
|
1068
|
+
async unlockExisting(password) {
|
|
1063
1069
|
if (this.currentUMPToken == null)
|
|
1064
1070
|
throw new Error('Provide presentation or recovery key first.');
|
|
1065
1071
|
const derivedPasswordKey = await derivePasswordKey(this.currentUMPToken, sdk_1.Utils.toArray(password, 'utf8'));
|
|
@@ -1078,11 +1084,11 @@ class CWIStyleWalletManager {
|
|
|
1078
1084
|
rootPrimaryKey = new sdk_1.SymmetricKey(primaryDecryptionKey).decrypt(this.currentUMPToken.passwordRecoveryPrimary);
|
|
1079
1085
|
rootPrivilegedKey = new sdk_1.SymmetricKey(this.XOR(rootPrimaryKey, derivedPasswordKey)).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
|
|
1080
1086
|
}
|
|
1081
|
-
await this.
|
|
1087
|
+
await this.setupRoot(rootPrimaryKey, rootPrivilegedKey);
|
|
1082
1088
|
await this.switchProfile(this.activeProfileId);
|
|
1083
1089
|
}
|
|
1084
1090
|
/** Handles the password step for a new user — generates keys, builds UMP token, publishes on-chain. */
|
|
1085
|
-
async
|
|
1091
|
+
async createNewUser(password) {
|
|
1086
1092
|
if (this.authenticationMode !== 'presentation-key-and-password') {
|
|
1087
1093
|
throw new Error('New-user flow requires presentation key and password mode.');
|
|
1088
1094
|
}
|
|
@@ -1121,7 +1127,7 @@ class CWIStyleWalletManager {
|
|
|
1121
1127
|
passwordKdf: this.kdfConfig
|
|
1122
1128
|
};
|
|
1123
1129
|
this.currentUMPToken = newToken;
|
|
1124
|
-
await this.
|
|
1130
|
+
await this.setupRoot(rootPrimaryKey);
|
|
1125
1131
|
await this.switchProfile(exports.DEFAULT_PROFILE_ID);
|
|
1126
1132
|
// Fund the *default* wallet if funder provided
|
|
1127
1133
|
if (this.newWalletFunder != null && this.underlying != null) {
|
|
@@ -1131,7 +1137,7 @@ class CWIStyleWalletManager {
|
|
|
1131
1137
|
catch (error) {
|
|
1132
1138
|
this.telemetry.capture({
|
|
1133
1139
|
name: 'wallet-toolbox.authentication.new-wallet-funding.failed',
|
|
1134
|
-
component:
|
|
1140
|
+
component: CWI_COMPONENT,
|
|
1135
1141
|
severity: 'error',
|
|
1136
1142
|
error: new Error('New wallet funding failed.')
|
|
1137
1143
|
});
|
|
@@ -1179,7 +1185,7 @@ class CWIStyleWalletManager {
|
|
|
1179
1185
|
const rootPrimaryKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.presentationRecoveryPrimary);
|
|
1180
1186
|
const rootPrivilegedKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.presentationRecoveryPrivileged);
|
|
1181
1187
|
// Build root infrastructure, load profiles, switch to default
|
|
1182
|
-
await this.
|
|
1188
|
+
await this.setupRoot(rootPrimaryKey, rootPrivilegedKey);
|
|
1183
1189
|
await this.switchProfile(this.activeProfileId);
|
|
1184
1190
|
}
|
|
1185
1191
|
}
|
|
@@ -1221,7 +1227,7 @@ class CWIStyleWalletManager {
|
|
|
1221
1227
|
}
|
|
1222
1228
|
this.telemetry.capture({
|
|
1223
1229
|
name: 'wallet-toolbox.snapshot.saved',
|
|
1224
|
-
component:
|
|
1230
|
+
component: CWI_COMPONENT,
|
|
1225
1231
|
severity: 'info',
|
|
1226
1232
|
attributes: {
|
|
1227
1233
|
formatVersion: 2,
|
|
@@ -1272,12 +1278,12 @@ class CWIStyleWalletManager {
|
|
|
1272
1278
|
// Assign loaded data
|
|
1273
1279
|
this.currentUMPToken = token;
|
|
1274
1280
|
// Setup root infrastructure, load profiles, and switch to the loaded active profile
|
|
1275
|
-
await this.
|
|
1281
|
+
await this.setupRoot(rootPrimaryKey); // Will automatically load profiles
|
|
1276
1282
|
await this.switchProfile(activeProfileId); // Switch to the profile saved in the snapshot
|
|
1277
1283
|
this.authenticationFlow = 'existing-user'; // Loading implies existing user
|
|
1278
1284
|
this.telemetry.capture({
|
|
1279
1285
|
name: 'wallet-toolbox.snapshot.loaded',
|
|
1280
|
-
component:
|
|
1286
|
+
component: CWI_COMPONENT,
|
|
1281
1287
|
severity: 'info',
|
|
1282
1288
|
attributes: {
|
|
1283
1289
|
formatVersion: version,
|
|
@@ -1289,7 +1295,7 @@ class CWIStyleWalletManager {
|
|
|
1289
1295
|
this.destroy(); // Clear state on error
|
|
1290
1296
|
this.telemetry.capture({
|
|
1291
1297
|
name: 'wallet-toolbox.snapshot.load-failed',
|
|
1292
|
-
component:
|
|
1298
|
+
component: CWI_COMPONENT,
|
|
1293
1299
|
severity: 'error',
|
|
1294
1300
|
error
|
|
1295
1301
|
});
|
|
@@ -1318,7 +1324,7 @@ class CWIStyleWalletManager {
|
|
|
1318
1324
|
return false;
|
|
1319
1325
|
}
|
|
1320
1326
|
this.currentUMPToken = refreshed;
|
|
1321
|
-
await this.
|
|
1327
|
+
await this.setupRoot(this.rootPrimaryKey);
|
|
1322
1328
|
this.saveSnapshot();
|
|
1323
1329
|
return true;
|
|
1324
1330
|
}
|
|
@@ -1395,7 +1401,7 @@ class CWIStyleWalletManager {
|
|
|
1395
1401
|
};
|
|
1396
1402
|
this.profiles.push(newProfile);
|
|
1397
1403
|
// Update the UMP token with the new profile list
|
|
1398
|
-
await this.
|
|
1404
|
+
await this.updateFactors(this.currentUMPToken.passwordSalt,
|
|
1399
1405
|
// Need to re-derive/decrypt factors needed for re-encryption
|
|
1400
1406
|
await this.getFactor('passwordKey'), await this.getFactor('presentationKey'), await this.getFactor('recoveryKey'), this.rootPrimaryKey, await this.getFactor('privilegedKey'), // Get ROOT privileged key
|
|
1401
1407
|
this.profiles // Pass the updated profile list
|
|
@@ -1430,7 +1436,7 @@ class CWIStyleWalletManager {
|
|
|
1430
1436
|
await this.switchProfile(exports.DEFAULT_PROFILE_ID); // This rebuilds the wallet
|
|
1431
1437
|
}
|
|
1432
1438
|
// Update the UMP token
|
|
1433
|
-
await this.
|
|
1439
|
+
await this.updateFactors(this.currentUMPToken.passwordSalt, await this.getFactor('passwordKey'), await this.getFactor('presentationKey'), await this.getFactor('recoveryKey'), this.rootPrimaryKey, await this.getFactor('privilegedKey'), // Get ROOT privileged key
|
|
1434
1440
|
this.profiles // Pass updated list
|
|
1435
1441
|
);
|
|
1436
1442
|
}
|
|
@@ -1499,7 +1505,7 @@ class CWIStyleWalletManager {
|
|
|
1499
1505
|
const recoveryKey = await this.getFactor('recoveryKey');
|
|
1500
1506
|
const presentationKey = await this.getFactor('presentationKey');
|
|
1501
1507
|
const rootPrivilegedKey = await this.getFactor('privilegedKey'); // Get ROOT privileged key
|
|
1502
|
-
await this.
|
|
1508
|
+
await this.updateFactors(passwordSalt, newPasswordKey, presentationKey, recoveryKey, this.rootPrimaryKey, rootPrivilegedKey, // Pass the explicitly fetched root key
|
|
1503
1509
|
this.profiles // Preserve existing profiles
|
|
1504
1510
|
);
|
|
1505
1511
|
}
|
|
@@ -1510,7 +1516,7 @@ class CWIStyleWalletManager {
|
|
|
1510
1516
|
if (!this.authenticated || this.currentUMPToken == null || this.rootPrivilegedKeyManager == null) {
|
|
1511
1517
|
throw new Error('Not authenticated or missing required data.');
|
|
1512
1518
|
}
|
|
1513
|
-
return
|
|
1519
|
+
return this.getFactor('recoveryKey');
|
|
1514
1520
|
}
|
|
1515
1521
|
/**
|
|
1516
1522
|
* Changes the user's recovery key. Prompts user to save the new key.
|
|
@@ -1529,7 +1535,7 @@ class CWIStyleWalletManager {
|
|
|
1529
1535
|
// Generate and save new recovery key
|
|
1530
1536
|
const newRecoveryKey = (0, sdk_1.Random)(32);
|
|
1531
1537
|
await this.recoveryKeySaver(newRecoveryKey);
|
|
1532
|
-
await this.
|
|
1538
|
+
await this.updateFactors(this.currentUMPToken.passwordSalt, passwordKey, presentationKey, newRecoveryKey, // Use the new key
|
|
1533
1539
|
this.rootPrimaryKey, rootPrivilegedKey, this.profiles // Preserve profiles
|
|
1534
1540
|
);
|
|
1535
1541
|
}
|
|
@@ -1550,7 +1556,7 @@ class CWIStyleWalletManager {
|
|
|
1550
1556
|
const recoveryKey = await this.getFactor('recoveryKey');
|
|
1551
1557
|
const passwordKey = await this.getFactor('passwordKey');
|
|
1552
1558
|
const rootPrivilegedKey = await this.getFactor('privilegedKey'); // Get ROOT privileged key
|
|
1553
|
-
await this.
|
|
1559
|
+
await this.updateFactors(this.currentUMPToken.passwordSalt, passwordKey, newPresentationKey, // Use the new key
|
|
1554
1560
|
recoveryKey, this.rootPrimaryKey, rootPrivilegedKey, this.profiles // Preserve profiles
|
|
1555
1561
|
);
|
|
1556
1562
|
// Update the temporarily stored key if it was set
|
|
@@ -1620,7 +1626,7 @@ class CWIStyleWalletManager {
|
|
|
1620
1626
|
catch (error) {
|
|
1621
1627
|
this.telemetry.capture({
|
|
1622
1628
|
name: 'wallet-toolbox.authentication.factor-decryption.failed',
|
|
1623
|
-
component:
|
|
1629
|
+
component: CWI_COMPONENT,
|
|
1624
1630
|
severity: 'error',
|
|
1625
1631
|
attributes: { factor: factorName },
|
|
1626
1632
|
error
|
|
@@ -1633,7 +1639,7 @@ class CWIStyleWalletManager {
|
|
|
1633
1639
|
* Recomputes UMP token fields with updated factors and profiles, then publishes the update.
|
|
1634
1640
|
* This operation requires the *root* privileged key and the *default* profile wallet.
|
|
1635
1641
|
*/
|
|
1636
|
-
async
|
|
1642
|
+
async updateFactors(passwordSalt, passwordKey, presentationKey, recoveryKey, rootPrimaryKey, rootPrivilegedKey, // Explicitly pass the root key bytes
|
|
1637
1643
|
profiles // Pass current/new profiles list
|
|
1638
1644
|
) {
|
|
1639
1645
|
if (!this.authenticated || this.rootPrimaryKey == null || this.currentUMPToken == null) {
|
|
@@ -1703,7 +1709,7 @@ class CWIStyleWalletManager {
|
|
|
1703
1709
|
if (!currentActiveId.every(x => x === 0)) {
|
|
1704
1710
|
this.telemetry.capture({
|
|
1705
1711
|
name: 'wallet-toolbox.ump.profile-switch.started',
|
|
1706
|
-
component:
|
|
1712
|
+
component: CWI_COMPONENT,
|
|
1707
1713
|
severity: 'debug',
|
|
1708
1714
|
attributes: { reason: 'token-update' }
|
|
1709
1715
|
});
|
|
@@ -1727,7 +1733,7 @@ class CWIStyleWalletManager {
|
|
|
1727
1733
|
await this.switchProfile(currentActiveId);
|
|
1728
1734
|
this.telemetry.capture({
|
|
1729
1735
|
name: 'wallet-toolbox.ump.profile-switch.completed',
|
|
1730
|
-
component:
|
|
1736
|
+
component: CWI_COMPONENT,
|
|
1731
1737
|
severity: 'debug',
|
|
1732
1738
|
attributes: { reason: 'token-update' }
|
|
1733
1739
|
});
|
|
@@ -1895,11 +1901,11 @@ class CWIStyleWalletManager {
|
|
|
1895
1901
|
* @param rootPrimaryKey The user's root primary key (32 bytes).
|
|
1896
1902
|
* @param ephemeralRootPrivilegedKey Optional root privileged key (e.g., during recovery flows).
|
|
1897
1903
|
*/
|
|
1898
|
-
async
|
|
1904
|
+
async setupRoot(rootKey, ephemeralRootPrivilegedKey) {
|
|
1899
1905
|
if (this.currentUMPToken == null) {
|
|
1900
1906
|
throw new Error('A UMP token must exist before setting up root infrastructure!');
|
|
1901
1907
|
}
|
|
1902
|
-
this.rootPrimaryKey =
|
|
1908
|
+
this.rootPrimaryKey = rootKey;
|
|
1903
1909
|
// Store ephemeral key if provided, for one-time use by the manager
|
|
1904
1910
|
let oneTimePrivilegedKey = ephemeralRootPrivilegedKey == null ? undefined : new sdk_1.PrivateKey(ephemeralRootPrivilegedKey);
|
|
1905
1911
|
// Create the ROOT PrivilegedKeyManager
|
|
@@ -1935,7 +1941,7 @@ class CWIStyleWalletManager {
|
|
|
1935
1941
|
this.profiles = []; // Clear existing profiles before loading
|
|
1936
1942
|
if (this.currentUMPToken.profilesEncrypted != null && this.currentUMPToken.profilesEncrypted.length > 0) {
|
|
1937
1943
|
try {
|
|
1938
|
-
const decryptedProfileBytes = new sdk_1.SymmetricKey(
|
|
1944
|
+
const decryptedProfileBytes = new sdk_1.SymmetricKey(rootKey).decrypt(this.currentUMPToken.profilesEncrypted);
|
|
1939
1945
|
const profilesJson = sdk_1.Utils.toUTF8(decryptedProfileBytes);
|
|
1940
1946
|
const profiles = JSON.parse(profilesJson);
|
|
1941
1947
|
if (!Array.isArray(profiles) || profiles.length > 1000 || !profiles.every(isValidProfile)) {
|
|
@@ -1947,7 +1953,7 @@ class CWIStyleWalletManager {
|
|
|
1947
1953
|
this.profiles = [];
|
|
1948
1954
|
this.telemetry.capture({
|
|
1949
1955
|
name: 'wallet-toolbox.profile.load-failed',
|
|
1950
|
-
component:
|
|
1956
|
+
component: CWI_COMPONENT,
|
|
1951
1957
|
severity: 'error',
|
|
1952
1958
|
error
|
|
1953
1959
|
});
|
|
@@ -1965,7 +1971,7 @@ class CWIStyleWalletManager {
|
|
|
1965
1971
|
* Includes authentication checks and admin originator protection.
|
|
1966
1972
|
* ---------------------------------------------------------------------------------------
|
|
1967
1973
|
*/
|
|
1968
|
-
|
|
1974
|
+
assertReady(originator) {
|
|
1969
1975
|
if (!this.authenticated) {
|
|
1970
1976
|
throw new Error('User is not authenticated.');
|
|
1971
1977
|
}
|
|
@@ -1979,92 +1985,92 @@ class CWIStyleWalletManager {
|
|
|
1979
1985
|
}
|
|
1980
1986
|
// Example proxy method (repeat pattern for all others)
|
|
1981
1987
|
async getPublicKey(args, originator) {
|
|
1982
|
-
this.
|
|
1983
|
-
return
|
|
1988
|
+
this.assertReady(originator);
|
|
1989
|
+
return this.underlying.getPublicKey(args, originator);
|
|
1984
1990
|
}
|
|
1985
1991
|
async revealCounterpartyKeyLinkage(args, originator) {
|
|
1986
|
-
this.
|
|
1987
|
-
return
|
|
1992
|
+
this.assertReady(originator);
|
|
1993
|
+
return this.underlying.revealCounterpartyKeyLinkage(args, originator);
|
|
1988
1994
|
}
|
|
1989
1995
|
async revealSpecificKeyLinkage(args, originator) {
|
|
1990
|
-
this.
|
|
1991
|
-
return
|
|
1996
|
+
this.assertReady(originator);
|
|
1997
|
+
return this.underlying.revealSpecificKeyLinkage(args, originator);
|
|
1992
1998
|
}
|
|
1993
1999
|
async encrypt(args, originator) {
|
|
1994
|
-
this.
|
|
1995
|
-
return
|
|
2000
|
+
this.assertReady(originator);
|
|
2001
|
+
return this.underlying.encrypt(args, originator);
|
|
1996
2002
|
}
|
|
1997
2003
|
async decrypt(args, originator) {
|
|
1998
|
-
this.
|
|
1999
|
-
return
|
|
2004
|
+
this.assertReady(originator);
|
|
2005
|
+
return this.underlying.decrypt(args, originator);
|
|
2000
2006
|
}
|
|
2001
2007
|
async createHmac(args, originator) {
|
|
2002
|
-
this.
|
|
2003
|
-
return
|
|
2008
|
+
this.assertReady(originator);
|
|
2009
|
+
return this.underlying.createHmac(args, originator);
|
|
2004
2010
|
}
|
|
2005
2011
|
async verifyHmac(args, originator) {
|
|
2006
|
-
this.
|
|
2007
|
-
return
|
|
2012
|
+
this.assertReady(originator);
|
|
2013
|
+
return this.underlying.verifyHmac(args, originator);
|
|
2008
2014
|
}
|
|
2009
2015
|
async createSignature(args, originator) {
|
|
2010
|
-
this.
|
|
2011
|
-
return
|
|
2016
|
+
this.assertReady(originator);
|
|
2017
|
+
return this.underlying.createSignature(args, originator);
|
|
2012
2018
|
}
|
|
2013
2019
|
async verifySignature(args, originator) {
|
|
2014
|
-
this.
|
|
2015
|
-
return
|
|
2020
|
+
this.assertReady(originator);
|
|
2021
|
+
return this.underlying.verifySignature(args, originator);
|
|
2016
2022
|
}
|
|
2017
2023
|
async createAction(args, originator) {
|
|
2018
|
-
this.
|
|
2019
|
-
return
|
|
2024
|
+
this.assertReady(originator);
|
|
2025
|
+
return this.underlying.createAction(args, originator);
|
|
2020
2026
|
}
|
|
2021
2027
|
async signAction(args, originator) {
|
|
2022
|
-
this.
|
|
2023
|
-
return
|
|
2028
|
+
this.assertReady(originator);
|
|
2029
|
+
return this.underlying.signAction(args, originator);
|
|
2024
2030
|
}
|
|
2025
2031
|
async abortAction(args, originator) {
|
|
2026
|
-
this.
|
|
2027
|
-
return
|
|
2032
|
+
this.assertReady(originator);
|
|
2033
|
+
return this.underlying.abortAction(args, originator);
|
|
2028
2034
|
}
|
|
2029
2035
|
async listActions(args, originator) {
|
|
2030
|
-
this.
|
|
2031
|
-
return
|
|
2036
|
+
this.assertReady(originator);
|
|
2037
|
+
return this.underlying.listActions(args, originator);
|
|
2032
2038
|
}
|
|
2033
2039
|
async internalizeAction(args, originator) {
|
|
2034
|
-
this.
|
|
2035
|
-
return
|
|
2040
|
+
this.assertReady(originator);
|
|
2041
|
+
return this.underlying.internalizeAction(args, originator);
|
|
2036
2042
|
}
|
|
2037
2043
|
async listOutputs(args, originator) {
|
|
2038
|
-
this.
|
|
2039
|
-
return
|
|
2044
|
+
this.assertReady(originator);
|
|
2045
|
+
return this.underlying.listOutputs(args, originator);
|
|
2040
2046
|
}
|
|
2041
2047
|
async relinquishOutput(args, originator) {
|
|
2042
|
-
this.
|
|
2043
|
-
return
|
|
2048
|
+
this.assertReady(originator);
|
|
2049
|
+
return this.underlying.relinquishOutput(args, originator);
|
|
2044
2050
|
}
|
|
2045
2051
|
async acquireCertificate(args, originator) {
|
|
2046
|
-
this.
|
|
2047
|
-
return
|
|
2052
|
+
this.assertReady(originator);
|
|
2053
|
+
return this.underlying.acquireCertificate(args, originator);
|
|
2048
2054
|
}
|
|
2049
2055
|
async listCertificates(args, originator) {
|
|
2050
|
-
this.
|
|
2051
|
-
return
|
|
2056
|
+
this.assertReady(originator);
|
|
2057
|
+
return this.underlying.listCertificates(args, originator);
|
|
2052
2058
|
}
|
|
2053
2059
|
async proveCertificate(args, originator) {
|
|
2054
|
-
this.
|
|
2055
|
-
return
|
|
2060
|
+
this.assertReady(originator);
|
|
2061
|
+
return this.underlying.proveCertificate(args, originator);
|
|
2056
2062
|
}
|
|
2057
2063
|
async relinquishCertificate(args, originator) {
|
|
2058
|
-
this.
|
|
2059
|
-
return
|
|
2064
|
+
this.assertReady(originator);
|
|
2065
|
+
return this.underlying.relinquishCertificate(args, originator);
|
|
2060
2066
|
}
|
|
2061
2067
|
async discoverByIdentityKey(args, originator) {
|
|
2062
|
-
this.
|
|
2063
|
-
return
|
|
2068
|
+
this.assertReady(originator);
|
|
2069
|
+
return this.underlying.discoverByIdentityKey(args, originator);
|
|
2064
2070
|
}
|
|
2065
2071
|
async discoverByAttributes(args, originator) {
|
|
2066
|
-
this.
|
|
2067
|
-
return
|
|
2072
|
+
this.assertReady(originator);
|
|
2073
|
+
return this.underlying.discoverByAttributes(args, originator);
|
|
2068
2074
|
}
|
|
2069
2075
|
async isAuthenticated(_, originator) {
|
|
2070
2076
|
if (!this.authenticated) {
|
|
@@ -2082,23 +2088,23 @@ class CWIStyleWalletManager {
|
|
|
2082
2088
|
while (!this.authenticated || this.underlying == null) {
|
|
2083
2089
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
2084
2090
|
}
|
|
2085
|
-
return
|
|
2091
|
+
return this.underlying.waitForAuthentication({}, originator);
|
|
2086
2092
|
}
|
|
2087
2093
|
async getHeight(_, originator) {
|
|
2088
|
-
this.
|
|
2089
|
-
return
|
|
2094
|
+
this.assertReady(originator);
|
|
2095
|
+
return this.underlying.getHeight({}, originator);
|
|
2090
2096
|
}
|
|
2091
2097
|
async getHeaderForHeight(args, originator) {
|
|
2092
|
-
this.
|
|
2093
|
-
return
|
|
2098
|
+
this.assertReady(originator);
|
|
2099
|
+
return this.underlying.getHeaderForHeight(args, originator);
|
|
2094
2100
|
}
|
|
2095
2101
|
async getNetwork(_, originator) {
|
|
2096
|
-
this.
|
|
2097
|
-
return
|
|
2102
|
+
this.assertReady(originator);
|
|
2103
|
+
return this.underlying.getNetwork({}, originator);
|
|
2098
2104
|
}
|
|
2099
2105
|
async getVersion(_, originator) {
|
|
2100
|
-
this.
|
|
2101
|
-
return
|
|
2106
|
+
this.assertReady(originator);
|
|
2107
|
+
return this.underlying.getVersion({}, originator);
|
|
2102
2108
|
}
|
|
2103
2109
|
}
|
|
2104
2110
|
exports.CWIStyleWalletManager = CWIStyleWalletManager;
|