@cardano-sdk/key-management 0.3.1-nightly.2 → 0.4.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/dist/cjs/InMemoryKeyAgent.d.ts +10 -8
- package/dist/cjs/InMemoryKeyAgent.d.ts.map +1 -1
- package/dist/cjs/InMemoryKeyAgent.js +38 -38
- package/dist/cjs/InMemoryKeyAgent.js.map +1 -1
- package/dist/cjs/KeyAgentBase.d.ts +9 -7
- package/dist/cjs/KeyAgentBase.d.ts.map +1 -1
- package/dist/cjs/KeyAgentBase.js +35 -25
- package/dist/cjs/KeyAgentBase.js.map +1 -1
- package/dist/cjs/LedgerKeyAgent.d.ts +4 -3
- package/dist/cjs/LedgerKeyAgent.d.ts.map +1 -1
- package/dist/cjs/LedgerKeyAgent.js +7 -3
- package/dist/cjs/LedgerKeyAgent.js.map +1 -1
- package/dist/cjs/TrezorKeyAgent.d.ts +3 -2
- package/dist/cjs/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/cjs/TrezorKeyAgent.js +27 -3
- package/dist/cjs/TrezorKeyAgent.js.map +1 -1
- package/dist/cjs/cip8/cip30signData.d.ts +3 -2
- package/dist/cjs/cip8/cip30signData.d.ts.map +1 -1
- package/dist/cjs/cip8/cip30signData.js +9 -9
- package/dist/cjs/cip8/cip30signData.js.map +1 -1
- package/dist/cjs/cip8/types.d.ts +3 -3
- package/dist/cjs/cip8/types.d.ts.map +1 -1
- package/dist/cjs/emip3.d.ts +3 -3
- package/dist/cjs/emip3.d.ts.map +1 -1
- package/dist/cjs/emip3.js +5 -5
- package/dist/cjs/emip3.js.map +1 -1
- package/dist/cjs/errors/AuthenticationError.d.ts +1 -1
- package/dist/cjs/errors/AuthenticationError.js +2 -2
- package/dist/cjs/errors/HwMappingError.d.ts +1 -1
- package/dist/cjs/errors/HwMappingError.js +2 -2
- package/dist/cjs/errors/ProofGenerationError.d.ts +1 -1
- package/dist/cjs/errors/ProofGenerationError.js +2 -2
- package/dist/cjs/errors/TransportError.d.ts +1 -1
- package/dist/cjs/errors/TransportError.js +2 -2
- package/dist/cjs/restoreKeyAgent.d.ts +4 -4
- package/dist/cjs/restoreKeyAgent.d.ts.map +1 -1
- package/dist/cjs/restoreKeyAgent.js +4 -4
- package/dist/cjs/restoreKeyAgent.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +20 -17
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/util/createAsyncKeyAgent.d.ts.map +1 -1
- package/dist/cjs/util/createAsyncKeyAgent.js +1 -0
- package/dist/cjs/util/createAsyncKeyAgent.js.map +1 -1
- package/dist/cjs/util/key.d.ts +5 -4
- package/dist/cjs/util/key.d.ts.map +1 -1
- package/dist/cjs/util/key.js +9 -17
- package/dist/cjs/util/key.js.map +1 -1
- package/dist/cjs/util/mapHardwareSigningData.d.ts +2 -1
- package/dist/cjs/util/mapHardwareSigningData.d.ts.map +1 -1
- package/dist/cjs/util/mapHardwareSigningData.js +3 -3
- package/dist/cjs/util/mapHardwareSigningData.js.map +1 -1
- package/dist/cjs/util/ownSignatureKeyPaths.js +1 -1
- package/dist/cjs/util/ownSignatureKeyPaths.js.map +1 -1
- package/dist/cjs/util/stubSignTransaction.d.ts.map +1 -1
- package/dist/cjs/util/stubSignTransaction.js +26 -3
- package/dist/cjs/util/stubSignTransaction.js.map +1 -1
- package/dist/esm/InMemoryKeyAgent.d.ts +10 -8
- package/dist/esm/InMemoryKeyAgent.d.ts.map +1 -1
- package/dist/esm/InMemoryKeyAgent.js +33 -33
- package/dist/esm/InMemoryKeyAgent.js.map +1 -1
- package/dist/esm/KeyAgentBase.d.ts +9 -7
- package/dist/esm/KeyAgentBase.d.ts.map +1 -1
- package/dist/esm/KeyAgentBase.js +35 -25
- package/dist/esm/KeyAgentBase.js.map +1 -1
- package/dist/esm/LedgerKeyAgent.d.ts +4 -3
- package/dist/esm/LedgerKeyAgent.d.ts.map +1 -1
- package/dist/esm/LedgerKeyAgent.js +9 -5
- package/dist/esm/LedgerKeyAgent.js.map +1 -1
- package/dist/esm/TrezorKeyAgent.d.ts +3 -2
- package/dist/esm/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/esm/TrezorKeyAgent.js +5 -4
- package/dist/esm/TrezorKeyAgent.js.map +1 -1
- package/dist/esm/cip8/cip30signData.d.ts +3 -2
- package/dist/esm/cip8/cip30signData.d.ts.map +1 -1
- package/dist/esm/cip8/cip30signData.js +2 -2
- package/dist/esm/cip8/cip30signData.js.map +1 -1
- package/dist/esm/cip8/types.d.ts +3 -3
- package/dist/esm/cip8/types.d.ts.map +1 -1
- package/dist/esm/emip3.d.ts +3 -3
- package/dist/esm/emip3.d.ts.map +1 -1
- package/dist/esm/emip3.js +5 -5
- package/dist/esm/emip3.js.map +1 -1
- package/dist/esm/errors/AuthenticationError.d.ts +1 -1
- package/dist/esm/errors/AuthenticationError.js +1 -1
- package/dist/esm/errors/HwMappingError.d.ts +1 -1
- package/dist/esm/errors/HwMappingError.js +1 -1
- package/dist/esm/errors/ProofGenerationError.d.ts +1 -1
- package/dist/esm/errors/ProofGenerationError.js +1 -1
- package/dist/esm/errors/TransportError.d.ts +1 -1
- package/dist/esm/errors/TransportError.js +1 -1
- package/dist/esm/restoreKeyAgent.d.ts +4 -4
- package/dist/esm/restoreKeyAgent.d.ts.map +1 -1
- package/dist/esm/restoreKeyAgent.js +4 -4
- package/dist/esm/restoreKeyAgent.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +20 -17
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/util/createAsyncKeyAgent.d.ts.map +1 -1
- package/dist/esm/util/createAsyncKeyAgent.js +1 -0
- package/dist/esm/util/createAsyncKeyAgent.js.map +1 -1
- package/dist/esm/util/key.d.ts +5 -4
- package/dist/esm/util/key.d.ts.map +1 -1
- package/dist/esm/util/key.js +9 -17
- package/dist/esm/util/key.js.map +1 -1
- package/dist/esm/util/mapHardwareSigningData.d.ts +2 -1
- package/dist/esm/util/mapHardwareSigningData.d.ts.map +1 -1
- package/dist/esm/util/mapHardwareSigningData.js +3 -3
- package/dist/esm/util/mapHardwareSigningData.js.map +1 -1
- package/dist/esm/util/ownSignatureKeyPaths.js +1 -1
- package/dist/esm/util/ownSignatureKeyPaths.js.map +1 -1
- package/dist/esm/util/stubSignTransaction.d.ts.map +1 -1
- package/dist/esm/util/stubSignTransaction.js +3 -3
- package/dist/esm/util/stubSignTransaction.js.map +1 -1
- package/package.json +7 -5
|
@@ -9,69 +9,72 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _InMemoryKeyAgent_instances,
|
|
12
|
+
var _InMemoryKeyAgent_instances, _InMemoryKeyAgent_getPassphrase, _InMemoryKeyAgent_decryptRootPrivateKey;
|
|
13
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
13
14
|
import * as errors from './errors';
|
|
14
15
|
import { KeyAgentType } from './types';
|
|
15
|
-
import {
|
|
16
|
+
import { HexBlob } from '@cardano-sdk/util';
|
|
16
17
|
import { KeyAgentBase } from './KeyAgentBase';
|
|
17
18
|
import { deriveAccountPrivateKey, harden, joinMnemonicWords, mnemonicWordsToEntropy, ownSignatureKeyPaths, validateMnemonic } from './util';
|
|
18
19
|
import { emip3decrypt, emip3encrypt } from './emip3';
|
|
19
20
|
import uniqBy from 'lodash/uniqBy';
|
|
20
|
-
const
|
|
21
|
+
const getPassphraseRethrowTypedError = async (getPassphrase) => {
|
|
21
22
|
try {
|
|
22
|
-
return await
|
|
23
|
+
return await getPassphrase();
|
|
23
24
|
}
|
|
24
25
|
catch (error) {
|
|
25
|
-
throw new errors.AuthenticationError('Failed to enter
|
|
26
|
+
throw new errors.AuthenticationError('Failed to enter passphrase', error);
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
export class InMemoryKeyAgent extends KeyAgentBase {
|
|
29
|
-
constructor({
|
|
30
|
+
constructor({ getPassphrase, ...serializableData }, dependencies) {
|
|
30
31
|
super({ ...serializableData, __typename: KeyAgentType.InMemory }, dependencies);
|
|
31
32
|
_InMemoryKeyAgent_instances.add(this);
|
|
32
|
-
|
|
33
|
-
__classPrivateFieldSet(this,
|
|
33
|
+
_InMemoryKeyAgent_getPassphrase.set(this, void 0);
|
|
34
|
+
__classPrivateFieldSet(this, _InMemoryKeyAgent_getPassphrase, getPassphrase, "f");
|
|
34
35
|
}
|
|
35
36
|
async signBlob({ index, role: type }, blob) {
|
|
36
37
|
const rootPrivateKey = await __classPrivateFieldGet(this, _InMemoryKeyAgent_instances, "m", _InMemoryKeyAgent_decryptRootPrivateKey).call(this);
|
|
37
|
-
const accountKey = deriveAccountPrivateKey({
|
|
38
|
+
const accountKey = await deriveAccountPrivateKey({
|
|
38
39
|
accountIndex: this.accountIndex,
|
|
40
|
+
bip32Ed25519: this.bip32Ed25519,
|
|
39
41
|
rootPrivateKey
|
|
40
42
|
});
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
43
|
+
const bip32SigningKey = await this.bip32Ed25519.derivePrivateKey(accountKey, [type, index]);
|
|
44
|
+
const signingKey = await this.bip32Ed25519.getRawPrivateKey(bip32SigningKey);
|
|
45
|
+
const signature = await this.bip32Ed25519.sign(signingKey, blob);
|
|
46
|
+
const publicKey = await this.bip32Ed25519.getPublicKey(signingKey);
|
|
44
47
|
return { publicKey, signature };
|
|
45
48
|
}
|
|
46
49
|
async exportRootPrivateKey() {
|
|
47
|
-
|
|
48
|
-
return Cardano.Bip32PrivateKey.fromHexBlob(util.bytesToHex(rootPrivateKey.as_bytes()));
|
|
50
|
+
return await __classPrivateFieldGet(this, _InMemoryKeyAgent_instances, "m", _InMemoryKeyAgent_decryptRootPrivateKey).call(this, true);
|
|
49
51
|
}
|
|
50
|
-
static async fromBip39MnemonicWords({ chainId,
|
|
52
|
+
static async fromBip39MnemonicWords({ chainId, getPassphrase, mnemonicWords, mnemonic2ndFactorPassphrase = '', accountIndex = 0 }, dependencies) {
|
|
51
53
|
const mnemonic = joinMnemonicWords(mnemonicWords);
|
|
52
54
|
const validMnemonic = validateMnemonic(mnemonic);
|
|
53
55
|
if (!validMnemonic)
|
|
54
56
|
throw new errors.InvalidMnemonicError();
|
|
55
57
|
const entropy = Buffer.from(mnemonicWordsToEntropy(mnemonicWords), 'hex');
|
|
56
|
-
const rootPrivateKey =
|
|
57
|
-
const
|
|
58
|
-
const encryptedRootPrivateKey = await emip3encrypt(
|
|
59
|
-
const accountPrivateKey = deriveAccountPrivateKey({
|
|
58
|
+
const rootPrivateKey = await dependencies.bip32Ed25519.fromBip39Entropy(entropy, mnemonic2ndFactorPassphrase);
|
|
59
|
+
const passphrase = await getPassphraseRethrowTypedError(getPassphrase);
|
|
60
|
+
const encryptedRootPrivateKey = await emip3encrypt(Buffer.from(rootPrivateKey, 'hex'), passphrase);
|
|
61
|
+
const accountPrivateKey = await deriveAccountPrivateKey({
|
|
60
62
|
accountIndex,
|
|
63
|
+
bip32Ed25519: dependencies.bip32Ed25519,
|
|
61
64
|
rootPrivateKey
|
|
62
65
|
});
|
|
63
|
-
const extendedAccountPublicKey =
|
|
66
|
+
const extendedAccountPublicKey = await dependencies.bip32Ed25519.getBip32PublicKey(accountPrivateKey);
|
|
64
67
|
return new InMemoryKeyAgent({
|
|
65
68
|
accountIndex,
|
|
66
69
|
chainId,
|
|
67
70
|
encryptedRootPrivateKeyBytes: [...encryptedRootPrivateKey],
|
|
68
71
|
extendedAccountPublicKey,
|
|
69
|
-
|
|
72
|
+
getPassphrase,
|
|
70
73
|
knownAddresses: []
|
|
71
74
|
}, dependencies);
|
|
72
75
|
}
|
|
73
76
|
async signTransaction({ body, hash }, { additionalKeyPaths = [] } = {}) {
|
|
74
|
-
const blob =
|
|
77
|
+
const blob = HexBlob(hash.toString());
|
|
75
78
|
const derivationPaths = await ownSignatureKeyPaths(body, this.knownAddresses, this.inputResolver);
|
|
76
79
|
const keyPaths = uniqBy([...derivationPaths, ...additionalKeyPaths], ({ role, index }) => `${role}.${index}`);
|
|
77
80
|
return new Map(await Promise.all(keyPaths.map(async ({ role, index }) => {
|
|
@@ -81,26 +84,23 @@ export class InMemoryKeyAgent extends KeyAgentBase {
|
|
|
81
84
|
}
|
|
82
85
|
async exportExtendedKeyPair(derivationPath) {
|
|
83
86
|
const rootPrivateKey = await this.exportRootPrivateKey();
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
for (const val of derivationPath) {
|
|
87
|
-
cslPrivateKey = cslPrivateKey.derive(harden(val));
|
|
88
|
-
}
|
|
87
|
+
const hardenedIndices = derivationPath.map((index) => harden(index));
|
|
88
|
+
const childKey = await this.bip32Ed25519.derivePrivateKey(rootPrivateKey, hardenedIndices);
|
|
89
89
|
return {
|
|
90
|
-
skey:
|
|
91
|
-
vkey:
|
|
90
|
+
skey: childKey,
|
|
91
|
+
vkey: await this.bip32Ed25519.getBip32PublicKey(childKey)
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
const
|
|
95
|
+
_InMemoryKeyAgent_getPassphrase = new WeakMap(), _InMemoryKeyAgent_instances = new WeakSet(), _InMemoryKeyAgent_decryptRootPrivateKey = async function _InMemoryKeyAgent_decryptRootPrivateKey(noCache) {
|
|
96
|
+
const passphrase = await getPassphraseRethrowTypedError(() => __classPrivateFieldGet(this, _InMemoryKeyAgent_getPassphrase, "f").call(this, noCache));
|
|
97
97
|
let decryptedRootKeyBytes;
|
|
98
98
|
try {
|
|
99
|
-
decryptedRootKeyBytes = await emip3decrypt(new Uint8Array(this.serializableData.encryptedRootPrivateKeyBytes),
|
|
99
|
+
decryptedRootKeyBytes = await emip3decrypt(new Uint8Array(this.serializableData.encryptedRootPrivateKeyBytes), passphrase);
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
throw new errors.AuthenticationError('Failed to decrypt root private key', error);
|
|
103
103
|
}
|
|
104
|
-
return
|
|
104
|
+
return Crypto.Bip32PrivateKeyHex(Buffer.from(decryptedRootKeyBytes).toString('hex'));
|
|
105
105
|
};
|
|
106
106
|
//# sourceMappingURL=InMemoryKeyAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryKeyAgent.js","sourceRoot":"","sources":["../../src/InMemoryKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAKL,YAAY,EAKb,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"InMemoryKeyAgent.js","sourceRoot":"","sources":["../../src/InMemoryKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAKL,YAAY,EAKb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,MAAM,MAAM,eAAe,CAAC;AAcnC,MAAM,8BAA8B,GAAG,KAAK,EAAE,aAA4B,EAAE,EAAE;IAC5E,IAAI;QACF,OAAO,MAAM,aAAa,EAAE,CAAC;KAC9B;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;SAC1D,CAAC;IACJ,CAAC;CAeF;wIAbC,KAAK,kDAAwB,OAAc;IACzC,MAAM,UAAU,GAAG,MAAM,8BAA8B,CAAC,GAAG,EAAE,CAAC,uBAAA,IAAI,uCAAe,MAAnB,IAAI,EAAgB,OAAO,CAAC,CAAC,CAAC;IAC5F,IAAI,qBAAiC,CAAC;IACtC,IAAI;QACF,qBAAqB,GAAG,MAAM,YAAY,CACxC,IAAI,UAAU,CAAE,IAAI,CAAC,gBAAqD,CAAC,4BAA4B,CAAC,EACxG,UAAU,CACX,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;KACnF;IACD,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
1
2
|
import { AccountAddressDerivationPath, AccountKeyDerivationPath, GroupedAddress, KeyAgent, KeyAgentDependencies, SerializableKeyAgentData, SignBlobResult, SignTransactionOptions } from './types';
|
|
2
|
-
import {
|
|
3
|
+
import { Cardano } from '@cardano-sdk/core';
|
|
4
|
+
import { HexBlob } from '@cardano-sdk/util';
|
|
3
5
|
export declare abstract class KeyAgentBase implements KeyAgent {
|
|
4
6
|
#private;
|
|
5
7
|
protected readonly inputResolver: Cardano.util.InputResolver;
|
|
6
8
|
get knownAddresses(): GroupedAddress[];
|
|
7
9
|
set knownAddresses(addresses: GroupedAddress[]);
|
|
8
10
|
get serializableData(): SerializableKeyAgentData;
|
|
9
|
-
get extendedAccountPublicKey():
|
|
11
|
+
get extendedAccountPublicKey(): Crypto.Bip32PublicKeyHex;
|
|
10
12
|
get chainId(): Cardano.ChainId;
|
|
11
13
|
get accountIndex(): number;
|
|
12
|
-
|
|
13
|
-
abstract
|
|
14
|
+
get bip32Ed25519(): Crypto.Bip32Ed25519;
|
|
15
|
+
abstract signBlob(derivationPath: AccountKeyDerivationPath, blob: HexBlob): Promise<SignBlobResult>;
|
|
16
|
+
abstract exportRootPrivateKey(): Promise<Crypto.Bip32PrivateKeyHex>;
|
|
14
17
|
abstract signTransaction(txInternals: Cardano.TxBodyWithHash, signTransactionOptions?: SignTransactionOptions): Promise<Cardano.Signatures>;
|
|
15
|
-
constructor(serializableData: SerializableKeyAgentData, { inputResolver }: KeyAgentDependencies);
|
|
18
|
+
constructor(serializableData: SerializableKeyAgentData, { inputResolver, bip32Ed25519 }: KeyAgentDependencies);
|
|
16
19
|
deriveAddress({ index, type }: AccountAddressDerivationPath): Promise<GroupedAddress>;
|
|
17
|
-
derivePublicKey(derivationPath: AccountKeyDerivationPath): Promise<
|
|
18
|
-
protected deriveCmlPublicKey({ index, role: type }: AccountKeyDerivationPath): Promise<CML.PublicKey>;
|
|
20
|
+
derivePublicKey(derivationPath: AccountKeyDerivationPath): Promise<Crypto.Ed25519PublicKeyHex>;
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=KeyAgentBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyAgentBase.d.ts","sourceRoot":"","sources":["../../src/KeyAgentBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,cAAc,EACd,QAAQ,EACR,oBAAoB,EAEpB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"KeyAgentBase.d.ts","sourceRoot":"","sources":["../../src/KeyAgentBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,cAAc,EACd,QAAQ,EACR,oBAAoB,EAEpB,wBA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 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _KeyAgentBase_serializableData;
|
|
13
|
-
import { CML, Cardano
|
|
12
|
+
var _KeyAgentBase_serializableData, _KeyAgentBase_bip32Ed25519;
|
|
13
|
+
import { CML, Cardano } from '@cardano-sdk/core';
|
|
14
|
+
import { usingAutoFree } from '@cardano-sdk/util';
|
|
14
15
|
import { STAKE_KEY_DERIVATION_PATH } from './util';
|
|
15
16
|
export class KeyAgentBase {
|
|
16
|
-
constructor(serializableData, { inputResolver }) {
|
|
17
|
+
constructor(serializableData, { inputResolver, bip32Ed25519 }) {
|
|
17
18
|
_KeyAgentBase_serializableData.set(this, void 0);
|
|
19
|
+
_KeyAgentBase_bip32Ed25519.set(this, void 0);
|
|
18
20
|
__classPrivateFieldSet(this, _KeyAgentBase_serializableData, serializableData, "f");
|
|
19
21
|
this.inputResolver = inputResolver;
|
|
22
|
+
__classPrivateFieldSet(this, _KeyAgentBase_bip32Ed25519, bip32Ed25519, "f");
|
|
20
23
|
}
|
|
21
24
|
get knownAddresses() {
|
|
22
25
|
return __classPrivateFieldGet(this, _KeyAgentBase_serializableData, "f").knownAddresses;
|
|
@@ -36,39 +39,46 @@ export class KeyAgentBase {
|
|
|
36
39
|
get accountIndex() {
|
|
37
40
|
return this.serializableData.accountIndex;
|
|
38
41
|
}
|
|
42
|
+
get bip32Ed25519() {
|
|
43
|
+
return __classPrivateFieldGet(this, _KeyAgentBase_bip32Ed25519, "f");
|
|
44
|
+
}
|
|
39
45
|
async deriveAddress({ index, type }) {
|
|
40
46
|
const knownAddress = this.knownAddresses.find((addr) => addr.type === type && addr.index === index);
|
|
41
47
|
if (knownAddress)
|
|
42
48
|
return knownAddress;
|
|
43
|
-
const derivedPublicPaymentKey = await this.
|
|
49
|
+
const derivedPublicPaymentKey = await this.derivePublicKey({
|
|
44
50
|
index,
|
|
45
51
|
role: type
|
|
46
52
|
});
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
const derivedPublicPaymentKeyHash = await __classPrivateFieldGet(this, _KeyAgentBase_bip32Ed25519, "f").getPubKeyHash(derivedPublicPaymentKey);
|
|
54
|
+
const publicStakeKey = await this.derivePublicKey(STAKE_KEY_DERIVATION_PATH);
|
|
55
|
+
const publicStakeKeyHash = await __classPrivateFieldGet(this, _KeyAgentBase_bip32Ed25519, "f").getPubKeyHash(publicStakeKey);
|
|
56
|
+
const groupedAddress = usingAutoFree((scope) => {
|
|
57
|
+
const stakeKeyCredential = scope.manage(CML.StakeCredential.from_keyhash(scope.manage(CML.Ed25519KeyHash.from_bytes(Buffer.from(publicStakeKeyHash, 'hex')))));
|
|
58
|
+
const address = scope.manage(scope
|
|
59
|
+
.manage(CML.BaseAddress.new(this.chainId.networkId, scope.manage(CML.StakeCredential.from_keyhash(scope.manage(CML.Ed25519KeyHash.from_bytes(Buffer.from(derivedPublicPaymentKeyHash, 'hex'))))), stakeKeyCredential))
|
|
60
|
+
.to_address());
|
|
61
|
+
const rewardAccount = scope.manage(scope.manage(CML.RewardAddress.new(this.chainId.networkId, stakeKeyCredential)).to_address());
|
|
62
|
+
return {
|
|
63
|
+
accountIndex: this.accountIndex,
|
|
64
|
+
address: Cardano.Address(address.to_bech32()),
|
|
65
|
+
index,
|
|
66
|
+
networkId: this.chainId.networkId,
|
|
67
|
+
rewardAccount: Cardano.RewardAccount(rewardAccount.to_bech32()),
|
|
68
|
+
stakeKeyDerivationPath: STAKE_KEY_DERIVATION_PATH,
|
|
69
|
+
type
|
|
70
|
+
};
|
|
71
|
+
});
|
|
60
72
|
this.knownAddresses = [...this.knownAddresses, groupedAddress];
|
|
61
73
|
return groupedAddress;
|
|
62
74
|
}
|
|
63
75
|
async derivePublicKey(derivationPath) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const accountPublicKey = CML.Bip32PublicKey.from_bytes(accountPublicKeyBytes);
|
|
70
|
-
return accountPublicKey.derive(type).derive(index).to_raw_key();
|
|
76
|
+
const childKey = await __classPrivateFieldGet(this, _KeyAgentBase_bip32Ed25519, "f").derivePublicKey(this.extendedAccountPublicKey, [
|
|
77
|
+
derivationPath.role,
|
|
78
|
+
derivationPath.index
|
|
79
|
+
]);
|
|
80
|
+
return await __classPrivateFieldGet(this, _KeyAgentBase_bip32Ed25519, "f").getRawPublicKey(childKey);
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
|
-
_KeyAgentBase_serializableData = new WeakMap();
|
|
83
|
+
_KeyAgentBase_serializableData = new WeakMap(), _KeyAgentBase_bip32Ed25519 = new WeakMap();
|
|
74
84
|
//# sourceMappingURL=KeyAgentBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyAgentBase.js","sourceRoot":"","sources":["../../src/KeyAgentBase.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"KeyAgentBase.js","sourceRoot":"","sources":["../../src/KeyAgentBase.ts"],"names":[],"mappings":";;;;;;;;;;;;AAYA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAW,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AAEnD,MAAM,OAAgB,YAAY;IAkChC,YAAY,gBAA0C,EAAE,EAAE,aAAa,EAAE,YAAY,EAAwB;QAjC7G,iDAAqD;QACrD,6CAA4C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AC,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC/D,sBAAsB,EAAE,yBAAyB;gBACjD,IAAI;aACL,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC/D,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,cAAwC;QAC5D,MAAM,QAAQ,GAAG,MAAM,uBAAA,IAAI,kCAAc,CAAC,eAAe,CAAC,IAAI,CAAC,wBAAwB,EAAE;YACvF,cAAc,CAAC,IAAI;YACnB,cAAc,CAAC,KAAK;SACrB,CAAC,CAAC;QAEH,OAAO,MAAM,uBAAA,IAAI,kCAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
1
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
2
3
|
import { CommunicationType, KeyAgentDependencies, LedgerTransportType, SerializableLedgerKeyAgentData, SignBlobResult } from './types';
|
|
3
4
|
import { KeyAgentBase } from './KeyAgentBase';
|
|
@@ -31,11 +32,11 @@ export declare class LedgerKeyAgent extends KeyAgentBase {
|
|
|
31
32
|
static createDeviceConnection(activeTransport: LedgerTransport): Promise<LedgerConnection>;
|
|
32
33
|
static establishDeviceConnection(communicationType: CommunicationType, devicePath?: string): Promise<LedgerConnection>;
|
|
33
34
|
static checkDeviceConnection(communicationType: CommunicationType, deviceConnection?: LedgerConnection): Promise<LedgerConnection>;
|
|
34
|
-
static getXpub({ deviceConnection, communicationType, accountIndex }: GetLedgerXpubProps): Promise<
|
|
35
|
+
static getXpub({ deviceConnection, communicationType, accountIndex }: GetLedgerXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
35
36
|
static getAppVersion(communicationType: CommunicationType, deviceConnection?: LedgerConnection): Promise<GetVersionResponse>;
|
|
36
37
|
static createWithDevice({ chainId, accountIndex, communicationType, deviceConnection }: CreateLedgerKeyAgentProps, dependencies: KeyAgentDependencies): Promise<LedgerKeyAgent>;
|
|
37
|
-
signTransaction({ body }: Cardano.TxBodyWithHash): Promise<Cardano.Signatures>;
|
|
38
|
+
signTransaction({ body, hash }: Cardano.TxBodyWithHash): Promise<Cardano.Signatures>;
|
|
38
39
|
signBlob(): Promise<SignBlobResult>;
|
|
39
|
-
exportRootPrivateKey(): Promise<
|
|
40
|
+
exportRootPrivateKey(): Promise<Crypto.Bip32PrivateKeyHex>;
|
|
40
41
|
}
|
|
41
42
|
//# sourceMappingURL=LedgerKeyAgent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LedgerKeyAgent.d.ts","sourceRoot":"","sources":["../../src/LedgerKeyAgent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LedgerKeyAgent.d.ts","sourceRoot":"","sources":["../../src/LedgerKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAGL,iBAAiB,EACjB,oBAAoB,EAEpB,mBAAmB,EACnB,8BAA8B,EAC9B,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,gBAAgB,EAAE,EAAE,kBAAkB,EAAS,MAAM,6CAA6C,CAAC;AAG1G,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,8BAA8B,EAAE,YAAY,CAAC;IAC7F,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAA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gBAAgB,GAClC,OAAO,CAAC,kBAAkB,CAAC;WASjB,gBAAgB,CAC3B,EAAE,OAAO,EAAE,YAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,EAAE,yBAAyB,EAC7F,YAAY,EAAE,oBAAoB;IA0B9B,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;IAyCpF,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAInC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;CAGjE"}
|
|
@@ -10,8 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _LedgerKeyAgent_communicationType;
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
13
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
14
|
+
import { AuthenticationError, HwMappingError, TransportError } from './errors';
|
|
15
|
+
import { NotImplementedError, coreToCml } from '@cardano-sdk/core';
|
|
15
16
|
import { CardanoKeyConst, Cip1852PathLevelIndexes, CommunicationType, KeyAgentType } from './types';
|
|
16
17
|
import { KeyAgentBase } from './KeyAgentBase';
|
|
17
18
|
import { ManagedFreeableScope } from '@cardano-sdk/util';
|
|
@@ -105,7 +106,7 @@ export class LedgerKeyAgent extends KeyAgentBase {
|
|
|
105
106
|
path: utils.str_to_path(derivationPath)
|
|
106
107
|
});
|
|
107
108
|
const xPubHex = `${extendedPublicKey.publicKeyHex}${extendedPublicKey.chainCodeHex}`;
|
|
108
|
-
return
|
|
109
|
+
return Crypto.Bip32PublicKeyHex(xPubHex);
|
|
109
110
|
}
|
|
110
111
|
catch (error) {
|
|
111
112
|
if (error.code === 28169) {
|
|
@@ -137,7 +138,7 @@ export class LedgerKeyAgent extends KeyAgentBase {
|
|
|
137
138
|
knownAddresses: []
|
|
138
139
|
}, dependencies);
|
|
139
140
|
}
|
|
140
|
-
async signTransaction({ body }) {
|
|
141
|
+
async signTransaction({ body, hash }) {
|
|
141
142
|
const scope = new ManagedFreeableScope();
|
|
142
143
|
try {
|
|
143
144
|
const cslTxBody = coreToCml.txBody(scope, body);
|
|
@@ -149,12 +150,15 @@ export class LedgerKeyAgent extends KeyAgentBase {
|
|
|
149
150
|
});
|
|
150
151
|
const deviceConnection = await LedgerKeyAgent.checkDeviceConnection(__classPrivateFieldGet(this, _LedgerKeyAgent_communicationType, "f"), this.deviceConnection);
|
|
151
152
|
const result = await deviceConnection.signTransaction(ledgerTxData);
|
|
153
|
+
if (result.txHashHex !== hash.toString()) {
|
|
154
|
+
throw new HwMappingError('Ledger computed a different transaction id');
|
|
155
|
+
}
|
|
152
156
|
return new Map(await Promise.all(result.witnesses.map(async (witness) => {
|
|
153
157
|
const publicKey = await this.derivePublicKey({
|
|
154
158
|
index: witness.path[Cip1852PathLevelIndexes.INDEX],
|
|
155
159
|
role: witness.path[Cip1852PathLevelIndexes.ROLE]
|
|
156
160
|
});
|
|
157
|
-
const signature =
|
|
161
|
+
const signature = Crypto.Ed25519SignatureHex(witness.witnessSignatureHex);
|
|
158
162
|
return [publicKey, signature];
|
|
159
163
|
})));
|
|
160
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LedgerKeyAgent.js","sourceRoot":"","sources":["../../src/LedgerKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/
|
|
1
|
+
{"version":3,"file":"LedgerKeyAgent.js","sourceRoot":"","sources":["../../src/LedgerKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EA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AM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC;oBAC3C,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBAClD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC;iBACjD,CAAC,CAAC;gBACH,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;gBAC1E,OAAO,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;YACzC,CAAC,CAAC,CACH,CACF,CAAC;SACH;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,KAAK,CAAC,IAAI,KAAK,KAAM,EAAE;gBACzB,MAAM,IAAI,mBAAmB,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;aACrE;YACD,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;SAClC;gBAAS;YACR,KAAK,CAAC,OAAO,EAAE,CAAC;SACjB;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
1
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
2
3
|
import { KeyAgentDependencies, SerializableTrezorKeyAgentData, SignBlobResult, TrezorConfig } from './types';
|
|
3
4
|
import { KeyAgentBase } from './KeyAgentBase';
|
|
@@ -18,10 +19,10 @@ export declare class TrezorKeyAgent extends KeyAgentBase {
|
|
|
18
19
|
constructor({ isTrezorInitialized, ...serializableData }: TrezorKeyAgentProps, dependencies: KeyAgentDependencies);
|
|
19
20
|
static initializeTrezorTransport({ manifest, communicationType, silentMode, lazyLoad }: TrezorConfig): Promise<boolean>;
|
|
20
21
|
static checkDeviceConnection(): Promise<Features>;
|
|
21
|
-
static getXpub({ accountIndex }: GetTrezorXpubProps): Promise<
|
|
22
|
+
static getXpub({ accountIndex }: GetTrezorXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
22
23
|
static createWithDevice({ chainId, accountIndex, trezorConfig }: CreateTrezorKeyAgentProps, dependencies: KeyAgentDependencies): Promise<TrezorKeyAgent>;
|
|
23
24
|
signTransaction({ body }: Cardano.TxBodyWithHash): Promise<Cardano.Signatures>;
|
|
24
25
|
signBlob(): Promise<SignBlobResult>;
|
|
25
|
-
exportRootPrivateKey(): Promise<
|
|
26
|
+
exportRootPrivateKey(): Promise<Crypto.Bip32PrivateKeyHex>;
|
|
26
27
|
}
|
|
27
28
|
//# sourceMappingURL=TrezorKeyAgent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.d.ts","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TrezorKeyAgent.d.ts","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAkC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAGL,oBAAoB,EAEpB,8BAA8B,EAC9B,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAsB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,8BAA8B,EAAE,YAAY,CAAC;IAC7F,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAKD,qBAAa,cAAe,SAAQ,YAAY;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAEnC,EAAE,mBAAmB,EAAE,GAAG,gBAAgB,EAAE,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB;WAUpG,yBAAyB,CAAC,EACrC,QAAQ,EACR,iBAAiB,EACjB,UAAkB,EAClB,QAAgB,EACjB,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;WAwBrB,qBAAqB,IAAI,OAAO,CAAC,QAAQ,CAAC;WAkB1C,OAAO,CAAC,EAAE,YAAY,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;WAoBhF,gBAAgB,CAC3B,EAAE,OAAO,EAAE,YAAgB,EAAE,YAAY,EAAE,EAAE,yBAAyB,EACtE,YAAY,EAAE,oBAAoB;IAiB9B,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;IAsC9E,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAInC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;CAGjE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as Crypto from '@cardano-sdk/crypto';
|
|
1
2
|
import { AuthenticationError, TransportError } from './errors';
|
|
2
|
-
import {
|
|
3
|
+
import { NotImplementedError, coreToCml } from '@cardano-sdk/core';
|
|
3
4
|
import { CardanoKeyConst, CommunicationType, KeyAgentType } from './types';
|
|
4
5
|
import { KeyAgentBase } from './KeyAgentBase';
|
|
5
6
|
import { ManagedFreeableScope } from '@cardano-sdk/util';
|
|
@@ -54,7 +55,7 @@ export class TrezorKeyAgent extends KeyAgentBase {
|
|
|
54
55
|
if (!extendedPublicKey.success) {
|
|
55
56
|
throw new TransportError('Failed to export extended account public key', extendedPublicKey.payload);
|
|
56
57
|
}
|
|
57
|
-
return
|
|
58
|
+
return Crypto.Bip32PublicKeyHex(extendedPublicKey.payload.publicKey);
|
|
58
59
|
}
|
|
59
60
|
catch (error) {
|
|
60
61
|
throw transportTypedError(error);
|
|
@@ -90,8 +91,8 @@ export class TrezorKeyAgent extends KeyAgentBase {
|
|
|
90
91
|
}
|
|
91
92
|
const signedData = result.payload;
|
|
92
93
|
return new Map(await Promise.all(signedData.witnesses.map(async (witness) => {
|
|
93
|
-
const publicKey =
|
|
94
|
-
const signature =
|
|
94
|
+
const publicKey = Crypto.Ed25519PublicKeyHex(witness.pubKey);
|
|
95
|
+
const signature = Crypto.Ed25519SignatureHex(witness.signature);
|
|
95
96
|
return [publicKey, signature];
|
|
96
97
|
})));
|
|
97
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAW,mBAAmB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,iBAAiB,EAEjB,YAAY,EAIb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO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BAChE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;YACzC,CAAC,CAAC,CACH,CACF,CAAC;SACH;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,yBAAyB,EAAE;gBACvD,MAAM,IAAI,mBAAmB,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;aACrE;YACD,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;SAClC;gBAAS;YACR,KAAK,CAAC,OAAO,EAAE,CAAC;SACjB;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AsyncKeyAgent } from '../types';
|
|
2
|
-
import { Cardano
|
|
2
|
+
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Cip30DataSignature } from '@cardano-sdk/dapp-connector';
|
|
4
|
+
import { ComposableError, HexBlob } from '@cardano-sdk/util';
|
|
4
5
|
export interface Cip30SignDataRequest {
|
|
5
6
|
keyAgent: AsyncKeyAgent;
|
|
6
7
|
signWith: Cardano.Address | Cardano.RewardAccount;
|
|
7
|
-
payload:
|
|
8
|
+
payload: HexBlob;
|
|
8
9
|
}
|
|
9
10
|
export declare enum Cip30DataSignErrorCode {
|
|
10
11
|
ProofGeneration = 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cip30signData.d.ts","sourceRoot":"","sources":["../../../src/cip8/cip30signData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cip30signData.d.ts","sourceRoot":"","sources":["../../../src/cip8/cip30signData.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAW,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,OAAO,EAAyB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAK5E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,oBAAY,sBAAsB;IAChC,eAAe,IAAI;IACnB,YAAY,IAAI;IAChB,YAAY,IAAI;CACjB;AAED,qBAAa,kBAAkB,CAAC,UAAU,GAAG,OAAO,CAAE,SAAQ,eAAe,CAAC,UAAU,CAAC;aAC3D,IAAI,EAAE,sBAAsB;aAAkB,IAAI,EAAE,MAAM;gBAA1D,IAAI,EAAE,sBAAsB,EAAkB,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU;CAGhH;AA2DD,eAAO,MAAM,aAAa,oCAIvB,oBAAoB,KAAG,QAAQ,kBAAkB,CAmBnD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AlgorithmId, CBORValue, COSEKey, KeyType as COSEKeyType, COSESign1Builder, CurveType, HeaderMap, Headers, Label, ProtectedHeaderMap } from '@emurgo/cardano-message-signing-nodejs';
|
|
2
|
-
import {
|
|
2
|
+
import { parseCmlAddress, util } from '@cardano-sdk/core';
|
|
3
|
+
import { ComposableError, usingAutoFree } from '@cardano-sdk/util';
|
|
3
4
|
import { CoseLabel } from './util';
|
|
4
5
|
import { STAKE_KEY_DERIVATION_PATH } from '../util';
|
|
5
6
|
import { firstValueFrom } from 'rxjs';
|
|
6
|
-
import { usingAutoFree } from '@cardano-sdk/util';
|
|
7
7
|
export var Cip30DataSignErrorCode;
|
|
8
8
|
(function (Cip30DataSignErrorCode) {
|
|
9
9
|
Cip30DataSignErrorCode[Cip30DataSignErrorCode["ProofGeneration"] = 1] = "ProofGeneration";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cip30signData.js","sourceRoot":"","sources":["../../../src/cip8/cip30signData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cip30signData.js","sourceRoot":"","sources":["../../../src/cip8/cip30signData.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,OAAO,IAAI,WAAW,EACtB,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,KAAK,EACL,kBAAkB,EAEnB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAW,eAAe,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAW,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAQtC,MAAM,CAAN,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,yFAAmB,CAAA;IACnB,mFAAgB,CAAA;IAChB,mFAAgB,CAAA;AAClB,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,QAIjC;AAED,MAAM,OAAO,kBAAyC,SAAQ,eAA2B;IACvF,YAA4B,IAA4B,EAAkB,IAAY,EAAE,UAAuB;QAC7G,KAAK,CAAC,uBAAuB,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC;QADvB,SAAI,GAAJ,IAAI,CAAwB;QAAkB,SAAI,GAAJ,IAAI,CAAQ;IAEtF,CAAC;CACF;AAED,MAAM,eAAe,GAAG,CAAC,QAAiD,EAAE,EAAE,CAC5E,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE;IACtB,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,QAA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C;IAEnE,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAClC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAC7F,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC3B,KAAK,CACN,CAAC;IACF,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IACjD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAChG,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEvD,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;KACjD,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/esm/cip8/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type CoseSign1CborHex =
|
|
3
|
-
export declare type CoseKeyCborHex =
|
|
1
|
+
import { HexBlob } from '@cardano-sdk/util';
|
|
2
|
+
export declare type CoseSign1CborHex = HexBlob;
|
|
3
|
+
export declare type CoseKeyCborHex = HexBlob;
|
|
4
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cip8/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,oBAAY,gBAAgB,GAAG,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cip8/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,oBAAY,gBAAgB,GAAG,OAAO,CAAC;AACvC,oBAAY,cAAc,GAAG,OAAO,CAAC"}
|
package/dist/esm/emip3.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const createPbkdf2Key: (
|
|
2
|
-
export declare const emip3encrypt: (data: Uint8Array,
|
|
3
|
-
export declare const emip3decrypt: (encrypted: Uint8Array,
|
|
1
|
+
export declare const createPbkdf2Key: (passphrase: Uint8Array, salt: Uint8Array | Uint16Array) => Promise<Buffer>;
|
|
2
|
+
export declare const emip3encrypt: (data: Uint8Array, passphrase: Uint8Array) => Promise<Uint8Array>;
|
|
3
|
+
export declare const emip3decrypt: (encrypted: Uint8Array, passphrase: Uint8Array) => Promise<Uint8Array>;
|
|
4
4
|
//# sourceMappingURL=emip3.d.ts.map
|
package/dist/esm/emip3.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emip3.d.ts","sourceRoot":"","sources":["../../src/emip3.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"emip3.d.ts","sourceRoot":"","sources":["../../src/emip3.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,eAAsB,UAAU,QAAQ,UAAU,GAAG,WAAW,oBAMzF,CAAC;AAKJ,eAAO,MAAM,YAAY,SAAgB,UAAU,cAAc,UAAU,KAAG,QAAQ,UAAU,CAY/F,CAAC;AAKF,eAAO,MAAM,YAAY,cAAqB,UAAU,cAAc,UAAU,KAAG,QAAQ,UAAU,CAUpG,CAAC"}
|