@synonymdev/pubky 0.14.0 → 0.16.0

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/index.cjs CHANGED
@@ -9,6 +9,7 @@ const PUBKY_SESSIONS_DB_NAME = "pubky-auth";
9
9
  const PUBKY_SESSIONS_DB_VERSION = 1;
10
10
  const PUBKY_SESSIONS_STORE_NAME = "storedSessions";
11
11
  const PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME = "delegatedGrantKeys";
12
+ const PUBKY_APPROVAL_SESSION_VERSION = "pubky-session-v2";
12
13
 
13
14
  /** Assert that IndexedDB is available for browser session persistence. */
14
15
  function requireIndexedDb() {
@@ -53,42 +54,32 @@ function openSessionStoreDb() {
53
54
  }
54
55
 
55
56
  /**
56
- * Run an IndexedDB operation against the stored-session object store.
57
+ * Run an IndexedDB operation across session records and browser keys.
57
58
  *
58
- * The callback receives the object store and returns a request. This wrapper
59
+ * The callback receives the transaction and returns a request. This wrapper
59
60
  * resolves only after the transaction commits, not when the request succeeds.
60
61
  */
61
- async function withSessionStore(mode, operation) {
62
+ async function withSessionStores(mode, operation) {
62
63
  const db = await openSessionStoreDb();
63
64
  try {
64
65
  return await new Promise((resolve, reject) => {
65
- const tx = db.transaction(PUBKY_SESSIONS_STORE_NAME, mode);
66
- const store = tx.objectStore(PUBKY_SESSIONS_STORE_NAME);
66
+ const tx = db.transaction(
67
+ [PUBKY_SESSIONS_STORE_NAME, PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME], mode,
68
+ );
67
69
  let result;
68
- let settled = false;
69
-
70
- function fail(error) {
71
- if (settled) return;
72
- settled = true;
73
- reject(error);
74
- }
75
-
76
70
  try {
77
- const request = operation(store);
71
+ const request = operation(tx);
78
72
  request.onsuccess = () => {
79
73
  result = request.result;
80
74
  };
81
- request.onerror = () => fail(request.error ?? new Error("Pubky session store request failed."));
75
+ request.onerror = () => reject(request.error ?? new Error("Pubky session store request failed."));
82
76
  } catch (error) {
83
- fail(error);
77
+ tx.abort();
78
+ reject(error);
84
79
  }
85
- tx.onerror = () => fail(tx.error ?? new Error("Pubky session store transaction failed."));
86
- tx.onabort = () => fail(tx.error ?? new Error("Pubky session store transaction aborted."));
87
- tx.oncomplete = () => {
88
- if (settled) return;
89
- settled = true;
90
- resolve(result);
91
- };
80
+ tx.onerror = () => reject(tx.error ?? new Error("Pubky session store transaction failed."));
81
+ tx.onabort = () => reject(tx.error ?? new Error("Pubky session store transaction aborted."));
82
+ tx.oncomplete = () => resolve(result);
92
83
  });
93
84
  } finally {
94
85
  db.close();
@@ -99,6 +90,7 @@ async function withSessionStore(mode, operation) {
99
90
  async function __pubkySessionStoreIsAvailable() {
100
91
  if (!globalThis.indexedDB) return false;
101
92
  try {
93
+ if (!globalThis.navigator?.locks) return false;
102
94
  const db = await openSessionStoreDb();
103
95
  db.close();
104
96
  return true;
@@ -108,20 +100,48 @@ async function __pubkySessionStoreIsAvailable() {
108
100
  }
109
101
 
110
102
  /** Persist or replace a browser session record. */
111
- async function __pubkySessionStorePut(record) {
103
+ async function __pubkySessionStorePut(record, lease) {
112
104
  requireIndexedDb();
113
105
  try {
114
- await withSessionStore("readwrite", (store) => store.put(record));
106
+ const previous = await __pubkySessionStoreGet(record.id);
107
+ if (previous?.version === PUBKY_APPROVAL_SESSION_VERSION && record.version !== previous.version) {
108
+ throw new Error("Cannot replace a stored approval with an authentication-only record.");
109
+ }
110
+ const stored = { ...record };
111
+ if (previous?.sharedSession) stored.sharedSession = previous.sharedSession;
112
+ await withSessionStores("readwrite", tx => {
113
+ const held = requireSessionLease(lease, true);
114
+ if (held.id !== record.id || held.homeserver !== record.homeserver) {
115
+ throw new Error("Session record does not match its browser lock.");
116
+ }
117
+ return tx.objectStore(PUBKY_SESSIONS_STORE_NAME).put(stored);
118
+ });
115
119
  } catch (error) {
116
120
  throw contextualSessionStoreError("Saving Pubky session failed.", error);
117
121
  }
118
122
  }
119
123
 
124
+ function sessionMetadata(record) {
125
+ if (!record) return record;
126
+ const { version, id, storageMode, publicKey, homeserver, grantId, clientId,
127
+ capabilities, grantExpiresAt, createdAt } = record;
128
+ return { version, id, storageMode, publicKey, homeserver, grantId, clientId,
129
+ capabilities, grantExpiresAt, createdAt,
130
+ hasStoredApproval: record.signedApproval !== undefined,
131
+ };
132
+ }
133
+
134
+ async function __pubkySessionStoreMetadata(id) {
135
+ return sessionMetadata(await __pubkySessionStoreGet(id));
136
+ }
137
+
120
138
  /** Load a browser session record by id. */
121
139
  async function __pubkySessionStoreGet(id) {
122
140
  requireIndexedDb();
123
141
  try {
124
- return await withSessionStore("readonly", (store) => store.get(id));
142
+ return await withSessionStores("readonly", tx =>
143
+ tx.objectStore(PUBKY_SESSIONS_STORE_NAME).get(id),
144
+ );
125
145
  } catch (error) {
126
146
  throw contextualSessionStoreError("Reading Pubky session failed.", error);
127
147
  }
@@ -131,71 +151,139 @@ async function __pubkySessionStoreGet(id) {
131
151
  async function __pubkySessionStoreList() {
132
152
  if (!globalThis.indexedDB) return [];
133
153
  try {
134
- return (await withSessionStore("readonly", (store) => store.getAll())) ?? [];
154
+ const records = await withSessionStores("readonly", tx =>
155
+ tx.objectStore(PUBKY_SESSIONS_STORE_NAME).getAll(),
156
+ );
157
+ return records.map(sessionMetadata);
135
158
  } catch (_error) {
136
159
  return [];
137
160
  }
138
161
  }
139
162
 
140
- /** Remove one browser session record by id. */
141
- async function __pubkySessionStoreDelete(id) {
142
- requireIndexedDb();
143
- try {
144
- await withSessionStore("readwrite", (store) => store.delete(id));
145
- } catch (error) {
146
- throw contextualSessionStoreError("Removing Pubky session failed.", error);
147
- }
148
- }
149
-
150
- /**
151
- * Clear saved session records and the delegated keys referenced by those records.
152
- *
153
- * Delegated keys not referenced by the supplied ids are intentionally preserved,
154
- * because they may belong to pending or unsaved grant flows.
155
- */
156
- async function __pubkySessionStoreClear(delegatedKeyIds) {
163
+ /** Clear saved sessions and their keys, or every key when clearing all auth state. */
164
+ async function clearSessionStore(allKeys = false) {
157
165
  requireIndexedDb();
158
166
  const db = await openSessionStoreDb();
159
167
  try {
160
168
  await new Promise((resolve, reject) => {
161
169
  const tx = db.transaction(
162
- [PUBKY_SESSIONS_STORE_NAME, PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME],
163
- "readwrite",
170
+ [PUBKY_SESSIONS_STORE_NAME, PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME], "readwrite",
164
171
  );
165
172
  const sessions = tx.objectStore(PUBKY_SESSIONS_STORE_NAME);
166
173
  const keys = tx.objectStore(PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME);
167
- sessions.clear();
168
- for (const keyId of new Set(delegatedKeyIds ?? [])) {
169
- keys.delete(keyId);
170
- }
171
- tx.oncomplete = () => resolve();
172
- tx.onerror = () => reject(tx.error ?? new Error("Clearing Pubky session store failed."));
173
- tx.onabort = () => reject(tx.error ?? new Error("Clearing Pubky session store aborted."));
174
+ const records = sessions.getAll();
175
+ records.onsuccess = () => {
176
+ try {
177
+ if (allKeys) keys.clear();
178
+ else for (const record of records.result) {
179
+ if (record.storageMode === "delegated") keys.delete(JSON.parse(record.credential).keyId);
180
+ }
181
+ sessions.clear();
182
+ } catch (error) { tx.abort(); reject(error); }
183
+ };
184
+ tx.oncomplete = resolve;
185
+ tx.onerror = tx.onabort = () => reject(tx.error ?? new Error("Clearing browser sessions failed."));
174
186
  });
175
- } finally {
176
- db.close();
187
+ } finally { db.close(); }
188
+ }
189
+
190
+ const SESSION_STORE_LOCK = "pubky-session-store";
191
+ const sessionLeases = new Map();
192
+ let nextSessionLease = 0;
193
+ const sessionChannel = typeof indexedDB !== "undefined" && typeof BroadcastChannel === "function"
194
+ ? new BroadcastChannel("pubky-session-store") : null;
195
+ function notifySessionChange(detail) {
196
+ if (typeof globalThis.dispatchEvent === "function") {
197
+ globalThis.dispatchEvent(new CustomEvent("pubky-session-changed", { detail }));
177
198
  }
178
199
  }
200
+ if (sessionChannel) sessionChannel.onmessage = event => notifySessionChange(event.data);
201
+ function sessionChanged(id, action) {
202
+ const detail = { id, action };
203
+ notifySessionChange(detail);
204
+ sessionChannel?.postMessage(detail);
205
+ }
179
206
 
180
- /** Clear all browser auth records, including all delegated key handles. */
181
- async function __pubkySessionStoreClearAll() {
182
- requireIndexedDb();
207
+ function __pubkySessionAcquire(id, homeserver, exclusive) {
208
+ if (!globalThis.navigator?.locks) throw new Error("Browser sessions require Web Locks in a secure context.");
209
+ const token = ++nextSessionLease;
210
+ const abort = new AbortController();
211
+ let release, ready, failed;
212
+ const held = new Promise(resolve => { release = resolve; });
213
+ const waiting = new Promise((resolve, reject) => { ready = resolve; failed = reject; });
214
+ // Cancellation can drop the Rust future before it starts awaiting this promise.
215
+ waiting.catch(() => {});
216
+ const lease = { id, homeserver, exclusive, abort, release, waiting, active: false };
217
+ sessionLeases.set(token, lease);
218
+ navigator.locks.request(SESSION_STORE_LOCK, { mode: "shared", signal: abort.signal }, () =>
219
+ navigator.locks.request(`pubky-shared-session:${homeserver}:${id}`, {
220
+ mode: exclusive ? "exclusive" : "shared", signal: abort.signal,
221
+ }, async () => {
222
+ lease.active = true;
223
+ ready();
224
+ await held;
225
+ })
226
+ ).catch(failed);
227
+ return token;
228
+ }
229
+ function __pubkySessionWait(token) {
230
+ return sessionLeases.get(token).waiting;
231
+ }
232
+ function __pubkySessionRelease(token) {
233
+ const lease = sessionLeases.get(token);
234
+ if (!lease) return;
235
+ lease.active = false;
236
+ lease.abort.abort();
237
+ lease.release();
238
+ sessionLeases.delete(token);
239
+ }
240
+ function requireSessionLease(token, write = false) {
241
+ const lease = sessionLeases.get(token);
242
+ if (!lease?.active || (write && !lease.exclusive)) throw new Error("Browser session lock was released.");
243
+ return lease;
244
+ }
245
+ async function __pubkySharedSessionLoad(token) {
246
+ const lease = requireSessionLease(token);
247
+ const record = await __pubkySessionStoreGet(lease.id);
248
+ if (record && record.homeserver !== lease.homeserver) throw new Error("Stored session homeserver changed.");
249
+ return record?.sharedSession;
250
+ }
251
+ async function __pubkySharedSessionStore(token, sharedSession) {
252
+ const lease = requireSessionLease(token, true);
253
+ const record = await __pubkySessionStoreGet(lease.id);
254
+ if (!record || record.homeserver !== lease.homeserver) throw new Error("Browser session was removed or changed.");
255
+ await withSessionStores("readwrite", tx => {
256
+ requireSessionLease(token, true);
257
+ return tx.objectStore(PUBKY_SESSIONS_STORE_NAME).put({ ...record, sharedSession });
258
+ });
259
+ }
260
+ async function __pubkySharedSessionRemove(token) {
261
+ const lease = requireSessionLease(token, true);
262
+ const record = await __pubkySessionStoreGet(lease.id);
263
+ if (!record) return;
183
264
  const db = await openSessionStoreDb();
184
265
  try {
266
+ requireSessionLease(token, true);
185
267
  await new Promise((resolve, reject) => {
186
- const tx = db.transaction(
187
- [PUBKY_SESSIONS_STORE_NAME, PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME],
188
- "readwrite",
189
- );
190
- tx.objectStore(PUBKY_SESSIONS_STORE_NAME).clear();
191
- tx.objectStore(PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME).clear();
192
- tx.oncomplete = () => resolve();
193
- tx.onerror = () => reject(tx.error ?? new Error("Clearing Pubky auth store failed."));
194
- tx.onabort = () => reject(tx.error ?? new Error("Clearing Pubky auth store aborted."));
268
+ const tx = db.transaction([PUBKY_SESSIONS_STORE_NAME, PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME], "readwrite");
269
+ tx.objectStore(PUBKY_SESSIONS_STORE_NAME).delete(lease.id);
270
+ if (record.storageMode === "delegated") {
271
+ const { keyId } = JSON.parse(record.credential);
272
+ tx.objectStore(PUBKY_SESSIONS_DELEGATED_KEYS_STORE_NAME).delete(keyId);
273
+ }
274
+ tx.oncomplete = resolve;
275
+ tx.onerror = tx.onabort = () => reject(tx.error ?? new Error("Removing browser session failed."));
195
276
  });
196
- } finally {
197
- db.close();
198
- }
277
+ } finally { db.close(); }
278
+ sessionChanged(lease.id, "removed");
279
+ }
280
+ async function __pubkySessionStoreClear() {
281
+ await navigator.locks.request(SESSION_STORE_LOCK, () => clearSessionStore());
282
+ sessionChanged(null, "cleared");
283
+ }
284
+ async function __pubkySessionStoreClearAll() {
285
+ await navigator.locks.request(SESSION_STORE_LOCK, () => clearSessionStore(true));
286
+ sessionChanged(null, "cleared");
199
287
  }
200
288
 
201
289
  const PUBKY_GRANT_KEYS_DB_NAME = "pubky-auth";
@@ -445,22 +533,40 @@ async function __pubkyGrantLoadDelegatedPublicKey(keyId) {
445
533
  * bytes are returned to Rust, which finishes compact JWS serialization.
446
534
  */
447
535
  async function __pubkyGrantDelegatedSign(keyId, signingInput) {
448
- requireBrowserCrypto();
449
- const existing = await getRecord(keyId);
450
- if (!existing?.privateKey) throw new Error(`Delegated grant key not found: ${keyId}`);
536
+ let existing;
537
+ try {
538
+ requireBrowserCrypto();
539
+ existing = await getRecord(keyId);
540
+ if (!existing?.privateKey) throw new Error(`Delegated grant key not found: ${keyId}`);
541
+ } catch (cause) {
542
+ // getRecord wraps IndexedDB failures; retain the underlying diagnostic.
543
+ const detail = cause?.cause ?? cause;
544
+ const error = contextualError(
545
+ `Delegated grant signing key unavailable: ${detail?.message ?? String(detail)}`,
546
+ cause,
547
+ );
548
+ error.code = "SigningKeyUnavailable";
549
+ throw error;
550
+ }
451
551
  const data = new TextEncoder().encode(signingInput);
452
552
  return new Uint8Array(await crypto.subtle.sign({ name: "Ed25519" }, existing.privateKey, data));
453
553
  }
454
554
 
455
- /**
456
- * Delete a browser-held delegated grant key by id.
457
- *
458
- * Used when a persisted delegated session record is removed from the SDK
459
- * session store. Missing keys are treated as already deleted.
460
- */
461
- async function __pubkyGrantDeleteDelegatedKey(keyId) {
462
- requireBrowserCrypto();
463
- await deleteRecord(keyId);
555
+
556
+ function __pubkyRecoveredEncryptionKeys(publicKey, grantId, keys) {
557
+ return { publicKey, grantId, keys };
558
+ }
559
+
560
+ async function __pubkyImportEncryptionCryptoKey(bytes) {
561
+ try {
562
+ if (!globalThis.crypto?.subtle) {
563
+ throw new Error("WebCrypto is unavailable; use a secure context.");
564
+ }
565
+ return await globalThis.crypto.subtle.importKey(
566
+ "raw", bytes, "AES-GCM", false, ["encrypt", "decrypt"]);
567
+ } finally {
568
+ bytes.fill(0);
569
+ }
464
570
  }
465
571
 
466
572
  /**
@@ -873,7 +979,7 @@ class BrowserSessionStore {
873
979
  * This removes all stored session records and all browser-held delegated
874
980
  * grant keys, including keys for pending delegated grant flows. Saved
875
981
  * delegated flow state becomes unrestorable. This does not revoke remote
876
- * grants or immediately invalidate already-live in-memory sessions.
982
+ * grants. Browser-managed handles stop working when their saved record is removed.
877
983
  * @returns {Promise<void>}
878
984
  */
879
985
  clearAll() {
@@ -892,7 +998,7 @@ class BrowserSessionStore {
892
998
  return ret;
893
999
  }
894
1000
  /**
895
- * Whether IndexedDB is available for durable session persistence.
1001
+ * Whether IndexedDB and Web Locks are available.
896
1002
  * @returns {Promise<boolean>}
897
1003
  */
898
1004
  isAvailable() {
@@ -918,8 +1024,28 @@ class BrowserSessionStore {
918
1024
  const ret = wasm.browsersessionstore_remove(this.__wbg_ptr, ptr0, len0);
919
1025
  return ret;
920
1026
  }
1027
+ /**
1028
+ * Recover a stored session's encryption keys without network access.
1029
+ * Verifies the signed approval, exact grant binding, and requested session
1030
+ * identity. Works after grant expiry/revocation and without the delegated
1031
+ * WebCrypto signing key.
1032
+ * Restore material is stored as plaintext in IndexedDB.
1033
+ * Bare-grant records return undefined; signed approvals without `e` scopes
1034
+ * return an empty bundle. Creates no session.
1035
+ * @param {string} id
1036
+ * @returns {Promise<EncryptionKeys | undefined>}
1037
+ */
1038
+ restoreEncryptionKeys(id) {
1039
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1040
+ const len0 = WASM_VECTOR_LEN;
1041
+ const ret = wasm.browsersessionstore_restoreEncryptionKeys(this.__wbg_ptr, ptr0, len0);
1042
+ return ret;
1043
+ }
921
1044
  /**
922
1045
  * Restore a specific stored session by id.
1046
+ *
1047
+ * Shares one bearer with other tabs on this origin. Requires IndexedDB and
1048
+ * Web Locks in a secure browser context.
923
1049
  * @param {string} id
924
1050
  * @returns {Promise<Session>}
925
1051
  */
@@ -930,7 +1056,11 @@ class BrowserSessionStore {
930
1056
  return ret;
931
1057
  }
932
1058
  /**
933
- * Persist a completed grant session in IndexedDB.
1059
+ * Persist a completed grant session and its optional signed approval.
1060
+ * Confidential restore material is stored as plaintext in IndexedDB.
1061
+ * Delegated signing keys remain non-extractable WebCrypto keys.
1062
+ * Records are identified by user and grant ID. Reauthorizing the same
1063
+ * client creates a separate record; use the returned ID to restore it.
934
1064
  * @param {Session} session
935
1065
  * @returns {Promise<StoredSessionInfo>}
936
1066
  */
@@ -1205,6 +1335,90 @@ class DirectSignupDeepLink {
1205
1335
  if (Symbol.dispose) DirectSignupDeepLink.prototype[Symbol.dispose] = DirectSignupDeepLink.prototype.free;
1206
1336
  exports.DirectSignupDeepLink = DirectSignupDeepLink;
1207
1337
 
1338
+ /**
1339
+ * Verified scoped encryption keys obtained from a session or offline recovery.
1340
+ * This object owns its secrets independently of the session and grants no storage
1341
+ * access. Call `free()` when finished; secret bytes are zeroized on free/drop.
1342
+ */
1343
+ class EncryptionKeys {
1344
+ static __wrap(ptr) {
1345
+ const obj = Object.create(EncryptionKeys.prototype);
1346
+ obj.__wbg_ptr = ptr;
1347
+ EncryptionKeysFinalization.register(obj, obj.__wbg_ptr, obj);
1348
+ return obj;
1349
+ }
1350
+ __destroy_into_raw() {
1351
+ const ptr = this.__wbg_ptr;
1352
+ this.__wbg_ptr = 0;
1353
+ EncryptionKeysFinalization.unregister(this);
1354
+ return ptr;
1355
+ }
1356
+ free() {
1357
+ const ptr = this.__destroy_into_raw();
1358
+ wasm.__wbg_encryptionkeys_free(ptr, 0);
1359
+ }
1360
+ /**
1361
+ * Derive a non-extractable AES-GCM-256 key for WebCrypto encryption/decryption.
1362
+ * Rejects directories and files outside approved scopes. Requires WebCrypto.
1363
+ * Temporary JS key bytes are cleared after import, including on failure.
1364
+ * @param {string} path
1365
+ * @returns {Promise<CryptoKey>}
1366
+ */
1367
+ deriveCryptoKeyForPath(path) {
1368
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1369
+ const len0 = WASM_VECTOR_LEN;
1370
+ const ret = wasm.encryptionkeys_deriveCryptoKeyForPath(this.__wbg_ptr, ptr0, len0);
1371
+ return ret;
1372
+ }
1373
+ /**
1374
+ * Derive a 32-byte content key for a canonical decoded file path.
1375
+ * Rejects directories and files outside the approved scopes. The caller
1376
+ * owns the JS byte copy and should clear it after use.
1377
+ * @param {string} path
1378
+ * @returns {Uint8Array}
1379
+ */
1380
+ deriveForPath(path) {
1381
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1382
+ const len0 = WASM_VECTOR_LEN;
1383
+ const ret = wasm.encryptionkeys_deriveForPath(this.__wbg_ptr, ptr0, len0);
1384
+ if (ret[2]) {
1385
+ throw takeFromExternrefTable0(ret[1]);
1386
+ }
1387
+ return takeFromExternrefTable0(ret[0]);
1388
+ }
1389
+ /**
1390
+ * Recover authenticated identity and keys from an exportLocalSecret() token offline.
1391
+ * Verifies the signed approval and grant binding even if the grant expired
1392
+ * or was revoked. Bare-grant tokens return undefined; signed approvals
1393
+ * without `e` scopes return a result with an empty key bundle.
1394
+ * Check publicKey (z-base-32) against the expected account and grantId
1395
+ * against the expected grant before using keys. Call keys.free() when done.
1396
+ * @param {string} token
1397
+ * @returns {RecoveredEncryptionKeys | undefined}
1398
+ */
1399
+ static fromLocalSecret(token) {
1400
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1401
+ const len0 = WASM_VECTOR_LEN;
1402
+ const ret = wasm.encryptionkeys_fromLocalSecret(ptr0, len0);
1403
+ if (ret[2]) {
1404
+ throw takeFromExternrefTable0(ret[1]);
1405
+ }
1406
+ return takeFromExternrefTable0(ret[0]);
1407
+ }
1408
+ /**
1409
+ * Approved scopes; directory scopes cover descendant files.
1410
+ * @returns {string[]}
1411
+ */
1412
+ get scopes() {
1413
+ const ret = wasm.encryptionkeys_scopes(this.__wbg_ptr);
1414
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
1415
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1416
+ return v1;
1417
+ }
1418
+ }
1419
+ if (Symbol.dispose) EncryptionKeys.prototype[Symbol.dispose] = EncryptionKeys.prototype.free;
1420
+ exports.EncryptionKeys = EncryptionKeys;
1421
+
1208
1422
  /**
1209
1423
  * A single event from the event stream.
1210
1424
  *
@@ -1626,7 +1840,8 @@ class GrantAuthFlow {
1626
1840
  * Resume a previously saved pending grant auth flow (standalone).
1627
1841
  * Prefer `pubky.resumeGrantAuthFlow()` to reuse a facade client.
1628
1842
  *
1629
- * **Security:** `savedState` contains the relay secret and PoP client private key.
1843
+ * **Security:** `savedState` contains the PoP client private key and either
1844
+ * a shared relay secret or a temporary HPKE recipient secret.
1630
1845
  * Store it only temporarily and delete it once the flow completes or is abandoned.
1631
1846
  *
1632
1847
  * @param {string} savedState A string produced by `grantFlow.saveLocal()`.
@@ -1646,9 +1861,9 @@ class GrantAuthFlow {
1646
1861
  /**
1647
1862
  * Save sensitive state required to resume this delegated pending grant flow.
1648
1863
  *
1649
- * This does not export the delegated private key, but it includes the relay
1650
- * secret in the authorization URL. Store it only temporarily and delete it
1651
- * once the flow completes or is abandoned.
1864
+ * This includes either a shared relay secret or a temporary HPKE recipient
1865
+ * secret. Store it only temporarily and delete it once the flow completes
1866
+ * or is abandoned.
1652
1867
  * @returns {string}
1653
1868
  */
1654
1869
  saveDelegated() {
@@ -1936,11 +2151,40 @@ class GrantSession {
1936
2151
  const ptr = this.__destroy_into_raw();
1937
2152
  wasm.__wbg_grantsession_free(ptr, 0);
1938
2153
  }
2154
+ /**
2155
+ * Sign JSON data and return both the custom proof and its root-signed grant.
2156
+ * Data follows `JSON.stringify` semantics, e.g. `undefined` properties are omitted.
2157
+ * Each proof carries its signing time (`iat`) and a random `nonce`.
2158
+ * Makes no network requests. Your applications handle freshness and replay protection.
2159
+ * @param {JsonValue} data
2160
+ * @returns {Promise<CustomPop>}
2161
+ */
2162
+ createCustomPop(data) {
2163
+ const ret = wasm.grantsession_createCustomPop(this.__wbg_ptr, data);
2164
+ return ret;
2165
+ }
2166
+ /**
2167
+ * Return scoped keys with the same derivation API as offline recovered keys.
2168
+ * Bare grants return `undefined`; signed approvals without `e` scopes
2169
+ * return an object with empty scopes.
2170
+ * Each access creates an owned copy. Keep it for repeated use and call
2171
+ * `free()` when finished. It remains usable after this view or its session
2172
+ * is freed, signed out, or revoked; freeing it does not affect the session.
2173
+ * @returns {EncryptionKeys | undefined}
2174
+ */
2175
+ get encryptionKeys() {
2176
+ const ret = wasm.grantsession_encryptionKeys(this.__wbg_ptr);
2177
+ if (ret[2]) {
2178
+ throw takeFromExternrefTable0(ret[1]);
2179
+ }
2180
+ return ret[0] === 0 ? undefined : EncryptionKeys.__wrap(ret[0]);
2181
+ }
1939
2182
  /**
1940
2183
  * Export the portable local secret material needed to restore this grant session.
1941
2184
  *
1942
2185
  * Treat the returned string as bearer-equivalent secret material until the
1943
- * grant expires or is revoked.
2186
+ * grant expires or is revoked. Included scoped keys remain sensitive after
2187
+ * expiry or revocation.
1944
2188
  *
1945
2189
  * @returns {Promise<string>}
1946
2190
  * @returns {Promise<string>}
@@ -2777,8 +3021,9 @@ class Pubky {
2777
3021
  /**
2778
3022
  * Resume a previously saved pending grant auth flow.
2779
3023
  *
2780
- * **Security:** `savedState` contains the relay secret and PoP client private key.
2781
- * Delete it from storage as soon as the resumed flow completes.
3024
+ * **Security:** `savedState` contains the PoP client private key and either
3025
+ * a shared relay secret or a temporary HPKE private key. Delete it from
3026
+ * storage when the flow completes or is abandoned.
2782
3027
  *
2783
3028
  * @param {string} savedState A string produced by `grantFlow.saveLocal()`.
2784
3029
  * @returns {GrantAuthFlow} A flow reconnected to the original relay channel.
@@ -2870,11 +3115,13 @@ class Pubky {
2870
3115
  *
2871
3116
  * Grant auth uses a user-signed grant JWS plus Proof-of-Possession and
2872
3117
  * returns a self-refreshing session.
3118
+ * Select `approvalFormat: "signedApprovalV1"` and include `e` on scopes that need content
3119
+ * keys. Storage `r` and `w` alone do not deliver encryption keys.
2873
3120
  *
2874
3121
  * @param {string} capabilities Comma-separated caps, e.g. `"/pub/app/:rw,/pub/foo/file:r"`.
2875
3122
  * @param {AuthFlowKind} kind The kind of authentication flow to perform.
2876
3123
  * @param {GrantAuthFlowOptions} options Options for the grant flow:
2877
- * `{ clientId, relay?, xCallback? }`.
3124
+ * `{ clientId, relay?, xCallback?, approvalFormat? }`.
2878
3125
  * @returns {Promise<GrantAuthFlow>}
2879
3126
  * A running grant auth flow. Show `authorizationUrl` as QR/deeplink,
2880
3127
  * then `awaitApproval()` to obtain a grant-backed `Session`.
@@ -3560,7 +3807,8 @@ exports.SessionInfo = SessionInfo;
3560
3807
  * Only {@link SessionStorage.exists} and {@link SessionStorage.stats} treat
3561
3808
  * HTTP 404/410 as missing. Other HTTP failures, including 401/403 and 5xx, reject.
3562
3809
  * Writes require write permission and can fail on directory targets (400),
3563
- * file/directory path conflicts (409), or exceeded quotas (507).
3810
+ * file/directory path conflicts (409), a path someone holds a
3811
+ * {@link StorageLock} on (423), or exceeded quotas (507).
3564
3812
  */
3565
3813
  class SessionStorage {
3566
3814
  static __wrap(ptr) {
@@ -3579,6 +3827,22 @@ class SessionStorage {
3579
3827
  const ptr = this.__destroy_into_raw();
3580
3828
  wasm.__wbg_sessionstorage_free(ptr, 0);
3581
3829
  }
3830
+ /**
3831
+ * `DELETE` the path of a lock this client holds. The lock stays in place.
3832
+ *
3833
+ * @param {StorageLock} lock A lock this client holds.
3834
+ * @returns {Promise<void>}
3835
+ * @throws {PubkyError} A lock that has expired or was unlocked rejects with
3836
+ * `RequestError` and status `412`; take a new one.
3837
+ * Otherwise as {@link SessionStorage.delete}.
3838
+ * @param {StorageLock} lock
3839
+ * @returns {Promise<void>}
3840
+ */
3841
+ deleteLocked(lock) {
3842
+ _assertClass(lock, StorageLock);
3843
+ const ret = wasm.sessionstorage_deleteLocked(this.__wbg_ptr, lock.__wbg_ptr);
3844
+ return ret;
3845
+ }
3582
3846
  /**
3583
3847
  * Delete a file. Directory targets are unsupported.
3584
3848
  *
@@ -3700,6 +3964,52 @@ class SessionStorage {
3700
3964
  const ret = wasm.sessionstorage_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
3701
3965
  return ret;
3702
3966
  }
3967
+ /**
3968
+ * Take an exclusive write lock on a file at an **absolute session path**.
3969
+ *
3970
+ * The file need not exist; locking a free path reserves it. `timeoutSeconds` is
3971
+ * the lifetime asked for; the homeserver caps it, and
3972
+ * {@link StorageLock.timeoutSeconds} tells what was granted. A write made under
3973
+ * the lock keeps it alive until the write ends, so it need not cover the upload itself.
3974
+ *
3975
+ * @param {Path} path File path; must not end with `/`.
3976
+ * @param {number} timeoutSeconds Lifetime to ask for, in seconds; rounded down to
3977
+ * whole seconds, and at least 1.
3978
+ * @returns {Promise<StorageLock>} The granted lock.
3979
+ * @throws {PubkyError} `InvalidInput` for a negative, NaN or out-of-range timeout;
3980
+ * a path that is already locked rejects with `RequestError` and status `423`;
3981
+ * directory targets with `400`; a homeserver without lock support with `405`.
3982
+ * See {@link SessionStorage} for shared errors.
3983
+ * @param {Path} path
3984
+ * @param {number} timeout_seconds
3985
+ * @returns {Promise<StorageLock>}
3986
+ */
3987
+ lock(path, timeout_seconds) {
3988
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3989
+ const len0 = WASM_VECTOR_LEN;
3990
+ const ret = wasm.sessionstorage_lock(this.__wbg_ptr, ptr0, len0, timeout_seconds);
3991
+ return ret;
3992
+ }
3993
+ /**
3994
+ * `PUT` binary data to the path of a lock this client holds.
3995
+ *
3996
+ * @param {StorageLock} lock A lock this client holds.
3997
+ * @param {Uint8Array} body
3998
+ * @returns {Promise<void>}
3999
+ * @throws {PubkyError} A lock that has expired or was unlocked rejects with
4000
+ * `RequestError` and status `412`; take a new one and read the file again.
4001
+ * Otherwise as {@link SessionStorage.putBytes}.
4002
+ * @param {StorageLock} lock
4003
+ * @param {Uint8Array} body
4004
+ * @returns {Promise<void>}
4005
+ */
4006
+ putBytesLocked(lock, body) {
4007
+ _assertClass(lock, StorageLock);
4008
+ const ptr0 = passArray8ToWasm0(body, wasm.__wbindgen_malloc);
4009
+ const len0 = WASM_VECTOR_LEN;
4010
+ const ret = wasm.sessionstorage_putBytesLocked(this.__wbg_ptr, lock.__wbg_ptr, ptr0, len0);
4011
+ return ret;
4012
+ }
3703
4013
  /**
3704
4014
  * Create or replace a file with binary data at an absolute session path.
3705
4015
  *
@@ -3737,6 +4047,26 @@ class SessionStorage {
3737
4047
  const ret = wasm.sessionstorage_putJson(this.__wbg_ptr, ptr0, len0, body);
3738
4048
  return ret;
3739
4049
  }
4050
+ /**
4051
+ * `PUT` text to the path of a lock this client holds.
4052
+ *
4053
+ * @param {StorageLock} lock A lock this client holds.
4054
+ * @param {string} body
4055
+ * @returns {Promise<void>}
4056
+ * @throws {PubkyError} A lock that has expired or was unlocked rejects with
4057
+ * `RequestError` and status `412`; take a new one and read the file again.
4058
+ * Otherwise as {@link SessionStorage.putText}.
4059
+ * @param {StorageLock} lock
4060
+ * @param {string} body
4061
+ * @returns {Promise<void>}
4062
+ */
4063
+ putTextLocked(lock, body) {
4064
+ _assertClass(lock, StorageLock);
4065
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4066
+ const len0 = WASM_VECTOR_LEN;
4067
+ const ret = wasm.sessionstorage_putTextLocked(this.__wbg_ptr, lock.__wbg_ptr, ptr0, len0);
4068
+ return ret;
4069
+ }
3740
4070
  /**
3741
4071
  * Create or replace a file with text at an absolute session path.
3742
4072
  *
@@ -3756,6 +4086,29 @@ class SessionStorage {
3756
4086
  const ret = wasm.sessionstorage_putText(this.__wbg_ptr, ptr0, len0, ptr1, len1);
3757
4087
  return ret;
3758
4088
  }
4089
+ /**
4090
+ * Restart the lifetime of a lock this client holds.
4091
+ *
4092
+ * On success the lock carries the newly granted
4093
+ * {@link StorageLock.timeoutSeconds}.
4094
+ *
4095
+ * @param {StorageLock} lock A lock this client holds.
4096
+ * @param {number} timeoutSeconds Lifetime to ask for, in seconds; rounded down to
4097
+ * whole seconds, and at least 1.
4098
+ * @returns {Promise<void>}
4099
+ * @throws {PubkyError} A lock that has expired or was unlocked rejects with
4100
+ * `RequestError` and status `412`; take a new one and read the file again.
4101
+ * `InvalidInput` for a negative, NaN or out-of-range timeout.
4102
+ * See {@link SessionStorage} for shared errors.
4103
+ * @param {StorageLock} lock
4104
+ * @param {number} timeout_seconds
4105
+ * @returns {Promise<void>}
4106
+ */
4107
+ refreshLock(lock, timeout_seconds) {
4108
+ _assertClass(lock, StorageLock);
4109
+ const ret = wasm.sessionstorage_refreshLock(this.__wbg_ptr, lock.__wbg_ptr, timeout_seconds);
4110
+ return ret;
4111
+ }
3759
4112
  /**
3760
4113
  * Get metadata for an absolute, session-scoped path (e.g. `"/pub/app/file.json"`).
3761
4114
  *
@@ -3773,6 +4126,21 @@ class SessionStorage {
3773
4126
  const ret = wasm.sessionstorage_stats(this.__wbg_ptr, ptr0, len0);
3774
4127
  return ret;
3775
4128
  }
4129
+ /**
4130
+ * Release a lock this client holds.
4131
+ *
4132
+ * @param {StorageLock} lock A lock this client holds.
4133
+ * @returns {Promise<void>}
4134
+ * @throws {PubkyError} A lock that no longer exists rejects with `RequestError`
4135
+ * and status `409`. See {@link SessionStorage} for shared errors.
4136
+ * @param {StorageLock} lock
4137
+ * @returns {Promise<void>}
4138
+ */
4139
+ unlock(lock) {
4140
+ _assertClass(lock, StorageLock);
4141
+ const ret = wasm.sessionstorage_unlock(this.__wbg_ptr, lock.__wbg_ptr);
4142
+ return ret;
4143
+ }
3776
4144
  }
3777
4145
  if (Symbol.dispose) SessionStorage.prototype[Symbol.dispose] = SessionStorage.prototype.free;
3778
4146
  exports.SessionStorage = SessionStorage;
@@ -3868,7 +4236,8 @@ class Signer {
3868
4236
  /**
3869
4237
  * Blocking sign-in. Waits for PKDNS publish to complete (slower; safer).
3870
4238
  *
3871
- * Creates a valid grant-backed homeserver Session with root capabilities.
4239
+ * Creates a grant-backed homeserver session with root storage access (`/:rw`).
4240
+ * Encryption keys require an explicit `e` request through a signed approval flow.
3872
4241
  * `clientId` is shown in the user's grant/session list.
3873
4242
  * @param {string} clientId App identifier, typically a domain.
3874
4243
  *
@@ -3905,7 +4274,8 @@ class Signer {
3905
4274
  /**
3906
4275
  * Fast sign-in for a returning user. Publishes PKDNS in the background.
3907
4276
  *
3908
- * Creates a valid grant-backed homeserver Session with root capabilities.
4277
+ * Creates a grant-backed homeserver session with root storage access (`/:rw`).
4278
+ * Encryption keys require an explicit `e` request through a signed approval flow.
3909
4279
  * `clientId` is shown in the user's grant/session list.
3910
4280
  * @param {string} clientId App identifier, typically a domain.
3911
4281
  *
@@ -4083,6 +4453,22 @@ class SigninGrantDeepLink {
4083
4453
  const ptr = this.__destroy_into_raw();
4084
4454
  wasm.__wbg_signingrantdeeplink_free(ptr, 0);
4085
4455
  }
4456
+ /**
4457
+ * Negotiated approval format: `bareGrant` or `signedApprovalV1`.
4458
+ * @returns {string}
4459
+ */
4460
+ get approvalFormat() {
4461
+ let deferred1_0;
4462
+ let deferred1_1;
4463
+ try {
4464
+ const ret = wasm.signingrantdeeplink_approvalFormat(this.__wbg_ptr);
4465
+ deferred1_0 = ret[0];
4466
+ deferred1_1 = ret[1];
4467
+ return getStringFromWasm0(ret[0], ret[1]);
4468
+ } finally {
4469
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4470
+ }
4471
+ }
4086
4472
  /**
4087
4473
  * Base HTTP relay inbox URL used by this auth request.
4088
4474
  *
@@ -4147,6 +4533,19 @@ class SigninGrantDeepLink {
4147
4533
  const ret = wasm.signingrantdeeplink_clientPublicKey(this.__wbg_ptr);
4148
4534
  return PublicKey.__wrap(ret);
4149
4535
  }
4536
+ /**
4537
+ * The 32-byte ephemeral HPKE public key from `epk`, or `undefined`
4538
+ * for a shared-secret link. The relay channel ID is the unpadded
4539
+ * base64url encoding of BLAKE3("pubky-grant-relay-channel-v1" || 0x00 || epk),
4540
+ * where `||` concatenates bytes and `epk` is the raw 32-byte public key.
4541
+ *
4542
+ * @returns {Uint8Array|undefined}
4543
+ * @returns {Uint8Array | undefined}
4544
+ */
4545
+ get ephemeralPublicKey() {
4546
+ const ret = wasm.signingrantdeeplink_ephemeralPublicKey(this.__wbg_ptr);
4547
+ return ret;
4548
+ }
4150
4549
  /**
4151
4550
  * Parse a grant signin deeplink URL.
4152
4551
  *
@@ -4166,12 +4565,11 @@ class SigninGrantDeepLink {
4166
4565
  return SigninGrantDeepLink.__wrap(ret[0]);
4167
4566
  }
4168
4567
  /**
4169
- * Relay channel secret embedded in the deeplink.
4170
- *
4171
- * Treat this as sensitive temporary auth-flow material.
4568
+ * Shared relay secret, or `undefined` for an HPKE link.
4569
+ * Keep this secret confidential until the flow completes or is abandoned.
4172
4570
  *
4173
- * @returns {Uint8Array}
4174
- * @returns {Uint8Array}
4571
+ * @returns {Uint8Array|undefined}
4572
+ * @returns {Uint8Array | undefined}
4175
4573
  */
4176
4574
  get secret() {
4177
4575
  const ret = wasm.signingrantdeeplink_secret(this.__wbg_ptr);
@@ -4349,6 +4747,22 @@ class SignupGrantDeepLink {
4349
4747
  const ptr = this.__destroy_into_raw();
4350
4748
  wasm.__wbg_signupgrantdeeplink_free(ptr, 0);
4351
4749
  }
4750
+ /**
4751
+ * Negotiated approval format: `bareGrant` or `signedApprovalV1`.
4752
+ * @returns {string}
4753
+ */
4754
+ get approvalFormat() {
4755
+ let deferred1_0;
4756
+ let deferred1_1;
4757
+ try {
4758
+ const ret = wasm.signupgrantdeeplink_approvalFormat(this.__wbg_ptr);
4759
+ deferred1_0 = ret[0];
4760
+ deferred1_1 = ret[1];
4761
+ return getStringFromWasm0(ret[0], ret[1]);
4762
+ } finally {
4763
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4764
+ }
4765
+ }
4352
4766
  /**
4353
4767
  * Base HTTP relay inbox URL used by this auth request.
4354
4768
  *
@@ -4413,6 +4827,19 @@ class SignupGrantDeepLink {
4413
4827
  const ret = wasm.signupgrantdeeplink_clientPublicKey(this.__wbg_ptr);
4414
4828
  return PublicKey.__wrap(ret);
4415
4829
  }
4830
+ /**
4831
+ * The 32-byte ephemeral HPKE public key from `epk`, or `undefined`
4832
+ * for a shared-secret link. The relay channel ID is the unpadded
4833
+ * base64url encoding of BLAKE3("pubky-grant-relay-channel-v1" || 0x00 || epk),
4834
+ * where `||` concatenates bytes and `epk` is the raw 32-byte public key.
4835
+ *
4836
+ * @returns {Uint8Array|undefined}
4837
+ * @returns {Uint8Array | undefined}
4838
+ */
4839
+ get ephemeralPublicKey() {
4840
+ const ret = wasm.signupgrantdeeplink_ephemeralPublicKey(this.__wbg_ptr);
4841
+ return ret;
4842
+ }
4416
4843
  /**
4417
4844
  * Homeserver public key requested for account creation.
4418
4845
  *
@@ -4442,12 +4869,11 @@ class SignupGrantDeepLink {
4442
4869
  return SignupGrantDeepLink.__wrap(ret[0]);
4443
4870
  }
4444
4871
  /**
4445
- * Relay channel secret embedded in the deeplink.
4446
- *
4447
- * Treat this as sensitive temporary auth-flow material.
4872
+ * Shared relay secret, or `undefined` for an HPKE link.
4873
+ * Keep this secret confidential until the flow completes or is abandoned.
4448
4874
  *
4449
- * @returns {Uint8Array}
4450
- * @returns {Uint8Array}
4875
+ * @returns {Uint8Array|undefined}
4876
+ * @returns {Uint8Array | undefined}
4451
4877
  */
4452
4878
  get secret() {
4453
4879
  const ret = wasm.signupgrantdeeplink_secret(this.__wbg_ptr);
@@ -4501,6 +4927,107 @@ class SignupGrantDeepLink {
4501
4927
  if (Symbol.dispose) SignupGrantDeepLink.prototype[Symbol.dispose] = SignupGrantDeepLink.prototype.free;
4502
4928
  exports.SignupGrantDeepLink = SignupGrantDeepLink;
4503
4929
 
4930
+ /**
4931
+ * An exclusive write lock on one file path, granted by the homeserver.
4932
+ *
4933
+ * While the lock lives, only writes that present it are accepted on the path;
4934
+ * every other write, and every other {@link SessionStorage.lock}, rejects with
4935
+ * `423 Locked`. The lock ends when it is {@link SessionStorage.unlock | unlocked}
4936
+ * or when its {@link StorageLock.timeoutSeconds} runs out without a
4937
+ * {@link SessionStorage.refreshLock | refresh}, so a client that disappears never
4938
+ * blocks a path for long.
4939
+ *
4940
+ * The lock is a bearer token: whoever holds this value, and may write the path,
4941
+ * can use and release the lock.
4942
+ *
4943
+ * Calls that take the lock may overlap: a {@link SessionStorage.refreshLock | refresh}
4944
+ * can run while a locked write is in flight.
4945
+ *
4946
+ * @example
4947
+ * const lock = await session.storage.lock("/pub/my.app/state.json", 30);
4948
+ * const state = await session.storage.getText(lock.path);
4949
+ * await session.storage.putTextLocked(lock, state);
4950
+ * await session.storage.unlock(lock);
4951
+ */
4952
+ class StorageLock {
4953
+ static __wrap(ptr) {
4954
+ const obj = Object.create(StorageLock.prototype);
4955
+ obj.__wbg_ptr = ptr;
4956
+ StorageLockFinalization.register(obj, obj.__wbg_ptr, obj);
4957
+ return obj;
4958
+ }
4959
+ __destroy_into_raw() {
4960
+ const ptr = this.__wbg_ptr;
4961
+ this.__wbg_ptr = 0;
4962
+ StorageLockFinalization.unregister(this);
4963
+ return ptr;
4964
+ }
4965
+ free() {
4966
+ const ptr = this.__destroy_into_raw();
4967
+ wasm.__wbg_storagelock_free(ptr, 0);
4968
+ }
4969
+ /**
4970
+ * Value of the `If` header that presents this lock on a write.
4971
+ * @returns {string}
4972
+ */
4973
+ ifHeader() {
4974
+ let deferred1_0;
4975
+ let deferred1_1;
4976
+ try {
4977
+ const ret = wasm.storagelock_ifHeader(this.__wbg_ptr);
4978
+ deferred1_0 = ret[0];
4979
+ deferred1_1 = ret[1];
4980
+ return getStringFromWasm0(ret[0], ret[1]);
4981
+ } finally {
4982
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4983
+ }
4984
+ }
4985
+ /**
4986
+ * The locked path.
4987
+ * @returns {Path}
4988
+ */
4989
+ get path() {
4990
+ let deferred1_0;
4991
+ let deferred1_1;
4992
+ try {
4993
+ const ret = wasm.storagelock_path(this.__wbg_ptr);
4994
+ deferred1_0 = ret[0];
4995
+ deferred1_1 = ret[1];
4996
+ return getStringFromWasm0(ret[0], ret[1]);
4997
+ } finally {
4998
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4999
+ }
5000
+ }
5001
+ /**
5002
+ * Lifetime the homeserver granted at the last `lock` or `refreshLock`, in seconds,
5003
+ * counted from when that call resolved. It may be shorter than what was asked for.
5004
+ * It is not the time remaining: note when the call resolved to know when to refresh.
5005
+ * @returns {number}
5006
+ */
5007
+ get timeoutSeconds() {
5008
+ const ret = wasm.storagelock_timeoutSeconds(this.__wbg_ptr);
5009
+ return ret;
5010
+ }
5011
+ /**
5012
+ * The lock token URL, `opaquelocktoken:<uuid>`.
5013
+ * @returns {string}
5014
+ */
5015
+ get token() {
5016
+ let deferred1_0;
5017
+ let deferred1_1;
5018
+ try {
5019
+ const ret = wasm.storagelock_token(this.__wbg_ptr);
5020
+ deferred1_0 = ret[0];
5021
+ deferred1_1 = ret[1];
5022
+ return getStringFromWasm0(ret[0], ret[1]);
5023
+ } finally {
5024
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
5025
+ }
5026
+ }
5027
+ }
5028
+ if (Symbol.dispose) StorageLock.prototype[Symbol.dispose] = StorageLock.prototype.free;
5029
+ exports.StorageLock = StorageLock;
5030
+
4504
5031
  /**
4505
5032
  * Metadata for a session saved in the browser session store.
4506
5033
  */
@@ -4710,7 +5237,8 @@ exports.setLogLevel = setLogLevel;
4710
5237
  /**
4711
5238
  * Validate and normalize a capabilities string.
4712
5239
  *
4713
- * - Normalizes action order (`wr` -> `rw`)
5240
+ * - Normalizes action order (`wr` -> `rw`, `ewr` -> `rwe`).
5241
+ * - `e` requests scoped encryption/decryption keys in V1 grant approvals.
4714
5242
  * - Throws `InvalidInput` identifying the first malformed entry.
4715
5243
  *
4716
5244
  * @param {string} input
@@ -4741,58 +5269,93 @@ function validateCapabilities(input) {
4741
5269
  }
4742
5270
  }
4743
5271
  exports.validateCapabilities = validateCapabilities;
5272
+
5273
+ /**
5274
+ * Verify both signatures, grant binding, and grant validity against the local clock.
5275
+ * Allows 30 seconds of future clock skew by default; never extends grant expiry.
5276
+ * Does not check replay, application authorization, or homeserver revocation.
5277
+ * @param {CustomPop} credentials
5278
+ * @param {CustomPopVerificationOptions | null} [options]
5279
+ * @returns {VerifiedCustomPop}
5280
+ */
5281
+ function verifyCustomGrantPop(credentials, options) {
5282
+ const ret = wasm.verifyCustomGrantPop(credentials, isLikeNone(options) ? 0 : addToExternrefTable0(options));
5283
+ if (ret[2]) {
5284
+ throw takeFromExternrefTable0(ret[1]);
5285
+ }
5286
+ return takeFromExternrefTable0(ret[0]);
5287
+ }
5288
+ exports.verifyCustomGrantPop = verifyCustomGrantPop;
4744
5289
  const import1 = {
4745
- __pubkyGrantIsDelegationAvailable,
4746
- __pubkyGrantCanUseDelegation,
4747
- __pubkyGrantEnsureDelegatedKey,
4748
- __pubkyGrantLoadDelegatedPublicKey,
4749
- __pubkyGrantDelegatedSign,
4750
- __pubkyGrantDeleteDelegatedKey,
4751
- };
4752
- const import2 = {
4753
5290
  __pubkySessionStoreIsAvailable,
4754
5291
  __pubkySessionStorePut,
5292
+ __pubkySessionStoreMetadata,
4755
5293
  __pubkySessionStoreGet,
4756
5294
  __pubkySessionStoreList,
4757
- __pubkySessionStoreDelete,
5295
+ __pubkySessionAcquire,
5296
+ __pubkySessionWait,
5297
+ __pubkySessionRelease,
5298
+ __pubkySharedSessionLoad,
5299
+ __pubkySharedSessionStore,
5300
+ __pubkySharedSessionRemove,
4758
5301
  __pubkySessionStoreClear,
4759
5302
  __pubkySessionStoreClearAll,
4760
5303
  };
4761
- const import3 = {
5304
+ const import2 = {
4762
5305
  __pubkySessionStoreIsAvailable,
4763
5306
  __pubkySessionStorePut,
5307
+ __pubkySessionStoreMetadata,
4764
5308
  __pubkySessionStoreGet,
4765
5309
  __pubkySessionStoreList,
4766
- __pubkySessionStoreDelete,
5310
+ __pubkySessionAcquire,
5311
+ __pubkySessionWait,
5312
+ __pubkySessionRelease,
5313
+ __pubkySharedSessionLoad,
5314
+ __pubkySharedSessionStore,
5315
+ __pubkySharedSessionRemove,
4767
5316
  __pubkySessionStoreClear,
4768
5317
  __pubkySessionStoreClearAll,
4769
5318
  };
4770
- const import4 = {
5319
+ const import3 = {
4771
5320
  __pubkySessionStoreIsAvailable,
4772
5321
  __pubkySessionStorePut,
5322
+ __pubkySessionStoreMetadata,
4773
5323
  __pubkySessionStoreGet,
4774
5324
  __pubkySessionStoreList,
4775
- __pubkySessionStoreDelete,
5325
+ __pubkySessionAcquire,
5326
+ __pubkySessionWait,
5327
+ __pubkySessionRelease,
5328
+ __pubkySharedSessionLoad,
5329
+ __pubkySharedSessionStore,
5330
+ __pubkySharedSessionRemove,
4776
5331
  __pubkySessionStoreClear,
4777
5332
  __pubkySessionStoreClearAll,
4778
5333
  };
4779
- const import5 = {
5334
+ const import4 = {
4780
5335
  __pubkySessionStoreIsAvailable,
4781
5336
  __pubkySessionStorePut,
5337
+ __pubkySessionStoreMetadata,
4782
5338
  __pubkySessionStoreGet,
4783
5339
  __pubkySessionStoreList,
4784
- __pubkySessionStoreDelete,
5340
+ __pubkySessionAcquire,
5341
+ __pubkySessionWait,
5342
+ __pubkySessionRelease,
5343
+ __pubkySharedSessionLoad,
5344
+ __pubkySharedSessionStore,
5345
+ __pubkySharedSessionRemove,
4785
5346
  __pubkySessionStoreClear,
4786
5347
  __pubkySessionStoreClearAll,
4787
5348
  };
5349
+ const import5 = {
5350
+ __pubkyGrantIsDelegationAvailable,
5351
+ __pubkyGrantCanUseDelegation,
5352
+ __pubkyGrantEnsureDelegatedKey,
5353
+ __pubkyGrantLoadDelegatedPublicKey,
5354
+ __pubkyGrantDelegatedSign,
5355
+ };
4788
5356
  const import6 = {
4789
- __pubkySessionStoreIsAvailable,
4790
- __pubkySessionStorePut,
4791
- __pubkySessionStoreGet,
4792
- __pubkySessionStoreList,
4793
- __pubkySessionStoreDelete,
4794
- __pubkySessionStoreClear,
4795
- __pubkySessionStoreClearAll,
5357
+ __pubkyRecoveredEncryptionKeys,
5358
+ __pubkyImportEncryptionCryptoKey,
4796
5359
  };
4797
5360
  const import7 = {
4798
5361
  __pubkyGrantIsDelegationAvailable,
@@ -4800,7 +5363,6 @@ const import7 = {
4800
5363
  __pubkyGrantEnsureDelegatedKey,
4801
5364
  __pubkyGrantLoadDelegatedPublicKey,
4802
5365
  __pubkyGrantDelegatedSign,
4803
- __pubkyGrantDeleteDelegatedKey,
4804
5366
  };
4805
5367
 
4806
5368
  function __wbg_get_imports() {
@@ -4821,7 +5383,7 @@ function __wbg_get_imports() {
4821
5383
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4822
5384
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4823
5385
  },
4824
- __wbg___pubkyGrantDelegatedSign_75d50e1487a4c01e: function(arg0, arg1, arg2, arg3) {
5386
+ __wbg___pubkyGrantDelegatedSign_45b22729433b1c79: function(arg0, arg1, arg2, arg3) {
4825
5387
  let deferred0_0;
4826
5388
  let deferred0_1;
4827
5389
  let deferred1_0;
@@ -4838,19 +5400,7 @@ function __wbg_get_imports() {
4838
5400
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
4839
5401
  }
4840
5402
  },
4841
- __wbg___pubkyGrantDeleteDelegatedKey_8c61ee224046056d: function(arg0, arg1) {
4842
- let deferred0_0;
4843
- let deferred0_1;
4844
- try {
4845
- deferred0_0 = arg0;
4846
- deferred0_1 = arg1;
4847
- const ret = __pubkyGrantDeleteDelegatedKey(getStringFromWasm0(arg0, arg1));
4848
- return ret;
4849
- } finally {
4850
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4851
- }
4852
- },
4853
- __wbg___pubkyGrantEnsureDelegatedKey_70e2f9e5fbabf7e4: function(arg0, arg1) {
5403
+ __wbg___pubkyGrantEnsureDelegatedKey_4f1cc4ccb5acf4e8: function(arg0, arg1) {
4854
5404
  let v0;
4855
5405
  if (arg0 !== 0) {
4856
5406
  v0 = getStringFromWasm0(arg0, arg1);
@@ -4859,7 +5409,7 @@ function __wbg_get_imports() {
4859
5409
  const ret = __pubkyGrantEnsureDelegatedKey(v0);
4860
5410
  return ret;
4861
5411
  },
4862
- __wbg___pubkyGrantLoadDelegatedPublicKey_5fed290b4e324487: function(arg0, arg1) {
5412
+ __wbg___pubkyGrantLoadDelegatedPublicKey_6591f0667321395a: function(arg0, arg1) {
4863
5413
  let deferred0_0;
4864
5414
  let deferred0_1;
4865
5415
  try {
@@ -4871,30 +5421,61 @@ function __wbg_get_imports() {
4871
5421
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4872
5422
  }
4873
5423
  },
4874
- __wbg___pubkySessionStoreDelete_c4feadf1aabc11f4: function(arg0, arg1) {
5424
+ __wbg___pubkyRecoveredEncryptionKeys_7375e79d20b5b126: function(arg0, arg1, arg2, arg3, arg4) {
5425
+ const ret = __pubkyRecoveredEncryptionKeys(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), EncryptionKeys.__wrap(arg4));
5426
+ return ret;
5427
+ },
5428
+ __wbg___pubkySessionAcquire_356f865b2001b846: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
5429
+ const ret = __pubkySessionAcquire(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 !== 0);
5430
+ return ret;
5431
+ }, arguments); },
5432
+ __wbg___pubkySessionRelease_3195014f66dee6ac: function(arg0) {
5433
+ __pubkySessionRelease(arg0 >>> 0);
5434
+ },
5435
+ __wbg___pubkySessionStoreGet_618e59d7f6ad6c2a: function(arg0, arg1) {
4875
5436
  let deferred0_0;
4876
5437
  let deferred0_1;
4877
5438
  try {
4878
5439
  deferred0_0 = arg0;
4879
5440
  deferred0_1 = arg1;
4880
- const ret = __pubkySessionStoreDelete(getStringFromWasm0(arg0, arg1));
5441
+ const ret = __pubkySessionStoreGet(getStringFromWasm0(arg0, arg1));
4881
5442
  return ret;
4882
5443
  } finally {
4883
5444
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4884
5445
  }
4885
5446
  },
4886
- __wbg___pubkySessionStoreGet_faa5b9fdbff7a8b0: function(arg0, arg1) {
5447
+ __wbg___pubkySessionStoreMetadata_a69b8b6778109b6e: function(arg0, arg1) {
4887
5448
  let deferred0_0;
4888
5449
  let deferred0_1;
4889
5450
  try {
4890
5451
  deferred0_0 = arg0;
4891
5452
  deferred0_1 = arg1;
4892
- const ret = __pubkySessionStoreGet(getStringFromWasm0(arg0, arg1));
5453
+ const ret = __pubkySessionStoreMetadata(getStringFromWasm0(arg0, arg1));
4893
5454
  return ret;
4894
5455
  } finally {
4895
5456
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4896
5457
  }
4897
5458
  },
5459
+ __wbg___pubkySessionStorePut_aa2189e6e7fdc513: function(arg0, arg1) {
5460
+ const ret = __pubkySessionStorePut(arg0, arg1 >>> 0);
5461
+ return ret;
5462
+ },
5463
+ __wbg___pubkySessionWait_a67a8077a61d91d1: function(arg0) {
5464
+ const ret = __pubkySessionWait(arg0 >>> 0);
5465
+ return ret;
5466
+ },
5467
+ __wbg___pubkySharedSessionLoad_4190e716399b75e0: function(arg0) {
5468
+ const ret = __pubkySharedSessionLoad(arg0 >>> 0);
5469
+ return ret;
5470
+ },
5471
+ __wbg___pubkySharedSessionRemove_f037c015c530dc4d: function(arg0) {
5472
+ const ret = __pubkySharedSessionRemove(arg0 >>> 0);
5473
+ return ret;
5474
+ },
5475
+ __wbg___pubkySharedSessionStore_3e370536d89738a5: function(arg0, arg1) {
5476
+ const ret = __pubkySharedSessionStore(arg0 >>> 0, arg1);
5477
+ return ret;
5478
+ },
4898
5479
  __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8: function(arg0, arg1) {
4899
5480
  const v = arg1;
4900
5481
  const ret = typeof(v) === 'bigint' ? v : undefined;
@@ -5044,6 +5625,10 @@ function __wbg_get_imports() {
5044
5625
  const ret = arg0.done;
5045
5626
  return ret;
5046
5627
  },
5628
+ __wbg_encryptionkeys_new: function(arg0) {
5629
+ const ret = EncryptionKeys.__wrap(arg0);
5630
+ return ret;
5631
+ },
5047
5632
  __wbg_enqueue_6cb545d22db14f33: function() { return handleError(function (arg0, arg1) {
5048
5633
  arg0.enqueue(arg1);
5049
5634
  }, arguments); },
@@ -5066,12 +5651,12 @@ function __wbg_get_imports() {
5066
5651
  const ret = fetch(arg0);
5067
5652
  return ret;
5068
5653
  },
5069
- __wbg_fetch_920242d59bac2026: function(arg0, arg1) {
5070
- const ret = arg0.fetch(arg1);
5654
+ __wbg_fetch_8ce5bc1de67f3146: function(arg0) {
5655
+ const ret = fetch(arg0);
5071
5656
  return ret;
5072
5657
  },
5073
- __wbg_fetch_bed2d90618c78f90: function(arg0) {
5074
- const ret = fetch(arg0);
5658
+ __wbg_fetch_920242d59bac2026: function(arg0, arg1) {
5659
+ const ret = arg0.fetch(arg1);
5075
5660
  return ret;
5076
5661
  },
5077
5662
  __wbg_from_a39669ce566077da: function(arg0) {
@@ -5149,6 +5734,16 @@ function __wbg_get_imports() {
5149
5734
  const ret = result;
5150
5735
  return ret;
5151
5736
  },
5737
+ __wbg_instanceof_CryptoKey_98e09fab6f03bfea: function(arg0) {
5738
+ let result;
5739
+ try {
5740
+ result = arg0 instanceof CryptoKey;
5741
+ } catch (_) {
5742
+ result = false;
5743
+ }
5744
+ const ret = result;
5745
+ return ret;
5746
+ },
5152
5747
  __wbg_instanceof_Error_fe6fa771c78ee4cf: function(arg0) {
5153
5748
  let result;
5154
5749
  try {
@@ -5222,6 +5817,10 @@ function __wbg_get_imports() {
5222
5817
  __wbg_log_d4082f66a52944c3: function(arg0, arg1, arg2, arg3) {
5223
5818
  console.log(arg0, arg1, arg2, arg3);
5224
5819
  },
5820
+ __wbg_message_1cbc5bc03dcf1dee: function(arg0) {
5821
+ const ret = arg0.message;
5822
+ return ret;
5823
+ },
5225
5824
  __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
5226
5825
  const ret = arg0.msCrypto;
5227
5826
  return ret;
@@ -5265,7 +5864,7 @@ function __wbg_get_imports() {
5265
5864
  const a = state0.a;
5266
5865
  state0.a = 0;
5267
5866
  try {
5268
- return wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined_______true_(a, state0.b, arg0, arg1);
5867
+ return wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined_______true_(a, state0.b, arg0, arg1);
5269
5868
  } finally {
5270
5869
  state0.a = a;
5271
5870
  }
@@ -5457,6 +6056,10 @@ function __wbg_get_imports() {
5457
6056
  const ret = arg0.status;
5458
6057
  return ret;
5459
6058
  },
6059
+ __wbg_storagelock_new: function(arg0) {
6060
+ const ret = StorageLock.__wrap(arg0);
6061
+ return ret;
6062
+ },
5460
6063
  __wbg_storedsessioninfo_new: function(arg0) {
5461
6064
  const ret = StoredSessionInfo.__wrap(arg0);
5462
6065
  return ret;
@@ -5508,18 +6111,18 @@ function __wbg_get_imports() {
5508
6111
  console.warn(arg0, arg1, arg2, arg3);
5509
6112
  },
5510
6113
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
5511
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 133, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
5512
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_ce198afa7cd4a644___JsError___true_);
6114
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 125, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
6115
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6fb33c0245079662___JsError___true_);
5513
6116
  return ret;
5514
6117
  },
5515
6118
  __wbindgen_generic_0000000000000002: function(arg0, arg1) {
5516
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 275, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5517
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue______true_);
6119
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 284, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
6120
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue______true_);
5518
6121
  return ret;
5519
6122
  },
5520
6123
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
5521
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 273, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5522
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke_______true_);
6124
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 282, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
6125
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6fb33c0245079662___convert__closures_____invoke_______true_);
5523
6126
  return ret;
5524
6127
  },
5525
6128
  __wbindgen_generic_0000000000000004: function(arg0) {
@@ -5557,14 +6160,14 @@ function __wbg_get_imports() {
5557
6160
  __wbindgen_generic_000000000000000a: function(arg0, arg1) {
5558
6161
  var v0 = getArrayJsValueFromWasm0(arg0, arg1);
5559
6162
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
5560
- // Cast intrinsic for `Vector(RustStruct { name: "GrantInfo", unique_crate_identifier: "pubky-wasm-77c580e5b10ee397" }) -> Externref`.
6163
+ // Cast intrinsic for `Vector(RustStruct { name: "GrantInfo", unique_crate_identifier: "pubky-wasm-a72b7beb1b0b81b7" }) -> Externref`.
5561
6164
  const ret = v0;
5562
6165
  return ret;
5563
6166
  },
5564
6167
  __wbindgen_generic_000000000000000b: function(arg0, arg1) {
5565
6168
  var v0 = getArrayJsValueFromWasm0(arg0, arg1);
5566
6169
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
5567
- // Cast intrinsic for `Vector(RustStruct { name: "StoredSessionInfo", unique_crate_identifier: "pubky-wasm-77c580e5b10ee397" }) -> Externref`.
6170
+ // Cast intrinsic for `Vector(RustStruct { name: "StoredSessionInfo", unique_crate_identifier: "pubky-wasm-a72b7beb1b0b81b7" }) -> Externref`.
5568
6171
  const ret = v0;
5569
6172
  return ret;
5570
6173
  },
@@ -5581,33 +6184,33 @@ function __wbg_get_imports() {
5581
6184
  return {
5582
6185
  __proto__: null,
5583
6186
  "./pubky_bg.js": import0,
5584
- "./snippets/pubky-wasm-77c580e5b10ee397/inline1.js": import1,
5585
- "./snippets/pubky-wasm-77c580e5b10ee397/inline0.js": import2,
5586
- "./snippets/pubky-wasm-77c580e5b10ee397/inline0.js": import3,
5587
- "./snippets/pubky-wasm-77c580e5b10ee397/inline0.js": import4,
5588
- "./snippets/pubky-wasm-77c580e5b10ee397/inline0.js": import5,
5589
- "./snippets/pubky-wasm-77c580e5b10ee397/inline0.js": import6,
5590
- "./snippets/pubky-wasm-77c580e5b10ee397/inline1.js": import7,
6187
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline0.js": import1,
6188
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline0.js": import2,
6189
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline0.js": import3,
6190
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline0.js": import4,
6191
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline1.js": import5,
6192
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline2.js": import6,
6193
+ "./snippets/pubky-wasm-a72b7beb1b0b81b7/inline1.js": import7,
5591
6194
  };
5592
6195
  }
5593
6196
 
5594
- function wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke_______true_(arg0, arg1) {
5595
- wasm.wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke_______true_(arg0, arg1);
6197
+ function wasm_bindgen_6fb33c0245079662___convert__closures_____invoke_______true_(arg0, arg1) {
6198
+ wasm.wasm_bindgen_6fb33c0245079662___convert__closures_____invoke_______true_(arg0, arg1);
5596
6199
  }
5597
6200
 
5598
- function wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue______true_(arg0, arg1, arg2) {
5599
- wasm.wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue______true_(arg0, arg1, arg2);
6201
+ function wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue______true_(arg0, arg1, arg2) {
6202
+ wasm.wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue______true_(arg0, arg1, arg2);
5600
6203
  }
5601
6204
 
5602
- function wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_ce198afa7cd4a644___JsError___true_(arg0, arg1, arg2) {
5603
- const ret = wasm.wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___wasm_bindgen_ce198afa7cd4a644___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_ce198afa7cd4a644___JsError___true_(arg0, arg1, arg2);
6205
+ function wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6fb33c0245079662___JsError___true_(arg0, arg1, arg2) {
6206
+ const ret = wasm.wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___wasm_bindgen_6fb33c0245079662___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6fb33c0245079662___JsError___true_(arg0, arg1, arg2);
5604
6207
  if (ret[1]) {
5605
6208
  throw takeFromExternrefTable0(ret[0]);
5606
6209
  }
5607
6210
  }
5608
6211
 
5609
- function wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
5610
- wasm.wasm_bindgen_ce198afa7cd4a644___convert__closures_____invoke___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined___js_sys_9e06d9a37a23efa4___Function_fn_wasm_bindgen_ce198afa7cd4a644___JsValue_____wasm_bindgen_ce198afa7cd4a644___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
6212
+ function wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
6213
+ wasm.wasm_bindgen_6fb33c0245079662___convert__closures_____invoke___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined___js_sys_5fd4844d262c835b___Function_fn_wasm_bindgen_6fb33c0245079662___JsValue_____wasm_bindgen_6fb33c0245079662___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
5611
6214
  }
5612
6215
 
5613
6216
 
@@ -5648,6 +6251,9 @@ const CookieSessionFinalization = (typeof FinalizationRegistry === 'undefined')
5648
6251
  const DirectSignupDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
5649
6252
  ? { register: () => {}, unregister: () => {} }
5650
6253
  : new FinalizationRegistry(ptr => wasm.__wbg_directsignupdeeplink_free(ptr, 1));
6254
+ const EncryptionKeysFinalization = (typeof FinalizationRegistry === 'undefined')
6255
+ ? { register: () => {}, unregister: () => {} }
6256
+ : new FinalizationRegistry(ptr => wasm.__wbg_encryptionkeys_free(ptr, 1));
5651
6257
  const EventFinalization = (typeof FinalizationRegistry === 'undefined')
5652
6258
  ? { register: () => {}, unregister: () => {} }
5653
6259
  : new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr, 1));
@@ -5732,6 +6338,9 @@ const SignupDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
5732
6338
  const SignupGrantDeepLinkFinalization = (typeof FinalizationRegistry === 'undefined')
5733
6339
  ? { register: () => {}, unregister: () => {} }
5734
6340
  : new FinalizationRegistry(ptr => wasm.__wbg_signupgrantdeeplink_free(ptr, 1));
6341
+ const StorageLockFinalization = (typeof FinalizationRegistry === 'undefined')
6342
+ ? { register: () => {}, unregister: () => {} }
6343
+ : new FinalizationRegistry(ptr => wasm.__wbg_storagelock_free(ptr, 1));
5735
6344
  const StoredSessionInfoFinalization = (typeof FinalizationRegistry === 'undefined')
5736
6345
  ? { register: () => {}, unregister: () => {} }
5737
6346
  : new FinalizationRegistry(ptr => wasm.__wbg_storedsessioninfo_free(ptr, 1));