@arbidocs/sdk 0.5.70 → 0.5.71
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.cjs +13 -11
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +18 -16
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +13 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -16
- package/dist/index.js.map +1 -1
- package/examples/react-chat/package.json +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs2, { readFileSync } from 'fs';
|
|
2
2
|
import path3, { dirname, resolve } from 'path';
|
|
3
3
|
import os2 from 'os';
|
|
4
|
-
import { createArbiClient, base64ToBytes, unwrapWorkspaceKey, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, encryptionKeypairFromSigningKey, sealedBoxEncrypt, sealedBoxDecrypt,
|
|
4
|
+
import { createArbiClient, base64ToBytes, unwrapWorkspaceKey, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, encryptionKeypairFromSigningKey, sealedBoxEncrypt, sealedBoxDecrypt, sealSecureMail, decodeSecureMailKey, openSecureMail, secureMailClaim, bytesToBase64 as bytesToBase64$1, encryptWithChatKey, decryptWithChatKey, decryptFile, deriveDirectChatKey, openSealedChatKey, generateChatKey, sealChatKey, sealCallKey, encryptMessage, createSessionManager, authRequestError, isAbortError, changePassword, openCallKeyOf, decryptCallTitle, generateCallKey, encryptCallTitle, sealCallKeyForPeers, openSealedCallKey, readSessionClaims } from '@arbidocs/client';
|
|
5
5
|
import { execSync, spawn } from 'child_process';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
@@ -6574,6 +6574,15 @@ __export(secure_mail_exports, {
|
|
|
6574
6574
|
prepareSecureMail: () => prepareSecureMail,
|
|
6575
6575
|
secureMime: () => secureMime
|
|
6576
6576
|
});
|
|
6577
|
+
|
|
6578
|
+
// src/operations/mail-encoding.ts
|
|
6579
|
+
function bytesToBase64(bytes) {
|
|
6580
|
+
let binary = "";
|
|
6581
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
6582
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
6583
|
+
}
|
|
6584
|
+
return btoa(binary);
|
|
6585
|
+
}
|
|
6577
6586
|
var MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
|
|
6578
6587
|
var utf8 = new TextEncoder();
|
|
6579
6588
|
var encodedWord = (value) => `=?UTF-8?B?${bytesToBase64(utf8.encode(value))}?=`;
|
|
@@ -7958,7 +7967,7 @@ async function uploadChatAttachment(arbi, input) {
|
|
|
7958
7967
|
name: input.name,
|
|
7959
7968
|
type: input.type || "application/octet-stream",
|
|
7960
7969
|
size: input.bytes.length,
|
|
7961
|
-
key: bytesToBase64(key)
|
|
7970
|
+
key: bytesToBase64$1(key)
|
|
7962
7971
|
};
|
|
7963
7972
|
} finally {
|
|
7964
7973
|
key.fill(0);
|
|
@@ -8047,7 +8056,7 @@ async function openChatKeyRing(chat, crypto2) {
|
|
|
8047
8056
|
const keys = /* @__PURE__ */ new Map();
|
|
8048
8057
|
if (chat.kind === "direct") {
|
|
8049
8058
|
const peer = directPeer(chat, crypto2.userExtId);
|
|
8050
|
-
const peerPub = peer?.encryption_public_key ?? bytesToBase64(crypto2.encryptionKeypair.publicKey);
|
|
8059
|
+
const peerPub = peer?.encryption_public_key ?? bytesToBase64$1(crypto2.encryptionKeypair.publicKey);
|
|
8051
8060
|
keys.set(0, await deriveDirectChatKey(peerPub, crypto2.encryptionKeypair.secretKey));
|
|
8052
8061
|
} else {
|
|
8053
8062
|
for (const k2 of chat.my_keys ?? []) {
|
|
@@ -8192,7 +8201,7 @@ async function createGroupChat(arbi, crypto2, params) {
|
|
|
8192
8201
|
),
|
|
8193
8202
|
creator_sealed_key: await sealChatKey(
|
|
8194
8203
|
key,
|
|
8195
|
-
bytesToBase64(crypto2.encryptionKeypair.publicKey)
|
|
8204
|
+
bytesToBase64$1(crypto2.encryptionKeypair.publicKey)
|
|
8196
8205
|
)
|
|
8197
8206
|
}
|
|
8198
8207
|
}),
|
|
@@ -10460,16 +10469,9 @@ function attachmentFromBytes(name, contentType, bytes) {
|
|
|
10460
10469
|
name,
|
|
10461
10470
|
content_type: contentType,
|
|
10462
10471
|
size: bytes.length,
|
|
10463
|
-
content_base64:
|
|
10472
|
+
content_base64: bytesToBase64(bytes)
|
|
10464
10473
|
};
|
|
10465
10474
|
}
|
|
10466
|
-
function bytesToBase644(bytes) {
|
|
10467
|
-
let binary = "";
|
|
10468
|
-
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
10469
|
-
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
10470
|
-
}
|
|
10471
|
-
return btoa(binary);
|
|
10472
|
-
}
|
|
10473
10475
|
|
|
10474
10476
|
// src/operations/calendar.ts
|
|
10475
10477
|
var calendar_exports = {};
|
|
@@ -13293,7 +13295,7 @@ var Arbi = class {
|
|
|
13293
13295
|
const crypto2 = await this.requireChatCrypto();
|
|
13294
13296
|
return {
|
|
13295
13297
|
externalId: crypto2.userExtId,
|
|
13296
|
-
publicKey: bytesToBase64(crypto2.encryptionKeypair.publicKey)
|
|
13298
|
+
publicKey: bytesToBase64$1(crypto2.encryptionKeypair.publicKey)
|
|
13297
13299
|
};
|
|
13298
13300
|
},
|
|
13299
13301
|
/** The keys of a chat I hold (cached per set of epochs). */
|
|
@@ -13416,7 +13418,7 @@ var Arbi = class {
|
|
|
13416
13418
|
mode: params.mode ?? "call",
|
|
13417
13419
|
...params.joinPolicy ? { join_policy: params.joinPolicy } : {},
|
|
13418
13420
|
title: title ? await encryptCallTitle(title, fresh) : null,
|
|
13419
|
-
creator_sealed_key: await sealCallKey(fresh, bytesToBase64(me2.encryptionKeypair.publicKey)),
|
|
13421
|
+
creator_sealed_key: await sealCallKey(fresh, bytesToBase64$1(me2.encryptionKeypair.publicKey)),
|
|
13420
13422
|
invitees: Object.entries(sealed).map(([user_ext_id, sealed_key]) => ({
|
|
13421
13423
|
user_ext_id,
|
|
13422
13424
|
sealed_key,
|
|
@@ -13474,7 +13476,7 @@ var Arbi = class {
|
|
|
13474
13476
|
const key = await generateCallKey();
|
|
13475
13477
|
const updated = await updateCall(this.requireClient(), call.external_id, {
|
|
13476
13478
|
reset_link: true,
|
|
13477
|
-
creator_sealed_key: await sealCallKey(key, bytesToBase64(me2.encryptionKeypair.publicKey)),
|
|
13479
|
+
creator_sealed_key: await sealCallKey(key, bytesToBase64$1(me2.encryptionKeypair.publicKey)),
|
|
13478
13480
|
sealed_keys: await sealCallKeyForPeers(key, invitees, me2.userExtId),
|
|
13479
13481
|
title: title ? await encryptCallTitle(title, key) : null
|
|
13480
13482
|
});
|
|
@@ -13496,7 +13498,7 @@ var Arbi = class {
|
|
|
13496
13498
|
title: title ? await encryptWithChatKey(title, chatKey) : null,
|
|
13497
13499
|
creator_sealed_key: await sealChatKey(
|
|
13498
13500
|
chatKey,
|
|
13499
|
-
bytesToBase64(me2.encryptionKeypair.publicKey)
|
|
13501
|
+
bytesToBase64$1(me2.encryptionKeypair.publicKey)
|
|
13500
13502
|
),
|
|
13501
13503
|
members: await Promise.all(
|
|
13502
13504
|
members.map(async (m2) => ({
|