@sidhujag/sysweb3-keyring 1.0.628 → 2.0.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 +22 -0
- package/README.md +66 -0
- package/cjs/hardware-wallet-manager.js +302 -128
- package/cjs/hardware-wallet-manager.js.map +1 -1
- package/cjs/keyring-core.js +93 -0
- package/cjs/keyring-core.js.map +1 -1
- package/cjs/keyring-manager.js +9 -3
- package/cjs/keyring-manager.js.map +1 -1
- package/cjs/ledger/bitcoin_client/lib/appClient.js.map +1 -1
- package/cjs/ledger/host-types.js +10 -0
- package/cjs/ledger/host-types.js.map +1 -0
- package/cjs/ledger/index.js +243 -447
- package/cjs/ledger/index.js.map +1 -1
- package/cjs/ledger/prepare-psbt.js +177 -0
- package/cjs/ledger/prepare-psbt.js.map +1 -0
- package/cjs/software-hd-account.js +23 -0
- package/cjs/software-hd-account.js.map +1 -0
- package/cjs/software.js +16 -0
- package/cjs/software.js.map +1 -1
- package/cjs/transactions/ethereum.js +55 -10
- package/cjs/transactions/ethereum.js.map +1 -1
- package/cjs/transactions/hardware-psbt.js +36 -44
- package/cjs/transactions/hardware-psbt.js.map +1 -1
- package/cjs/transactions/prepared-evm.js +196 -0
- package/cjs/transactions/prepared-evm.js.map +1 -0
- package/cjs/trezor/connect.js +243 -0
- package/cjs/trezor/connect.js.map +1 -0
- package/cjs/trezor/index.js +96 -58
- package/cjs/trezor/index.js.map +1 -1
- package/cjs/trezor/witness.js +25 -0
- package/cjs/trezor/witness.js.map +1 -0
- package/cjs/utils/psbt-account-scope.js +5 -3
- package/cjs/utils/psbt-account-scope.js.map +1 -1
- package/esm/errorUtils.js +72 -0
- package/esm/errorUtils.js.map +1 -0
- package/esm/ethers-v6.js +207 -0
- package/esm/ethers-v6.js.map +1 -0
- package/esm/hardware-wallet-manager.js +643 -0
- package/esm/hardware-wallet-manager.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/appClient.js +279 -0
- package/esm/ledger/bitcoin_client/lib/appClient.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/bip32.js +49 -0
- package/esm/ledger/bitcoin_client/lib/bip32.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/buffertools.js +119 -0
- package/esm/ledger/bitcoin_client/lib/buffertools.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/clientCommands.js +269 -0
- package/esm/ledger/bitcoin_client/lib/clientCommands.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkelizedPsbt.js +50 -0
- package/esm/ledger/bitcoin_client/lib/merkelizedPsbt.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkle.js +111 -0
- package/esm/ledger/bitcoin_client/lib/merkle.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkleMap.js +42 -0
- package/esm/ledger/bitcoin_client/lib/merkleMap.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/policy.js +68 -0
- package/esm/ledger/bitcoin_client/lib/policy.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/psbtv2.js +645 -0
- package/esm/ledger/bitcoin_client/lib/psbtv2.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/varint.js +108 -0
- package/esm/ledger/bitcoin_client/lib/varint.js.map +1 -0
- package/esm/ledger/consts.js +4 -0
- package/esm/ledger/consts.js.map +1 -0
- package/esm/ledger/dmk-evm.js +258 -0
- package/esm/ledger/dmk-evm.js.map +1 -0
- package/esm/ledger/dmk-session.js +264 -0
- package/esm/ledger/dmk-session.js.map +1 -0
- package/esm/ledger/dmk-utxo.js +279 -0
- package/esm/ledger/dmk-utxo.js.map +1 -0
- package/esm/ledger/host-types.js +5 -0
- package/esm/ledger/host-types.js.map +1 -0
- package/esm/ledger/index.js +268 -0
- package/esm/ledger/index.js.map +1 -0
- package/esm/ledger/prepare-psbt.js +141 -0
- package/esm/ledger/prepare-psbt.js.map +1 -0
- package/esm/ledger/types.js +2 -0
- package/esm/ledger/types.js.map +1 -0
- package/esm/ledger-host.js +36 -0
- package/esm/ledger-host.js.map +1 -0
- package/esm/private-records.js +153 -0
- package/esm/private-records.js.map +1 -0
- package/esm/providers.js +588 -0
- package/esm/providers.js.map +1 -0
- package/esm/signers.js +28 -0
- package/esm/signers.js.map +1 -0
- package/esm/trezor/connect.js +206 -0
- package/esm/trezor/connect.js.map +1 -0
- package/esm/trezor/index.js +876 -0
- package/esm/trezor/index.js.map +1 -0
- package/esm/trezor/witness.js +21 -0
- package/esm/trezor/witness.js.map +1 -0
- package/esm/types.js +17 -0
- package/esm/types.js.map +1 -0
- package/esm/utils/derivation-paths.js +109 -0
- package/esm/utils/derivation-paths.js.map +1 -0
- package/esm/utils/psbt-account-scope.js +310 -0
- package/esm/utils/psbt-account-scope.js.map +1 -0
- package/package.json +21 -8
- package/types/hardware-wallet-manager.d.ts +12 -19
- package/types/keyring-core.d.ts +6 -0
- package/types/keyring-manager.d.ts +2 -1
- package/types/ledger/bitcoin_client/lib/appClient.d.ts +6 -3
- package/types/ledger/dmk-evm.d.ts +8 -0
- package/types/ledger/dmk-session.d.ts +60 -0
- package/types/ledger/dmk-utxo.d.ts +26 -0
- package/types/ledger/host-types.d.ts +131 -0
- package/types/ledger/index.d.ts +21 -58
- package/types/ledger/prepare-psbt.d.ts +3 -0
- package/types/ledger/types.d.ts +3 -0
- package/types/ledger-host.d.ts +7 -0
- package/types/software-hd-account.d.ts +16 -0
- package/types/software.d.ts +16 -0
- package/types/transactions/ethereum.d.ts +1 -1
- package/types/transactions/prepared-evm.d.ts +53 -0
- package/types/trezor/connect.d.ts +42 -0
- package/types/trezor/index.d.ts +22 -4
- package/types/trezor/witness.d.ts +3 -0
- package/types/utils/psbt-account-scope.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
- Add `SoftwareKeyring.deriveEvmHdRuntimeAccount` for host-allocated Ethereum BIP44 indices. It returns the existing password-encrypted runtime account record without installing an account, writing storage or querying a network. The method binds session, selection and network identity and requires a synchronous host guard. Hosts must strip encrypted `xprv` before producing public metadata.
|
|
6
|
+
|
|
7
|
+
- Add `SoftwareKeyring.signPreparedEvmTransaction` for offline signing of fully specified legacy/EIP-1559 envelopes. The request binds the selected software account and exact network/endpoint, requires synchronous host admission, validates all signed fields and recovered identity, and returns immutable signed bytes plus their local hash. It never estimates fees, resolves names, fills fields or broadcasts; hosts must durably retain the result before submission and reconcile uncertain broadcasts by hash.
|
|
8
|
+
|
|
9
|
+
- Breaking: Ledger signing requires an explicitly injected semantic `LedgerHost`. Raw LedgerJS transports/clients are removed; use the isolated browser ESM host entry for device access.
|
|
10
|
+
- Adopt current Device Management Kit and Ethereum signer packages while preserving the custom Syscoin/Bitcoin protocol. Serialize device operations and reject stale, wrong-account, malformed and mismatched-sighash responses.
|
|
11
|
+
- Disable remote Ledger metadata/transaction checks/telemetry by default. Require fresh per-intent consent for transaction/typed-data signing that may fall back to blind signing.
|
|
12
|
+
- Bind receive addresses to public account derivation, preserve on-device approval for unusual paths, and snapshot queued UTXO requests before connection awaits.
|
|
13
|
+
- Existing software-only entry, vault formats and account derivation remain compatible. Host/device and native-runtime qualification are separate requirements.
|
|
14
|
+
|
|
15
|
+
- Remove the legacy Trezor UTXO library. Reuse Bitcoinjs address decoding with a checksum-verified two-byte-version compatibility path, and encode witness vectors with the public CompactSize codec.
|
|
16
|
+
|
|
17
|
+
- Move Trezor hardware integration to Connect 10.0.1 and remove the redundant direct Connect Web dependency.
|
|
18
|
+
- Load the browser transport only inside a supported MV3 extension. Preserve CommonJS/ESM and software-entry imports without browser globals or device initialization.
|
|
19
|
+
- Preserve the existing SDK failure payload while retaining Connect error codes; stop retrying cancellations, disconnects and unsupported hosts/coins.
|
|
20
|
+
- Replace removed Connect device events with status updates from request outcomes and disposal. Immediate physical unplug notifications are no longer exposed by upstream.
|
|
21
|
+
- Reject pending calls locally on lock/disposal and discard late responses. Defer remote cleanup while requests are outstanding; return `HARDWARE_SIGNER_BUSY` until they settle rather than opening another approval prompt.
|
|
22
|
+
- Normalize Trezor hexadecimal recovery values without mutating signed responses; preserve approved transaction and session checks.
|
|
23
|
+
- Physical device qualification and consuming-extension Suite Web permissions remain release gates.
|
|
24
|
+
|
|
3
25
|
## 1.0.628
|
|
4
26
|
|
|
5
27
|
- Add the `cjs/software` entry with explicit asynchronous host storage and an opaque wallet-authority handle. Software keyrings do not load browser hardware transports or global storage.
|
package/README.md
CHANGED
|
@@ -150,6 +150,32 @@ const signature = await keyringManager.ethereumTransaction.signPersonalMessage([
|
|
|
150
150
|
|
|
151
151
|
### Hardware Wallet Support
|
|
152
152
|
|
|
153
|
+
Trezor uses `@trezor/connect-webextension` 10.0.1. The hardware adapter loads it
|
|
154
|
+
only when a supported MV3 extension invokes Trezor; ordinary Node CommonJS/ESM
|
|
155
|
+
imports and the software entry do not initialize browser transports. Unsupported
|
|
156
|
+
hosts reject hardware operations instead of falling back to software signing.
|
|
157
|
+
|
|
158
|
+
The extension must configure `externally_connectable` for
|
|
159
|
+
`https://suite.trezor.io/*` and host access to that origin, as required by the
|
|
160
|
+
[published Connect 10 webextension package](https://www.npmjs.com/package/@trezor/connect-webextension/v/10.0.1).
|
|
161
|
+
Connect selects Suite Desktop or the Suite Web popup. The old Connect 9 iframe,
|
|
162
|
+
content script, and `connectSrc` settings are not part of this integration.
|
|
163
|
+
|
|
164
|
+
Connect 10 does not expose the old device event emitter. SDK connection status
|
|
165
|
+
and cached model information update from request results and disposal; they are
|
|
166
|
+
not immediate physical unplug notifications. Disposal immediately rejects pending
|
|
167
|
+
SDK operations and fences late replies. Suite Web may leave its popup open; a
|
|
168
|
+
late approval there is discarded locally rather than treated as a fresh approval.
|
|
169
|
+
When an underlying request is still active, transport cleanup is deferred to avoid
|
|
170
|
+
triggering an automatic fallback popup. New initialization fails with
|
|
171
|
+
`HARDWARE_SIGNER_BUSY` until that request settles; local lock/disposal does not
|
|
172
|
+
wait for the remote prompt. An upstream transport failure can still trigger remote
|
|
173
|
+
fallback UI while that old request is pending; the local SDK will reject its result.
|
|
174
|
+
A failed or cancelled operation
|
|
175
|
+
never authorizes a cached transaction, and terminal disconnect/unsupported-host
|
|
176
|
+
errors are not retried. Device pairing, display verification, signing, and
|
|
177
|
+
reconnection still require physical-device qualification in the consuming host.
|
|
178
|
+
|
|
153
179
|
```javascript
|
|
154
180
|
// Import Trezor account
|
|
155
181
|
const trezorAccount = await keyringManager.importTrezorAccount(
|
|
@@ -293,3 +319,43 @@ collection rather than guaranteed memory erasure.
|
|
|
293
319
|
## License
|
|
294
320
|
|
|
295
321
|
MIT License
|
|
322
|
+
|
|
323
|
+
### Ledger platform host
|
|
324
|
+
|
|
325
|
+
Ledger device access uses the Device Management Kit. The regular and software
|
|
326
|
+
entries do not load a Ledger transport or device SDK. Browser integrations must
|
|
327
|
+
create the heavy host from `@sidhujag/sysweb3-keyring/esm/ledger-host` in a visible
|
|
328
|
+
extension page and inject its semantic `LedgerHost` port into the wallet authority:
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
// Visible device page only:
|
|
332
|
+
import { createLedgerDmkHost } from '@sidhujag/sysweb3-keyring/esm/ledger-host';
|
|
333
|
+
const host = createLedgerDmkHost({
|
|
334
|
+
confirmBlindSigning: async (intent, signal) => {
|
|
335
|
+
// Show the exact immutable intent and an explicit blind-signing warning.
|
|
336
|
+
// Return true only after a fresh user decision; cancellation must return false.
|
|
337
|
+
return showTrustedWalletConfirmation(intent, signal);
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
// Wallet authority: use a secured semantic port to that page, not a raw APDU port.
|
|
342
|
+
const wallet = new KeyringManager(undefined, authorizedLedgerHostPort);
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Use only the ESM host entry with a browser bundler and its required platform
|
|
346
|
+
polyfills. `cjs/ledger-host` is not a supported entry. A service worker cannot own
|
|
347
|
+
the WebHID device picker. The platform must bind the host to its own trusted page,
|
|
348
|
+
revoke pending operations on lock/close, and never expose this port to dapps.
|
|
349
|
+
A missing host fails with `HARDWARE_SIGNER_UNAVAILABLE`; there is no legacy
|
|
350
|
+
LedgerJS fallback. Pass either a shared hardware manager or a Ledger host to
|
|
351
|
+
`KeyringManager`, not both.
|
|
352
|
+
|
|
353
|
+
The default host performs no remote metadata lookup, transaction checks, or
|
|
354
|
+
signing telemetry. The current Ethereum signer library can fall back to blind
|
|
355
|
+
signing, so transaction and typed-data signing require per-request approval
|
|
356
|
+
through the trusted `confirmBlindSigning` callback. Omitting it fails closed.
|
|
357
|
+
Personal-message signing and address retrieval remain available offline.
|
|
358
|
+
Signatures are checked against the expected account; UTXO signatures must also
|
|
359
|
+
match the approved PSBT and its requested sighash coverage. The custom UTXO host
|
|
360
|
+
supports the existing Syscoin and Bitcoin app protocols. Physical-device and
|
|
361
|
+
firmware qualification remain separate from source and mocked-device tests.
|