@cardano-sdk/hardware-trezor 0.7.25 → 0.7.27
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/README.md +355 -0
- package/dist/cjs/TrezorKeyAgent.d.ts +4 -2
- package/dist/cjs/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/cjs/TrezorKeyAgent.js +32 -5
- package/dist/cjs/TrezorKeyAgent.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/TrezorKeyAgent.d.ts +4 -2
- package/dist/esm/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/esm/TrezorKeyAgent.js +32 -5
- package/dist/esm/TrezorKeyAgent.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1 +1,356 @@
|
|
|
1
1
|
# Cardano JS SDK | Hardware | Trezor
|
|
2
|
+
|
|
3
|
+
Hardware wallet integration for Trezor devices in the Cardano ecosystem. This package provides secure key management and transaction signing capabilities for Trezor hardware wallets.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔐 **Secure Key Management** - Private keys never leave the Trezor device
|
|
8
|
+
- 🔄 **Multiple Master Key Generation Schemes** - Support for ICARUS, ICARUS_TREZOR, and LEDGER master key generation algorithms
|
|
9
|
+
- 📝 **Transaction Signing** - Sign Cardano transactions securely on hardware
|
|
10
|
+
- 🏗️ **TypeScript Support** - Full type safety and IntelliSense support
|
|
11
|
+
- 🔌 **Trezor Connect Integration** - Built on the official Trezor Connect library
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @cardano-sdk/hardware-trezor
|
|
17
|
+
# or
|
|
18
|
+
yarn add @cardano-sdk/hardware-trezor
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- **Trezor Device** - Model T, One, or newer
|
|
24
|
+
- **Trezor Bridge** - Required for USB communication
|
|
25
|
+
- **Node.js** - Version 16.20.1 or higher
|
|
26
|
+
|
|
27
|
+
### Quick Setup
|
|
28
|
+
|
|
29
|
+
For automated setup of the Trezor testing environment:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Set up Trezor testing environment (from wallet package)
|
|
33
|
+
./packages/wallet/scripts/setup-hw-testing.sh
|
|
34
|
+
|
|
35
|
+
# Or install Trezor Bridge only
|
|
36
|
+
./packages/wallet/scripts/install-trezor-bridge.sh
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Basic Usage
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { TrezorKeyAgent } from '@cardano-sdk/hardware-trezor';
|
|
45
|
+
import { Cardano, CommunicationType } from '@cardano-sdk/core';
|
|
46
|
+
|
|
47
|
+
// Create a key agent with default settings
|
|
48
|
+
const keyAgent = await TrezorKeyAgent.createWithDevice({
|
|
49
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
50
|
+
trezorConfig: {
|
|
51
|
+
communicationType: CommunicationType.Node,
|
|
52
|
+
manifest: {
|
|
53
|
+
appUrl: 'https://your-app.com',
|
|
54
|
+
email: 'contact@your-app.com'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, dependencies);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### With Custom Derivation Type
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { TrezorKeyAgent } from '@cardano-sdk/hardware-trezor';
|
|
64
|
+
import { Cardano, CommunicationType } from '@cardano-sdk/core';
|
|
65
|
+
|
|
66
|
+
// Create a key agent with specific derivation type
|
|
67
|
+
const keyAgent = await TrezorKeyAgent.createWithDevice({
|
|
68
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
69
|
+
trezorConfig: {
|
|
70
|
+
communicationType: CommunicationType.Node,
|
|
71
|
+
derivationType: 'ICARUS', // or 'ICARUS_TREZOR', 'LEDGER'
|
|
72
|
+
manifest: {
|
|
73
|
+
appUrl: 'https://your-app.com',
|
|
74
|
+
email: 'contact@your-app.com'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, dependencies);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Master Key Generation Schemes
|
|
81
|
+
|
|
82
|
+
The package supports three master key generation algorithms for compatibility with different wallet types:
|
|
83
|
+
|
|
84
|
+
### ICARUS (Baseline - Software Wallets)
|
|
85
|
+
- **Value**: `'ICARUS'`
|
|
86
|
+
- **Use Case**: Software wallets
|
|
87
|
+
- **Algorithm**: Standard CIP-3 (BIP-39 → Ed25519-BIP32)
|
|
88
|
+
- **Technical Flow**: `Mnemonic → entropy → BIP-39 seed (using PBKDF2-HMAC-SHA512, with optional passphrase) → ed25519-bip32 master key (CIP-3 spec)`
|
|
89
|
+
|
|
90
|
+
### ICARUS_TREZOR (Trezor Hardware Compatibility)
|
|
91
|
+
- **Value**: `'ICARUS_TREZOR'`
|
|
92
|
+
- **Use Case**: Trezor hardware wallets
|
|
93
|
+
- **Algorithm**: Trezor's variant of CIP-3 with different PRF for 24-word mnemonics
|
|
94
|
+
- **Technical Details**: Trezor historically diverged in how it turned the BIP-39 seed into the root master key when dealing with 24-word mnemonics. Instead of doing a direct Icarus (CIP-3) root generation, firmware used a slightly different PRF step when expanding the seed into the Ed25519-BIP32 master key.
|
|
95
|
+
|
|
96
|
+
### LEDGER (Ledger Hardware Wallet)
|
|
97
|
+
- **Value**: `'LEDGER'`
|
|
98
|
+
- **Use Case**: Ledger hardware wallets
|
|
99
|
+
- **Algorithm**: Ledger's CIP-3 implementation
|
|
100
|
+
|
|
101
|
+
## Key Difference: ICARUS vs ICARUS_TREZOR
|
|
102
|
+
|
|
103
|
+
**Behavior:**
|
|
104
|
+
- **12/18-word mnemonics**: `ICARUS` and `ICARUS_TREZOR` produce identical keys
|
|
105
|
+
- **24-word mnemonics**: `ICARUS` and `ICARUS_TREZOR` produce different keys
|
|
106
|
+
|
|
107
|
+
> **⚠️ Important**: When restoring a Trezor wallet, use `ICARUS_TREZOR` for 24-word mnemonics that originated from Trezor devices, otherwise you'll get wrong addresses.
|
|
108
|
+
|
|
109
|
+
**Why it matters:**
|
|
110
|
+
If you're writing code to restore a Trezor wallet, you must select the correct derivation scheme (`ICARUS_TREZOR`) if the mnemonic came from a Trezor, otherwise you'll get a completely different xpub tree and addresses won't match.
|
|
111
|
+
|
|
112
|
+
### Usage Examples
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Software wallet compatibility
|
|
116
|
+
const softwareWallet = await TrezorKeyAgent.createWithDevice({
|
|
117
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
118
|
+
trezorConfig: { derivationType: 'ICARUS' }
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Trezor wallet (uses internal default)
|
|
122
|
+
const trezorWallet = await TrezorKeyAgent.createWithDevice({
|
|
123
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
124
|
+
trezorConfig: { /* no derivationType */ }
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Ledger wallet migration
|
|
128
|
+
const ledgerWallet = await TrezorKeyAgent.createWithDevice({
|
|
129
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
130
|
+
trezorConfig: { derivationType: 'LEDGER' }
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Configuration
|
|
135
|
+
|
|
136
|
+
### TrezorConfig Interface
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface TrezorConfig {
|
|
140
|
+
communicationType: CommunicationType;
|
|
141
|
+
derivationType?: 'ICARUS' | 'ICARUS_TREZOR' | 'LEDGER'; // Master key generation scheme
|
|
142
|
+
manifest: {
|
|
143
|
+
appUrl: string;
|
|
144
|
+
email: string;
|
|
145
|
+
};
|
|
146
|
+
shouldHandlePassphrase?: boolean;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Communication Types
|
|
151
|
+
|
|
152
|
+
- **`CommunicationType.Node`** - USB communication via Trezor Bridge (recommended for Node.js)
|
|
153
|
+
- **`CommunicationType.Web`** - Web-based communication (for browser environments)
|
|
154
|
+
|
|
155
|
+
## API Reference
|
|
156
|
+
|
|
157
|
+
### TrezorKeyAgent
|
|
158
|
+
|
|
159
|
+
#### `createWithDevice(options, dependencies)`
|
|
160
|
+
|
|
161
|
+
Creates a new TrezorKeyAgent instance with a connected Trezor device.
|
|
162
|
+
|
|
163
|
+
**Parameters:**
|
|
164
|
+
- `options.chainId` - Cardano chain ID (Mainnet, Preprod, etc.)
|
|
165
|
+
- `options.trezorConfig` - Trezor configuration object
|
|
166
|
+
- `dependencies` - Required dependencies (crypto, logger, etc.)
|
|
167
|
+
|
|
168
|
+
**Returns:** `Promise<TrezorKeyAgent>`
|
|
169
|
+
|
|
170
|
+
#### `getXpub(props)`
|
|
171
|
+
|
|
172
|
+
Retrieves the extended public key from the Trezor device.
|
|
173
|
+
|
|
174
|
+
**Parameters:**
|
|
175
|
+
- `props.purpose` - Key purpose (Payment, Stake, etc.)
|
|
176
|
+
- `props.accountIndex` - Account index
|
|
177
|
+
- `props.derivationType` - Optional master key generation scheme override
|
|
178
|
+
|
|
179
|
+
**Returns:** `Promise<Bip32PublicKeyHex>`
|
|
180
|
+
|
|
181
|
+
#### `signTransaction(txBody, context)`
|
|
182
|
+
|
|
183
|
+
Signs a Cardano transaction using the Trezor device.
|
|
184
|
+
|
|
185
|
+
**Parameters:**
|
|
186
|
+
- `txBody` - Transaction body to sign
|
|
187
|
+
- `context` - Signing context (addresses, key paths, etc.)
|
|
188
|
+
|
|
189
|
+
**Returns:** `Promise<CardanoTxWitnesses>`
|
|
190
|
+
|
|
191
|
+
## Error Handling
|
|
192
|
+
|
|
193
|
+
The package provides comprehensive error handling for common scenarios:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { TrezorKeyAgent } from '@cardano-sdk/hardware-trezor';
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
const keyAgent = await TrezorKeyAgent.createWithDevice(config, deps);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (error.message.includes('Trezor transport failed')) {
|
|
202
|
+
// Handle device connection issues
|
|
203
|
+
console.error('Please ensure your Trezor device is connected and unlocked');
|
|
204
|
+
} else if (error.message.includes('Authentication failure')) {
|
|
205
|
+
// Handle authentication issues
|
|
206
|
+
console.error('Please check your Trezor device and try again');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Troubleshooting
|
|
212
|
+
|
|
213
|
+
### Common Issues
|
|
214
|
+
|
|
215
|
+
1. **"Trezor transport failed"**
|
|
216
|
+
- Ensure Trezor Bridge is installed and running
|
|
217
|
+
- Check USB connection
|
|
218
|
+
- Verify device is unlocked
|
|
219
|
+
|
|
220
|
+
2. **"Authentication failure"**
|
|
221
|
+
- Unlock your Trezor device
|
|
222
|
+
- Close other applications using the device
|
|
223
|
+
- Try reconnecting the device
|
|
224
|
+
|
|
225
|
+
3. **Wrong master key generation scheme**
|
|
226
|
+
- Verify the master key generation scheme matches your wallet's origin
|
|
227
|
+
- Check the MASTER_KEY_GENERATION.md for detailed guidance
|
|
228
|
+
|
|
229
|
+
### Device Setup
|
|
230
|
+
|
|
231
|
+
1. **Install Trezor Bridge**
|
|
232
|
+
```bash
|
|
233
|
+
# Download from https://suite.trezor.io/trezor-bridge
|
|
234
|
+
# Or install via package manager
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
2. **Connect and Unlock Device**
|
|
238
|
+
- Connect your Trezor device via USB
|
|
239
|
+
- Unlock the device using your PIN
|
|
240
|
+
- Ensure no other applications are using the device
|
|
241
|
+
|
|
242
|
+
## Examples
|
|
243
|
+
|
|
244
|
+
### Complete Wallet Integration
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
import { TrezorKeyAgent } from '@cardano-sdk/hardware-trezor';
|
|
248
|
+
import { createPersonalWallet } from '@cardano-sdk/wallet';
|
|
249
|
+
import { Cardano, CommunicationType } from '@cardano-sdk/core';
|
|
250
|
+
|
|
251
|
+
async function createTrezorWallet() {
|
|
252
|
+
// Create key agent
|
|
253
|
+
const keyAgent = await TrezorKeyAgent.createWithDevice({
|
|
254
|
+
chainId: Cardano.ChainIds.Mainnet,
|
|
255
|
+
trezorConfig: {
|
|
256
|
+
communicationType: CommunicationType.Node,
|
|
257
|
+
derivationType: 'ICARUS_TREZOR', // or omit to use Trezor's internal default
|
|
258
|
+
manifest: {
|
|
259
|
+
appUrl: 'https://my-cardano-app.com',
|
|
260
|
+
email: 'support@my-cardano-app.com'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}, dependencies);
|
|
264
|
+
|
|
265
|
+
// Create wallet
|
|
266
|
+
const wallet = createPersonalWallet(
|
|
267
|
+
{ name: 'My Trezor Wallet' },
|
|
268
|
+
{
|
|
269
|
+
keyAgent,
|
|
270
|
+
// ... other providers
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
return wallet;
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Development
|
|
279
|
+
|
|
280
|
+
### Running Tests
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Run all tests
|
|
284
|
+
yarn test
|
|
285
|
+
|
|
286
|
+
# Run with coverage
|
|
287
|
+
yarn test --coverage
|
|
288
|
+
|
|
289
|
+
# Run specific test file
|
|
290
|
+
yarn test TrezorKeyAgent.test.ts
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Building
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Build the package
|
|
297
|
+
yarn build
|
|
298
|
+
|
|
299
|
+
# Build and watch for changes
|
|
300
|
+
yarn build --watch
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Implementation Details
|
|
304
|
+
|
|
305
|
+
### Default Behavior
|
|
306
|
+
When no `derivationType` is specified in the `TrezorConfig`, the SDK passes no derivation type to Trezor, allowing Trezor to use its own internal default:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
const trezorConfig: TrezorConfig = {
|
|
310
|
+
communicationType: CommunicationType.Node,
|
|
311
|
+
manifest: {
|
|
312
|
+
appUrl: 'https://your.application.com',
|
|
313
|
+
email: 'email@developer.com'
|
|
314
|
+
}
|
|
315
|
+
// No derivationType specified - Trezor uses its internal default
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
## Troubleshooting
|
|
319
|
+
|
|
320
|
+
### Common Issues
|
|
321
|
+
|
|
322
|
+
1. **Wrong addresses when restoring Trezor wallet**: Use `ICARUS_TREZOR` for 24-word mnemonics that originated from Trezor devices
|
|
323
|
+
2. **Same keys for different schemes**: This is expected for 12/18-word seeds with `ICARUS` and `ICARUS_TREZOR`
|
|
324
|
+
3. **Test failures**: Ensure tests account for both 12/18 and 24-word seed scenarios
|
|
325
|
+
|
|
326
|
+
### Debugging
|
|
327
|
+
|
|
328
|
+
To determine which scenario you're dealing with:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
const defaultXPub = defaultKeyAgent.extendedAccountPublicKey;
|
|
332
|
+
const icarusXPub = icarusKeyAgent.extendedAccountPublicKey;
|
|
333
|
+
|
|
334
|
+
if (defaultXPub === icarusXPub) {
|
|
335
|
+
console.log('12/18 word seed detected - ICARUS and ICARUS_TREZOR master key generation schemes are identical');
|
|
336
|
+
} else {
|
|
337
|
+
console.log('24 word seed detected - ICARUS and ICARUS_TREZOR master key generation schemes are different');
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Related Documentation
|
|
342
|
+
|
|
343
|
+
- [Cardano JS SDK Documentation](https://github.com/input-output-hk/cardano-js-sdk)
|
|
344
|
+
- [Trezor Connect Documentation](https://docs.trezor.io/trezor-connect/)
|
|
345
|
+
- [CIP-1852: HD Wallets for Cardano](https://cips.cardano.org/cips/cip1852/)
|
|
346
|
+
- [CIP-3: Wallet Key Generation](https://cips.cardano.org/cips/cip3/)
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICENSE) file for details.
|
|
351
|
+
|
|
352
|
+
## Support
|
|
353
|
+
|
|
354
|
+
For issues and questions:
|
|
355
|
+
- [GitHub Issues](https://github.com/input-output-hk/cardano-js-sdk/issues)
|
|
356
|
+
- [Cardano Community](https://cardano.org/community)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
2
2
|
import * as Trezor from '@trezor/connect';
|
|
3
3
|
import { Cardano, Serialization } from '@cardano-sdk/core';
|
|
4
|
-
import { CommunicationType, KeyAgentBase, KeyAgentDependencies, KeyPurpose, SerializableTrezorKeyAgentData, SignBlobResult, SignTransactionContext, TrezorConfig } from '@cardano-sdk/key-management';
|
|
4
|
+
import { CommunicationType, KeyAgentBase, KeyAgentDependencies, KeyPurpose, MasterKeyGeneration, SerializableTrezorKeyAgentData, SignBlobResult, SignTransactionContext, TrezorConfig } from '@cardano-sdk/key-management';
|
|
5
5
|
import { Cip30DataSignature } from '@cardano-sdk/dapp-connector';
|
|
6
6
|
declare const TrezorConnectNode: Trezor.TrezorConnect;
|
|
7
7
|
declare const TrezorConnectWeb: Trezor.TrezorConnect;
|
|
@@ -12,6 +12,7 @@ export interface GetTrezorXpubProps {
|
|
|
12
12
|
accountIndex: number;
|
|
13
13
|
communicationType: CommunicationType;
|
|
14
14
|
purpose: KeyPurpose;
|
|
15
|
+
derivationType?: MasterKeyGeneration;
|
|
15
16
|
}
|
|
16
17
|
export interface CreateTrezorKeyAgentProps {
|
|
17
18
|
chainId: Cardano.ChainId;
|
|
@@ -24,9 +25,10 @@ export declare class TrezorKeyAgent extends KeyAgentBase {
|
|
|
24
25
|
#private;
|
|
25
26
|
readonly isTrezorInitialized: Promise<boolean>;
|
|
26
27
|
constructor({ isTrezorInitialized, ...serializableData }: TrezorKeyAgentProps, dependencies: KeyAgentDependencies);
|
|
28
|
+
get trezorConfig(): TrezorConfig;
|
|
27
29
|
static initializeTrezorTransport({ manifest, communicationType, silentMode, lazyLoad, shouldHandlePassphrase }: TrezorConfig): Promise<boolean>;
|
|
28
30
|
static checkDeviceConnection(communicationType: CommunicationType): Promise<Trezor.Features>;
|
|
29
|
-
static getXpub({ accountIndex, communicationType, purpose }: GetTrezorXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
31
|
+
static getXpub({ accountIndex, communicationType, purpose, derivationType }: GetTrezorXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
30
32
|
static createWithDevice({ chainId, accountIndex, trezorConfig, purpose }: CreateTrezorKeyAgentProps, dependencies: KeyAgentDependencies): Promise<TrezorKeyAgent>;
|
|
31
33
|
static matchSigningMode(tx: Omit<Trezor.CardanoSignTransaction, 'signingMode'>): Trezor.PROTO.CardanoTxSigningMode;
|
|
32
34
|
signTransaction(txBody: Serialization.TransactionBody, { knownAddresses, txInKeyPathMap, scripts }: SignTransactionContext): Promise<Cardano.Signatures>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.d.ts","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAuB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAEL,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EAEpB,UAAU,EAEV,8BAA8B,EAC9B,cAAc,EACd,sBAAsB,EACtB,YAAY,EAGb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKjE,QAAA,MAAM,i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I3C,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;CAGjE"}
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _TrezorKeyAgent_communicationType;
|
|
39
|
+
var _TrezorKeyAgent_communicationType, _TrezorKeyAgent_trezorConfig;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.TrezorKeyAgent = void 0;
|
|
42
42
|
const Crypto = __importStar(require("@cardano-sdk/crypto"));
|
|
@@ -52,6 +52,18 @@ const TrezorConnectWeb = connect_web_1.default.default
|
|
|
52
52
|
: connect_web_1.default;
|
|
53
53
|
const transportTypedError = (error) => new key_management_1.errors.AuthenticationError('Trezor transport failed', new key_management_1.errors.TransportError('Trezor transport failed', error));
|
|
54
54
|
const getTrezorConnect = (communicationType) => communicationType === key_management_1.CommunicationType.Node ? TrezorConnectNode : TrezorConnectWeb;
|
|
55
|
+
const mapDerivationType = (derivationType) => {
|
|
56
|
+
switch (derivationType) {
|
|
57
|
+
case 'ICARUS':
|
|
58
|
+
return Trezor.PROTO.CardanoDerivationType.ICARUS;
|
|
59
|
+
case 'ICARUS_TREZOR':
|
|
60
|
+
return Trezor.PROTO.CardanoDerivationType.ICARUS_TREZOR;
|
|
61
|
+
case 'LEDGER':
|
|
62
|
+
return Trezor.PROTO.CardanoDerivationType.LEDGER;
|
|
63
|
+
default:
|
|
64
|
+
throw new Error(`Unsupported derivation type: ${derivationType}`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
55
67
|
const stakeCredentialCert = (certificateType) => certificateType === Trezor.PROTO.CardanoCertificateType.STAKE_REGISTRATION ||
|
|
56
68
|
certificateType === Trezor.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION ||
|
|
57
69
|
certificateType === Trezor.PROTO.CardanoCertificateType.STAKE_DELEGATION;
|
|
@@ -82,10 +94,15 @@ class TrezorKeyAgent extends key_management_1.KeyAgentBase {
|
|
|
82
94
|
constructor({ isTrezorInitialized, ...serializableData }, dependencies) {
|
|
83
95
|
super({ ...serializableData, __typename: key_management_1.KeyAgentType.Trezor }, dependencies);
|
|
84
96
|
_TrezorKeyAgent_communicationType.set(this, void 0);
|
|
97
|
+
_TrezorKeyAgent_trezorConfig.set(this, void 0);
|
|
85
98
|
if (!isTrezorInitialized) {
|
|
86
99
|
this.isTrezorInitialized = TrezorKeyAgent.initializeTrezorTransport(serializableData.trezorConfig);
|
|
87
100
|
}
|
|
88
101
|
__classPrivateFieldSet(this, _TrezorKeyAgent_communicationType, serializableData.trezorConfig.communicationType, "f");
|
|
102
|
+
__classPrivateFieldSet(this, _TrezorKeyAgent_trezorConfig, serializableData.trezorConfig, "f");
|
|
103
|
+
}
|
|
104
|
+
get trezorConfig() {
|
|
105
|
+
return __classPrivateFieldGet(this, _TrezorKeyAgent_trezorConfig, "f");
|
|
89
106
|
}
|
|
90
107
|
static async initializeTrezorTransport({ manifest, communicationType, silentMode = false, lazyLoad = false, shouldHandlePassphrase = false }) {
|
|
91
108
|
const trezorConnect = getTrezorConnect(communicationType);
|
|
@@ -130,14 +147,18 @@ class TrezorKeyAgent extends key_management_1.KeyAgentBase {
|
|
|
130
147
|
throw transportTypedError(error);
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
|
-
static async getXpub({ accountIndex, communicationType, purpose }) {
|
|
150
|
+
static async getXpub({ accountIndex, communicationType, purpose, derivationType }) {
|
|
134
151
|
try {
|
|
135
152
|
await TrezorKeyAgent.checkDeviceConnection(communicationType);
|
|
136
153
|
const derivationPath = `m/${purpose}'/${key_management_1.CardanoKeyConst.COIN_TYPE}'/${accountIndex}'`;
|
|
137
154
|
const trezorConnect = getTrezorConnect(communicationType);
|
|
155
|
+
const trezorDerivationType = derivationType ? mapDerivationType(derivationType) : undefined;
|
|
138
156
|
const extendedPublicKey = await trezorConnect.cardanoGetPublicKey({
|
|
139
157
|
path: derivationPath,
|
|
140
|
-
showOnTrezor: true
|
|
158
|
+
showOnTrezor: true,
|
|
159
|
+
...(derivationType && {
|
|
160
|
+
derivationType: trezorDerivationType
|
|
161
|
+
})
|
|
141
162
|
});
|
|
142
163
|
if (!extendedPublicKey.success) {
|
|
143
164
|
throw new key_management_1.errors.TransportError('Failed to export extended account public key', extendedPublicKey.payload);
|
|
@@ -153,6 +174,7 @@ class TrezorKeyAgent extends key_management_1.KeyAgentBase {
|
|
|
153
174
|
const extendedAccountPublicKey = await TrezorKeyAgent.getXpub({
|
|
154
175
|
accountIndex,
|
|
155
176
|
communicationType: trezorConfig.communicationType,
|
|
177
|
+
derivationType: trezorConfig.derivationType,
|
|
156
178
|
purpose
|
|
157
179
|
});
|
|
158
180
|
return new TrezorKeyAgent({
|
|
@@ -209,7 +231,12 @@ class TrezorKeyAgent extends key_management_1.KeyAgentBase {
|
|
|
209
231
|
...(signingMode === Trezor.PROTO.CardanoTxSigningMode.MULTISIG_TRANSACTION && {
|
|
210
232
|
additionalWitnessRequests: multiSigWitnessPaths
|
|
211
233
|
}),
|
|
212
|
-
signingMode
|
|
234
|
+
signingMode,
|
|
235
|
+
...(this.trezorConfig.derivationType
|
|
236
|
+
? {
|
|
237
|
+
derivationType: mapDerivationType(this.trezorConfig.derivationType)
|
|
238
|
+
}
|
|
239
|
+
: {})
|
|
213
240
|
});
|
|
214
241
|
const expectedPublicKeys = await Promise.all(key_management_1.util
|
|
215
242
|
.ownSignatureKeyPaths(body, knownAddresses, txInKeyPathMap, undefined, scripts)
|
|
@@ -247,5 +274,5 @@ class TrezorKeyAgent extends key_management_1.KeyAgentBase {
|
|
|
247
274
|
}
|
|
248
275
|
}
|
|
249
276
|
exports.TrezorKeyAgent = TrezorKeyAgent;
|
|
250
|
-
_TrezorKeyAgent_communicationType = new WeakMap();
|
|
277
|
+
_TrezorKeyAgent_communicationType = new WeakMap(), _TrezorKeyAgent_trezorConfig = new WeakMap();
|
|
251
278
|
//# sourceMappingURL=TrezorKeyAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA8C;AAC9C,wDAA0C;AAE1C,4CAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA8C;AAC9C,wDAA0C;AAE1C,4CAAgF;AAChF,gEAeqC;AAErC,4CAA2E;AAC3E,0CAA+C;AAC/C,sEAAoD;AAEpD,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;AACzC,MAAM,gBAAgB,GAAI,qBAAyB,CAAC,OAAO;IACzD,CAAC,CAAG,qBAAyB,CAAC,OAAoC;IAClE,CAAC,CAAC,qBAAiB,CAAC;AAEtB,MAAM,mBAAmB,GAAG,CAAC,KAAW,EAAE,EAAE,CAC1C,IAAI,uBAAM,CAAC,mBAAmB,CAC5B,yBAAyB,EACzB,IAAI,uBAAM,CAAC,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAC5D,CAAC;AAsBJ,MAAM,gBAAgB,GAAG,CAAC,iBAAoC,EAA6B,EAAE,CAC3F,iBAAiB,KAAK,kCAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAGtF,MAAM,iBAAiB,GAAG,CAAC,cAAmC,EAAsC,EAAE;IACpG,QAAQ,cAAc,EAAE;QACtB,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC;QACnD,KAAK,eAAe;YA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