@cardano-sdk/key-management 0.2.0-nightly.13 → 0.2.0-nightly.15

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.
@@ -82,7 +82,7 @@ class InMemoryKeyAgent extends KeyAgentBase_1.KeyAgentBase {
82
82
  if (!validMnemonic)
83
83
  throw new errors.InvalidMnemonicError();
84
84
  const entropy = Buffer.from((0, util_1.mnemonicWordsToEntropy)(mnemonicWords), 'hex');
85
- const rootPrivateKey = core_1.CSL.Bip32PrivateKey.from_bip39_entropy(entropy, mnemonic2ndFactorPassphrase);
85
+ const rootPrivateKey = core_1.CML.Bip32PrivateKey.from_bip39_entropy(entropy, mnemonic2ndFactorPassphrase);
86
86
  const password = await getPasswordRethrowTypedError(getPassword);
87
87
  const encryptedRootPrivateKey = await (0, emip3_1.emip3encrypt)(rootPrivateKey.as_bytes(), password);
88
88
  const accountPrivateKey = (0, util_1.deriveAccountPrivateKey)({
@@ -110,7 +110,7 @@ class InMemoryKeyAgent extends KeyAgentBase_1.KeyAgentBase {
110
110
  }
111
111
  async exportExtendedKeyPair(derivationPath) {
112
112
  const rootPrivateKey = await this.exportRootPrivateKey();
113
- const cslRootPrivateKey = core_1.CSL.Bip32PrivateKey.from_bytes(Buffer.from(rootPrivateKey, 'hex'));
113
+ const cslRootPrivateKey = core_1.CML.Bip32PrivateKey.from_bytes(Buffer.from(rootPrivateKey, 'hex'));
114
114
  let cslPrivateKey = cslRootPrivateKey;
115
115
  for (const val of derivationPath) {
116
116
  cslPrivateKey = cslPrivateKey.derive((0, util_1.harden)(val));
@@ -131,6 +131,6 @@ _InMemoryKeyAgent_getPassword = new WeakMap(), _InMemoryKeyAgent_instances = new
131
131
  catch (error) {
132
132
  throw new errors.AuthenticationError('Failed to decrypt root private key', error);
133
133
  }
134
- return core_1.CSL.Bip32PrivateKey.from_bytes(decryptedRootKeyBytes);
134
+ return core_1.CML.Bip32PrivateKey.from_bytes(decryptedRootKeyBytes);
135
135
  };
136
136
  //# sourceMappingURL=InMemoryKeyAgent.js.map
@@ -1,5 +1,5 @@
1
1
  import { AccountAddressDerivationPath, AccountKeyDerivationPath, GroupedAddress, KeyAgent, KeyAgentDependencies, SerializableKeyAgentData, SignBlobResult, SignTransactionOptions } from './types';
2
- import { CSL, Cardano } from '@cardano-sdk/core';
2
+ import { CML, Cardano } from '@cardano-sdk/core';
3
3
  export declare abstract class KeyAgentBase implements KeyAgent {
4
4
  #private;
5
5
  protected readonly inputResolver: Cardano.util.InputResolver;
@@ -15,6 +15,6 @@ export declare abstract class KeyAgentBase implements KeyAgent {
15
15
  constructor(serializableData: SerializableKeyAgentData, { inputResolver }: KeyAgentDependencies);
16
16
  deriveAddress({ index, type }: AccountAddressDerivationPath): Promise<GroupedAddress>;
17
17
  derivePublicKey(derivationPath: AccountKeyDerivationPath): Promise<Cardano.Ed25519PublicKey>;
18
- protected deriveCslPublicKey({ index, role: type }: AccountKeyDerivationPath): Promise<CSL.PublicKey>;
18
+ protected deriveCmlPublicKey({ index, role: type }: AccountKeyDerivationPath): Promise<CML.PublicKey>;
19
19
  }
20
20
  //# sourceMappingURL=KeyAgentBase.d.ts.map
@@ -43,14 +43,14 @@ class KeyAgentBase {
43
43
  const knownAddress = this.knownAddresses.find((addr) => addr.type === type && addr.index === index);
44
44
  if (knownAddress)
45
45
  return knownAddress;
46
- const derivedPublicPaymentKey = await this.deriveCslPublicKey({
46
+ const derivedPublicPaymentKey = await this.deriveCmlPublicKey({
47
47
  index,
48
48
  role: type
49
49
  });
50
- const publicStakeKey = await this.deriveCslPublicKey(util_1.STAKE_KEY_DERIVATION_PATH);
51
- const stakeKeyCredential = core_1.CSL.StakeCredential.from_keyhash(publicStakeKey.hash());
52
- const address = core_1.CSL.BaseAddress.new(this.networkId, core_1.CSL.StakeCredential.from_keyhash(derivedPublicPaymentKey.hash()), stakeKeyCredential).to_address();
53
- const rewardAccount = core_1.CSL.RewardAddress.new(this.networkId, stakeKeyCredential).to_address();
50
+ const publicStakeKey = await this.deriveCmlPublicKey(util_1.STAKE_KEY_DERIVATION_PATH);
51
+ const stakeKeyCredential = core_1.CML.StakeCredential.from_keyhash(publicStakeKey.hash());
52
+ const address = core_1.CML.BaseAddress.new(this.networkId, core_1.CML.StakeCredential.from_keyhash(derivedPublicPaymentKey.hash()), stakeKeyCredential).to_address();
53
+ const rewardAccount = core_1.CML.RewardAddress.new(this.networkId, stakeKeyCredential).to_address();
54
54
  const groupedAddress = {
55
55
  accountIndex: this.accountIndex,
56
56
  address: core_1.Cardano.Address(address.to_bech32()),
@@ -63,12 +63,12 @@ class KeyAgentBase {
63
63
  return groupedAddress;
64
64
  }
65
65
  async derivePublicKey(derivationPath) {
66
- const cslPublicKey = await this.deriveCslPublicKey(derivationPath);
66
+ const cslPublicKey = await this.deriveCmlPublicKey(derivationPath);
67
67
  return core_1.Cardano.Ed25519PublicKey.fromHexBlob(core_1.util.bytesToHex(cslPublicKey.as_bytes()));
68
68
  }
69
- async deriveCslPublicKey({ index, role: type }) {
69
+ async deriveCmlPublicKey({ index, role: type }) {
70
70
  const accountPublicKeyBytes = Buffer.from(this.extendedAccountPublicKey, 'hex');
71
- const accountPublicKey = core_1.CSL.Bip32PublicKey.from_bytes(accountPublicKeyBytes);
71
+ const accountPublicKey = core_1.CML.Bip32PublicKey.from_bytes(accountPublicKeyBytes);
72
72
  return accountPublicKey.derive(type).derive(index).to_raw_key();
73
73
  }
74
74
  }
@@ -172,7 +172,7 @@ class LedgerKeyAgent extends KeyAgentBase_1.KeyAgentBase {
172
172
  async signTransaction({ body }) {
173
173
  const scope = new util_1.ManagedFreeableScope();
174
174
  try {
175
- const cslTxBody = core_1.coreToCsl.txBody(scope, body);
175
+ const cslTxBody = core_1.coreToCml.txBody(scope, body);
176
176
  const ledgerTxData = await (0, util_2.txToLedger)({
177
177
  cslTxBody,
178
178
  inputResolver: this.inputResolver,
@@ -97,7 +97,7 @@ class TrezorKeyAgent extends KeyAgentBase_1.KeyAgentBase {
97
97
  const scope = new util_1.ManagedFreeableScope();
98
98
  try {
99
99
  await this.isTrezorInitialized;
100
- const cslTxBody = core_1.coreToCsl.txBody(scope, body);
100
+ const cslTxBody = core_1.coreToCml.txBody(scope, body);
101
101
  const trezorTxData = await (0, util_2.txToTrezor)({
102
102
  accountIndex: this.accountIndex,
103
103
  cslTxBody,
@@ -22,7 +22,7 @@ class Cip30DataSignError extends core_1.ComposableError {
22
22
  }
23
23
  exports.Cip30DataSignError = Cip30DataSignError;
24
24
  const getAddressBytes = (signWith) => (0, util_3.usingAutoFree)((scope) => {
25
- const cslAddress = (0, core_1.parseCslAddress)(scope, signWith.toString());
25
+ const cslAddress = (0, core_1.parseCmlAddress)(scope, signWith.toString());
26
26
  if (!cslAddress) {
27
27
  throw new Cip30DataSignError(Cip30DataSignErrorCode.AddressNotPK, 'Invalid address');
28
28
  }