@cardano-sdk/key-management 0.28.1 → 0.29.1
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/Bip32Account.d.ts +4 -4
- package/dist/cjs/Bip32Account.d.ts.map +1 -1
- package/dist/cjs/Bip32Account.js +7 -7
- package/dist/cjs/Bip32Account.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/Bip32Account.d.ts +4 -4
- package/dist/esm/Bip32Account.d.ts.map +1 -1
- package/dist/esm/Bip32Account.js +7 -7
- package/dist/esm/Bip32Account.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -8,8 +8,8 @@ declare type Bip32AccountProps = {
|
|
|
8
8
|
chainId: Cardano.ChainId;
|
|
9
9
|
};
|
|
10
10
|
export declare type Bip32AccountDependencies = {
|
|
11
|
-
bip32Ed25519: Pick<Bip32Ed25519, '
|
|
12
|
-
blake2b: Blake2b
|
|
11
|
+
bip32Ed25519: Pick<Bip32Ed25519, 'derivePublicKeyAsync'>;
|
|
12
|
+
blake2b: Pick<Blake2b, 'hashAsync'>;
|
|
13
13
|
};
|
|
14
14
|
export declare class Bip32Account {
|
|
15
15
|
#private;
|
|
@@ -17,8 +17,8 @@ export declare class Bip32Account {
|
|
|
17
17
|
readonly chainId: Cardano.ChainId;
|
|
18
18
|
readonly accountIndex: number;
|
|
19
19
|
constructor({ extendedAccountPublicKey, chainId, accountIndex }: Bip32AccountProps, dependencies: Bip32AccountDependencies);
|
|
20
|
-
derivePublicKey(derivationPath: AccountKeyDerivationPath): Crypto.Ed25519PublicKeyHex
|
|
21
|
-
deriveAddress(paymentKeyDerivationPath: AccountAddressDerivationPath, stakeKeyDerivationIndex: number): GroupedAddress
|
|
20
|
+
derivePublicKey(derivationPath: AccountKeyDerivationPath): Promise<Crypto.Ed25519PublicKeyHex>;
|
|
21
|
+
deriveAddress(paymentKeyDerivationPath: AccountAddressDerivationPath, stakeKeyDerivationIndex: number): Promise<GroupedAddress>;
|
|
22
22
|
static createDefaultDependencies(): Promise<Bip32AccountDependencies>;
|
|
23
23
|
static fromAsyncKeyAgent(keyAgent: AsyncKeyAgent, dependencies?: Bip32AccountDependencies): Promise<Bip32Account>;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bip32Account.d.ts","sourceRoot":"","sources":["../../src/Bip32Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,aAAa,EACb,cAAc,EAEf,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,YAAY,EACZ,OAAO,EAIR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,aAAK,iBAAiB,GAAG;IACvB,wBAAwB,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAC1B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"Bip32Account.d.ts","sourceRoot":"","sources":["../../src/Bip32Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,aAAa,EACb,cAAc,EAEf,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,YAAY,EACZ,OAAO,EAIR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,aAAK,iBAAiB,GAAG;IACvB,wBAAwB,EAAE,MAAM,CAAC,iBAAiB,CAAC;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAC1B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACzD,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;CACrC,CAAC;AAGF,qBAAa,YAAY;;IACvB,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAM5B,EAAE,wBAAwB,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,iBAAiB,EACtE,YAAY,EAAE,wBAAwB;IASlC,eAAe,CAAC,cAAc,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAQ9F,aAAa,CACjB,wBAAwB,EAAE,4BAA4B,EACtD,uBAAuB,EAAE,MAAM,GAC9B,OAAO,CAAC,cAAc,CAAC;WA0Cb,yBAAyB,IAAI,OAAO,CAAC,wBAAwB,CAAC;WAa9D,iBAAiB,CAC5B,QAAQ,EAAE,aAAa,EACvB,YAAY,CAAC,EAAE,wBAAwB,GACtC,OAAO,CAAC,YAAY,CAAC;CAWzB"}
|
package/dist/cjs/Bip32Account.js
CHANGED
|
@@ -26,25 +26,25 @@ class Bip32Account {
|
|
|
26
26
|
this.chainId = chainId;
|
|
27
27
|
this.accountIndex = accountIndex;
|
|
28
28
|
}
|
|
29
|
-
derivePublicKey(derivationPath) {
|
|
30
|
-
const extendedKey = __classPrivateFieldGet(this, _Bip32Account_bip32Ed25519, "f").
|
|
29
|
+
async derivePublicKey(derivationPath) {
|
|
30
|
+
const extendedKey = await __classPrivateFieldGet(this, _Bip32Account_bip32Ed25519, "f").derivePublicKeyAsync(this.extendedAccountPublicKeyHex, [
|
|
31
31
|
derivationPath.role,
|
|
32
32
|
derivationPath.index
|
|
33
33
|
]);
|
|
34
34
|
return crypto_1.Ed25519PublicKeyHex.fromBip32PublicKey(extendedKey);
|
|
35
35
|
}
|
|
36
|
-
deriveAddress(paymentKeyDerivationPath, stakeKeyDerivationIndex) {
|
|
36
|
+
async deriveAddress(paymentKeyDerivationPath, stakeKeyDerivationIndex) {
|
|
37
37
|
const stakeKeyDerivationPath = {
|
|
38
38
|
index: stakeKeyDerivationIndex,
|
|
39
39
|
role: types_1.KeyRole.Stake
|
|
40
40
|
};
|
|
41
|
-
const derivedPublicPaymentKey = this.derivePublicKey({
|
|
41
|
+
const derivedPublicPaymentKey = await this.derivePublicKey({
|
|
42
42
|
index: paymentKeyDerivationPath.index,
|
|
43
43
|
role: Number(paymentKeyDerivationPath.type)
|
|
44
44
|
});
|
|
45
|
-
const derivedPublicPaymentKeyHash = __classPrivateFieldGet(this, _Bip32Account_blake2b, "f").
|
|
46
|
-
const publicStakeKey = this.derivePublicKey(stakeKeyDerivationPath);
|
|
47
|
-
const publicStakeKeyHash = __classPrivateFieldGet(this, _Bip32Account_blake2b, "f").
|
|
45
|
+
const derivedPublicPaymentKeyHash = (await __classPrivateFieldGet(this, _Bip32Account_blake2b, "f").hashAsync(derivedPublicPaymentKey, crypto_1.BIP32_PUBLIC_KEY_HASH_LENGTH));
|
|
46
|
+
const publicStakeKey = await this.derivePublicKey(stakeKeyDerivationPath);
|
|
47
|
+
const publicStakeKeyHash = (await __classPrivateFieldGet(this, _Bip32Account_blake2b, "f").hashAsync(publicStakeKey, crypto_1.BIP32_PUBLIC_KEY_HASH_LENGTH));
|
|
48
48
|
const stakeCredential = { hash: publicStakeKeyHash, type: core_1.Cardano.CredentialType.KeyHash };
|
|
49
49
|
const address = core_1.Cardano.BaseAddress.fromCredentials(this.chainId.networkId, { hash: derivedPublicPaymentKeyHash, type: core_1.Cardano.CredentialType.KeyHash }, stakeCredential).toAddress();
|
|
50
50
|
const rewardAccount = core_1.Cardano.RewardAddress.fromCredentials(this.chainId.networkId, stakeCredential).toAddress();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bip32Account.js","sourceRoot":"","sources":["../../src/Bip32Account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mCAMiB;AACjB,gDAO6B;AAC7B,4CAA4C;AAc5C,MAAa,YAAY;IAQvB,YACE,EAAE,wBAAwB,EAAE,OAAO,EAAE,YAAY,EAAqB,EACtE,YAAsC;QANxC,6CAAiE;QACjE,
|
|
1
|
+
{"version":3,"file":"Bip32Account.js","sourceRoot":"","sources":["../../src/Bip32Account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mCAMiB;AACjB,gDAO6B;AAC7B,4CAA4C;AAc5C,MAAa,YAAY;IAQvB,YACE,EAAE,wBAAwB,EAAE,OAAO,EAAE,YAAY,EAAqB,EACtE,YAAsC;QANxC,6CAAiE;QACjE,wCAAuD;QAOrD,IAAI,CAAC,2BAA2B,GAAG,wBAAwB,CAAC;QAC5D,uBAAA,IAAI,8BAAiB,YAAY,CAAC,YAAY,MAAA,CAAC;QAC/C,uBAAA,IAAI,yBAAY,YAAY,CAAC,OAAO,MAAA,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,cAAwC;QAC5D,MAAM,WAAW,GAAG,MAAM,uBAAA,IAAI,kCAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAClG,cAAc,CAAC,IAAI;YACnB,cAAc,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,OAAO,4BAAmB,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,wBAAsD,EACtD,uBAA+B;QAE/B,MAAM,sBAAsB,GAAG;YAC7B,KAAK,EAAE,uBAAuB;YAC9B,IAAI,EAAE,eAAO,CAA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