@sidhujag/sysweb3-keyring 2.1.7 → 2.1.9
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 +12 -0
- package/cjs/hardware-transaction-authority.js +15 -11
- package/cjs/hardware-transaction-authority.js.map +1 -1
- package/cjs/hardware-wallet-manager.js +74 -119
- package/cjs/hardware-wallet-manager.js.map +1 -1
- package/cjs/hardware-wallet-types.js +16 -0
- package/cjs/hardware-wallet-types.js.map +1 -0
- package/cjs/host-keyring.js +32 -0
- package/cjs/host-keyring.js.map +1 -0
- package/cjs/index.js +1 -0
- package/cjs/index.js.map +1 -1
- package/cjs/keyring-core.js +96 -61
- package/cjs/keyring-core.js.map +1 -1
- package/cjs/keyring-manager.js +15 -16
- package/cjs/keyring-manager.js.map +1 -1
- package/cjs/ledger/host-types.js.map +1 -1
- package/cjs/ledger/index.js +24 -4
- package/cjs/ledger/index.js.map +1 -1
- package/cjs/ledger-hardware.js +15 -0
- package/cjs/ledger-hardware.js.map +1 -0
- package/cjs/software.js +6 -25
- package/cjs/software.js.map +1 -1
- package/cjs/transactions/ethereum.js +371 -494
- package/cjs/transactions/ethereum.js.map +1 -1
- package/cjs/transactions/evm-submission-failure.js +73 -0
- package/cjs/transactions/evm-submission-failure.js.map +1 -0
- package/cjs/transactions/evm-submission.js +35 -61
- package/cjs/transactions/evm-submission.js.map +1 -1
- package/cjs/transactions/ledger-signing.js +52 -0
- package/cjs/transactions/ledger-signing.js.map +1 -0
- package/cjs/transactions/prepared-evm.js +24 -1
- package/cjs/transactions/prepared-evm.js.map +1 -1
- package/cjs/transactions/trezor-signing.js +90 -0
- package/cjs/transactions/trezor-signing.js.map +1 -0
- package/cjs/trezor/connect.js +238 -243
- package/cjs/trezor/connect.js.map +1 -1
- package/cjs/trezor/host-types.js +19 -0
- package/cjs/trezor/host-types.js.map +1 -0
- package/cjs/trezor/index.js +75 -23
- package/cjs/trezor/index.js.map +1 -1
- package/cjs/trezor/webextension-host.js +118 -0
- package/cjs/trezor/webextension-host.js.map +1 -0
- package/cjs/trezor-hardware.js +16 -0
- package/cjs/trezor-hardware.js.map +1 -0
- package/cjs/types.js.map +1 -1
- package/esm/hardware-transaction-authority.js +14 -11
- package/esm/hardware-transaction-authority.js.map +1 -1
- package/esm/hardware-wallet-manager.js +20 -32
- package/esm/hardware-wallet-manager.js.map +1 -1
- package/esm/hardware-wallet-types.js +13 -0
- package/esm/hardware-wallet-types.js.map +1 -0
- package/esm/keyring-core.js +98 -63
- package/esm/keyring-core.js.map +1 -1
- package/esm/ledger/dmk-host.js +2 -0
- package/esm/ledger/dmk-host.js.map +1 -1
- package/esm/ledger/dmk-session.js +73 -8
- package/esm/ledger/dmk-session.js.map +1 -1
- package/esm/ledger/host-types.js.map +1 -1
- package/esm/ledger/index.js +22 -2
- package/esm/ledger/index.js.map +1 -1
- package/esm/transactions/ethereum.js +372 -495
- package/esm/transactions/ethereum.js.map +1 -1
- package/esm/transactions/evm-submission-failure.js +68 -0
- package/esm/transactions/evm-submission-failure.js.map +1 -0
- package/esm/transactions/evm-submission.js +32 -59
- package/esm/transactions/evm-submission.js.map +1 -1
- package/esm/transactions/ledger-signing.js +49 -0
- package/esm/transactions/ledger-signing.js.map +1 -0
- package/esm/transactions/prepared-evm.js +23 -1
- package/esm/transactions/prepared-evm.js.map +1 -1
- package/esm/transactions/trezor-signing.js +87 -0
- package/esm/transactions/trezor-signing.js.map +1 -0
- package/esm/trezor/connect.js +236 -209
- package/esm/trezor/connect.js.map +1 -1
- package/esm/trezor/host-types.js +16 -0
- package/esm/trezor/host-types.js.map +1 -0
- package/esm/trezor/index.js +74 -22
- package/esm/trezor/index.js.map +1 -1
- package/esm/types.js.map +1 -1
- package/package.json +61 -1
- package/types/hardware-transaction-authority.d.ts +1 -0
- package/types/hardware-wallet-manager.d.ts +6 -22
- package/types/hardware-wallet-types.d.ts +21 -0
- package/types/host-keyring.d.ts +16 -0
- package/types/index.d.ts +1 -0
- package/types/keyring-core.d.ts +12 -4
- package/types/keyring-manager.d.ts +5 -3
- package/types/ledger/dmk-host.d.ts +2 -0
- package/types/ledger/dmk-session.d.ts +9 -0
- package/types/ledger/host-types.d.ts +2 -0
- package/types/ledger/index.d.ts +3 -1
- package/types/ledger-hardware.d.ts +5 -0
- package/types/software.d.ts +2 -16
- package/types/transactions/ethereum.d.ts +11 -1
- package/types/transactions/evm-submission-failure.d.ts +11 -0
- package/types/transactions/evm-submission.d.ts +6 -8
- package/types/transactions/ledger-signing.d.ts +13 -0
- package/types/transactions/prepared-evm.d.ts +12 -0
- package/types/transactions/trezor-signing.d.ts +13 -0
- package/types/trezor/connect.d.ts +11 -9
- package/types/trezor/host-types.d.ts +25 -0
- package/types/trezor/index.d.ts +7 -7
- package/types/trezor/webextension-host.d.ts +7 -0
- package/types/trezor-hardware.d.ts +6 -0
- package/types/types.d.ts +16 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createKeyringHost = exports.HostKeyring = void 0;
|
|
4
|
+
const keyring_core_1 = require("./keyring-core");
|
|
5
|
+
const keyring_host_1 = require("./keyring-host");
|
|
6
|
+
/** Shared wallet engine with explicit host authority and hardware capabilities. */
|
|
7
|
+
class HostKeyring extends keyring_core_1.KeyringCore {
|
|
8
|
+
constructor(host, options, createHardware) {
|
|
9
|
+
if (typeof createHardware !== 'function')
|
|
10
|
+
throw new TypeError('Keyring requires explicit hardware capabilities');
|
|
11
|
+
const { binding, publishControls } = (0, keyring_host_1.prepareKeyringHost)(host, options);
|
|
12
|
+
const hardware = createHardware();
|
|
13
|
+
if (!hardware ||
|
|
14
|
+
!('ledgerSigner' in hardware) ||
|
|
15
|
+
!('trezorSigner' in hardware))
|
|
16
|
+
throw new TypeError('Keyring requires explicit hardware capabilities');
|
|
17
|
+
super(binding, hardware);
|
|
18
|
+
publishControls?.();
|
|
19
|
+
}
|
|
20
|
+
/** Derive runtime state using the shared software account implementation. */
|
|
21
|
+
deriveEvmHdRuntimeAccount(request, options) {
|
|
22
|
+
return this.deriveSoftwareEvmHdRuntimeAccount(request, options);
|
|
23
|
+
}
|
|
24
|
+
/** Sign the prepared software envelope; the host retains it before broadcast. */
|
|
25
|
+
signPreparedEvmTransaction(request, options) {
|
|
26
|
+
return this.signPreparedSoftwareEvmTransaction(request, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.HostKeyring = HostKeyring;
|
|
30
|
+
var keyring_host_2 = require("./keyring-host");
|
|
31
|
+
Object.defineProperty(exports, "createKeyringHost", { enumerable: true, get: function () { return keyring_host_2.createKeyringHost; } });
|
|
32
|
+
//# sourceMappingURL=host-keyring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-keyring.js","sourceRoot":"","sources":["../../src/host-keyring.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAC7C,iDAAoD;AAmBpD,mFAAmF;AACnF,MAAa,WAGX,SAAQ,0BAA6B;IACrC,YACE,IAAiB,EACjB,OAAuB,EACvB,cAAuD;QAEvD,IAAI,OAAO,cAAc,KAAK,UAAU;YACtC,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;QACzE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,IAAA,iCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;QAClC,IACE,CAAC,QAAQ;YACT,CAAC,CAAC,cAAc,IAAI,QAAQ,CAAC;YAC7B,CAAC,CAAC,cAAc,IAAI,QAAQ,CAAC;YAE7B,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;QACzE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzB,eAAe,EAAE,EAAE,CAAC;IACtB,CAAC;IAED,6EAA6E;IACtE,yBAAyB,CAC9B,OAAmC,EACnC,OAAmC;QAEnC,OAAO,IAAI,CAAC,iCAAiC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,iFAAiF;IAC1E,0BAA0B,CAC/B,OAA0C,EAC1C,OAAkC;QAElC,OAAO,IAAI,CAAC,kCAAkC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;CACF;AAtCD,kCAsCC;AAED,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA"}
|
package/cjs/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __exportStar(require("./providers"), exports);
|
|
|
31
31
|
__exportStar(require("./utils/derivation-paths"), exports);
|
|
32
32
|
__exportStar(require("./network-utils"), exports);
|
|
33
33
|
__exportStar(require("./hardware-wallet-manager"), exports);
|
|
34
|
+
__exportStar(require("./hardware-wallet-types"), exports);
|
|
34
35
|
var psbt_1 = require("./utils/psbt");
|
|
35
36
|
Object.defineProperty(exports, "PsbtUtils", { enumerable: true, get: function () { return psbt_1.PsbtUtils; } });
|
|
36
37
|
var watch_descriptor_1 = require("./utils/watch-descriptor");
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,0CAAwB;AACxB,+CAA0D;AAAjD,wHAAA,wBAAwB,OAAA;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAE1B,qDAG2B;AAFzB,2HAAA,wBAAwB,OAAA;AACxB,iIAAA,8BAA8B,OAAA;AAOhC,8CAA4B;AAC5B,2DAAyC;AACzC,kDAAgC;AAChC,4DAA0C;AAC1C,qCAAyC;AAAhC,iGAAA,SAAS,OAAA;AAClB,6DAGkC;AAFhC,2HAAA,uBAAuB,OAAA;AACvB,sHAAA,kBAAkB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,0CAAwB;AACxB,+CAA0D;AAAjD,wHAAA,wBAAwB,OAAA;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA;AAE1B,qDAG2B;AAFzB,2HAAA,wBAAwB,OAAA;AACxB,iIAAA,8BAA8B,OAAA;AAOhC,8CAA4B;AAC5B,2DAAyC;AACzC,kDAAgC;AAChC,4DAA0C;AAC1C,0DAAwC;AACxC,qCAAyC;AAAhC,iGAAA,SAAS,OAAA;AAClB,6DAGkC;AAFhC,2HAAA,uBAAuB,OAAA;AACvB,sHAAA,kBAAkB,OAAA"}
|
package/cjs/keyring-core.js
CHANGED
|
@@ -70,6 +70,7 @@ const SLH_DSA_SETUP_SECRET_HEX_LENGTH = 64;
|
|
|
70
70
|
const SLH_DSA_PARAMETER_SET = 'SLH-DSA-SHA2-128-24';
|
|
71
71
|
const current_vault_refusal_1 = require("./current-vault-refusal");
|
|
72
72
|
const ethers_v6_1 = require("./ethers-v6");
|
|
73
|
+
const hardware_transaction_authority_1 = require("./hardware-transaction-authority");
|
|
73
74
|
const initial_state_1 = require("./initial-state");
|
|
74
75
|
const keyring_host_1 = require("./keyring-host");
|
|
75
76
|
const private_records_1 = require("./private-records");
|
|
@@ -153,6 +154,10 @@ class KeyringCore {
|
|
|
153
154
|
this.getVaultState = null;
|
|
154
155
|
// Method to inject store getter from Pali side
|
|
155
156
|
this.setVaultStateGetter = (getter) => {
|
|
157
|
+
if (typeof getter !== 'function')
|
|
158
|
+
throw new TypeError('Vault state getter must be a function');
|
|
159
|
+
if (this.getVaultState)
|
|
160
|
+
throw new Error('Vault state getter is already bound');
|
|
156
161
|
this.getVaultState = getter;
|
|
157
162
|
};
|
|
158
163
|
// Helper method to get current vault state
|
|
@@ -193,6 +198,7 @@ class KeyringCore {
|
|
|
193
198
|
this.sessionPassword = null;
|
|
194
199
|
this.sessionMnemonic = null; // can be a mnemonic or a zprv, can be changed to a zprv when using an imported wallet
|
|
195
200
|
this.privateRecordSessionRevision = 0;
|
|
201
|
+
this.sessionLifetime = new AbortController();
|
|
196
202
|
_KeyringCore_deviceUnlockRetired.set(this, false);
|
|
197
203
|
_KeyringCore_sessionOwnership.set(this, void 0);
|
|
198
204
|
this.createSyscoinTransactions = () => new syscoin_core_1.SyscoinTransactionsCore(this.getSigner, this.getReadOnlySigner, this.getAccountsState, this.syscoinHardwareSigners, this.capturePsbtSigningContext);
|
|
@@ -214,7 +220,7 @@ class KeyringCore {
|
|
|
214
220
|
};
|
|
215
221
|
this.isUnlocked = () => !!this.sessionPassword && !this.sessionPassword.isCleared();
|
|
216
222
|
this.lockWallet = async () => {
|
|
217
|
-
this.
|
|
223
|
+
this.retireSessionLifetime();
|
|
218
224
|
// Clear secure session data
|
|
219
225
|
if (this.sessionPassword) {
|
|
220
226
|
this.sessionPassword.clear();
|
|
@@ -254,8 +260,8 @@ class KeyringCore {
|
|
|
254
260
|
}
|
|
255
261
|
}
|
|
256
262
|
};
|
|
257
|
-
|
|
258
|
-
this.
|
|
263
|
+
/** Retire hardware before preparing a synchronous, one-use session move. */
|
|
264
|
+
this.prepareSessionTransfer = async (targetKeyring, assertCurrent) => {
|
|
259
265
|
if (!this.isUnlocked()) {
|
|
260
266
|
throw new Error('Source keyring must be unlocked to transfer session');
|
|
261
267
|
}
|
|
@@ -263,21 +269,78 @@ class KeyringCore {
|
|
|
263
269
|
if (!(targetKeyring instanceof KeyringCore) ||
|
|
264
270
|
targetKeyring.authority !== this.authority ||
|
|
265
271
|
targetKeyring.storage !== this.storage ||
|
|
266
|
-
targetKeyring.vaultPersistence !== this.vaultPersistence
|
|
272
|
+
targetKeyring.vaultPersistence !== this.vaultPersistence ||
|
|
273
|
+
__classPrivateFieldGet(targetKeyring, _KeyringCore_sessionOwnership, "f").tracker !== __classPrivateFieldGet(this, _KeyringCore_sessionOwnership, "f").tracker) {
|
|
267
274
|
throw new Error('Cannot transfer session between different wallet authorities');
|
|
268
275
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
276
|
+
const sourceGuard = __classPrivateFieldGet(this, _KeyringCore_instances, "m", _KeyringCore_captureSessionGuard).call(this);
|
|
277
|
+
const targetRevision = targetKeyring.privateRecordSessionRevision;
|
|
278
|
+
const ledger = this.ledgerSigner;
|
|
279
|
+
const trezor = this.trezorSigner;
|
|
280
|
+
const retirementChecks = [];
|
|
281
|
+
const checkOwnership = () => {
|
|
282
|
+
sourceGuard();
|
|
283
|
+
if (!this.isUnlocked() ||
|
|
284
|
+
!this.sessionMnemonic ||
|
|
285
|
+
this.ledgerSigner !== ledger ||
|
|
286
|
+
this.trezorSigner !== trezor ||
|
|
287
|
+
__classPrivateFieldGet(targetKeyring, _KeyringCore_sessionOwnership, "f").destroyed ||
|
|
288
|
+
targetKeyring.privateRecordSessionRevision !== targetRevision)
|
|
289
|
+
throw new Error('Wallet session changed during transfer preparation');
|
|
290
|
+
};
|
|
291
|
+
const check = () => {
|
|
292
|
+
checkOwnership();
|
|
293
|
+
(0, hardware_transaction_authority_1.assertHardwareOperationCurrent)(assertCurrent);
|
|
294
|
+
for (const assertRetired of retirementChecks)
|
|
295
|
+
(0, hardware_transaction_authority_1.assertHardwareOperationCurrent)(assertRetired);
|
|
296
|
+
checkOwnership();
|
|
297
|
+
};
|
|
298
|
+
check();
|
|
299
|
+
if (targetKeyring !== this) {
|
|
300
|
+
const signals = [
|
|
301
|
+
this.sessionLifetime.signal,
|
|
302
|
+
targetKeyring.sessionLifetime.signal,
|
|
303
|
+
];
|
|
304
|
+
let cancel;
|
|
305
|
+
const cancelled = new Promise((_resolve, reject) => {
|
|
306
|
+
cancel = () => reject(new Error('Wallet session changed during transfer preparation'));
|
|
307
|
+
for (const signal of signals)
|
|
308
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
309
|
+
});
|
|
310
|
+
const signers = [ledger, trezor].filter((signer) => signer !== undefined);
|
|
311
|
+
const retirement = Promise.allSettled(signers.map((signer) => Promise.resolve().then(() => signer.retire()))).then((results) => {
|
|
312
|
+
for (const result of results) {
|
|
313
|
+
if (result.status === 'rejected')
|
|
314
|
+
throw result.reason;
|
|
315
|
+
retirementChecks.push(result.value);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
try {
|
|
319
|
+
await Promise.race([retirement, cancelled]);
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
for (const signal of signals)
|
|
323
|
+
signal.removeEventListener('abort', cancel);
|
|
324
|
+
}
|
|
325
|
+
check();
|
|
274
326
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
327
|
+
let consumed = false;
|
|
328
|
+
return Object.freeze({
|
|
329
|
+
transfer: () => {
|
|
330
|
+
if (consumed)
|
|
331
|
+
throw new Error('Session transfer has already been used');
|
|
332
|
+
consumed = true;
|
|
333
|
+
check();
|
|
334
|
+
if (targetKeyring === this)
|
|
335
|
+
return;
|
|
336
|
+
__classPrivateFieldGet(targetKeyring, _KeyringCore_instances, "m", _KeyringCore_acceptSessionFrom).call(targetKeyring, this);
|
|
337
|
+
this.retireSessionLifetime();
|
|
338
|
+
__classPrivateFieldSet(this, _KeyringCore_deviceUnlockRetired, true, "f");
|
|
339
|
+
// Move the original SecureBuffers without copying their contents.
|
|
340
|
+
this.sessionPassword = null;
|
|
341
|
+
this.sessionMnemonic = null;
|
|
342
|
+
},
|
|
343
|
+
});
|
|
281
344
|
};
|
|
282
345
|
this.addNewAccount = async (label) => {
|
|
283
346
|
// Check if wallet is unlocked
|
|
@@ -1249,6 +1312,22 @@ class KeyringCore {
|
|
|
1249
1312
|
// No need to explicitly set active account - it's managed externally
|
|
1250
1313
|
return account;
|
|
1251
1314
|
}
|
|
1315
|
+
/** Capture wallet-session authority without binding an account or network. */
|
|
1316
|
+
captureUnlockedSessionGuard() {
|
|
1317
|
+
const assertOwner = __classPrivateFieldGet(this, _KeyringCore_instances, "m", _KeyringCore_captureSessionGuard).call(this);
|
|
1318
|
+
const assertCurrent = () => {
|
|
1319
|
+
assertOwner();
|
|
1320
|
+
if (!this.isUnlocked())
|
|
1321
|
+
throw new Error('Wallet unlock session changed');
|
|
1322
|
+
};
|
|
1323
|
+
assertCurrent();
|
|
1324
|
+
return assertCurrent;
|
|
1325
|
+
}
|
|
1326
|
+
retireSessionLifetime() {
|
|
1327
|
+
this.privateRecordSessionRevision++;
|
|
1328
|
+
this.sessionLifetime.abort();
|
|
1329
|
+
this.sessionLifetime = new AbortController();
|
|
1330
|
+
}
|
|
1252
1331
|
/**
|
|
1253
1332
|
* Returns canLogin:false only when the first vault authentication fails.
|
|
1254
1333
|
* Storage, platform and session restoration failures reject so callers do
|
|
@@ -1859,51 +1938,7 @@ class KeyringCore {
|
|
|
1859
1938
|
}
|
|
1860
1939
|
/** The software facade owns this public capability; no device fallback. */
|
|
1861
1940
|
signPreparedSoftwareEvmTransaction(input, options) {
|
|
1862
|
-
|
|
1863
|
-
const assertSession = this.capturePsbtSigningContext();
|
|
1864
|
-
const vault = this.getVault();
|
|
1865
|
-
const selected = { ...vault.activeAccount };
|
|
1866
|
-
const selectedAccount = vault.accounts[selected.type]?.[selected.id];
|
|
1867
|
-
const encryptedKey = selectedAccount?.xprv;
|
|
1868
|
-
const request = (0, prepared_evm_1.snapshotPreparedEvmRequest)(input);
|
|
1869
|
-
const hostGuard = (0, prepared_evm_1.preparedEvmGuard)(options);
|
|
1870
|
-
const assertCurrent = () => {
|
|
1871
|
-
assertSession();
|
|
1872
|
-
const current = this.getVault();
|
|
1873
|
-
const account = current.accounts[selected.type]?.[selected.id];
|
|
1874
|
-
if ((selected.type !== types_1.KeyringAccountType.HDAccount &&
|
|
1875
|
-
selected.type !== types_1.KeyringAccountType.Imported) ||
|
|
1876
|
-
!account ||
|
|
1877
|
-
account.id !== selected.id ||
|
|
1878
|
-
account.isLedgerWallet ||
|
|
1879
|
-
account.isTrezorWallet ||
|
|
1880
|
-
account.isSmartAccount ||
|
|
1881
|
-
typeof encryptedKey !== 'string' ||
|
|
1882
|
-
encryptedKey.length === 0 ||
|
|
1883
|
-
account.xprv !== encryptedKey ||
|
|
1884
|
-
request.account.type !== selected.type ||
|
|
1885
|
-
request.account.id !== selected.id ||
|
|
1886
|
-
request.account.expectedAddress !== (0, ethers_v6_1.getAddress)(account.address) ||
|
|
1887
|
-
current.activeNetwork.kind !== sysweb3_network_1.INetworkType.Ethereum ||
|
|
1888
|
-
current.activeNetwork.slip44 !== 60 ||
|
|
1889
|
-
!Number.isSafeInteger(current.activeNetwork.chainId) ||
|
|
1890
|
-
current.activeNetwork.chainId <= 0 ||
|
|
1891
|
-
BigInt(current.activeNetwork.chainId).toString() !==
|
|
1892
|
-
request.network.chainId ||
|
|
1893
|
-
current.activeNetwork.url !== request.network.url)
|
|
1894
|
-
throw new Error('Prepared EVM signing context changed or is unsupported');
|
|
1895
|
-
};
|
|
1896
|
-
assertCurrent();
|
|
1897
|
-
hostGuard();
|
|
1898
|
-
assertCurrent();
|
|
1899
|
-
const key = this.getDecryptedPrivateKey();
|
|
1900
|
-
if ((0, ethers_v6_1.getAddress)(key.address) !== request.account.expectedAddress)
|
|
1901
|
-
throw new Error('Prepared EVM signer address mismatch');
|
|
1902
|
-
assertCurrent();
|
|
1903
|
-
const { signed } = (0, prepared_evm_1.signPreparedEvmEnvelope)(request.transaction, key.decryptedPrivateKey);
|
|
1904
|
-
hostGuard();
|
|
1905
|
-
assertCurrent();
|
|
1906
|
-
return signed;
|
|
1941
|
+
return this.ethereumTransaction.signPreparedEvmTransaction(input, options);
|
|
1907
1942
|
}
|
|
1908
1943
|
writeUtf8Diagnostic(hasUtf8Error) {
|
|
1909
1944
|
try {
|
|
@@ -2743,7 +2778,7 @@ _KeyringCore_deviceUnlockRetired = new WeakMap(), _KeyringCore_sessionOwnership
|
|
|
2743
2778
|
};
|
|
2744
2779
|
}, _KeyringCore_replaceSessionBuffers = function _KeyringCore_replaceSessionBuffers(sessionPassword, sessionMnemonic, sourceToken) {
|
|
2745
2780
|
__classPrivateFieldGet(this, _KeyringCore_instances, "m", _KeyringCore_assertSessionOwner).call(this, sourceToken);
|
|
2746
|
-
this.
|
|
2781
|
+
this.retireSessionLifetime();
|
|
2747
2782
|
// Clear any existing data first
|
|
2748
2783
|
if (this.sessionPassword) {
|
|
2749
2784
|
this.sessionPassword.clear();
|