@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 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(metaSk)), ed.CURVE.n);
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(metaSk)), ed.CURVE.n);
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adelos/sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Adelos Protocol SDK - Privacy Stealth Transfers on Solana",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",