@adelos/sdk 0.1.3 → 0.1.5
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.js +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -370,8 +370,9 @@ function computeSharedSecret(ephemeralSk, recipientMetaPk) {
|
|
|
370
370
|
return (0, import_sha256.sha256)(point.multiply(scalar).toRawBytes());
|
|
371
371
|
}
|
|
372
372
|
function computeSharedSecretAsRecipient(metaSk, ephemeralPk) {
|
|
373
|
+
const secretKey = metaSk.length === 64 ? metaSk.slice(0, 32) : metaSk;
|
|
373
374
|
const point = ed.ExtendedPoint.fromHex(bytesToHex(ephemeralPk));
|
|
374
|
-
const scalar = ed.etc.mod(BigInt("0x" + bytesToHex(
|
|
375
|
+
const scalar = ed.etc.mod(BigInt("0x" + bytesToHex(secretKey)), ed.CURVE.n);
|
|
375
376
|
return (0, import_sha256.sha256)(point.multiply(scalar).toRawBytes());
|
|
376
377
|
}
|
|
377
378
|
function deriveStealthPubkey(metaPk, sharedSecret) {
|
package/dist/index.mjs
CHANGED
|
@@ -321,8 +321,9 @@ function computeSharedSecret(ephemeralSk, recipientMetaPk) {
|
|
|
321
321
|
return sha256(point.multiply(scalar).toRawBytes());
|
|
322
322
|
}
|
|
323
323
|
function computeSharedSecretAsRecipient(metaSk, ephemeralPk) {
|
|
324
|
+
const secretKey = metaSk.length === 64 ? metaSk.slice(0, 32) : metaSk;
|
|
324
325
|
const point = ed.ExtendedPoint.fromHex(bytesToHex(ephemeralPk));
|
|
325
|
-
const scalar = ed.etc.mod(BigInt("0x" + bytesToHex(
|
|
326
|
+
const scalar = ed.etc.mod(BigInt("0x" + bytesToHex(secretKey)), ed.CURVE.n);
|
|
326
327
|
return sha256(point.multiply(scalar).toRawBytes());
|
|
327
328
|
}
|
|
328
329
|
function deriveStealthPubkey(metaPk, sharedSecret) {
|