@synonymdev/pubky 0.16.2 → 0.18.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/README.md +58 -2
- package/index.cjs +227 -51
- package/index.js +228 -52
- package/package.json +4 -3
- package/pubky.d.ts +167 -29
- package/pubky_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -182,6 +182,11 @@ const userPk = session.info.publicKey.toString(); // -> pubky<z32> identifier
|
|
|
182
182
|
const caps = session.info.capabilities; // -> string[] permissions and paths
|
|
183
183
|
|
|
184
184
|
const storage = session.storage; // -> This User's storage API (absolute paths)
|
|
185
|
+
|
|
186
|
+
// With a grant session that has read permission on `/` (`/:r`, `/:rw`, ...):
|
|
187
|
+
// storage used and the quota that applies.
|
|
188
|
+
const account = await session.grant.account();
|
|
189
|
+
console.log(account.usedBytes, account.quota.effective.storageQuotaMb);
|
|
185
190
|
```
|
|
186
191
|
|
|
187
192
|
**Persist a grant session**
|
|
@@ -347,6 +352,28 @@ Legacy cookie auth flows can be resumed with
|
|
|
347
352
|
`sessionStorage`, not `localStorage`, and delete it once the flow completes or
|
|
348
353
|
is abandoned.
|
|
349
354
|
|
|
355
|
+
#### Require the signed-in identity
|
|
356
|
+
|
|
357
|
+
When the app already knows who is signed in, for example to re-authorize or to
|
|
358
|
+
request more capabilities, pass that user's public key as `expectedSigner`.
|
|
359
|
+
The link gains `spk=<z32>`, an expected-identity constraint: a signer such as
|
|
360
|
+
Pubky Ring opens that key or refuses the request, and `awaitApproval()`
|
|
361
|
+
rejects an approval issued by any other key. Switching accounts takes a fresh
|
|
362
|
+
sign-in without `expectedSigner`. Leave it out for a first sign-in. Sign-up
|
|
363
|
+
flows reject it.
|
|
364
|
+
|
|
365
|
+
```js
|
|
366
|
+
const flow = await pubky.startGrantAuthFlow(caps, AuthFlowKind.signin(), {
|
|
367
|
+
clientId: "my-cool-app.example",
|
|
368
|
+
expectedSigner: session.info.publicKey.z32(),
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Signers that predate `spk` ignore it and show their usual key picker; an
|
|
373
|
+
approval from another key picked there is rejected. Any app can name any
|
|
374
|
+
public key, so signers should show prominently that the app chose the
|
|
375
|
+
identity; see [AUTH.md](../../../../docs/AUTH.md) for the accepted tradeoffs.
|
|
376
|
+
|
|
350
377
|
#### Request encryption keys
|
|
351
378
|
|
|
352
379
|
Apps can also ask the signer for encryption keys scoped to storage paths. Set
|
|
@@ -517,6 +544,7 @@ const s = session.storage;
|
|
|
517
544
|
await s.putJson("/pub/example.com/data.json", { ok: true });
|
|
518
545
|
await s.putText("/pub/example.com/note.txt", "hello");
|
|
519
546
|
await s.putBytes("/pub/example.com/img.bin", new Uint8Array([1, 2, 3]));
|
|
547
|
+
await s.putBlob("/pub/example.com/file.bin", new Blob(["file contents"]));
|
|
520
548
|
|
|
521
549
|
// Reads
|
|
522
550
|
const response = await s.get("/pub/example.com/data.json"); // -> Response (stream it)
|
|
@@ -541,12 +569,15 @@ lock.token; // -> "opaquelocktoken:<uuid>"
|
|
|
541
569
|
lock.timeoutSeconds; // -> what the homeserver granted (it caps the lifetime)
|
|
542
570
|
await s.putTextLocked(lock, JSON.stringify({ count: 1 })); // only the holder can write; no putJsonLocked
|
|
543
571
|
await s.putBytesLocked(lock, new Uint8Array([1, 2, 3]));
|
|
572
|
+
await s.putBlobLocked(lock, new Blob(["updated contents"]));
|
|
544
573
|
await s.deleteLocked(lock);
|
|
545
574
|
await s.refreshLock(lock, 30); // restart the lifetime
|
|
546
575
|
await s.unlock(lock);
|
|
547
576
|
```
|
|
548
577
|
|
|
549
|
-
|
|
578
|
+
`putBlob()` and `putBlobLocked()` accept a `Blob` or `File` without copying its contents into WASM memory.
|
|
579
|
+
|
|
580
|
+
While a lock lives, a plain `putJson`/`putText`/`putBytes`/`putBlob`/`delete` on that path rejects with `423 Locked`, and so does a second `lock()`. Once the lock is gone, the old value is refused with `412` (write, delete, refresh) and `409` on `unlock()`; take a new lock and read the file again. A homeserver without lock support answers `405`.
|
|
550
581
|
|
|
551
582
|
`timeoutSeconds` is rounded down to whole seconds, with a minimum of 1. If `lock()` rejects without a status code (a lost connection, say), the homeserver may still have granted the lock; nothing can release it, so the path answers `423` until it times out.
|
|
552
583
|
|
|
@@ -556,6 +587,8 @@ Path rules:
|
|
|
556
587
|
|
|
557
588
|
- Session storage uses **absolute** paths under `/pub/` or `/priv/`.
|
|
558
589
|
- Public storage uses **addressed** form `pubky<user>/pub/app/file.txt` (preferred) or `pubky://<user>/...`.
|
|
590
|
+
- A path is the file's plain name, such as `/pub/app/My File.txt`; the SDK percent-encodes it when it builds the HTTP URL.
|
|
591
|
+
- `list()` entries and `event.resource.path` carry the same plain name, which is also the form a `list()` cursor takes.
|
|
559
592
|
|
|
560
593
|
**Convention:** put your app’s public data under a domain-like folder in `/pub`, e.g. `/pub/my-new-app/`.
|
|
561
594
|
|
|
@@ -639,15 +672,38 @@ All async methods throw a structured `PubkyError`:
|
|
|
639
672
|
interface PubkyError extends Error {
|
|
640
673
|
name:
|
|
641
674
|
| "RequestError" // network/server/validation/JSON
|
|
675
|
+
| "CredentialRefreshError" // grant refresh request failed
|
|
642
676
|
| "InvalidInput"
|
|
643
677
|
| "AuthenticationError"
|
|
644
678
|
| "PkarrError"
|
|
645
679
|
| "InternalError";
|
|
646
680
|
message: string;
|
|
647
|
-
data?: unknown; // structured context when available
|
|
681
|
+
data?: unknown; // structured context when available; RequestErrorData for RequestError
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
`RequestError` carries a `RequestErrorData`: `reason` (`Http`, `Timeout`,
|
|
686
|
+
`Connection`, `TlsVerification`, `Body`, `Decode`, `InvalidRequest` or `Other`)
|
|
687
|
+
and, for HTTP failures, `statusCode`. Browser Fetch may only report `Other`.
|
|
688
|
+
`TlsVerification` means the server certificate was rejected; after a legitimate
|
|
689
|
+
key rotation a stale pkarr cache looks the same, so it does not prove
|
|
690
|
+
interception on its own. A reason describes the failure, not whether retrying a
|
|
691
|
+
write is safe.
|
|
692
|
+
|
|
693
|
+
```ts
|
|
694
|
+
import type { PubkyError, RequestErrorData } from "@synonymdev/pubky";
|
|
695
|
+
|
|
696
|
+
if (error.name === "RequestError") {
|
|
697
|
+
const { reason, statusCode } = error.data as RequestErrorData;
|
|
648
698
|
}
|
|
649
699
|
```
|
|
650
700
|
|
|
701
|
+
`CredentialRefreshError` represents secret-safe refresh request failures. It
|
|
702
|
+
includes `data: { statusCode: number }` when the refresh endpoint responded, while
|
|
703
|
+
transport failures omit `data`. Local authentication, resolution, parsing, and
|
|
704
|
+
build failures keep their normal error names. This distinguishes unavailable
|
|
705
|
+
grant refresh from a failure returned by the requested storage operation.
|
|
706
|
+
|
|
651
707
|
Example:
|
|
652
708
|
|
|
653
709
|
```js
|
package/index.cjs
CHANGED
|
@@ -569,6 +569,85 @@ async function __pubkyGrantDelegatedSign(keyId, signingInput) {
|
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
|
|
572
|
+
/**
|
|
573
|
+
* A user's account as returned by `session.grant.account()`.
|
|
574
|
+
*/
|
|
575
|
+
class AccountInfo {
|
|
576
|
+
static __wrap(ptr) {
|
|
577
|
+
const obj = Object.create(AccountInfo.prototype);
|
|
578
|
+
obj.__wbg_ptr = ptr;
|
|
579
|
+
AccountInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
580
|
+
return obj;
|
|
581
|
+
}
|
|
582
|
+
__destroy_into_raw() {
|
|
583
|
+
const ptr = this.__wbg_ptr;
|
|
584
|
+
this.__wbg_ptr = 0;
|
|
585
|
+
AccountInfoFinalization.unregister(this);
|
|
586
|
+
return ptr;
|
|
587
|
+
}
|
|
588
|
+
free() {
|
|
589
|
+
const ptr = this.__destroy_into_raw();
|
|
590
|
+
wasm.__wbg_accountinfo_free(ptr, 0);
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* When the user signed up, as an ISO 8601 date and time without a UTC
|
|
594
|
+
* offset (e.g. `2026-10-22T10:11:12.123456`).
|
|
595
|
+
* @returns {string}
|
|
596
|
+
*/
|
|
597
|
+
get createdAt() {
|
|
598
|
+
let deferred1_0;
|
|
599
|
+
let deferred1_1;
|
|
600
|
+
try {
|
|
601
|
+
const ret = wasm.accountinfo_createdAt(this.__wbg_ptr);
|
|
602
|
+
deferred1_0 = ret[0];
|
|
603
|
+
deferred1_1 = ret[1];
|
|
604
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
605
|
+
} finally {
|
|
606
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Whether the account is disabled. Disabled accounts can read and delete
|
|
611
|
+
* but not write.
|
|
612
|
+
* @returns {boolean}
|
|
613
|
+
*/
|
|
614
|
+
get disabled() {
|
|
615
|
+
const ret = wasm.accountinfo_disabled(this.__wbg_ptr);
|
|
616
|
+
return ret !== 0;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* The user this account belongs to.
|
|
620
|
+
* @returns {PublicKey}
|
|
621
|
+
*/
|
|
622
|
+
get pubky() {
|
|
623
|
+
const ret = wasm.accountinfo_pubky(this.__wbg_ptr);
|
|
624
|
+
return PublicKey.__wrap(ret);
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* The quota that applies and the per-user overrides behind it.
|
|
628
|
+
*
|
|
629
|
+
* @returns {AccountQuota}
|
|
630
|
+
* @returns {AccountQuota}
|
|
631
|
+
*/
|
|
632
|
+
get quota() {
|
|
633
|
+
const ret = wasm.accountinfo_quota(this.__wbg_ptr);
|
|
634
|
+
if (ret[2]) {
|
|
635
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
636
|
+
}
|
|
637
|
+
return takeFromExternrefTable0(ret[0]);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Bytes of storage currently used.
|
|
641
|
+
* @returns {number}
|
|
642
|
+
*/
|
|
643
|
+
get usedBytes() {
|
|
644
|
+
const ret = wasm.accountinfo_usedBytes(this.__wbg_ptr);
|
|
645
|
+
return ret;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (Symbol.dispose) AccountInfo.prototype[Symbol.dispose] = AccountInfo.prototype.free;
|
|
649
|
+
exports.AccountInfo = AccountInfo;
|
|
650
|
+
|
|
572
651
|
/**
|
|
573
652
|
* Start and control a pubkyauth authorization flow.
|
|
574
653
|
*
|
|
@@ -1943,7 +2022,7 @@ class GrantAuthFlow {
|
|
|
1943
2022
|
* The kind of authentication flow to perform.
|
|
1944
2023
|
*
|
|
1945
2024
|
* @param {GrantAuthFlowOptions} options
|
|
1946
|
-
* Options for the grant flow: `{ clientId, relay?, xCallback? }`.
|
|
2025
|
+
* Options for the grant flow: `{ clientId, relay?, xCallback?, approvalFormat?, expectedSigner? }`.
|
|
1947
2026
|
*
|
|
1948
2027
|
* @returns {GrantAuthFlow}
|
|
1949
2028
|
* A running grant auth flow. Call `authorizationUrl()` to show the deep link,
|
|
@@ -2151,6 +2230,21 @@ class GrantSession {
|
|
|
2151
2230
|
const ptr = this.__destroy_into_raw();
|
|
2152
2231
|
wasm.__wbg_grantsession_free(ptr, 0);
|
|
2153
2232
|
}
|
|
2233
|
+
/**
|
|
2234
|
+
* Fetch this user's account: storage used, whether it is disabled, and
|
|
2235
|
+
* the quota that applies.
|
|
2236
|
+
*
|
|
2237
|
+
* Requires read permission on the root scope (`/:r`, `/:rw`, ...).
|
|
2238
|
+
* Path-scoped sessions surface the homeserver `403` as the standard
|
|
2239
|
+
* request error.
|
|
2240
|
+
*
|
|
2241
|
+
* @returns {Promise<AccountInfo>}
|
|
2242
|
+
* @returns {Promise<AccountInfo>}
|
|
2243
|
+
*/
|
|
2244
|
+
account() {
|
|
2245
|
+
const ret = wasm.grantsession_account(this.__wbg_ptr);
|
|
2246
|
+
return ret;
|
|
2247
|
+
}
|
|
2154
2248
|
/**
|
|
2155
2249
|
* Sign JSON data and return both the custom proof and its root-signed grant.
|
|
2156
2250
|
* Data follows `JSON.stringify` semantics, e.g. `undefined` properties are omitted.
|
|
@@ -3121,7 +3215,7 @@ class Pubky {
|
|
|
3121
3215
|
* @param {string} capabilities Comma-separated caps, e.g. `"/pub/app/:rw,/pub/foo/file:r"`.
|
|
3122
3216
|
* @param {AuthFlowKind} kind The kind of authentication flow to perform.
|
|
3123
3217
|
* @param {GrantAuthFlowOptions} options Options for the grant flow:
|
|
3124
|
-
* `{ clientId, relay?, xCallback?, approvalFormat? }`.
|
|
3218
|
+
* `{ clientId, relay?, xCallback?, approvalFormat?, expectedSigner? }`.
|
|
3125
3219
|
* @returns {Promise<GrantAuthFlow>}
|
|
3126
3220
|
* A running grant auth flow. Show `authorizationUrl` as QR/deeplink,
|
|
3127
3221
|
* then `awaitApproval()` to obtain a grant-backed `Session`.
|
|
@@ -3252,7 +3346,7 @@ class PubkyResource {
|
|
|
3252
3346
|
return PubkyResource.__wrap(ret[0]);
|
|
3253
3347
|
}
|
|
3254
3348
|
/**
|
|
3255
|
-
* Get the absolute path (e.g., "/pub/
|
|
3349
|
+
* Get the absolute path (e.g., "/pub/My File.txt").
|
|
3256
3350
|
* @returns {string}
|
|
3257
3351
|
*/
|
|
3258
3352
|
get path() {
|
|
@@ -3268,7 +3362,8 @@ class PubkyResource {
|
|
|
3268
3362
|
}
|
|
3269
3363
|
}
|
|
3270
3364
|
/**
|
|
3271
|
-
* Render as `pubky://<owner
|
|
3365
|
+
* Render as `pubky://<owner><path>` (deep-link form), the form listings
|
|
3366
|
+
* and events use.
|
|
3272
3367
|
* @returns {string}
|
|
3273
3368
|
*/
|
|
3274
3369
|
toPubkyUrl() {
|
|
@@ -3470,10 +3565,10 @@ class PublicStorage {
|
|
|
3470
3565
|
return ret;
|
|
3471
3566
|
}
|
|
3472
3567
|
/**
|
|
3473
|
-
* List a directory. Results are `pubky
|
|
3568
|
+
* List a directory. Results are `pubky://<pk><path>` entries.
|
|
3474
3569
|
*
|
|
3475
3570
|
* @param {Address} address Addressed directory (must end with `/`).
|
|
3476
|
-
* @param {string|null=} cursor Optional suffix or
|
|
3571
|
+
* @param {string|null=} cursor Optional suffix or entry (as returned) to start **after**.
|
|
3477
3572
|
* @param {boolean=} reverse Default `false`. When `true`, newest/lexicographically-last first.
|
|
3478
3573
|
* @param {number=} limit Optional result limit.
|
|
3479
3574
|
* @param {boolean=} shallow Default `false`. When `true`, lists only first-level entries.
|
|
@@ -3801,8 +3896,10 @@ exports.SessionInfo = SessionInfo;
|
|
|
3801
3896
|
*
|
|
3802
3897
|
* Failures reject with a {@link PubkyError}. Path validation, transport, and HTTP
|
|
3803
3898
|
* failures use `RequestError`; only HTTP errors include `data.statusCode`.
|
|
3804
|
-
*
|
|
3805
|
-
*
|
|
3899
|
+
* Automatic grant refresh failures use `CredentialRefreshError`, with the
|
|
3900
|
+
* refresh HTTP status in `data.statusCode` when available. URL parsing failures
|
|
3901
|
+
* use `InvalidInput`. Other credential preparation and reading response bodies
|
|
3902
|
+
* can also fail.
|
|
3806
3903
|
*
|
|
3807
3904
|
* Only {@link SessionStorage.exists} and {@link SessionStorage.stats} treat
|
|
3808
3905
|
* HTTP 404/410 as missing. Other HTTP failures, including 401/403 and 5xx, reject.
|
|
@@ -3942,11 +4039,11 @@ class SessionStorage {
|
|
|
3942
4039
|
* List a directory (absolute session path).
|
|
3943
4040
|
*
|
|
3944
4041
|
* @param {Path} path Must end with `/`.
|
|
3945
|
-
* @param {string|null=} cursor Optional last entry
|
|
4042
|
+
* @param {string|null=} cursor Optional last entry (as returned) to start **after**.
|
|
3946
4043
|
* @param {boolean=} reverse Default `false`.
|
|
3947
4044
|
* @param {number=} limit Optional result limit.
|
|
3948
4045
|
* @param {boolean=} shallow Default `false`.
|
|
3949
|
-
* @returns {Promise<string[]>} `pubky
|
|
4046
|
+
* @returns {Promise<string[]>} `pubky://<pk><path>` entries, or an empty array for an empty page.
|
|
3950
4047
|
* @throws {PubkyError} Missing directory (404), invalid cursor (400), invalid response
|
|
3951
4048
|
* entries, or shared errors (see {@link SessionStorage}).
|
|
3952
4049
|
* @param {Path} path
|
|
@@ -3990,6 +4087,53 @@ class SessionStorage {
|
|
|
3990
4087
|
const ret = wasm.sessionstorage_lock(this.__wbg_ptr, ptr0, len0, timeout_seconds);
|
|
3991
4088
|
return ret;
|
|
3992
4089
|
}
|
|
4090
|
+
/**
|
|
4091
|
+
* Upload a Blob or File to a locked path without copying its contents into
|
|
4092
|
+
* WASM memory.
|
|
4093
|
+
*
|
|
4094
|
+
* @param {StorageLock} lock A lock you hold. The upload uses the lock's path.
|
|
4095
|
+
* @param {Blob} body A Blob or File to upload.
|
|
4096
|
+
* @returns {Promise<void>}
|
|
4097
|
+
* @throws {PubkyError} An expired or released lock rejects with status `412`.
|
|
4098
|
+
* A file that changed since the write was prepared rejects with status `409`.
|
|
4099
|
+
* See {@link SessionStorage.putBytesLocked} for recovery and
|
|
4100
|
+
* {@link SessionStorage.putBlob} for input validation and shared errors.
|
|
4101
|
+
* @example
|
|
4102
|
+
* const lock = await session.storage.lock("/pub/example.com/file.bin", 30);
|
|
4103
|
+
* try {
|
|
4104
|
+
* await session.storage.putBlobLocked(lock, file);
|
|
4105
|
+
* } finally {
|
|
4106
|
+
* await session.storage.unlock(lock);
|
|
4107
|
+
* }
|
|
4108
|
+
* @param {StorageLock} lock
|
|
4109
|
+
* @param {Blob} body
|
|
4110
|
+
* @returns {Promise<void>}
|
|
4111
|
+
*/
|
|
4112
|
+
putBlobLocked(lock, body) {
|
|
4113
|
+
_assertClass(lock, StorageLock);
|
|
4114
|
+
const ret = wasm.sessionstorage_putBlobLocked(this.__wbg_ptr, lock.__wbg_ptr, body);
|
|
4115
|
+
return ret;
|
|
4116
|
+
}
|
|
4117
|
+
/**
|
|
4118
|
+
* Upload a Blob or File without copying its contents into WASM memory.
|
|
4119
|
+
*
|
|
4120
|
+
* @param {Path} path File path; must not end with `/`.
|
|
4121
|
+
* @param {Blob} body A Blob or File to upload.
|
|
4122
|
+
* @returns {Promise<void>}
|
|
4123
|
+
* @throws {PubkyError} `InvalidInput` if body is not a Blob or File;
|
|
4124
|
+
* otherwise upload or shared write/request errors (see {@link SessionStorage}).
|
|
4125
|
+
* @example
|
|
4126
|
+
* await session.storage.putBlob("/pub/example.com/file.bin", file);
|
|
4127
|
+
* @param {Path} path
|
|
4128
|
+
* @param {Blob} body
|
|
4129
|
+
* @returns {Promise<void>}
|
|
4130
|
+
*/
|
|
4131
|
+
putBlob(path, body) {
|
|
4132
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4134
|
+
const ret = wasm.sessionstorage_putBlob(this.__wbg_ptr, ptr0, len0, body);
|
|
4135
|
+
return ret;
|
|
4136
|
+
}
|
|
3993
4137
|
/**
|
|
3994
4138
|
* `PUT` binary data to the path of a lock this client holds.
|
|
3995
4139
|
*
|
|
@@ -4572,6 +4716,17 @@ class SigninGrantDeepLink {
|
|
|
4572
4716
|
const ret = wasm.signingrantdeeplink_ephemeralPublicKey(this.__wbg_ptr);
|
|
4573
4717
|
return ret;
|
|
4574
4718
|
}
|
|
4719
|
+
/**
|
|
4720
|
+
* Expected identity (`spk`): the public key that must approve this
|
|
4721
|
+
* request, or `undefined`. Signers approve with this key or refuse.
|
|
4722
|
+
*
|
|
4723
|
+
* @returns {PublicKey|undefined}
|
|
4724
|
+
* @returns {PublicKey | undefined}
|
|
4725
|
+
*/
|
|
4726
|
+
get expectedSigner() {
|
|
4727
|
+
const ret = wasm.signingrantdeeplink_expectedSigner(this.__wbg_ptr);
|
|
4728
|
+
return ret === 0 ? undefined : PublicKey.__wrap(ret);
|
|
4729
|
+
}
|
|
4575
4730
|
/**
|
|
4576
4731
|
* Parse a grant signin deeplink URL.
|
|
4577
4732
|
*
|
|
@@ -5409,7 +5564,7 @@ function __wbg_get_imports() {
|
|
|
5409
5564
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5410
5565
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5411
5566
|
},
|
|
5412
|
-
|
|
5567
|
+
__wbg___pubkyGrantDelegatedSign_41716d73c2c343e6: function(arg0, arg1, arg2, arg3) {
|
|
5413
5568
|
let deferred0_0;
|
|
5414
5569
|
let deferred0_1;
|
|
5415
5570
|
let deferred1_0;
|
|
@@ -5426,7 +5581,7 @@ function __wbg_get_imports() {
|
|
|
5426
5581
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
5427
5582
|
}
|
|
5428
5583
|
},
|
|
5429
|
-
|
|
5584
|
+
__wbg___pubkyGrantEnsureDelegatedKey_fb6d009c63fedb54: function(arg0, arg1) {
|
|
5430
5585
|
let v0;
|
|
5431
5586
|
if (arg0 !== 0) {
|
|
5432
5587
|
v0 = getStringFromWasm0(arg0, arg1);
|
|
@@ -5435,7 +5590,7 @@ function __wbg_get_imports() {
|
|
|
5435
5590
|
const ret = __pubkyGrantEnsureDelegatedKey(v0);
|
|
5436
5591
|
return ret;
|
|
5437
5592
|
},
|
|
5438
|
-
|
|
5593
|
+
__wbg___pubkyGrantLoadDelegatedPublicKey_3516a6bc4e78f266: function(arg0, arg1) {
|
|
5439
5594
|
let deferred0_0;
|
|
5440
5595
|
let deferred0_1;
|
|
5441
5596
|
try {
|
|
@@ -5447,18 +5602,18 @@ function __wbg_get_imports() {
|
|
|
5447
5602
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
5448
5603
|
}
|
|
5449
5604
|
},
|
|
5450
|
-
|
|
5605
|
+
__wbg___pubkyRecoveredEncryptionKeys_8129a9d229919061: function(arg0, arg1, arg2, arg3, arg4) {
|
|
5451
5606
|
const ret = __pubkyRecoveredEncryptionKeys(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), EncryptionKeys.__wrap(arg4));
|
|
5452
5607
|
return ret;
|
|
5453
5608
|
},
|
|
5454
|
-
|
|
5609
|
+
__wbg___pubkySessionAcquire_b810bc4be7513322: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
5455
5610
|
const ret = __pubkySessionAcquire(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4 !== 0);
|
|
5456
5611
|
return ret;
|
|
5457
5612
|
}, arguments); },
|
|
5458
|
-
|
|
5613
|
+
__wbg___pubkySessionRelease_f019c6fb31a86113: function(arg0) {
|
|
5459
5614
|
__pubkySessionRelease(arg0 >>> 0);
|
|
5460
5615
|
},
|
|
5461
|
-
|
|
5616
|
+
__wbg___pubkySessionStoreGet_1166e2b524db1bdf: function(arg0, arg1) {
|
|
5462
5617
|
let deferred0_0;
|
|
5463
5618
|
let deferred0_1;
|
|
5464
5619
|
try {
|
|
@@ -5470,7 +5625,7 @@ function __wbg_get_imports() {
|
|
|
5470
5625
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
5471
5626
|
}
|
|
5472
5627
|
},
|
|
5473
|
-
|
|
5628
|
+
__wbg___pubkySessionStoreMetadata_e8097eef06412410: function(arg0, arg1) {
|
|
5474
5629
|
let deferred0_0;
|
|
5475
5630
|
let deferred0_1;
|
|
5476
5631
|
try {
|
|
@@ -5482,23 +5637,23 @@ function __wbg_get_imports() {
|
|
|
5482
5637
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
5483
5638
|
}
|
|
5484
5639
|
},
|
|
5485
|
-
|
|
5640
|
+
__wbg___pubkySessionStorePut_306972a8d5d40992: function(arg0, arg1) {
|
|
5486
5641
|
const ret = __pubkySessionStorePut(arg0, arg1 >>> 0);
|
|
5487
5642
|
return ret;
|
|
5488
5643
|
},
|
|
5489
|
-
|
|
5644
|
+
__wbg___pubkySessionWait_9431fb951145fff1: function(arg0) {
|
|
5490
5645
|
const ret = __pubkySessionWait(arg0 >>> 0);
|
|
5491
5646
|
return ret;
|
|
5492
5647
|
},
|
|
5493
|
-
|
|
5648
|
+
__wbg___pubkySharedSessionLoad_1a7e09fe9e7a6c6e: function(arg0) {
|
|
5494
5649
|
const ret = __pubkySharedSessionLoad(arg0 >>> 0);
|
|
5495
5650
|
return ret;
|
|
5496
5651
|
},
|
|
5497
|
-
|
|
5652
|
+
__wbg___pubkySharedSessionRemove_0d9792736173a9cd: function(arg0) {
|
|
5498
5653
|
const ret = __pubkySharedSessionRemove(arg0 >>> 0);
|
|
5499
5654
|
return ret;
|
|
5500
5655
|
},
|
|
5501
|
-
|
|
5656
|
+
__wbg___pubkySharedSessionStore_4a6f968b46c591fb: function(arg0, arg1) {
|
|
5502
5657
|
const ret = __pubkySharedSessionStore(arg0 >>> 0, arg1);
|
|
5503
5658
|
return ret;
|
|
5504
5659
|
},
|
|
@@ -5583,6 +5738,10 @@ function __wbg_get_imports() {
|
|
|
5583
5738
|
__wbg_abort_76dea11221098ae5: function(arg0) {
|
|
5584
5739
|
arg0.abort();
|
|
5585
5740
|
},
|
|
5741
|
+
__wbg_accountinfo_new: function(arg0) {
|
|
5742
|
+
const ret = AccountInfo.__wrap(arg0);
|
|
5743
|
+
return ret;
|
|
5744
|
+
},
|
|
5586
5745
|
__wbg_append_8e87c13f0f08f8cd: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
5587
5746
|
arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
5588
5747
|
}, arguments); },
|
|
@@ -5673,10 +5832,6 @@ function __wbg_get_imports() {
|
|
|
5673
5832
|
const ret = Event.__wrap(arg0);
|
|
5674
5833
|
return ret;
|
|
5675
5834
|
},
|
|
5676
|
-
__wbg_fetch_5aa263e0c14b0c5f: function(arg0) {
|
|
5677
|
-
const ret = fetch(arg0);
|
|
5678
|
-
return ret;
|
|
5679
|
-
},
|
|
5680
5835
|
__wbg_fetch_7a37768ab67c5bd8: function(arg0) {
|
|
5681
5836
|
const ret = fetch(arg0);
|
|
5682
5837
|
return ret;
|
|
@@ -5685,6 +5840,10 @@ function __wbg_get_imports() {
|
|
|
5685
5840
|
const ret = arg0.fetch(arg1);
|
|
5686
5841
|
return ret;
|
|
5687
5842
|
},
|
|
5843
|
+
__wbg_fetch_d2beca3120ba8e1b: function(arg0) {
|
|
5844
|
+
const ret = fetch(arg0);
|
|
5845
|
+
return ret;
|
|
5846
|
+
},
|
|
5688
5847
|
__wbg_from_a39669ce566077da: function(arg0) {
|
|
5689
5848
|
const ret = Array.from(arg0);
|
|
5690
5849
|
return ret;
|
|
@@ -5699,6 +5858,10 @@ function __wbg_get_imports() {
|
|
|
5699
5858
|
const ret = arg0.getReader();
|
|
5700
5859
|
return ret;
|
|
5701
5860
|
}, arguments); },
|
|
5861
|
+
__wbg_getReader_bf34f92ee19c42b4: function() { return handleError(function (arg0) {
|
|
5862
|
+
const ret = arg0.getReader();
|
|
5863
|
+
return ret;
|
|
5864
|
+
}, arguments); },
|
|
5702
5865
|
__wbg_get_6cf5a4d4d8ad3c5a: function() { return handleError(function (arg0, arg1) {
|
|
5703
5866
|
const ret = Reflect.get(arg0, arg1);
|
|
5704
5867
|
return ret;
|
|
@@ -5760,6 +5923,16 @@ function __wbg_get_imports() {
|
|
|
5760
5923
|
const ret = result;
|
|
5761
5924
|
return ret;
|
|
5762
5925
|
},
|
|
5926
|
+
__wbg_instanceof_Blob_38df052cf775f822: function(arg0) {
|
|
5927
|
+
let result;
|
|
5928
|
+
try {
|
|
5929
|
+
result = arg0 instanceof Blob;
|
|
5930
|
+
} catch (_) {
|
|
5931
|
+
result = false;
|
|
5932
|
+
}
|
|
5933
|
+
const ret = result;
|
|
5934
|
+
return ret;
|
|
5935
|
+
},
|
|
5763
5936
|
__wbg_instanceof_CryptoKey_98e09fab6f03bfea: function(arg0) {
|
|
5764
5937
|
let result;
|
|
5765
5938
|
try {
|
|
@@ -5890,7 +6063,7 @@ function __wbg_get_imports() {
|
|
|
5890
6063
|
const a = state0.a;
|
|
5891
6064
|
state0.a = 0;
|
|
5892
6065
|
try {
|
|
5893
|
-
return
|
|
6066
|
+
return wasm_bindgen_328ac0967063b244___convert__closures_____invoke___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
5894
6067
|
} finally {
|
|
5895
6068
|
state0.a = a;
|
|
5896
6069
|
}
|
|
@@ -6137,18 +6310,18 @@ function __wbg_get_imports() {
|
|
|
6137
6310
|
console.warn(arg0, arg1, arg2, arg3);
|
|
6138
6311
|
},
|
|
6139
6312
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
6140
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
6141
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6313
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 128, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
6314
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_328ac0967063b244___JsError___true_);
|
|
6142
6315
|
return ret;
|
|
6143
6316
|
},
|
|
6144
6317
|
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
6145
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
6146
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6318
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 288, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
6319
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue______true_);
|
|
6147
6320
|
return ret;
|
|
6148
6321
|
},
|
|
6149
6322
|
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
6150
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
6151
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6323
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 286, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
6324
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_328ac0967063b244___convert__closures_____invoke_______true_);
|
|
6152
6325
|
return ret;
|
|
6153
6326
|
},
|
|
6154
6327
|
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
@@ -6186,14 +6359,14 @@ function __wbg_get_imports() {
|
|
|
6186
6359
|
__wbindgen_generic_000000000000000a: function(arg0, arg1) {
|
|
6187
6360
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1);
|
|
6188
6361
|
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
6189
|
-
// Cast intrinsic for `Vector(RustStruct { name: "GrantInfo", unique_crate_identifier: "pubky-wasm-
|
|
6362
|
+
// Cast intrinsic for `Vector(RustStruct { name: "GrantInfo", unique_crate_identifier: "pubky-wasm-9e9e95822c39db63" }) -> Externref`.
|
|
6190
6363
|
const ret = v0;
|
|
6191
6364
|
return ret;
|
|
6192
6365
|
},
|
|
6193
6366
|
__wbindgen_generic_000000000000000b: function(arg0, arg1) {
|
|
6194
6367
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1);
|
|
6195
6368
|
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
6196
|
-
// Cast intrinsic for `Vector(RustStruct { name: "StoredSessionInfo", unique_crate_identifier: "pubky-wasm-
|
|
6369
|
+
// Cast intrinsic for `Vector(RustStruct { name: "StoredSessionInfo", unique_crate_identifier: "pubky-wasm-9e9e95822c39db63" }) -> Externref`.
|
|
6197
6370
|
const ret = v0;
|
|
6198
6371
|
return ret;
|
|
6199
6372
|
},
|
|
@@ -6210,33 +6383,33 @@ function __wbg_get_imports() {
|
|
|
6210
6383
|
return {
|
|
6211
6384
|
__proto__: null,
|
|
6212
6385
|
"./pubky_bg.js": import0,
|
|
6213
|
-
"./snippets/pubky-wasm-
|
|
6214
|
-
"./snippets/pubky-wasm-
|
|
6215
|
-
"./snippets/pubky-wasm-
|
|
6216
|
-
"./snippets/pubky-wasm-
|
|
6217
|
-
"./snippets/pubky-wasm-
|
|
6218
|
-
"./snippets/pubky-wasm-
|
|
6219
|
-
"./snippets/pubky-wasm-
|
|
6386
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline1.js": import1,
|
|
6387
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline1.js": import2,
|
|
6388
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline1.js": import3,
|
|
6389
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline1.js": import4,
|
|
6390
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline2.js": import5,
|
|
6391
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline0.js": import6,
|
|
6392
|
+
"./snippets/pubky-wasm-9e9e95822c39db63/inline2.js": import7,
|
|
6220
6393
|
};
|
|
6221
6394
|
}
|
|
6222
6395
|
|
|
6223
|
-
function
|
|
6224
|
-
wasm.
|
|
6396
|
+
function wasm_bindgen_328ac0967063b244___convert__closures_____invoke_______true_(arg0, arg1) {
|
|
6397
|
+
wasm.wasm_bindgen_328ac0967063b244___convert__closures_____invoke_______true_(arg0, arg1);
|
|
6225
6398
|
}
|
|
6226
6399
|
|
|
6227
|
-
function
|
|
6228
|
-
wasm.
|
|
6400
|
+
function wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue______true_(arg0, arg1, arg2) {
|
|
6401
|
+
wasm.wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue______true_(arg0, arg1, arg2);
|
|
6229
6402
|
}
|
|
6230
6403
|
|
|
6231
|
-
function
|
|
6232
|
-
const ret = wasm.
|
|
6404
|
+
function wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_328ac0967063b244___JsError___true_(arg0, arg1, arg2) {
|
|
6405
|
+
const ret = wasm.wasm_bindgen_328ac0967063b244___convert__closures_____invoke___wasm_bindgen_328ac0967063b244___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_328ac0967063b244___JsError___true_(arg0, arg1, arg2);
|
|
6233
6406
|
if (ret[1]) {
|
|
6234
6407
|
throw takeFromExternrefTable0(ret[0]);
|
|
6235
6408
|
}
|
|
6236
6409
|
}
|
|
6237
6410
|
|
|
6238
|
-
function
|
|
6239
|
-
wasm.
|
|
6411
|
+
function wasm_bindgen_328ac0967063b244___convert__closures_____invoke___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
6412
|
+
wasm.wasm_bindgen_328ac0967063b244___convert__closures_____invoke___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined___js_sys_ffedb94bf63a75b7___Function_fn_wasm_bindgen_328ac0967063b244___JsValue_____wasm_bindgen_328ac0967063b244___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
6240
6413
|
}
|
|
6241
6414
|
|
|
6242
6415
|
|
|
@@ -6256,6 +6429,9 @@ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
|
6256
6429
|
|
|
6257
6430
|
|
|
6258
6431
|
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
6432
|
+
const AccountInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6433
|
+
? { register: () => {}, unregister: () => {} }
|
|
6434
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_accountinfo_free(ptr, 1));
|
|
6259
6435
|
const AuthFlowFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
6260
6436
|
? { register: () => {}, unregister: () => {} }
|
|
6261
6437
|
: new FinalizationRegistry(ptr => wasm.__wbg_authflow_free(ptr, 1));
|