@arbidocs/sdk 0.3.88 → 0.3.90
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-qGcHaBIG.d.cts → browser-1eU3ZnIX.d.cts} +92 -1
- package/dist/{browser-qGcHaBIG.d.ts → browser-1eU3ZnIX.d.ts} +92 -1
- package/dist/browser.cjs +38 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +38 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5580,6 +5580,7 @@ __export(dm_exports, {
|
|
|
5580
5580
|
listDMs: () => listDMs,
|
|
5581
5581
|
listDecryptedDMs: () => listDecryptedDMs,
|
|
5582
5582
|
markRead: () => markRead,
|
|
5583
|
+
requestWorkspaceAccess: () => requestWorkspaceAccess,
|
|
5583
5584
|
sendDM: () => sendDM,
|
|
5584
5585
|
sendEncryptedDM: () => sendEncryptedDM
|
|
5585
5586
|
});
|
|
@@ -5648,6 +5649,28 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
5648
5649
|
"Failed to send message"
|
|
5649
5650
|
);
|
|
5650
5651
|
}
|
|
5652
|
+
async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
5653
|
+
const payload = JSON.stringify({
|
|
5654
|
+
session_pubkey_b64: params.sessionPubkeyB64,
|
|
5655
|
+
note: params.note?.trim() || void 0
|
|
5656
|
+
});
|
|
5657
|
+
const content = await encryptDmContent(
|
|
5658
|
+
arbi,
|
|
5659
|
+
payload,
|
|
5660
|
+
params.recipientEncryptionPublicKey,
|
|
5661
|
+
crypto.encryptionKeypair.secretKey
|
|
5662
|
+
);
|
|
5663
|
+
return requireData(
|
|
5664
|
+
await arbi.fetch.POST("/v1/notifications/access-request", {
|
|
5665
|
+
body: {
|
|
5666
|
+
recipient_ext_id: params.recipientExtId,
|
|
5667
|
+
content,
|
|
5668
|
+
...params.workspaceExtId ? { workspace_ext_id: params.workspaceExtId } : {}
|
|
5669
|
+
}
|
|
5670
|
+
}),
|
|
5671
|
+
"Failed to request workspace access"
|
|
5672
|
+
);
|
|
5673
|
+
}
|
|
5651
5674
|
async function sendDM(arbi, messages) {
|
|
5652
5675
|
return requireData(
|
|
5653
5676
|
await arbi.fetch.POST("/v1/notifications/", {
|
|
@@ -6012,6 +6035,21 @@ var Arbi = class {
|
|
|
6012
6035
|
addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
|
|
6013
6036
|
removeUsers: (userIds) => removeWorkspaceUsers(this.requireClient(), userIds),
|
|
6014
6037
|
setUserRole: (userIds, role) => setUserRole(this.requireClient(), userIds, role),
|
|
6038
|
+
/**
|
|
6039
|
+
* Ask another user to grant you workspace access. Builds the E2E-encrypted
|
|
6040
|
+
* request `content` (carrying this session's public key for a temporary
|
|
6041
|
+
* grant) and posts it. `workspaceExtId` is optional — pass it only when you
|
|
6042
|
+
* already know the target workspace id (obtained out-of-band).
|
|
6043
|
+
*/
|
|
6044
|
+
requestAccess: (params) => {
|
|
6045
|
+
const client = this.requireClient();
|
|
6046
|
+
const lr2 = this.requireLogin();
|
|
6047
|
+
const userExtId = lr2.userExtId ?? client.session.getState().userExtId;
|
|
6048
|
+
if (!userExtId) throw new ArbiError("No user id in session \u2014 cannot request access");
|
|
6049
|
+
const crypto = createDmCryptoContext(client, lr2.signingPrivateKey, userExtId);
|
|
6050
|
+
const sessionPubkeyB64 = client.crypto.bytesToBase64(lr2.serverSessionKey);
|
|
6051
|
+
return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 }, crypto);
|
|
6052
|
+
},
|
|
6015
6053
|
copyDocuments: (targetWorkspaceId, docIds, targetWorkspaceKey) => copyDocuments(
|
|
6016
6054
|
this.requireClient(),
|
|
6017
6055
|
targetWorkspaceId,
|