@sip-protocol/sdk 0.6.1 → 0.6.3

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/browser.js CHANGED
@@ -4066,17 +4066,33 @@ function validateStealthMetaAddress(metaAddress, field = "recipientMetaAddress")
4066
4066
  `${field}.chain`
4067
4067
  );
4068
4068
  }
4069
- if (!isValidCompressedPublicKey(metaAddress.spendingKey)) {
4070
- throw new ValidationError(
4071
- "spendingKey must be a valid compressed secp256k1 public key (33 bytes, starting with 02 or 03)",
4072
- `${field}.spendingKey`
4073
- );
4074
- }
4075
- if (!isValidCompressedPublicKey(metaAddress.viewingKey)) {
4076
- throw new ValidationError(
4077
- "viewingKey must be a valid compressed secp256k1 public key (33 bytes, starting with 02 or 03)",
4078
- `${field}.viewingKey`
4079
- );
4069
+ const isEd25519 = isEd25519Chain(metaAddress.chain);
4070
+ if (isEd25519) {
4071
+ if (!isValidEd25519PublicKey(metaAddress.spendingKey)) {
4072
+ throw new ValidationError(
4073
+ "spendingKey must be a valid ed25519 public key (32 bytes)",
4074
+ `${field}.spendingKey`
4075
+ );
4076
+ }
4077
+ if (!isValidEd25519PublicKey(metaAddress.viewingKey)) {
4078
+ throw new ValidationError(
4079
+ "viewingKey must be a valid ed25519 public key (32 bytes)",
4080
+ `${field}.viewingKey`
4081
+ );
4082
+ }
4083
+ } else {
4084
+ if (!isValidCompressedPublicKey(metaAddress.spendingKey)) {
4085
+ throw new ValidationError(
4086
+ "spendingKey must be a valid compressed secp256k1 public key (33 bytes, starting with 02 or 03)",
4087
+ `${field}.spendingKey`
4088
+ );
4089
+ }
4090
+ if (!isValidCompressedPublicKey(metaAddress.viewingKey)) {
4091
+ throw new ValidationError(
4092
+ "viewingKey must be a valid compressed secp256k1 public key (33 bytes, starting with 02 or 03)",
4093
+ `${field}.viewingKey`
4094
+ );
4095
+ }
4080
4096
  }
4081
4097
  }
4082
4098
  function generateStealthAddress(recipientMetaAddress) {
@@ -5380,7 +5396,7 @@ async function createShieldedIntent(params, options) {
5380
5396
  let recipientStealth;
5381
5397
  if (privacyConfig.useStealth && recipientMetaAddress) {
5382
5398
  const metaAddress = decodeStealthMetaAddress(recipientMetaAddress);
5383
- const { stealthAddress } = generateStealthAddress(metaAddress);
5399
+ const { stealthAddress } = isEd25519Chain(metaAddress.chain) ? generateEd25519StealthAddress(metaAddress) : generateStealthAddress(metaAddress);
5384
5400
  recipientStealth = stealthAddress;
5385
5401
  } else {
5386
5402
  recipientStealth = {
package/dist/browser.mjs CHANGED
@@ -263,7 +263,7 @@ import {
263
263
  walletRegistry,
264
264
  withSecureBuffer,
265
265
  withSecureBufferSync
266
- } from "./chunk-PCFM7FQO.mjs";
266
+ } from "./chunk-AB3SCLVT.mjs";
267
267
  import {
268
268
  fulfillment_proof_default,
269
269
  funding_proof_default,