@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 +28 -12
- package/dist/browser.mjs +1 -1
- package/dist/chunk-AB3SCLVT.mjs +17026 -0
- package/dist/chunk-GOOEOAMV.mjs +17026 -0
- package/dist/index.js +28 -12
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/intent.ts +10 -2
- package/src/stealth.ts +31 -13
package/dist/browser.js
CHANGED
|
@@ -4066,17 +4066,33 @@ function validateStealthMetaAddress(metaAddress, field = "recipientMetaAddress")
|
|
|
4066
4066
|
`${field}.chain`
|
|
4067
4067
|
);
|
|
4068
4068
|
}
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
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 = {
|