@cardano-sdk/key-management 0.13.0 → 0.14.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.
@@ -1,5 +1,6 @@
1
1
  import * as Crypto from '@cardano-sdk/crypto';
2
- import { AccountKeyDerivationPath, Ed25519KeyPair, KeyPair } from '../types';
2
+ import { AccountKeyDerivationPath, Ed25519KeyPair, GroupedAddress, KeyPair } from '../types';
3
+ import { BIP32Path } from '@cardano-sdk/crypto';
3
4
  export declare const harden: (num: number) => number;
4
5
  export declare const STAKE_KEY_DERIVATION_PATH: AccountKeyDerivationPath;
5
6
  export declare const DREP_KEY_DERIVATION_PATH: AccountKeyDerivationPath;
@@ -10,4 +11,6 @@ export interface DeriveAccountPrivateKeyProps {
10
11
  bip32Ed25519: Crypto.Bip32Ed25519;
11
12
  }
12
13
  export declare const deriveAccountPrivateKey: ({ rootPrivateKey, accountIndex, bip32Ed25519 }: DeriveAccountPrivateKeyProps) => Promise<Crypto.Bip32PrivateKeyHex>;
14
+ export declare const paymentKeyPathFromGroupedAddress: (address: GroupedAddress) => Crypto.BIP32Path;
15
+ export declare const stakeKeyPathFromGroupedAddress: (address: GroupedAddress | undefined) => BIP32Path | null;
13
16
  //# sourceMappingURL=key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/util/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAmB,cAAc,EAAE,OAAO,EAAW,MAAM,UAAU,CAAC;AAEvG,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAA6B,CAAC;AAEnE,eAAO,MAAM,yBAAyB,EAAE,wBAGvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,wBAGtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,iBACb,OAAO,YACX,OAAO,YAAY,KAC5B,QAAQ,cAAc,CAGvB,CAAC;AAEH,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;CACnC;AAED,eAAO,MAAM,uBAAuB,mDAIjC,4BAA4B,KAAG,QAAQ,OAAO,kBAAkB,CAK/D,CAAC"}
1
+ {"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../../src/util/key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAmB,cAAc,EAAE,cAAc,EAAE,OAAO,EAAW,MAAM,UAAU,CAAC;AACvH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,eAAO,MAAM,MAAM,QAAS,MAAM,KAAG,MAA6B,CAAC;AAEnE,eAAO,MAAM,yBAAyB,EAAE,wBAGvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,wBAGtC,CAAC;AAEF,eAAO,MAAM,gBAAgB,iBACb,OAAO,YACX,OAAO,YAAY,KAC5B,QAAQ,cAAc,CAGvB,CAAC;AAEH,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;CACnC;AAED,eAAO,MAAM,uBAAuB,mDAIjC,4BAA4B,KAAG,QAAQ,OAAO,kBAAkB,CAK/D,CAAC;AAOL,eAAO,MAAM,gCAAgC,YAAa,cAAc,qBAMvE,CAAC;AAOF,eAAO,MAAM,8BAA8B,YAAa,cAAc,GAAG,SAAS,KAAG,SAAS,GAAG,IAShG,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deriveAccountPrivateKey = exports.toEd25519KeyPair = exports.DREP_KEY_DERIVATION_PATH = exports.STAKE_KEY_DERIVATION_PATH = exports.harden = void 0;
3
+ exports.stakeKeyPathFromGroupedAddress = exports.paymentKeyPathFromGroupedAddress = exports.deriveAccountPrivateKey = exports.toEd25519KeyPair = exports.DREP_KEY_DERIVATION_PATH = exports.STAKE_KEY_DERIVATION_PATH = exports.harden = void 0;
4
4
  const types_1 = require("../types");
5
5
  const harden = (num) => 2147483648 + num;
6
6
  exports.harden = harden;
@@ -23,4 +23,24 @@ const deriveAccountPrivateKey = async ({ rootPrivateKey, accountIndex, bip32Ed25
23
23
  (0, exports.harden)(accountIndex)
24
24
  ]);
25
25
  exports.deriveAccountPrivateKey = deriveAccountPrivateKey;
26
+ const paymentKeyPathFromGroupedAddress = (address) => [
27
+ (0, exports.harden)(types_1.CardanoKeyConst.PURPOSE),
28
+ (0, exports.harden)(types_1.CardanoKeyConst.COIN_TYPE),
29
+ (0, exports.harden)(address.accountIndex),
30
+ address.type,
31
+ address.index
32
+ ];
33
+ exports.paymentKeyPathFromGroupedAddress = paymentKeyPathFromGroupedAddress;
34
+ const stakeKeyPathFromGroupedAddress = (address) => {
35
+ if (!address?.stakeKeyDerivationPath)
36
+ return null;
37
+ return [
38
+ (0, exports.harden)(types_1.CardanoKeyConst.PURPOSE),
39
+ (0, exports.harden)(types_1.CardanoKeyConst.COIN_TYPE),
40
+ (0, exports.harden)(address.accountIndex),
41
+ address.stakeKeyDerivationPath.role,
42
+ address.stakeKeyDerivationPath.index
43
+ ];
44
+ };
45
+ exports.stakeKeyPathFromGroupedAddress = stakeKeyPathFromGroupedAddress;
26
46
  //# sourceMappingURL=key.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/util/key.ts"],"names":[],"mappings":";;;AACA,oCAAuG;AAEhG,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,UAAa,GAAG,GAAG,CAAC;AAAtD,QAAA,MAAM,UAAgD;AAEtD,QAAA,yBAAyB,GAA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AA8B,kCASzC"}
@@ -1,4 +1,3 @@
1
- import { TrezorKeyAgent } from './TrezorKeyAgent';
2
1
  export * as errors from './errors';
3
2
  export * from './KeyAgentBase';
4
3
  export * from './InMemoryKeyAgent';
@@ -6,5 +5,4 @@ export * as util from './util';
6
5
  export * from './emip3';
7
6
  export * from './types';
8
7
  export * as cip8 from './cip8';
9
- export { TrezorKeyAgent };
10
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { TrezorKeyAgent } from './TrezorKeyAgent';
2
1
  export * as errors from './errors';
3
2
  export * from './KeyAgentBase';
4
3
  export * from './InMemoryKeyAgent';
@@ -6,5 +5,4 @@ export * as util from './util';
6
5
  export * from './emip3';
7
6
  export * from './types';
8
7
  export * as cip8 from './cip8';
9
- export { TrezorKeyAgent };
10
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}