@morseai/sdk 0.1.0-beta.10 → 0.1.0-beta.11
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/README.md +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
TypeScript SDK for creating and accessing encrypted signals in the MORSE platform.
|
|
8
8
|
|
|
9
|
-
**Version:** 0.1.0-beta.
|
|
9
|
+
**Version:** 0.1.0-beta.11 (Beta Release)
|
|
10
10
|
|
|
11
11
|
> ⚠️ **Beta Notice**: This is a beta release. The API is stable but may have minor changes before the 1.0.0 release. Please report any issues you encounter.
|
|
12
12
|
|
package/dist/index.js
CHANGED
|
@@ -244,9 +244,8 @@ async function openSharedSignal(encryptedPayloadBase64, payloadNonceBase64, seal
|
|
|
244
244
|
chainId,
|
|
245
245
|
signMessage
|
|
246
246
|
);
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
);
|
|
247
|
+
const senderEphemeralPubBytes = Buffer.from(senderEphemeralPublicKeyBase64, "base64");
|
|
248
|
+
const senderEphemeralPub = new Uint8Array(senderEphemeralPubBytes);
|
|
250
249
|
const sharedSecret = sodium.crypto_scalarmult(
|
|
251
250
|
recipientKeypair.privateKey,
|
|
252
251
|
senderEphemeralPub
|
|
@@ -254,10 +253,13 @@ async function openSharedSignal(encryptedPayloadBase64, payloadNonceBase64, seal
|
|
|
254
253
|
const salt = `MORSE_SEAL_${signalId}_v1`;
|
|
255
254
|
const info = "wrap_datakey";
|
|
256
255
|
const wrappingKey = await hkdfSha256(sharedSecret, salt, info, 32);
|
|
257
|
-
const
|
|
258
|
-
const
|
|
256
|
+
const sealedDataKeyBytes = Buffer.from(sealedDataKeyBase64, "base64");
|
|
257
|
+
const sealedDataKey = new Uint8Array(sealedDataKeyBytes);
|
|
258
|
+
const sealedNonceBytes = Buffer.from(sealedNonceBase64, "base64");
|
|
259
|
+
const sealedNonce = new Uint8Array(sealedNonceBytes);
|
|
259
260
|
const expiresAtInt = Math.floor(Number(expiresAt));
|
|
260
261
|
const abiCoder = ethers.ethers.AbiCoder.defaultAbiCoder();
|
|
262
|
+
const senderEphemeralPubHex = ethers.ethers.hexlify(senderEphemeralPub);
|
|
261
263
|
const aad = abiCoder.encode(
|
|
262
264
|
["string", "address", "address", "uint64", "string", "bytes32"],
|
|
263
265
|
[
|
|
@@ -266,10 +268,10 @@ async function openSharedSignal(encryptedPayloadBase64, payloadNonceBase64, seal
|
|
|
266
268
|
walletCreator.toLowerCase(),
|
|
267
269
|
expiresAtInt,
|
|
268
270
|
exports.X25519_CIPHER_VERSION,
|
|
269
|
-
ethers.ethers.zeroPadValue(
|
|
271
|
+
ethers.ethers.zeroPadValue(senderEphemeralPubHex, 32)
|
|
270
272
|
]
|
|
271
273
|
);
|
|
272
|
-
const aadBytes = ethers.ethers.getBytes(aad);
|
|
274
|
+
const aadBytes = new Uint8Array(ethers.ethers.getBytes(aad));
|
|
273
275
|
const computedAadHash = ethers.ethers.keccak256(aad).slice(2);
|
|
274
276
|
if (computedAadHash !== aadHash) {
|
|
275
277
|
throw new Error("AAD hash mismatch - possible tampering");
|