@arbidocs/client 0.5.177 → 0.5.179
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.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +136 -46
- package/dist/index.d.ts +136 -46
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2549,6 +2549,24 @@ function createTransport(options) {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
};
|
|
2551
2551
|
}
|
|
2552
|
+
var CALL_MEDIA_PROTOCOL = "arbi.call.media.v1";
|
|
2553
|
+
var DOMAIN = new TextEncoder().encode(`${CALL_MEDIA_PROTOCOL}\0`);
|
|
2554
|
+
var MAX_PACKET = 14e3;
|
|
2555
|
+
async function mediaKey(key) {
|
|
2556
|
+
await initSodium();
|
|
2557
|
+
if (key.length !== 32) throw new Error("Invalid call key");
|
|
2558
|
+
return sodium__default.default.crypto_generichash(32, DOMAIN, key);
|
|
2559
|
+
}
|
|
2560
|
+
async function encryptCallMedia(payload, key) {
|
|
2561
|
+
const packet = encryptFile(new TextEncoder().encode(JSON.stringify(payload)), await mediaKey(key));
|
|
2562
|
+
if (packet.length > MAX_PACKET) throw new Error("Call media packet exceeds its bound");
|
|
2563
|
+
return packet;
|
|
2564
|
+
}
|
|
2565
|
+
async function decryptCallMedia(packet, key) {
|
|
2566
|
+
if (packet.length > MAX_PACKET) throw new Error("Call media packet exceeds its bound");
|
|
2567
|
+
const plaintext = decryptFile(packet, await mediaKey(key));
|
|
2568
|
+
return JSON.parse(new TextDecoder().decode(plaintext));
|
|
2569
|
+
}
|
|
2552
2570
|
|
|
2553
2571
|
// src/websocket.ts
|
|
2554
2572
|
function buildWebSocketUrl(baseUrl) {
|
|
@@ -2599,6 +2617,7 @@ var logger = {
|
|
|
2599
2617
|
exports.ACCESS_TOKEN_STORAGE_KEY = ACCESS_TOKEN_STORAGE_KEY;
|
|
2600
2618
|
exports.API_PREFIX = API_PREFIX;
|
|
2601
2619
|
exports.CALL_KEY_BYTES = CALL_KEY_BYTES;
|
|
2620
|
+
exports.CALL_MEDIA_PROTOCOL = CALL_MEDIA_PROTOCOL;
|
|
2602
2621
|
exports.CHAT_KEY_BYTES = CHAT_KEY_BYTES;
|
|
2603
2622
|
exports.ENCRYPTED_RECOVERY_KEY_SIZE = ENCRYPTED_RECOVERY_KEY_SIZE;
|
|
2604
2623
|
exports.RECOVERY_KEY_ERRORS = RECOVERY_KEY_ERRORS;
|
|
@@ -2640,6 +2659,7 @@ exports.createWorkspaceOpens = createWorkspaceOpens;
|
|
|
2640
2659
|
exports.createWorkspaceReopener = createWorkspaceReopener;
|
|
2641
2660
|
exports.decodeCallKey = decodeCallKey;
|
|
2642
2661
|
exports.decodeSecureMailKey = decodeSecureMailKey;
|
|
2662
|
+
exports.decryptCallMedia = decryptCallMedia;
|
|
2643
2663
|
exports.decryptCallTitle = decryptCallTitle;
|
|
2644
2664
|
exports.decryptFile = decryptFile;
|
|
2645
2665
|
exports.decryptMessage = decryptMessage;
|
|
@@ -2651,6 +2671,7 @@ exports.deriveEncryptionKeypairFromSigning = deriveEncryptionKeypairFromSigning;
|
|
|
2651
2671
|
exports.derivePublicKey = derivePublicKey;
|
|
2652
2672
|
exports.disconnectSso = disconnectSso;
|
|
2653
2673
|
exports.encodeCallKey = encodeCallKey;
|
|
2674
|
+
exports.encryptCallMedia = encryptCallMedia;
|
|
2654
2675
|
exports.encryptCallTitle = encryptCallTitle;
|
|
2655
2676
|
exports.encryptFile = encryptFile;
|
|
2656
2677
|
exports.encryptMessage = encryptMessage;
|