@meshsdk/core-cst 1.6.5 → 1.6.7

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,21 @@ 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 bip32ed25519 = cjsBip32ed25519;
1139
+ var exportedBip32ed25519 = bip32ed25519?.default || bip32ed25519;
1140
+ var StricaPrivateKey = exportedBip32ed25519.PrivateKey;
1141
+ var StricaPublicKey = exportedBip32ed25519.PublicKey;
1142
+ var StricaBip32PrivateKey = exportedBip32ed25519.Bip32PrivateKey;
1143
+ var StricaBip32PublicKey = exportedBip32ed25519.Bip32PublicKey;
1134
1144
 
1135
- // src/stricahq/cbors/index.ts
1136
- var import_cbors = require("@stricahq/cbors");
1145
+ // src/stricahq/cbors/wrapper.ts
1146
+ var cjsCbors = __toESM(require("@stricahq/cbors"), 1);
1147
+ var cbors = cjsCbors;
1148
+ var exportedCbors = cbors?.default || cbors;
1149
+ var StricaEncoder = exportedCbors.Encoder;
1150
+ var StricaDecoder = exportedCbors.Decoder;
1137
1151
 
1138
1152
  // src/message-signing/cose-sign1.ts
1139
1153
  var CoseSign1 = class _CoseSign1 {
@@ -1151,13 +1165,13 @@ var CoseSign1 = class _CoseSign1 {
1151
1165
  this.signature = payload.signature;
1152
1166
  }
1153
1167
  static fromCbor(cbor) {
1154
- const decoded = import_cbors.Decoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1168
+ const decoded = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1155
1169
  if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
1156
1170
  if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
1157
1171
  let protectedMap;
1158
1172
  const protectedSerialized = decoded.value[0];
1159
1173
  try {
1160
- protectedMap = import_cbors.Decoder.decode(protectedSerialized).value;
1174
+ protectedMap = StricaDecoder.decode(protectedSerialized).value;
1161
1175
  if (!(protectedMap instanceof Map)) {
1162
1176
  throw Error();
1163
1177
  }
@@ -1178,7 +1192,7 @@ var CoseSign1 = class _CoseSign1 {
1178
1192
  createSigStructure(externalAad = import_buffer.Buffer.alloc(0)) {
1179
1193
  let protectedSerialized = import_buffer.Buffer.alloc(0);
1180
1194
  if (this.protectedMap.size !== 0) {
1181
- protectedSerialized = import_cbors.Encoder.encode(this.protectedMap);
1195
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1182
1196
  }
1183
1197
  const structure = [
1184
1198
  "Signature1",
@@ -1186,13 +1200,13 @@ var CoseSign1 = class _CoseSign1 {
1186
1200
  externalAad,
1187
1201
  this.payload
1188
1202
  ];
1189
- return import_cbors.Encoder.encode(structure);
1203
+ return StricaEncoder.encode(structure);
1190
1204
  }
1191
1205
  buildMessage(signature) {
1192
1206
  this.signature = signature;
1193
1207
  let protectedSerialized = import_buffer.Buffer.alloc(0);
1194
1208
  if (this.protectedMap.size !== 0) {
1195
- protectedSerialized = import_cbors.Encoder.encode(this.protectedMap);
1209
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1196
1210
  }
1197
1211
  const coseSign1 = [
1198
1212
  protectedSerialized,
@@ -1200,7 +1214,7 @@ var CoseSign1 = class _CoseSign1 {
1200
1214
  this.payload,
1201
1215
  this.signature
1202
1216
  ];
1203
- return import_cbors.Encoder.encode(coseSign1);
1217
+ return StricaEncoder.encode(coseSign1);
1204
1218
  }
1205
1219
  verifySignature({
1206
1220
  externalAad = import_buffer.Buffer.alloc(0),
@@ -1211,7 +1225,7 @@ var CoseSign1 = class _CoseSign1 {
1211
1225
  }
1212
1226
  if (!publicKeyBuffer) throw Error("Public key not found");
1213
1227
  if (!this.signature) throw Error("Signature not found");
1214
- const publicKey = new import_bip32ed25519.PublicKey(publicKeyBuffer);
1228
+ const publicKey = new StricaPublicKey(publicKeyBuffer);
1215
1229
  return publicKey.verify(
1216
1230
  this.signature,
1217
1231
  this.createSigStructure(externalAad)
@@ -1242,7 +1256,7 @@ var CoseSign1 = class _CoseSign1 {
1242
1256
  }
1243
1257
  };
1244
1258
  var getPublicKeyFromCoseKey = (cbor) => {
1245
- const decodedCoseKey = import_cbors.Decoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1259
+ const decodedCoseKey = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
1246
1260
  const publicKeyBuffer = decodedCoseKey.value.get(-2);
1247
1261
  if (publicKeyBuffer) {
1248
1262
  return publicKeyBuffer;
@@ -1255,7 +1269,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
1255
1269
  coseKeyMap.set(3, -8);
1256
1270
  coseKeyMap.set(6, -2);
1257
1271
  coseKeyMap.set(-2, import_buffer.Buffer.from(cbor, "hex"));
1258
- return import_cbors.Encoder.encode(coseKeyMap);
1272
+ return StricaEncoder.encode(coseKeyMap);
1259
1273
  };
1260
1274
 
1261
1275
  // src/message-signing/check-signature.ts
@@ -1405,17 +1419,17 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
1405
1419
  };
1406
1420
  var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
1407
1421
  if (typeof entropy === "string") {
1408
- const rootKey = new import_bip32ed25519.Bip32PrivateKey(Buffer.from(entropy, "hex"));
1422
+ const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
1409
1423
  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
1424
  const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
1411
1425
  const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
1412
1426
  const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
1413
1427
  return { paymentKey, stakeKey, dRepKey };
1414
1428
  } else {
1415
- const paymentKey = import_bip32ed25519.PrivateKey.fromSecretKey(
1429
+ const paymentKey = StricaPrivateKey.fromSecretKey(
1416
1430
  Buffer.from(entropy[0], "hex")
1417
1431
  );
1418
- const stakeKey = import_bip32ed25519.PrivateKey.fromSecretKey(
1432
+ const stakeKey = StricaPrivateKey.fromSecretKey(
1419
1433
  Buffer.from(entropy[1], "hex")
1420
1434
  );
1421
1435
  return { paymentKey, stakeKey };
@@ -2090,7 +2104,7 @@ var CardanoSDKSerializer = class {
2090
2104
  if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
2091
2105
  keyHex = keyHex.substring(4);
2092
2106
  }
2093
- const cardanoSigner = import_bip32ed25519.PrivateKey.fromSecretKey(
2107
+ const cardanoSigner = StricaPrivateKey.fromSecretKey(
2094
2108
  Buffer.from(keyHex, "hex")
2095
2109
  );
2096
2110
  const signature = cardanoSigner.sign(
@@ -2747,11 +2761,15 @@ var CardanoSDK = __toESM(require("@cardano-sdk/core"), 1);
2747
2761
  StakeDelegation,
2748
2762
  StakeRegistration,
2749
2763
  StricaBip32PrivateKey,
2764
+ StricaBip32PrivateKeyType,
2750
2765
  StricaBip32PublicKey,
2766
+ StricaBip32PublicKeyType,
2751
2767
  StricaDecoder,
2752
2768
  StricaEncoder,
2753
2769
  StricaPrivateKey,
2770
+ StricaPrivateKeyType,
2754
2771
  StricaPublicKey,
2772
+ StricaPublicKeyType,
2755
2773
  Transaction,
2756
2774
  TransactionBody,
2757
2775
  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,21 @@ 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 bip32ed25519 = cjsBip32ed25519;
980
+ var exportedBip32ed25519 = bip32ed25519?.default || bip32ed25519;
981
+ var StricaPrivateKey = exportedBip32ed25519.PrivateKey;
982
+ var StricaPublicKey = exportedBip32ed25519.PublicKey;
983
+ var StricaBip32PrivateKey = exportedBip32ed25519.Bip32PrivateKey;
984
+ var StricaBip32PublicKey = exportedBip32ed25519.Bip32PublicKey;
984
985
 
985
- // src/stricahq/cbors/index.ts
986
- import { Decoder, Encoder } from "@stricahq/cbors";
986
+ // src/stricahq/cbors/wrapper.ts
987
+ import * as cjsCbors from "@stricahq/cbors";
988
+ var cbors = cjsCbors;
989
+ var exportedCbors = cbors?.default || cbors;
990
+ var StricaEncoder = exportedCbors.Encoder;
991
+ var StricaDecoder = exportedCbors.Decoder;
987
992
 
988
993
  // src/message-signing/cose-sign1.ts
989
994
  var CoseSign1 = class _CoseSign1 {
@@ -1001,13 +1006,13 @@ var CoseSign1 = class _CoseSign1 {
1001
1006
  this.signature = payload.signature;
1002
1007
  }
1003
1008
  static fromCbor(cbor) {
1004
- const decoded = Decoder.decode(Buffer2.from(cbor, "hex"));
1009
+ const decoded = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
1005
1010
  if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
1006
1011
  if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
1007
1012
  let protectedMap;
1008
1013
  const protectedSerialized = decoded.value[0];
1009
1014
  try {
1010
- protectedMap = Decoder.decode(protectedSerialized).value;
1015
+ protectedMap = StricaDecoder.decode(protectedSerialized).value;
1011
1016
  if (!(protectedMap instanceof Map)) {
1012
1017
  throw Error();
1013
1018
  }
@@ -1028,7 +1033,7 @@ var CoseSign1 = class _CoseSign1 {
1028
1033
  createSigStructure(externalAad = Buffer2.alloc(0)) {
1029
1034
  let protectedSerialized = Buffer2.alloc(0);
1030
1035
  if (this.protectedMap.size !== 0) {
1031
- protectedSerialized = Encoder.encode(this.protectedMap);
1036
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1032
1037
  }
1033
1038
  const structure = [
1034
1039
  "Signature1",
@@ -1036,13 +1041,13 @@ var CoseSign1 = class _CoseSign1 {
1036
1041
  externalAad,
1037
1042
  this.payload
1038
1043
  ];
1039
- return Encoder.encode(structure);
1044
+ return StricaEncoder.encode(structure);
1040
1045
  }
1041
1046
  buildMessage(signature) {
1042
1047
  this.signature = signature;
1043
1048
  let protectedSerialized = Buffer2.alloc(0);
1044
1049
  if (this.protectedMap.size !== 0) {
1045
- protectedSerialized = Encoder.encode(this.protectedMap);
1050
+ protectedSerialized = StricaEncoder.encode(this.protectedMap);
1046
1051
  }
1047
1052
  const coseSign1 = [
1048
1053
  protectedSerialized,
@@ -1050,7 +1055,7 @@ var CoseSign1 = class _CoseSign1 {
1050
1055
  this.payload,
1051
1056
  this.signature
1052
1057
  ];
1053
- return Encoder.encode(coseSign1);
1058
+ return StricaEncoder.encode(coseSign1);
1054
1059
  }
1055
1060
  verifySignature({
1056
1061
  externalAad = Buffer2.alloc(0),
@@ -1061,7 +1066,7 @@ var CoseSign1 = class _CoseSign1 {
1061
1066
  }
1062
1067
  if (!publicKeyBuffer) throw Error("Public key not found");
1063
1068
  if (!this.signature) throw Error("Signature not found");
1064
- const publicKey = new PublicKey(publicKeyBuffer);
1069
+ const publicKey = new StricaPublicKey(publicKeyBuffer);
1065
1070
  return publicKey.verify(
1066
1071
  this.signature,
1067
1072
  this.createSigStructure(externalAad)
@@ -1092,7 +1097,7 @@ var CoseSign1 = class _CoseSign1 {
1092
1097
  }
1093
1098
  };
1094
1099
  var getPublicKeyFromCoseKey = (cbor) => {
1095
- const decodedCoseKey = Decoder.decode(Buffer2.from(cbor, "hex"));
1100
+ const decodedCoseKey = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
1096
1101
  const publicKeyBuffer = decodedCoseKey.value.get(-2);
1097
1102
  if (publicKeyBuffer) {
1098
1103
  return publicKeyBuffer;
@@ -1105,7 +1110,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
1105
1110
  coseKeyMap.set(3, -8);
1106
1111
  coseKeyMap.set(6, -2);
1107
1112
  coseKeyMap.set(-2, Buffer2.from(cbor, "hex"));
1108
- return Encoder.encode(coseKeyMap);
1113
+ return StricaEncoder.encode(coseKeyMap);
1109
1114
  };
1110
1115
 
1111
1116
  // src/message-signing/check-signature.ts
@@ -1255,17 +1260,17 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
1255
1260
  };
1256
1261
  var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
1257
1262
  if (typeof entropy === "string") {
1258
- const rootKey = new Bip32PrivateKey3(Buffer.from(entropy, "hex"));
1263
+ const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
1259
1264
  const accountKey = rootKey.derive(HARDENED_KEY_START + 1852).derive(HARDENED_KEY_START + 1815).derive(HARDENED_KEY_START + accountIndex);
1260
1265
  const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
1261
1266
  const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
1262
1267
  const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
1263
1268
  return { paymentKey, stakeKey, dRepKey };
1264
1269
  } else {
1265
- const paymentKey = PrivateKey.fromSecretKey(
1270
+ const paymentKey = StricaPrivateKey.fromSecretKey(
1266
1271
  Buffer.from(entropy[0], "hex")
1267
1272
  );
1268
- const stakeKey = PrivateKey.fromSecretKey(
1273
+ const stakeKey = StricaPrivateKey.fromSecretKey(
1269
1274
  Buffer.from(entropy[1], "hex")
1270
1275
  );
1271
1276
  return { paymentKey, stakeKey };
@@ -1945,7 +1950,7 @@ var CardanoSDKSerializer = class {
1945
1950
  if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
1946
1951
  keyHex = keyHex.substring(4);
1947
1952
  }
1948
- const cardanoSigner = PrivateKey.fromSecretKey(
1953
+ const cardanoSigner = StricaPrivateKey.fromSecretKey(
1949
1954
  Buffer.from(keyHex, "hex")
1950
1955
  );
1951
1956
  const signature = cardanoSigner.sign(
@@ -2600,12 +2605,16 @@ export {
2600
2605
  StakeCredentialStatus,
2601
2606
  StakeDelegation,
2602
2607
  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,
2608
+ StricaBip32PrivateKey,
2609
+ StricaBip32PrivateKey as StricaBip32PrivateKeyType,
2610
+ StricaBip32PublicKey,
2611
+ StricaBip32PublicKey as StricaBip32PublicKeyType,
2612
+ StricaDecoder,
2613
+ StricaEncoder,
2614
+ StricaPrivateKey,
2615
+ StricaPrivateKey as StricaPrivateKeyType,
2616
+ StricaPublicKey,
2617
+ StricaPublicKey as StricaPublicKeyType,
2609
2618
  Transaction,
2610
2619
  TransactionBody,
2611
2620
  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.7",
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
+ }