@meshsdk/core-cst 1.6.5 → 1.6.6

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/index.cjs CHANGED
@@ -968,12 +968,16 @@ __export(src_exports, {
968
968
  StakeCredentialStatus: () => StakeCredentialStatus,
969
969
  StakeDelegation: () => StakeDelegation,
970
970
  StakeRegistration: () => StakeRegistration,
971
- StricaBip32PrivateKey: () => import_bip32ed25519.Bip32PrivateKey,
972
- StricaBip32PublicKey: () => import_bip32ed25519.Bip32PublicKey,
973
- StricaDecoder: () => import_cbors.Decoder,
974
- StricaEncoder: () => import_cbors.Encoder,
975
- StricaPrivateKey: () => import_bip32ed25519.PrivateKey,
976
- StricaPublicKey: () => import_bip32ed25519.PublicKey,
971
+ StricaBip32PrivateKey: () => StricaBip32PrivateKey,
972
+ StricaBip32PrivateKeyType: () => StricaBip32PrivateKey,
973
+ StricaBip32PublicKey: () => StricaBip32PublicKey,
974
+ StricaBip32PublicKeyType: () => StricaBip32PublicKey,
975
+ StricaDecoder: () => StricaDecoder,
976
+ StricaEncoder: () => StricaEncoder,
977
+ StricaPrivateKey: () => StricaPrivateKey,
978
+ StricaPrivateKeyType: () => StricaPrivateKey,
979
+ StricaPublicKey: () => StricaPublicKey,
980
+ StricaPublicKeyType: () => StricaPublicKey,
977
981
  Transaction: () => Transaction,
978
982
  TransactionBody: () => TransactionBody,
979
983
  TransactionId: () => TransactionId,
@@ -1129,11 +1133,17 @@ var StakeCredentialStatus = import_core.Cardano.StakeCredentialStatus;
1129
1133
  var import_buffer = require("buffer");
1130
1134
  var import_blakejs = __toESM(require_blakejs(), 1);
1131
1135
 
1132
- // src/stricahq/bip32ed25519/index.ts
1133
- var import_bip32ed25519 = require("@stricahq/bip32ed25519");
1136
+ // src/stricahq/bip32ed25519/wrapper.ts
1137
+ var cjsBip32ed25519 = __toESM(require("@stricahq/bip32ed25519"), 1);
1138
+ var StricaPrivateKey = cjsBip32ed25519.PrivateKey;
1139
+ var StricaPublicKey = cjsBip32ed25519.PublicKey;
1140
+ var StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
1141
+ var StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
1134
1142
 
1135
- // src/stricahq/cbors/index.ts
1136
- var import_cbors = require("@stricahq/cbors");
1143
+ // src/stricahq/cbors/wrapper.ts
1144
+ var cjsCbors = __toESM(require("@stricahq/cbors"), 1);
1145
+ var StricaEncoder = cjsCbors.Encoder;
1146
+ var StricaDecoder = cjsCbors.Decoder;
1137
1147
 
1138
1148
  // src/message-signing/cose-sign1.ts
1139
1149
  var CoseSign1 = class _CoseSign1 {
@@ -1151,13 +1161,13 @@ var CoseSign1 = class _CoseSign1 {
1151
1161
  this.signature = payload.signature;
1152
1162
  }
1153
1163
  static fromCbor(cbor) {
1154
- const decoded = import_cbors.Decoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1164
+ const decoded = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1155
1165
  if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
1156
1166
  if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
1157
1167
  let protectedMap;
1158
1168
  const protectedSerialized = decoded.value[0];
1159
1169
  try {
1160
- protectedMap = import_cbors.Decoder.decode(protectedSerialized).value;
1170
+ protectedMap = StricaDecoder.decode(protectedSerialized).value;
1161
1171
  if (!(protectedMap instanceof Map)) {
1162
1172
  throw Error();
1163
1173
  }
@@ -1178,7 +1188,7 @@ var CoseSign1 = class _CoseSign1 {
1178
1188
  createSigStructure(externalAad = import_buffer.Buffer.alloc(0)) {
1179
1189
  let protectedSerialized = import_buffer.Buffer.alloc(0);
1180
1190
  if (this.protectedMap.size !== 0) {
1181
- protectedSerialized = import_cbors.Encoder.encode(this.protectedMap);
1191
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1182
1192
  }
1183
1193
  const structure = [
1184
1194
  "Signature1",
@@ -1186,13 +1196,13 @@ var CoseSign1 = class _CoseSign1 {
1186
1196
  externalAad,
1187
1197
  this.payload
1188
1198
  ];
1189
- return import_cbors.Encoder.encode(structure);
1199
+ return StricaEncoder.encode(structure);
1190
1200
  }
1191
1201
  buildMessage(signature) {
1192
1202
  this.signature = signature;
1193
1203
  let protectedSerialized = import_buffer.Buffer.alloc(0);
1194
1204
  if (this.protectedMap.size !== 0) {
1195
- protectedSerialized = import_cbors.Encoder.encode(this.protectedMap);
1205
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1196
1206
  }
1197
1207
  const coseSign1 = [
1198
1208
  protectedSerialized,
@@ -1200,7 +1210,7 @@ var CoseSign1 = class _CoseSign1 {
1200
1210
  this.payload,
1201
1211
  this.signature
1202
1212
  ];
1203
- return import_cbors.Encoder.encode(coseSign1);
1213
+ return StricaEncoder.encode(coseSign1);
1204
1214
  }
1205
1215
  verifySignature({
1206
1216
  externalAad = import_buffer.Buffer.alloc(0),
@@ -1211,7 +1221,7 @@ var CoseSign1 = class _CoseSign1 {
1211
1221
  }
1212
1222
  if (!publicKeyBuffer) throw Error("Public key not found");
1213
1223
  if (!this.signature) throw Error("Signature not found");
1214
- const publicKey = new import_bip32ed25519.PublicKey(publicKeyBuffer);
1224
+ const publicKey = new StricaPublicKey(publicKeyBuffer);
1215
1225
  return publicKey.verify(
1216
1226
  this.signature,
1217
1227
  this.createSigStructure(externalAad)
@@ -1242,7 +1252,7 @@ var CoseSign1 = class _CoseSign1 {
1242
1252
  }
1243
1253
  };
1244
1254
  var getPublicKeyFromCoseKey = (cbor) => {
1245
- const decodedCoseKey = import_cbors.Decoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1255
+ const decodedCoseKey = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1246
1256
  const publicKeyBuffer = decodedCoseKey.value.get(-2);
1247
1257
  if (publicKeyBuffer) {
1248
1258
  return publicKeyBuffer;
@@ -1255,7 +1265,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
1255
1265
  coseKeyMap.set(3, -8);
1256
1266
  coseKeyMap.set(6, -2);
1257
1267
  coseKeyMap.set(-2, import_buffer.Buffer.from(cbor, "hex"));
1258
- return import_cbors.Encoder.encode(coseKeyMap);
1268
+ return StricaEncoder.encode(coseKeyMap);
1259
1269
  };
1260
1270
 
1261
1271
  // src/message-signing/check-signature.ts
@@ -1405,17 +1415,17 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
1405
1415
  };
1406
1416
  var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
1407
1417
  if (typeof entropy === "string") {
1408
- const rootKey = new import_bip32ed25519.Bip32PrivateKey(Buffer.from(entropy, "hex"));
1418
+ const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
1409
1419
  const accountKey = rootKey.derive(import_common2.HARDENED_KEY_START + 1852).derive(import_common2.HARDENED_KEY_START + 1815).derive(import_common2.HARDENED_KEY_START + accountIndex);
1410
1420
  const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
1411
1421
  const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
1412
1422
  const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
1413
1423
  return { paymentKey, stakeKey, dRepKey };
1414
1424
  } else {
1415
- const paymentKey = import_bip32ed25519.PrivateKey.fromSecretKey(
1425
+ const paymentKey = StricaPrivateKey.fromSecretKey(
1416
1426
  Buffer.from(entropy[0], "hex")
1417
1427
  );
1418
- const stakeKey = import_bip32ed25519.PrivateKey.fromSecretKey(
1428
+ const stakeKey = StricaPrivateKey.fromSecretKey(
1419
1429
  Buffer.from(entropy[1], "hex")
1420
1430
  );
1421
1431
  return { paymentKey, stakeKey };
@@ -2090,7 +2100,7 @@ var CardanoSDKSerializer = class {
2090
2100
  if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
2091
2101
  keyHex = keyHex.substring(4);
2092
2102
  }
2093
- const cardanoSigner = import_bip32ed25519.PrivateKey.fromSecretKey(
2103
+ const cardanoSigner = StricaPrivateKey.fromSecretKey(
2094
2104
  Buffer.from(keyHex, "hex")
2095
2105
  );
2096
2106
  const signature = cardanoSigner.sign(
@@ -2747,11 +2757,15 @@ var CardanoSDK = __toESM(require("@cardano-sdk/core"), 1);
2747
2757
  StakeDelegation,
2748
2758
  StakeRegistration,
2749
2759
  StricaBip32PrivateKey,
2760
+ StricaBip32PrivateKeyType,
2750
2761
  StricaBip32PublicKey,
2762
+ StricaBip32PublicKeyType,
2751
2763
  StricaDecoder,
2752
2764
  StricaEncoder,
2753
2765
  StricaPrivateKey,
2766
+ StricaPrivateKeyType,
2754
2767
  StricaPublicKey,
2768
+ StricaPublicKeyType,
2755
2769
  Transaction,
2756
2770
  TransactionBody,
2757
2771
  TransactionId,
package/dist/index.d.cts CHANGED
@@ -7,11 +7,10 @@ import { OpaqueString } from '@cardano-sdk/util';
7
7
  export { _cardano_sdk_util as CardanoSDKUtil };
8
8
  import * as Crypto from '@cardano-sdk/crypto';
9
9
  export { Crypto };
10
- import { PrivateKey } from '@stricahq/bip32ed25519';
11
- export { Bip32PrivateKey as StricaBip32PrivateKey, Bip32PublicKey as StricaBip32PublicKey, PrivateKey as StricaPrivateKey, PublicKey as StricaPublicKey } from '@stricahq/bip32ed25519';
10
+ import * as cjsBip32ed25519 from '@stricahq/bip32ed25519';
12
11
  import { DataSignature, Data, NativeScript as NativeScript$1, PlutusScript, IMeshTxSerializer, DeserializedAddress, BuilderData, IDeserializer, IResolver, MeshTxBuilderBody, Protocol, UTxO, Asset, LanguageVersion } from '@meshsdk/common';
13
- import { Buffer } from 'buffer';
14
- export { Decoder as StricaDecoder, Encoder as StricaEncoder } from '@stricahq/cbors';
12
+ import { Buffer as Buffer$1 } from 'buffer';
13
+ import * as cjsCbors from '@stricahq/cbors';
15
14
 
16
15
  declare const Slot: (value: number) => Cardano.Slot;
17
16
  type Slot = Cardano.Slot;
@@ -218,7 +217,7 @@ declare const StakeCredentialStatus: typeof Cardano.StakeCredentialStatus;
218
217
 
219
218
  type Signer = {
220
219
  address: Address;
221
- key: PrivateKey;
220
+ key: StricaPrivateKey;
222
221
  };
223
222
 
224
223
  declare const checkSignature: (data: string, { key, signature }: DataSignature) => boolean;
@@ -231,24 +230,24 @@ declare class CoseSign1 {
231
230
  constructor(payload: {
232
231
  protectedMap: Map<any, any>;
233
232
  unProtectedMap: Map<any, any>;
234
- payload: Buffer | null;
235
- signature?: Buffer;
233
+ payload: Buffer$1 | null;
234
+ signature?: Buffer$1;
236
235
  });
237
236
  static fromCbor(cbor: string): CoseSign1;
238
- createSigStructure(externalAad?: Buffer): Buffer;
239
- buildMessage(signature: Buffer): Buffer;
237
+ createSigStructure(externalAad?: Buffer$1): Buffer$1;
238
+ buildMessage(signature: Buffer$1): Buffer$1;
240
239
  verifySignature({ externalAad, publicKeyBuffer, }?: {
241
- externalAad?: Buffer;
242
- publicKeyBuffer?: Buffer;
240
+ externalAad?: Buffer$1;
241
+ publicKeyBuffer?: Buffer$1;
243
242
  }): boolean;
244
243
  hashPayload(): void;
245
- getAddress(): Buffer;
246
- getPublicKey(): Buffer;
247
- getSignature(): Buffer | undefined;
248
- getPayload(): Buffer | null;
244
+ getAddress(): Buffer$1;
245
+ getPublicKey(): Buffer$1;
246
+ getSignature(): Buffer$1 | undefined;
247
+ getPayload(): Buffer$1 | null;
249
248
  }
250
- declare const getPublicKeyFromCoseKey: (cbor: string) => Buffer;
251
- declare const getCoseKeyFromPublicKey: (cbor: string) => Buffer;
249
+ declare const getPublicKeyFromCoseKey: (cbor: string) => Buffer$1;
250
+ declare const getCoseKeyFromPublicKey: (cbor: string) => Buffer$1;
252
251
 
253
252
  declare const generateNonce: (label?: string, length?: number) => string;
254
253
 
@@ -302,14 +301,31 @@ declare class CardanoSDKSerializer implements IMeshTxSerializer {
302
301
  private createDummyTx;
303
302
  }
304
303
 
304
+ type StricaPrivateKey = cjsBip32ed25519.PrivateKey;
305
+ declare const StricaPrivateKey: typeof cjsBip32ed25519.PrivateKey;
306
+ type StricaPublicKey = cjsBip32ed25519.PublicKey;
307
+ declare const StricaPublicKey: typeof cjsBip32ed25519.PublicKey;
308
+ type StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
309
+ declare const StricaBip32PrivateKey: typeof cjsBip32ed25519.Bip32PrivateKey;
310
+ type StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
311
+ declare const StricaBip32PublicKey: typeof cjsBip32ed25519.Bip32PublicKey;
312
+
313
+ declare const StricaEncoder: {
314
+ encode: (input: any, options?: {
315
+ collapseBigNumber: Boolean;
316
+ }) => Buffer;
317
+ };
318
+ declare const StricaDecoder: typeof cjsCbors.Decoder;
319
+ type StricaDecoder = cjsCbors.Decoder;
320
+
305
321
  declare const buildBaseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16, stakeKeyHash: Hash28ByteBase16) => BaseAddress;
306
322
  declare const buildEnterpriseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16) => EnterpriseAddress;
307
323
  declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey;
308
324
  declare const buildRewardAddress: (networkId: number, stakeKeyHash: Hash28ByteBase16) => RewardAddress;
309
325
  declare const buildKeys: (entropy: string | [string, string], accountIndex: number, keyIndex?: number) => {
310
- paymentKey: PrivateKey;
311
- stakeKey: PrivateKey;
312
- dRepKey?: PrivateKey;
326
+ paymentKey: StricaPrivateKey;
327
+ stakeKey: StricaPrivateKey;
328
+ dRepKey?: StricaPrivateKey;
313
329
  };
314
330
  declare const buildScriptPubkey: (keyHash: Ed25519KeyHash) => NativeScript;
315
331
  declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) => DRepID;
@@ -349,4 +365,4 @@ declare function negatives(v: Value): Value;
349
365
  declare function assetTypes(v: Value): number;
350
366
  declare function empty(v: Value): boolean;
351
367
 
352
- export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
368
+ export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, StricaBip32PrivateKey, StricaBip32PrivateKey as StricaBip32PrivateKeyType, StricaBip32PublicKey, StricaBip32PublicKey as StricaBip32PublicKeyType, StricaDecoder, StricaEncoder, StricaPrivateKey, StricaPrivateKey as StricaPrivateKeyType, StricaPublicKey, StricaPublicKey as StricaPublicKeyType, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
package/dist/index.d.ts CHANGED
@@ -7,11 +7,10 @@ import { OpaqueString } from '@cardano-sdk/util';
7
7
  export { _cardano_sdk_util as CardanoSDKUtil };
8
8
  import * as Crypto from '@cardano-sdk/crypto';
9
9
  export { Crypto };
10
- import { PrivateKey } from '@stricahq/bip32ed25519';
11
- export { Bip32PrivateKey as StricaBip32PrivateKey, Bip32PublicKey as StricaBip32PublicKey, PrivateKey as StricaPrivateKey, PublicKey as StricaPublicKey } from '@stricahq/bip32ed25519';
10
+ import * as cjsBip32ed25519 from '@stricahq/bip32ed25519';
12
11
  import { DataSignature, Data, NativeScript as NativeScript$1, PlutusScript, IMeshTxSerializer, DeserializedAddress, BuilderData, IDeserializer, IResolver, MeshTxBuilderBody, Protocol, UTxO, Asset, LanguageVersion } from '@meshsdk/common';
13
- import { Buffer } from 'buffer';
14
- export { Decoder as StricaDecoder, Encoder as StricaEncoder } from '@stricahq/cbors';
12
+ import { Buffer as Buffer$1 } from 'buffer';
13
+ import * as cjsCbors from '@stricahq/cbors';
15
14
 
16
15
  declare const Slot: (value: number) => Cardano.Slot;
17
16
  type Slot = Cardano.Slot;
@@ -218,7 +217,7 @@ declare const StakeCredentialStatus: typeof Cardano.StakeCredentialStatus;
218
217
 
219
218
  type Signer = {
220
219
  address: Address;
221
- key: PrivateKey;
220
+ key: StricaPrivateKey;
222
221
  };
223
222
 
224
223
  declare const checkSignature: (data: string, { key, signature }: DataSignature) => boolean;
@@ -231,24 +230,24 @@ declare class CoseSign1 {
231
230
  constructor(payload: {
232
231
  protectedMap: Map<any, any>;
233
232
  unProtectedMap: Map<any, any>;
234
- payload: Buffer | null;
235
- signature?: Buffer;
233
+ payload: Buffer$1 | null;
234
+ signature?: Buffer$1;
236
235
  });
237
236
  static fromCbor(cbor: string): CoseSign1;
238
- createSigStructure(externalAad?: Buffer): Buffer;
239
- buildMessage(signature: Buffer): Buffer;
237
+ createSigStructure(externalAad?: Buffer$1): Buffer$1;
238
+ buildMessage(signature: Buffer$1): Buffer$1;
240
239
  verifySignature({ externalAad, publicKeyBuffer, }?: {
241
- externalAad?: Buffer;
242
- publicKeyBuffer?: Buffer;
240
+ externalAad?: Buffer$1;
241
+ publicKeyBuffer?: Buffer$1;
243
242
  }): boolean;
244
243
  hashPayload(): void;
245
- getAddress(): Buffer;
246
- getPublicKey(): Buffer;
247
- getSignature(): Buffer | undefined;
248
- getPayload(): Buffer | null;
244
+ getAddress(): Buffer$1;
245
+ getPublicKey(): Buffer$1;
246
+ getSignature(): Buffer$1 | undefined;
247
+ getPayload(): Buffer$1 | null;
249
248
  }
250
- declare const getPublicKeyFromCoseKey: (cbor: string) => Buffer;
251
- declare const getCoseKeyFromPublicKey: (cbor: string) => Buffer;
249
+ declare const getPublicKeyFromCoseKey: (cbor: string) => Buffer$1;
250
+ declare const getCoseKeyFromPublicKey: (cbor: string) => Buffer$1;
252
251
 
253
252
  declare const generateNonce: (label?: string, length?: number) => string;
254
253
 
@@ -302,14 +301,31 @@ declare class CardanoSDKSerializer implements IMeshTxSerializer {
302
301
  private createDummyTx;
303
302
  }
304
303
 
304
+ type StricaPrivateKey = cjsBip32ed25519.PrivateKey;
305
+ declare const StricaPrivateKey: typeof cjsBip32ed25519.PrivateKey;
306
+ type StricaPublicKey = cjsBip32ed25519.PublicKey;
307
+ declare const StricaPublicKey: typeof cjsBip32ed25519.PublicKey;
308
+ type StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
309
+ declare const StricaBip32PrivateKey: typeof cjsBip32ed25519.Bip32PrivateKey;
310
+ type StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
311
+ declare const StricaBip32PublicKey: typeof cjsBip32ed25519.Bip32PublicKey;
312
+
313
+ declare const StricaEncoder: {
314
+ encode: (input: any, options?: {
315
+ collapseBigNumber: Boolean;
316
+ }) => Buffer;
317
+ };
318
+ declare const StricaDecoder: typeof cjsCbors.Decoder;
319
+ type StricaDecoder = cjsCbors.Decoder;
320
+
305
321
  declare const buildBaseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16, stakeKeyHash: Hash28ByteBase16) => BaseAddress;
306
322
  declare const buildEnterpriseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16) => EnterpriseAddress;
307
323
  declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey;
308
324
  declare const buildRewardAddress: (networkId: number, stakeKeyHash: Hash28ByteBase16) => RewardAddress;
309
325
  declare const buildKeys: (entropy: string | [string, string], accountIndex: number, keyIndex?: number) => {
310
- paymentKey: PrivateKey;
311
- stakeKey: PrivateKey;
312
- dRepKey?: PrivateKey;
326
+ paymentKey: StricaPrivateKey;
327
+ stakeKey: StricaPrivateKey;
328
+ dRepKey?: StricaPrivateKey;
313
329
  };
314
330
  declare const buildScriptPubkey: (keyHash: Ed25519KeyHash) => NativeScript;
315
331
  declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) => DRepID;
@@ -349,4 +365,4 @@ declare function negatives(v: Value): Value;
349
365
  declare function assetTypes(v: Value): number;
350
366
  declare function empty(v: Value): boolean;
351
367
 
352
- export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
368
+ export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, StricaBip32PrivateKey, StricaBip32PrivateKey as StricaBip32PrivateKeyType, StricaBip32PublicKey, StricaBip32PublicKey as StricaBip32PublicKeyType, StricaDecoder, StricaEncoder, StricaPrivateKey, StricaPrivateKey as StricaPrivateKeyType, StricaPublicKey, StricaPublicKey as StricaPublicKeyType, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
package/dist/index.js CHANGED
@@ -974,16 +974,17 @@ var StakeCredentialStatus = Cardano.StakeCredentialStatus;
974
974
  var import_blakejs = __toESM(require_blakejs(), 1);
975
975
  import { Buffer as Buffer2 } from "buffer";
976
976
 
977
- // src/stricahq/bip32ed25519/index.ts
978
- import {
979
- Bip32PrivateKey as Bip32PrivateKey3,
980
- Bip32PublicKey,
981
- PrivateKey,
982
- PublicKey
983
- } from "@stricahq/bip32ed25519";
977
+ // src/stricahq/bip32ed25519/wrapper.ts
978
+ import * as cjsBip32ed25519 from "@stricahq/bip32ed25519";
979
+ var StricaPrivateKey = cjsBip32ed25519.PrivateKey;
980
+ var StricaPublicKey = cjsBip32ed25519.PublicKey;
981
+ var StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
982
+ var StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
984
983
 
985
- // src/stricahq/cbors/index.ts
986
- import { Decoder, Encoder } from "@stricahq/cbors";
984
+ // src/stricahq/cbors/wrapper.ts
985
+ import * as cjsCbors from "@stricahq/cbors";
986
+ var StricaEncoder = cjsCbors.Encoder;
987
+ var StricaDecoder = cjsCbors.Decoder;
987
988
 
988
989
  // src/message-signing/cose-sign1.ts
989
990
  var CoseSign1 = class _CoseSign1 {
@@ -1001,13 +1002,13 @@ var CoseSign1 = class _CoseSign1 {
1001
1002
  this.signature = payload.signature;
1002
1003
  }
1003
1004
  static fromCbor(cbor) {
1004
- const decoded = Decoder.decode(Buffer2.from(cbor, "hex"));
1005
+ const decoded = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
1005
1006
  if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
1006
1007
  if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
1007
1008
  let protectedMap;
1008
1009
  const protectedSerialized = decoded.value[0];
1009
1010
  try {
1010
- protectedMap = Decoder.decode(protectedSerialized).value;
1011
+ protectedMap = StricaDecoder.decode(protectedSerialized).value;
1011
1012
  if (!(protectedMap instanceof Map)) {
1012
1013
  throw Error();
1013
1014
  }
@@ -1028,7 +1029,7 @@ var CoseSign1 = class _CoseSign1 {
1028
1029
  createSigStructure(externalAad = Buffer2.alloc(0)) {
1029
1030
  let protectedSerialized = Buffer2.alloc(0);
1030
1031
  if (this.protectedMap.size !== 0) {
1031
- protectedSerialized = Encoder.encode(this.protectedMap);
1032
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1032
1033
  }
1033
1034
  const structure = [
1034
1035
  "Signature1",
@@ -1036,13 +1037,13 @@ var CoseSign1 = class _CoseSign1 {
1036
1037
  externalAad,
1037
1038
  this.payload
1038
1039
  ];
1039
- return Encoder.encode(structure);
1040
+ return StricaEncoder.encode(structure);
1040
1041
  }
1041
1042
  buildMessage(signature) {
1042
1043
  this.signature = signature;
1043
1044
  let protectedSerialized = Buffer2.alloc(0);
1044
1045
  if (this.protectedMap.size !== 0) {
1045
- protectedSerialized = Encoder.encode(this.protectedMap);
1046
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1046
1047
  }
1047
1048
  const coseSign1 = [
1048
1049
  protectedSerialized,
@@ -1050,7 +1051,7 @@ var CoseSign1 = class _CoseSign1 {
1050
1051
  this.payload,
1051
1052
  this.signature
1052
1053
  ];
1053
- return Encoder.encode(coseSign1);
1054
+ return StricaEncoder.encode(coseSign1);
1054
1055
  }
1055
1056
  verifySignature({
1056
1057
  externalAad = Buffer2.alloc(0),
@@ -1061,7 +1062,7 @@ var CoseSign1 = class _CoseSign1 {
1061
1062
  }
1062
1063
  if (!publicKeyBuffer) throw Error("Public key not found");
1063
1064
  if (!this.signature) throw Error("Signature not found");
1064
- const publicKey = new PublicKey(publicKeyBuffer);
1065
+ const publicKey = new StricaPublicKey(publicKeyBuffer);
1065
1066
  return publicKey.verify(
1066
1067
  this.signature,
1067
1068
  this.createSigStructure(externalAad)
@@ -1092,7 +1093,7 @@ var CoseSign1 = class _CoseSign1 {
1092
1093
  }
1093
1094
  };
1094
1095
  var getPublicKeyFromCoseKey = (cbor) => {
1095
- const decodedCoseKey = Decoder.decode(Buffer2.from(cbor, "hex"));
1096
+ const decodedCoseKey = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
1096
1097
  const publicKeyBuffer = decodedCoseKey.value.get(-2);
1097
1098
  if (publicKeyBuffer) {
1098
1099
  return publicKeyBuffer;
@@ -1105,7 +1106,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
1105
1106
  coseKeyMap.set(3, -8);
1106
1107
  coseKeyMap.set(6, -2);
1107
1108
  coseKeyMap.set(-2, Buffer2.from(cbor, "hex"));
1108
- return Encoder.encode(coseKeyMap);
1109
+ return StricaEncoder.encode(coseKeyMap);
1109
1110
  };
1110
1111
 
1111
1112
  // src/message-signing/check-signature.ts
@@ -1255,17 +1256,17 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
1255
1256
  };
1256
1257
  var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
1257
1258
  if (typeof entropy === "string") {
1258
- const rootKey = new Bip32PrivateKey3(Buffer.from(entropy, "hex"));
1259
+ const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
1259
1260
  const accountKey = rootKey.derive(HARDENED_KEY_START + 1852).derive(HARDENED_KEY_START + 1815).derive(HARDENED_KEY_START + accountIndex);
1260
1261
  const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
1261
1262
  const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
1262
1263
  const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
1263
1264
  return { paymentKey, stakeKey, dRepKey };
1264
1265
  } else {
1265
- const paymentKey = PrivateKey.fromSecretKey(
1266
+ const paymentKey = StricaPrivateKey.fromSecretKey(
1266
1267
  Buffer.from(entropy[0], "hex")
1267
1268
  );
1268
- const stakeKey = PrivateKey.fromSecretKey(
1269
+ const stakeKey = StricaPrivateKey.fromSecretKey(
1269
1270
  Buffer.from(entropy[1], "hex")
1270
1271
  );
1271
1272
  return { paymentKey, stakeKey };
@@ -1945,7 +1946,7 @@ var CardanoSDKSerializer = class {
1945
1946
  if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
1946
1947
  keyHex = keyHex.substring(4);
1947
1948
  }
1948
- const cardanoSigner = PrivateKey.fromSecretKey(
1949
+ const cardanoSigner = StricaPrivateKey.fromSecretKey(
1949
1950
  Buffer.from(keyHex, "hex")
1950
1951
  );
1951
1952
  const signature = cardanoSigner.sign(
@@ -2600,12 +2601,16 @@ export {
2600
2601
  StakeCredentialStatus,
2601
2602
  StakeDelegation,
2602
2603
  StakeRegistration,
2603
- Bip32PrivateKey3 as StricaBip32PrivateKey,
2604
- Bip32PublicKey as StricaBip32PublicKey,
2605
- Decoder as StricaDecoder,
2606
- Encoder as StricaEncoder,
2607
- PrivateKey as StricaPrivateKey,
2608
- PublicKey as StricaPublicKey,
2604
+ StricaBip32PrivateKey,
2605
+ StricaBip32PrivateKey as StricaBip32PrivateKeyType,
2606
+ StricaBip32PublicKey,
2607
+ StricaBip32PublicKey as StricaBip32PublicKeyType,
2608
+ StricaDecoder,
2609
+ StricaEncoder,
2610
+ StricaPrivateKey,
2611
+ StricaPrivateKey as StricaPrivateKeyType,
2612
+ StricaPublicKey,
2613
+ StricaPublicKey as StricaPublicKeyType,
2609
2614
  Transaction,
2610
2615
  TransactionBody,
2611
2616
  TransactionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/core-cst",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -44,7 +44,6 @@
44
44
  "@meshsdk/common": "*",
45
45
  "@stricahq/bip32ed25519": "^1.1.0",
46
46
  "@stricahq/cbors": "^1.0.0",
47
- "hash.js": "^1.1.7",
48
47
  "pbkdf2": "^3.1.2"
49
48
  },
50
49
  "prettier": "@meshsdk/configs/prettier",
@@ -59,4 +58,4 @@
59
58
  "blockchain",
60
59
  "sdk"
61
60
  ]
62
- }
61
+ }