@synonymdev/pubky 0.10.0 → 0.12.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/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "@synonymdev/pubky",
3
3
  "type": "module",
4
4
  "description": "Decentralized identity, auth flows, and user-owned storage",
5
- "version": "0.10.0",
5
+ "version": "0.12.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/pubky/pubky-core.git"
9
+ "url": "git+https://github.com/pubky/pubky-homeserver.git"
10
10
  },
11
11
  "scripts": {
12
12
  "testnet": "cargo run -p pubky-testnet",
package/pubky.d.ts CHANGED
@@ -51,11 +51,11 @@ export interface XCallbackParams {
51
51
  */
52
52
  export interface GrantAuthFlowOptions {
53
53
  /**
54
- * App identifier shown in the user\'s grant/session list, typically a domain.
54
+ * App identifier shown in the user's grant/session list, typically a domain.
55
55
  */
56
56
  clientId: string;
57
57
  /**
58
- * Optional HTTP relay base, e.g. `\"https://demo.httprelay.io/inbox/\"`.
58
+ * Optional HTTP relay base, e.g. `"https://demo.httprelay.io/inbox/"`.
59
59
  * Defaults to the default Synonym-hosted relay when omitted.
60
60
  */
61
61
  relay?: string | null;
@@ -137,10 +137,10 @@ export interface PubkyError extends Error {
137
137
  * } catch (e) {
138
138
  * const error = e as PubkyError;
139
139
  * if (
140
- * error.name === \'RequestError\' &&
141
- * typeof error.data === \'object\' &&
140
+ * error.name === 'RequestError' &&
141
+ * typeof error.data === 'object' &&
142
142
  * error.data !== null &&
143
- * \'statusCode\' in error.data &&
143
+ * 'statusCode' in error.data &&
144
144
  * (error.data as { statusCode?: number }).statusCode === 404
145
145
  * ) {
146
146
  * // Handle not found...
@@ -162,7 +162,7 @@ export interface PubkyError {
162
162
  *
163
163
  * @typedef {Object} ResourceStats
164
164
  * @property {number=} contentLength Size in bytes.
165
- * @property {string=} contentType Media type (e.g. \"application/json; charset=utf-8\").
165
+ * @property {string=} contentType Media type (e.g. "application/json; charset=utf-8").
166
166
  * @property {number=} lastModifiedMs Unix epoch milliseconds.
167
167
  * @property {string=} etag Opaque server ETag for the current version.
168
168
  *
@@ -183,7 +183,7 @@ export interface ResourceStats {
183
183
  */
184
184
  contentLength?: number;
185
185
  /**
186
- * Media type of the stored object (e.g., `\"application/json\"`).
186
+ * Media type of the stored object (e.g., `"application/json"`).
187
187
  */
188
188
  contentType?: string;
189
189
  /**
@@ -256,6 +256,8 @@ export class AuthFlow {
256
256
  * @returns {AuthFlow} A flow reconnected to the original relay channel.
257
257
  * @throws {PubkyError}
258
258
  * - `{ name: "AuthenticationError" }` if the URL is invalid or not a signin/signup link
259
+ *
260
+ * @deprecated Use `GrantAuthFlow.resume(...)` instead.
259
261
  */
260
262
  static resume(authorization_url: string): AuthFlow;
261
263
  /**
@@ -501,7 +503,7 @@ export class Client {
501
503
  *
502
504
  * @example
503
505
  * const client = pubky.client;
504
- * const res = await client.fetch(`https://_pubky.${user}/pub/app/file.txt`, { method: "PUT", body: "hi", credentials: "include" });
506
+ * const res = await client.fetch(`https://_pubky.${user}/storage/${user}/pub/app/file.txt`, { method: "PUT", body: "hi", credentials: "include" });
505
507
  */
506
508
  fetch(url: string, init?: RequestInit | null): Promise<Response>;
507
509
  /**
@@ -549,8 +551,9 @@ export class Client {
549
551
  /**
550
552
  * Cookie-only view over a cookie-backed `Session`.
551
553
  *
552
- * Grant-backed sessions do not expose this view; use `session.cookie` and
553
- * check for `undefined` before calling cookie-specific methods.
554
+ * New applications should use `session.grant` and `GrantSession`.
555
+ *
556
+ * @deprecated Use `GrantSession` instead.
554
557
  */
555
558
  export class CookieSession {
556
559
  private constructor();
@@ -563,6 +566,7 @@ export class CookieSession {
563
566
  * still hold the HTTP-only cookie.
564
567
  *
565
568
  * @returns {string}
569
+ * @deprecated Use `GrantSession.exportLocalSecret()` instead.
566
570
  */
567
571
  export(): string;
568
572
  /**
@@ -572,6 +576,7 @@ export class CookieSession {
572
576
  * Node.js. Browser sessions cannot read HTTP-only Set-Cookie values.
573
577
  *
574
578
  * @returns {Promise<string>}
579
+ * @deprecated Use `GrantSession.exportLocalSecret()` instead.
575
580
  */
576
581
  exportSecret(): Promise<string>;
577
582
  }
@@ -1291,6 +1296,8 @@ export class Pubky {
1291
1296
  * sessionStorage.removeItem("pubky-auth-url");
1292
1297
  * }
1293
1298
  * }
1299
+ *
1300
+ * @deprecated Use `resumeGrantAuthFlow(...)` instead.
1294
1301
  */
1295
1302
  resumeCookieAuthFlow(authorization_url: string): AuthFlow;
1296
1303
  /**
@@ -1356,6 +1363,8 @@ export class Pubky {
1356
1363
  * const flow = pubky.startCookieAuthFlow("/pub/my-cool-app/:rw");
1357
1364
  * renderQr(flow.authorizationUrl);
1358
1365
  * const session = await flow.awaitApproval();
1366
+ *
1367
+ * @deprecated Use `startGrantAuthFlow(...)` instead.
1359
1368
  */
1360
1369
  startCookieAuthFlow(capabilities: Capabilities, kind: AuthFlowKind, relay?: string | null, x_callback?: XCallbackParams | null): AuthFlow;
1361
1370
  /**
@@ -1605,7 +1614,7 @@ export class Session {
1605
1614
  * @returns {string}
1606
1615
  * A base64 string to store (e.g. in `localStorage`).
1607
1616
  *
1608
- * @deprecated Prefer `exportLocalSecret()` for grant sessions.
1617
+ * @deprecated Use `GrantSession.exportLocalSecret()` instead.
1609
1618
  */
1610
1619
  export(): string;
1611
1620
  /**
@@ -1635,7 +1644,7 @@ export class Session {
1635
1644
  * Optional client to reuse transport configuration.
1636
1645
  * @returns {Promise<Session>}
1637
1646
  *
1638
- * @deprecated Prefer `Pubky.restoreSession(...)`.
1647
+ * @deprecated Use `Pubky.restoreSession(...)` with a grant secret.
1639
1648
  */
1640
1649
  static restore(exported: string, client?: Client | null): Promise<Session>;
1641
1650
  /**
@@ -1651,6 +1660,7 @@ export class Session {
1651
1660
  * Grant-backed sessions return `undefined`.
1652
1661
  *
1653
1662
  * @returns {CookieSession|undefined}
1663
+ * @deprecated Use `session.grant` and `GrantSession` instead.
1654
1664
  */
1655
1665
  readonly cookie: CookieSession | undefined;
1656
1666
  /**
@@ -2113,7 +2123,7 @@ export class StoredSessionInfo {
2113
2123
  * Resolve a `pubky://` or `pubky<pk>/…` identifier into the homeserver transport URL.
2114
2124
  *
2115
2125
  * @param {string} identifier Either `pubky<pk>/...` (preferred) or `pubky://<pk>/...`.
2116
- * @returns {string} HTTPS URL in the form `https://_pubky.<pk>/...`.
2126
+ * @returns {string} HTTPS URL in the form `https://_pubky.<pk>/storage/<pk>/...`.
2117
2127
  */
2118
2128
  export function resolvePubky(identifier: string): string;
2119
2129
 
package/pubky_bg.wasm CHANGED
Binary file