@enbox/api 0.6.24 → 0.6.25
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.mjs +19 -11
- package/dist/browser.mjs.map +4 -4
- package/dist/esm/enbox-types.js +11 -0
- package/dist/esm/enbox-types.js.map +1 -0
- package/dist/esm/enbox.js +300 -40
- package/dist/esm/enbox.js.map +1 -1
- package/dist/esm/index.js +7 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/read-only-record.js.map +1 -1
- package/dist/esm/repository.js +29 -3
- package/dist/esm/repository.js.map +1 -1
- package/dist/types/enbox-types.d.ts +94 -0
- package/dist/types/enbox-types.d.ts.map +1 -0
- package/dist/types/enbox.d.ts +141 -74
- package/dist/types/enbox.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/repository.d.ts +19 -0
- package/dist/types/repository.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/enbox-types.ts +111 -0
- package/src/enbox.ts +340 -83
- package/src/index.ts +8 -5
- package/src/read-only-record.ts +1 -1
- package/src/repository.ts +30 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public type surface for the {@link Enbox} class.
|
|
3
|
+
*
|
|
4
|
+
* Session and connect types are derived from
|
|
5
|
+
* {@link AgentSessionPrimitives} in `@enbox/agent`, so the minimal session
|
|
6
|
+
* shape lives in one place and downstream packages stay in sync.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=enbox-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enbox-types.js","sourceRoot":"","sources":["../../src/enbox-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/esm/enbox.js
CHANGED
|
@@ -13,31 +13,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
import { AnonymousDwnApi } from '@enbox/agent';
|
|
16
|
+
import { AuthManager } from '@enbox/auth/auth-manager';
|
|
16
17
|
import { EnboxRpcClient } from '@enbox/dwn-clients';
|
|
18
|
+
import { omitUndefined } from '@enbox/common';
|
|
17
19
|
import { DidDht, DidJwk, DidKey, DidResolverCacheMemory, DidWeb, UniversalResolver } from '@enbox/dids';
|
|
18
20
|
import { DidApi } from './did-api.js';
|
|
19
21
|
import { DwnApi } from './dwn-api.js';
|
|
20
22
|
import { DwnReaderApi } from './dwn-reader-api.js';
|
|
21
23
|
import { TypedEnbox } from './typed-enbox.js';
|
|
22
24
|
import { VcApi } from './vc-api.js';
|
|
25
|
+
/**
|
|
26
|
+
* Module-level registry of in-flight {@link Enbox.connect} calls, keyed by
|
|
27
|
+
* the resolved data path (or a sentinel for "default path").
|
|
28
|
+
*
|
|
29
|
+
* `AuthManager.create()` opens LevelDB handles at the agent's `dataPath`;
|
|
30
|
+
* LevelDB enforces an exclusive lock per directory, so two parallel
|
|
31
|
+
* `Enbox.connect()` invocations on the same path would race on the lock
|
|
32
|
+
* and surface a cryptic `LEVEL_LOCKED` error to the caller. The registry
|
|
33
|
+
* detects the race at the API boundary and throws a clear, domain-level
|
|
34
|
+
* error instead. Custom `storage` adapters that don't share a path with
|
|
35
|
+
* the agent's vault can still race below this guard — but for the default
|
|
36
|
+
* path that every dapp uses, this catches the common case.
|
|
37
|
+
*/
|
|
38
|
+
const DEFAULT_DATA_PATH_KEY = '\x00default\x00';
|
|
39
|
+
const inflightConnects = new Map();
|
|
23
40
|
/**
|
|
24
41
|
* The main Enbox API interface. It provides protocol-scoped access to
|
|
25
42
|
* Decentralized Web Nodes (DWNs), Decentralized Identifiers (DIDs),
|
|
26
43
|
* and Verifiable Credentials (VCs).
|
|
27
44
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
45
|
+
* For common app flows, use the asynchronous {@link Enbox.connect} helper.
|
|
46
|
+
* For custom auth/session flows, use {@link Enbox.fromSession} with an
|
|
47
|
+
* existing session, or the public constructor with raw `{ agent, connectedDid }`.
|
|
31
48
|
*
|
|
32
49
|
* @example
|
|
33
50
|
* ```ts
|
|
34
|
-
* import { AuthManager } from '@enbox/auth';
|
|
35
51
|
* import { Enbox } from '@enbox/api';
|
|
36
52
|
*
|
|
37
|
-
* const
|
|
38
|
-
*
|
|
53
|
+
* const { enbox } = await Enbox.connect({
|
|
54
|
+
* createIdentity: true,
|
|
55
|
+
* sync: '15s',
|
|
56
|
+
* });
|
|
39
57
|
*
|
|
40
|
-
* const enbox = Enbox.connect({ session });
|
|
41
58
|
* const social = enbox.using(SocialProtocol);
|
|
42
59
|
* ```
|
|
43
60
|
*/
|
|
@@ -97,31 +114,107 @@ export class Enbox {
|
|
|
97
114
|
return instance;
|
|
98
115
|
}
|
|
99
116
|
/**
|
|
100
|
-
*
|
|
117
|
+
* Signs the user out and releases resources held by this Enbox instance.
|
|
118
|
+
*
|
|
119
|
+
* When this instance owns the underlying `AuthManager` (i.e. it was
|
|
120
|
+
* created via `Enbox.connect()` with no caller-supplied `agent`), the
|
|
121
|
+
* disconnect proceeds in three phases:
|
|
122
|
+
*
|
|
123
|
+
* 1. **Stop sync** — `agent.sync.stopSync(timeout)` halts the DWN
|
|
124
|
+
* sync engine. Always runs, regardless of ownership.
|
|
125
|
+
* 2. **Sign out** — `AuthManager.disconnect()` sends delegate-grant
|
|
126
|
+
* revocations to the connected DWN endpoints, clears session
|
|
127
|
+
* restore markers (PREVIOUSLY_CONNECTED, ACTIVE_IDENTITY,
|
|
128
|
+
* delegate keys, etc.) from the StorageAdapter, and clears the
|
|
129
|
+
* in-memory delegate decryption key cache. **Without this step
|
|
130
|
+
* a later `Enbox.connect()` would silently restore the
|
|
131
|
+
* supposedly signed-out session from the persisted markers.**
|
|
132
|
+
* 3. **Release resources** — `AuthManager.shutdown()` locks the
|
|
133
|
+
* vault, closes the sync engine, and closes the StorageAdapter.
|
|
134
|
+
*
|
|
135
|
+
* When the instance was created from a caller-owned session
|
|
136
|
+
* ({@link Enbox.fromSession}), a raw agent (the public constructor),
|
|
137
|
+
* or `Enbox.connect({ agent })`, only step 1 (stop sync) runs — the
|
|
138
|
+
* caller's AuthManager / agent keep their lifecycle. The caller is
|
|
139
|
+
* responsible for calling `auth.disconnect()` and `auth.shutdown()`
|
|
140
|
+
* on their own handle when they're done.
|
|
101
141
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* `disconnect()`, the `Enbox` instance should not be reused.
|
|
142
|
+
* Idempotent: parallel calls share the same teardown promise. After
|
|
143
|
+
* calling `disconnect()`, the `Enbox` instance should not be reused.
|
|
105
144
|
*
|
|
106
145
|
* @param timeout - Maximum milliseconds to wait for an in-progress sync
|
|
107
146
|
* cycle to finish before force-stopping. Defaults to `2000`.
|
|
108
147
|
*
|
|
109
148
|
* @example
|
|
110
149
|
* ```ts
|
|
111
|
-
*
|
|
150
|
+
* // High-level flow: a single disconnect() does sign-out + teardown.
|
|
151
|
+
* const { enbox } = await Enbox.connect({ createIdentity: true });
|
|
152
|
+
* // ... user uses the app ...
|
|
153
|
+
* await enbox.disconnect(); // revoke grants, clear markers, close vault
|
|
154
|
+
*
|
|
155
|
+
* // Caller-owned auth: enbox.disconnect() only stops Enbox-side state.
|
|
156
|
+
* const auth = await AuthManager.create({...});
|
|
157
|
+
* const session = await auth.connect();
|
|
158
|
+
* const enbox = Enbox.fromSession(session);
|
|
159
|
+
* await enbox.disconnect(); // stops sync + clears typed-enbox cache
|
|
160
|
+
* await auth.disconnect(); // sign-out: caller's responsibility
|
|
161
|
+
* await auth.shutdown(); // close resources: caller's responsibility
|
|
112
162
|
* ```
|
|
113
163
|
*
|
|
114
164
|
* @beta
|
|
115
165
|
*/
|
|
116
166
|
disconnect(timeout) {
|
|
117
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
168
|
+
// Memoize so parallel calls share the same teardown promise. Without
|
|
169
|
+
// this, two concurrent disconnect()s would each invoke
|
|
170
|
+
// agent.sync.stopSync (idempotent, but redundant) and could race on
|
|
171
|
+
// _ownedAuth ownership transfer.
|
|
172
|
+
if (this._disconnecting !== undefined) {
|
|
173
|
+
return this._disconnecting;
|
|
122
174
|
}
|
|
175
|
+
this._disconnecting = this._doDisconnect(timeout);
|
|
176
|
+
return this._disconnecting;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
_doDisconnect(timeout) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
yield this.agent.sync.stopSync(timeout);
|
|
123
182
|
// Clear cached TypedEnbox instances so they are not accidentally reused.
|
|
124
183
|
this._typedInstances.clear();
|
|
184
|
+
// If this Enbox owns the AuthManager (created via Enbox.connect), the
|
|
185
|
+
// sign-out + resource-teardown both fall on us:
|
|
186
|
+
//
|
|
187
|
+
// 1. `auth.disconnect()` — sign-out semantics: revoke delegate
|
|
188
|
+
// grants on the remote DWN, clear session restore markers
|
|
189
|
+
// (PREVIOUSLY_CONNECTED, ACTIVE_IDENTITY, delegate keys, etc.)
|
|
190
|
+
// from the StorageAdapter, and clear the in-memory delegate
|
|
191
|
+
// decryption key cache. MUST run while the agent's resources
|
|
192
|
+
// are still open (revocations need DWN access). Without this,
|
|
193
|
+
// a later `Enbox.connect()` would restore the supposedly
|
|
194
|
+
// signed-out session from the persisted markers.
|
|
195
|
+
// 2. `auth.shutdown()` — resource teardown: lock the vault,
|
|
196
|
+
// close the sync engine, close the storage adapter. Runs
|
|
197
|
+
// after disconnect so revocation traffic completes first.
|
|
198
|
+
//
|
|
199
|
+
// Both are idempotent and best-effort; failures are logged but do
|
|
200
|
+
// not propagate. We always attempt shutdown() even if disconnect()
|
|
201
|
+
// throws, so resources still close.
|
|
202
|
+
if (this._ownedAuth !== undefined) {
|
|
203
|
+
const owned = this._ownedAuth;
|
|
204
|
+
this._ownedAuth = undefined;
|
|
205
|
+
try {
|
|
206
|
+
yield owned.disconnect({ timeout });
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.warn('[@enbox/api] Enbox.disconnect: AuthManager.disconnect() failed', error);
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
yield owned.shutdown({ timeout });
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
console.warn('[@enbox/api] Enbox.disconnect: AuthManager.shutdown() failed', error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
125
218
|
});
|
|
126
219
|
}
|
|
127
220
|
/**
|
|
@@ -163,38 +256,205 @@ export class Enbox {
|
|
|
163
256
|
};
|
|
164
257
|
}
|
|
165
258
|
/**
|
|
166
|
-
* Creates an {@link Enbox} instance from
|
|
259
|
+
* Creates an {@link Enbox} instance from a session-shaped object.
|
|
260
|
+
*
|
|
261
|
+
* Accepts `AuthSession`, `AgentSession`, or any compatible custom session
|
|
262
|
+
* with `{ agent, did, delegateDid? }`. This is the right entry point
|
|
263
|
+
* whenever you already hold an active session — including ones produced by
|
|
264
|
+
* a caller-managed `AuthManager`.
|
|
265
|
+
*
|
|
266
|
+
* For raw `{ agent, connectedDid }` access (no session shape), use the
|
|
267
|
+
* public constructor directly: `new Enbox({ agent, connectedDid })`.
|
|
268
|
+
*/
|
|
269
|
+
static fromSession(session) {
|
|
270
|
+
return new Enbox({
|
|
271
|
+
agent: session.agent,
|
|
272
|
+
connectedDid: session.did,
|
|
273
|
+
delegateDid: session.delegateDid,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* High-level entry point that creates an {@link AuthManager}, runs
|
|
278
|
+
* `auth.connect()`, and returns the resulting `{ auth, session, enbox }`.
|
|
167
279
|
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
280
|
+
* For callers that already own an agent and DID, use the dedicated
|
|
281
|
+
* synchronous entry points instead:
|
|
282
|
+
* - `new Enbox({ agent, connectedDid })` for raw parameters
|
|
283
|
+
* - {@link Enbox.fromSession} for session-shaped objects
|
|
171
284
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
285
|
+
* Routing happens at runtime inside `AuthManager._isLocalConnect`:
|
|
286
|
+
* presence of a non-empty `protocols` array or a `connectHandler` selects
|
|
287
|
+
* the handler flow; everything else routes to local. Local-style fields
|
|
288
|
+
* (`password`, `dwnEndpoints`, etc.) are forwarded to both the manager
|
|
289
|
+
* (as defaults) and the per-call payload, so behavior is consistent with
|
|
290
|
+
* restored sessions.
|
|
291
|
+
*
|
|
292
|
+
* If you need exact control of the `AuthManager.connect()` payload,
|
|
293
|
+
* drop down one layer: create the `AuthManager` yourself with
|
|
294
|
+
* `AuthManager.create()`, call `auth.connect(...)` with your exact
|
|
295
|
+
* options, and pass the resulting session to `Enbox.fromSession`.
|
|
175
296
|
*
|
|
176
297
|
* @example
|
|
177
298
|
* ```ts
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* const enbox = Enbox.connect({ session });
|
|
183
|
-
*
|
|
184
|
-
* // Using raw parameters
|
|
185
|
-
* const enbox = Enbox.connect({ agent, connectedDid: did });
|
|
299
|
+
* const { enbox, session, auth } = await Enbox.connect({ createIdentity: true });
|
|
300
|
+
* // ...
|
|
301
|
+
* await enbox.disconnect();
|
|
302
|
+
* await auth.shutdown(); // release vault + storage handles
|
|
186
303
|
* ```
|
|
187
304
|
*/
|
|
188
|
-
static connect(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
305
|
+
static connect() {
|
|
306
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
307
|
+
var _a, _b;
|
|
308
|
+
// Cross-instance concurrency guard. `AuthManager.create()` opens the
|
|
309
|
+
// agent's LevelDB at `options.dataPath` (or the platform default), and
|
|
310
|
+
// LevelDB enforces an exclusive `LOCK` file per directory — two
|
|
311
|
+
// parallel calls on the same path would otherwise race and surface
|
|
312
|
+
// `LEVEL_LOCKED` as a low-level error. The guard / ownership flag
|
|
313
|
+
// tracks one question only: did we build the underlying agent? If
|
|
314
|
+
// `options.agent` is supplied the caller owns the agent's lifecycle
|
|
315
|
+
// and on-disk handles, so we skip both the guard (no new dataPath
|
|
316
|
+
// race) and ownership cleanup (`disconnect()` must not tear down
|
|
317
|
+
// the caller's agent). A custom `storage` adapter alone is NOT a
|
|
318
|
+
// basis for skipping — Enbox still builds an agent that opens
|
|
319
|
+
// LevelDB handles at `dataPath`, and the storage adapter governs
|
|
320
|
+
// session-persistence keys, not the agent vault.
|
|
321
|
+
//
|
|
322
|
+
// Limitation: the key is the raw `options.dataPath` string, not its
|
|
323
|
+
// resolved on-disk location. Two callers — one with `dataPath`
|
|
324
|
+
// omitted and another passing the explicit platform default
|
|
325
|
+
// ('DATA/AGENT' in browser, '~/.enbox' in CLI) — refer to the same
|
|
326
|
+
// directory but produce different keys, so the guard won't catch
|
|
327
|
+
// that race. Resolving the path here would require pulling in the
|
|
328
|
+
// platform-default logic from `@enbox/agent`, which we deliberately
|
|
329
|
+
// avoid to keep the helper layered above the agent. Pick one
|
|
330
|
+
// convention per app: always omit `dataPath`, or always set it
|
|
331
|
+
// explicitly.
|
|
332
|
+
const shouldGuard = options.agent === undefined;
|
|
333
|
+
const key = (_a = options.dataPath) !== null && _a !== void 0 ? _a : DEFAULT_DATA_PATH_KEY;
|
|
334
|
+
if (shouldGuard && inflightConnects.has(key)) {
|
|
335
|
+
throw new Error(`[@enbox/api] Enbox.connect() is already in progress for dataPath '${(_b = options.dataPath) !== null && _b !== void 0 ? _b : '<default>'}'. Await the in-flight call before starting another, or pass a custom dataPath.`);
|
|
336
|
+
}
|
|
337
|
+
const run = () => __awaiter(this, void 0, void 0, function* () {
|
|
338
|
+
const auth = yield AuthManager.create(Enbox.toAuthManagerOptions(options));
|
|
339
|
+
try {
|
|
340
|
+
const session = yield auth.connect(Enbox.toAuthConnectOptions(options));
|
|
341
|
+
const enbox = Enbox.fromSession(session);
|
|
342
|
+
// Take AuthManager ownership ONLY when we built the agent
|
|
343
|
+
// ourselves — `auth.shutdown()` will lock that agent's vault
|
|
344
|
+
// and close its sync engine. If the caller supplied
|
|
345
|
+
// `options.agent`, they retain agent ownership and must not
|
|
346
|
+
// have its lifecycle resources torn down by
|
|
347
|
+
// `enbox.disconnect()`. Callers that want explicit control
|
|
348
|
+
// (e.g. their own storage adapter without their own agent)
|
|
349
|
+
// can still grab the `auth` handle from the result and call
|
|
350
|
+
// `auth.shutdown()` themselves; we always include it in the
|
|
351
|
+
// returned `EnboxConnectResult`.
|
|
352
|
+
if (shouldGuard) {
|
|
353
|
+
enbox._ownedAuth = auth;
|
|
354
|
+
}
|
|
355
|
+
return { auth, enbox, session };
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
try {
|
|
359
|
+
yield auth.shutdown();
|
|
360
|
+
}
|
|
361
|
+
catch (shutdownError) {
|
|
362
|
+
// Surface the recovery failure for diagnosis but preserve the
|
|
363
|
+
// original connect rejection on the rethrow path below.
|
|
364
|
+
console.warn('[@enbox/api] Enbox.connect: auth.shutdown() failed during error recovery', shutdownError);
|
|
365
|
+
}
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
195
368
|
});
|
|
196
|
-
|
|
197
|
-
|
|
369
|
+
if (!shouldGuard) {
|
|
370
|
+
return run();
|
|
371
|
+
}
|
|
372
|
+
const promise = run();
|
|
373
|
+
inflightConnects.set(key, promise);
|
|
374
|
+
try {
|
|
375
|
+
return yield promise;
|
|
376
|
+
}
|
|
377
|
+
finally {
|
|
378
|
+
inflightConnects.delete(key);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Split `EnboxConnectOptions` into the manager-wide defaults that
|
|
384
|
+
* `AuthManager.create()` consumes.
|
|
385
|
+
*
|
|
386
|
+
* Implemented as an **explicit allowlist** for the same reason as
|
|
387
|
+
* `toAuthConnectOptions`: a denylist would silently leak future
|
|
388
|
+
* `HandlerConnectOptions` / `LocalConnectOptions` fields into the
|
|
389
|
+
* manager-default record. The `satisfies Partial<AuthManagerOptions>`
|
|
390
|
+
* annotation makes the compiler verify every key in the allowlist
|
|
391
|
+
* exists on `AuthManagerOptions`, so a misspelled or stale field name
|
|
392
|
+
* is a type error.
|
|
393
|
+
*/
|
|
394
|
+
static toAuthManagerOptions(options) {
|
|
395
|
+
// Explicit allowlist — every key must exist on `AuthManagerOptions`
|
|
396
|
+
// (verified by `satisfies` below).
|
|
397
|
+
const allowlisted = {
|
|
398
|
+
agent: options.agent,
|
|
399
|
+
agentVault: options.agentVault,
|
|
400
|
+
localDwnStrategy: options.localDwnStrategy,
|
|
401
|
+
dataPath: options.dataPath,
|
|
402
|
+
storage: options.storage,
|
|
403
|
+
password: options.password,
|
|
404
|
+
passwordProvider: options.passwordProvider,
|
|
405
|
+
sync: options.sync,
|
|
406
|
+
dwnEndpoints: options.dwnEndpoints,
|
|
407
|
+
registration: options.registration,
|
|
408
|
+
connectHandler: options.connectHandler,
|
|
409
|
+
};
|
|
410
|
+
return omitUndefined(allowlisted);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Split `EnboxConnectOptions` into the per-call payload that
|
|
414
|
+
* `AuthManager.connect()` consumes.
|
|
415
|
+
*
|
|
416
|
+
* Implemented as an **explicit allowlist** of the fields declared on
|
|
417
|
+
* {@link HandlerConnectOptions} ∪ {@link LocalConnectOptions}. A
|
|
418
|
+
* denylist (strip manager-only fields, forward the rest) would
|
|
419
|
+
* silently leak any future `AuthManagerOptions` field into
|
|
420
|
+
* `AuthManager.connect()`; the allowlist makes the type boundary
|
|
421
|
+
* explicit and the leak impossible. The trade-off is symmetric:
|
|
422
|
+
* any new connect-options field requires an edit here. That's
|
|
423
|
+
* acceptable — it's the same edit the public `ConnectOptions` type
|
|
424
|
+
* already needs, just on one extra line.
|
|
425
|
+
*
|
|
426
|
+
* The `satisfies Partial<ConnectOptions>` annotation makes the
|
|
427
|
+
* compiler verify every key in the allowlist exists on `ConnectOptions`,
|
|
428
|
+
* so misspelling a field name is a type error rather than a silent
|
|
429
|
+
* drop. Routing between local and handler flow happens inside
|
|
430
|
+
* `AuthManager._isLocalConnect` based on the presence of `protocols`
|
|
431
|
+
* / `connectHandler`.
|
|
432
|
+
*
|
|
433
|
+
* `protocols: []` is normalized away — an empty array carries no
|
|
434
|
+
* permission intent and would otherwise produce a zero-grant
|
|
435
|
+
* "connected" handler session indistinguishable from a denied connect.
|
|
436
|
+
*/
|
|
437
|
+
static toAuthConnectOptions(options) {
|
|
438
|
+
// Explicit allowlist — every key must exist on the
|
|
439
|
+
// `ConnectOptions` union (verified by `satisfies` below).
|
|
440
|
+
const allowlisted = {
|
|
441
|
+
// Shared across handler + local
|
|
442
|
+
password: options.password,
|
|
443
|
+
sync: options.sync,
|
|
444
|
+
dwnEndpoints: options.dwnEndpoints,
|
|
445
|
+
// Handler-only
|
|
446
|
+
protocols: options.protocols,
|
|
447
|
+
connectHandler: options.connectHandler,
|
|
448
|
+
// Local-only
|
|
449
|
+
recoveryPhrase: options.recoveryPhrase,
|
|
450
|
+
createIdentity: options.createIdentity,
|
|
451
|
+
metadata: options.metadata,
|
|
452
|
+
};
|
|
453
|
+
// Normalize `protocols: []` to undefined so omitUndefined strips it.
|
|
454
|
+
const normalized = (Array.isArray(allowlisted.protocols) && allowlisted.protocols.length === 0)
|
|
455
|
+
? Object.assign(Object.assign({}, allowlisted), { protocols: undefined }) : allowlisted;
|
|
456
|
+
const cleaned = omitUndefined(normalized);
|
|
457
|
+
return Object.keys(cleaned).length === 0 ? undefined : cleaned;
|
|
198
458
|
}
|
|
199
459
|
}
|
|
200
460
|
//# sourceMappingURL=enbox.js.map
|
package/dist/esm/enbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enbox.js","sourceRo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,CAAC,WAAW,CAAC;QAEhB,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,CAAC;CACF"}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
* The SDK provides protocol-scoped access to DWN records with compile-time
|
|
5
5
|
* type safety, DID management, and Verifiable Credential operations.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Common authentication and identity setup is available through
|
|
8
|
+
* `Enbox.connect()`. Advanced session management can use `@enbox/auth` or
|
|
9
|
+
* `@enbox/agent` directly.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* ```ts
|
|
11
|
-
* import { AuthManager } from '@enbox/auth';
|
|
12
13
|
* import { Enbox } from '@enbox/api';
|
|
13
14
|
*
|
|
14
|
-
* const
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* const { enbox } = await Enbox.connect({
|
|
16
|
+
* createIdentity: true,
|
|
17
|
+
* sync: '15s',
|
|
18
|
+
* });
|
|
17
19
|
* ```
|
|
18
20
|
*
|
|
19
21
|
* [Link to GitHub Repo](https://github.com/enboxorg/enbox)
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAE3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;A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AK,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;gBAClE,CAAC;gBAED,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;YAC1B,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,OAAO,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;gBAC3E,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,CAAC,SAAS,MAAM,OAAO,EAAE,CAAC,CAAC;YACnG,CAAC;QACH,CAAC;KAAA;CACF"}
|
package/dist/esm/repository.js
CHANGED
|
@@ -24,6 +24,25 @@
|
|
|
24
24
|
* const members = await social.group.member.query(groupContextId);
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
|
+
* ## Deliberate `as never` pattern
|
|
28
|
+
*
|
|
29
|
+
* The CRUD methods below pass their `options: Record<string, unknown>`
|
|
30
|
+
* parameter to `typed.records.{create, query, subscribe, update}` with
|
|
31
|
+
* `as never`. This is the type-system bridge between the type-erased
|
|
32
|
+
* Proxy (which doesn't carry the per-protocol generic) and the strictly-
|
|
33
|
+
* typed record methods (which take `TypedRecordCreateParams<...>` etc.).
|
|
34
|
+
*
|
|
35
|
+
* `never` is the universal bottom subtype, so any strict generic is
|
|
36
|
+
* satisfied. The structural runtime shape of `options` is validated by
|
|
37
|
+
* the DWN SDK's grant-processing layer downstream — the cast is a
|
|
38
|
+
* narrow, intentional escape hatch at the proxy boundary.
|
|
39
|
+
*
|
|
40
|
+
* SonarCloud's `typescript:S4325` flags these casts as redundant
|
|
41
|
+
* because its rule doesn't model generic-parameter constraints. We
|
|
42
|
+
* suppress S4325 at the file level (see `sonar-project.properties`)
|
|
43
|
+
* because every CRUD method uses the same pattern and per-line
|
|
44
|
+
* `// NOSONAR` would dwarf the actual code.
|
|
45
|
+
*
|
|
27
46
|
* @module
|
|
28
47
|
*/
|
|
29
48
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -51,9 +70,11 @@ function isRecordLimitExceeded(status) {
|
|
|
51
70
|
* (has `$recordLimit: { max: 1 }`).
|
|
52
71
|
*/
|
|
53
72
|
function isSingletonPath(definition, path) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
const [first, ...rest] = path.split('/');
|
|
74
|
+
// Top-level lookup uses the declared `{ [key: string]: ProtocolRuleSet }`
|
|
75
|
+
// index signature directly — no top-level cast needed.
|
|
76
|
+
let node = definition.structure[first];
|
|
77
|
+
for (const seg of rest) {
|
|
57
78
|
if (!node || typeof node !== 'object') {
|
|
58
79
|
return false;
|
|
59
80
|
}
|
|
@@ -73,6 +94,11 @@ function isSingletonPath(definition, path) {
|
|
|
73
94
|
* reached by the given path.
|
|
74
95
|
*/
|
|
75
96
|
function getChildKeys(definition, path) {
|
|
97
|
+
// Top-level: walk into the structure's declared index-signature value.
|
|
98
|
+
// The structure is `{ [key: string]: ProtocolRuleSet }`; navigating
|
|
99
|
+
// beneath the first segment uses `ProtocolRuleSet`'s own index
|
|
100
|
+
// signature, which contains both rule-set children and `$`-prefixed
|
|
101
|
+
// metadata — we filter out the metadata at the leaf below.
|
|
76
102
|
const segments = path.split('/');
|
|
77
103
|
let node = definition.structure;
|
|
78
104
|
for (const seg of segments) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;;;;;;;;;AAQH,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,MAAwC;IACrE,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