@arbidocs/sdk 0.5.58 → 0.5.59
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 +27 -5
- package/dist/{browser-BX1E63gK.d.ts → browser-H9ziI77P.d.ts} +2 -0
- package/dist/{browser-ENBx11nT.d.cts → browser-wtQhRmpE.d.cts} +2 -0
- package/dist/browser.cjs +1 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/examples/node-response.mjs +36 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -26,10 +26,9 @@ await arbi.assistant.ask(
|
|
|
26
26
|
)
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Node.js needs no IndexedDB polyfill. Keys stay in memory for this SDK instance unless you supply an explicit persistence adapter:
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
-
import 'fake-indexeddb/auto'
|
|
33
32
|
import { Arbi } from '@arbidocs/sdk'
|
|
34
33
|
```
|
|
35
34
|
|
|
@@ -87,7 +86,7 @@ const result = await arbi.assistant.ask(
|
|
|
87
86
|
|
|
88
87
|
## Session recovery
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
Browsers persist the signing key encrypted in IndexedDB. Without IndexedDB, each SDK client keeps its own key in memory; it is not shared with other instances or saved to disk. Recover a session without a password:
|
|
91
90
|
|
|
92
91
|
```typescript
|
|
93
92
|
await arbi.loginWithKey('user@example.com', signingKeyBase64)
|
|
@@ -100,7 +99,7 @@ The SDK also auto-recovers on 401 responses using the stored key.
|
|
|
100
99
|
- **Zero-knowledge auth** — passwords never leave the client
|
|
101
100
|
- **E2E workspace encryption** — symmetric keys wrapped with your public key
|
|
102
101
|
- **Encrypted key storage** — private keys in IndexedDB encrypted with non-extractable AES-GCM
|
|
103
|
-
- **
|
|
102
|
+
- **Session cleanup** — logout ends the live session; the stored identity supports offline unlock and default storage is cleared on logout-everywhere
|
|
104
103
|
|
|
105
104
|
## React
|
|
106
105
|
|
|
@@ -109,7 +108,7 @@ For React apps, use `@arbidocs/react` instead — it wraps this SDK with hooks a
|
|
|
109
108
|
## Requirements
|
|
110
109
|
|
|
111
110
|
- **Browser**: Any modern browser with Web Crypto API
|
|
112
|
-
- **Node.js**:
|
|
111
|
+
- **Node.js**: native fetch/Web Crypto runtime; Node 22+ is used by the executable example and package smoke check (no `fake-indexeddb` needed)
|
|
113
112
|
- **TypeScript**: 5.0+ (optional)
|
|
114
113
|
|
|
115
114
|
## Automations
|
|
@@ -213,6 +212,29 @@ startup frame is needed. The iterator buffers at most 256 frames, covering exist
|
|
|
213
212
|
control fixtures; overflow rejects its reads with code `RESPONSE_EVENT_OVERFLOW`, while snapshot
|
|
214
213
|
reduction continues. Return/break the iterator to release its buffer; a second iterator is rejected.
|
|
215
214
|
|
|
215
|
+
|
|
216
|
+
### Node example and package check
|
|
217
|
+
|
|
218
|
+
Run [examples/node-response.mjs](examples/node-response.mjs) with Node 22+ after installing
|
|
219
|
+
`@arbidocs/sdk` (`node node_modules/@arbidocs/sdk/examples/node-response.mjs`). Set `ARBI_URL`, `ARBI_EMAIL`, `ARBI_PASSWORD` and `ARBI_WORKSPACE_ID`;
|
|
220
|
+
`ARBI_QUESTION` is optional. It explicitly selects the current workspace, submits one Responses
|
|
221
|
+
turn, distinguishes disconnect from completion and refetches an accepted response rather than
|
|
222
|
+
resubmitting it. Ctrl-C detaches the reader; it does not claim to cancel background execution.
|
|
223
|
+
|
|
224
|
+
Default Node storage lasts only for that client instance. For persistence across process restarts,
|
|
225
|
+
pass `persistence: { getSession, saveSession, clearSession }` to `Arbi` or `createArbiClient`.
|
|
226
|
+
The existing `SessionPersistence` interface is retained; `clearSession` is optional for existing
|
|
227
|
+
adapters and is invoked by logout-everywhere when provided. Protect keys in any custom persistent
|
|
228
|
+
store. Normal logout retains the stored identity for the existing offline-unlock behavior;
|
|
229
|
+
logout-everywhere clears the default memory adapter. Browser encrypted storage remains unchanged.
|
|
230
|
+
|
|
231
|
+
Repository maintainers can run `node scripts/sdk-node-smoke.mjs` after building the client and SDK.
|
|
232
|
+
It packs both packages, installs their tarballs/runtime dependencies in a fresh temporary npm
|
|
233
|
+
consumer, checks ESM/CommonJS/browser/testing imports and exercises key login, recovery and
|
|
234
|
+
Responses over a local fake fetch. It requires the npm registry for dependencies, no deployment
|
|
235
|
+
credentials, and no IndexedDB polyfill. It verifies package/runtime behavior, not backend access
|
|
236
|
+
control or live deployment integration.
|
|
237
|
+
|
|
216
238
|
### Configuring HTTP transport
|
|
217
239
|
|
|
218
240
|
React Query still manages React caches, mutations and refetching. The SDK transport underneath
|
|
@@ -7958,6 +7958,8 @@ type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
|
|
|
7958
7958
|
type WorkspaceOpenResponse = components['schemas']['WorkspaceOpenResponse'];
|
|
7959
7959
|
|
|
7960
7960
|
interface ArbiOptions {
|
|
7961
|
+
/** Optional key persistence. Defaults to encrypted browser storage or per-client Node memory. Ignored with a host session. */
|
|
7962
|
+
persistence?: SessionPersistence;
|
|
7961
7963
|
/** Shared HTTP configuration. With a host session, configure its client instead. */
|
|
7962
7964
|
transport?: HttpTransportOptions;
|
|
7963
7965
|
/** Backend API URL (e.g. 'https://arbi.mycompany.com') */
|
|
@@ -7958,6 +7958,8 @@ type ConfigUpdateData$1 = components['schemas']['ConfigUpdateData'];
|
|
|
7958
7958
|
type WorkspaceOpenResponse = components['schemas']['WorkspaceOpenResponse'];
|
|
7959
7959
|
|
|
7960
7960
|
interface ArbiOptions {
|
|
7961
|
+
/** Optional key persistence. Defaults to encrypted browser storage or per-client Node memory. Ignored with a host session. */
|
|
7962
|
+
persistence?: SessionPersistence;
|
|
7961
7963
|
/** Shared HTTP configuration. With a host session, configure its client instead. */
|
|
7962
7964
|
transport?: HttpTransportOptions;
|
|
7963
7965
|
/** Backend API URL (e.g. 'https://arbi.mycompany.com') */
|
package/dist/browser.cjs
CHANGED
|
@@ -10673,6 +10673,7 @@ var Arbi = class {
|
|
|
10673
10673
|
baseUrl: this.options.url,
|
|
10674
10674
|
deploymentDomain: domain,
|
|
10675
10675
|
credentials: this.options.credentials ?? "omit",
|
|
10676
|
+
persistence: this.options.persistence,
|
|
10676
10677
|
transport: this.options.transport,
|
|
10677
10678
|
session: client.createSessionManager({ storage: this.options.sessionStorage }),
|
|
10678
10679
|
// A silent re-login rotates the server session key: keep ours in step, or the next
|