@solarpunkltd/swarm-id 0.8.0 → 0.8.1

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.
@@ -77,6 +77,7 @@ export interface WithWriteOptions {
77
77
  wait?: "block" | "skip";
78
78
  }
79
79
  export interface BatchWriteCoordinatorDeps {
80
+ /** Read on every use, so a getter here follows a change of node. */
80
81
  bee: Bee;
81
82
  /** Postage batch id (hex) — the `withBatchWriteLock` key. */
82
83
  batchId: string;
package/dist/types.d.ts CHANGED
@@ -653,6 +653,7 @@ export declare const ConnectionInfoSchema: z.ZodObject<{
653
653
  message: z.ZodString;
654
654
  signature: z.ZodString;
655
655
  }, z.core.$strip>>;
656
+ beeApiUrl: z.ZodOptional<z.ZodString>;
656
657
  }, z.core.$strip>;
657
658
  export type ConnectionInfo = z.infer<typeof ConnectionInfoSchema>;
658
659
  export declare const AppMetadataSchema: z.ZodObject<{
@@ -762,6 +763,15 @@ export declare const DeriveAppSecretMessageSchema: z.ZodObject<{
762
763
  requestId: z.ZodString;
763
764
  label: z.ZodString;
764
765
  }, z.core.$strip>;
766
+ /**
767
+ * The site's own Bee address for this frame from now on, replacing the one
768
+ * `parentIdentify` gave, for the site's session alone.
769
+ */
770
+ export declare const SetBeeApiUrlMessageSchema: z.ZodObject<{
771
+ type: z.ZodLiteral<"setBeeApiUrl">;
772
+ requestId: z.ZodString;
773
+ beeApiUrl: z.ZodString;
774
+ }, z.core.$strip>;
765
775
  export declare const GetChatKeyMessageSchema: z.ZodObject<{
766
776
  type: z.ZodLiteral<"getChatKey">;
767
777
  requestId: z.ZodString;
@@ -1366,6 +1376,10 @@ export declare const ParentToIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
1366
1376
  }, z.core.$strip>, z.ZodObject<{
1367
1377
  type: z.ZodLiteral<"getChatKey">;
1368
1378
  requestId: z.ZodString;
1379
+ }, z.core.$strip>, z.ZodObject<{
1380
+ type: z.ZodLiteral<"setBeeApiUrl">;
1381
+ requestId: z.ZodString;
1382
+ beeApiUrl: z.ZodString;
1369
1383
  }, z.core.$strip>, z.ZodObject<{
1370
1384
  type: z.ZodLiteral<"stampChunk">;
1371
1385
  requestId: z.ZodString;
@@ -1833,6 +1847,7 @@ export type UploadDataMessage = z.infer<typeof UploadDataMessageSchema>;
1833
1847
  export type DownloadDataMessage = z.infer<typeof DownloadDataMessageSchema>;
1834
1848
  export type DeriveAppSecretMessage = z.infer<typeof DeriveAppSecretMessageSchema>;
1835
1849
  export type GetChatKeyMessage = z.infer<typeof GetChatKeyMessageSchema>;
1850
+ export type SetBeeApiUrlMessage = z.infer<typeof SetBeeApiUrlMessageSchema>;
1836
1851
  export type StampChunkSigner = z.infer<typeof StampChunkSignerSchema>;
1837
1852
  export type StampChunkRequest = z.infer<typeof StampChunkRequestSchema>;
1838
1853
  export type StampChunkMessage = z.infer<typeof StampChunkMessageSchema>;
@@ -1917,6 +1932,11 @@ export declare const GetChatKeyResponseMessageSchema: z.ZodObject<{
1917
1932
  requestId: z.ZodString;
1918
1933
  chatKey: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
1919
1934
  }, z.core.$strip>;
1935
+ export declare const SetBeeApiUrlResponseMessageSchema: z.ZodObject<{
1936
+ type: z.ZodLiteral<"setBeeApiUrlResponse">;
1937
+ requestId: z.ZodString;
1938
+ beeApiUrl: z.ZodString;
1939
+ }, z.core.$strip>;
1920
1940
  export declare const StampChunkResponseMessageSchema: z.ZodObject<{
1921
1941
  type: z.ZodLiteral<"stampChunkResponse">;
1922
1942
  requestId: z.ZodString;
@@ -2122,6 +2142,7 @@ export declare const ConnectionInfoChangedMessageSchema: z.ZodObject<{
2122
2142
  message: z.ZodString;
2123
2143
  signature: z.ZodString;
2124
2144
  }, z.core.$strip>>;
2145
+ beeApiUrl: z.ZodOptional<z.ZodString>;
2125
2146
  }, z.core.$strip>;
2126
2147
  export declare const ConnectResponseMessageSchema: z.ZodObject<{
2127
2148
  type: z.ZodLiteral<"connectResponse">;
@@ -2365,6 +2386,10 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
2365
2386
  type: z.ZodLiteral<"getChatKeyResponse">;
2366
2387
  requestId: z.ZodString;
2367
2388
  chatKey: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
2389
+ }, z.core.$strip>, z.ZodObject<{
2390
+ type: z.ZodLiteral<"setBeeApiUrlResponse">;
2391
+ requestId: z.ZodString;
2392
+ beeApiUrl: z.ZodString;
2368
2393
  }, z.core.$strip>, z.ZodObject<{
2369
2394
  type: z.ZodLiteral<"stampChunkResponse">;
2370
2395
  requestId: z.ZodString;
@@ -2485,6 +2510,7 @@ export declare const IframeToParentMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
2485
2510
  message: z.ZodString;
2486
2511
  signature: z.ZodString;
2487
2512
  }, z.core.$strip>>;
2513
+ beeApiUrl: z.ZodOptional<z.ZodString>;
2488
2514
  }, z.core.$strip>, z.ZodObject<{
2489
2515
  type: z.ZodLiteral<"connectResponse">;
2490
2516
  requestId: z.ZodString;
@@ -2671,6 +2697,7 @@ export type AuthSuccessMessage = z.infer<typeof AuthSuccessMessageSchema>;
2671
2697
  export type UploadDataResponseMessage = z.infer<typeof UploadDataResponseMessageSchema>;
2672
2698
  export type DownloadDataResponseMessage = z.infer<typeof DownloadDataResponseMessageSchema>;
2673
2699
  export type GetChatKeyResponseMessage = z.infer<typeof GetChatKeyResponseMessageSchema>;
2700
+ export type SetBeeApiUrlResponseMessage = z.infer<typeof SetBeeApiUrlResponseMessageSchema>;
2674
2701
  export type DeriveAppSecretResponseMessage = z.infer<typeof DeriveAppSecretResponseMessageSchema>;
2675
2702
  export type StampChunkResponseMessage = z.infer<typeof StampChunkResponseMessageSchema>;
2676
2703
  export type UploadFileResponseMessage = z.infer<typeof UploadFileResponseMessageSchema>;
@@ -2990,6 +3017,14 @@ export interface ClientOptions {
2990
3017
  containerId?: string;
2991
3018
  /** URL of a subsidised gateway for users without postage stamps. Gateway handles stamping server-side. */
2992
3019
  subsidisedGatewayUrl?: string;
3020
+ /**
3021
+ * The Bee node this site's content reads and stamped uploads go through, in
3022
+ * place of the node the person set in Swarm ID, which keeps applying on
3023
+ * every other site. The person's account and device coordination stay on
3024
+ * their own node. An http(s) URL, optionally with a path. Change it later
3025
+ * with `setBeeApiUrl`. Held by this site's frame alone and never stored.
3026
+ */
3027
+ beeApiUrl?: string;
2993
3028
  }
2994
3029
  export interface AuthOptions {
2995
3030
  masterKeyStorageKey?: string;
@@ -11,6 +11,14 @@ export declare function normalizeUrl(url: string): string;
11
11
  * dialog so a broken Bee/RPC endpoint can't be saved or persisted.
12
12
  */
13
13
  export declare function isHttpUrl(value: string): boolean;
14
+ /**
15
+ * True for an address a site may name as its Bee node: an `http:` or
16
+ * `https:` URL, optionally with a path, the way a gateway in front of Bee is
17
+ * often mounted. Refused besides what `isHttpUrl` refuses: credentials, which
18
+ * `fetch` will not send from a URL and throws on, and a query or fragment,
19
+ * which bee-js would put in the middle of every request path it appends.
20
+ */
21
+ export declare function isBeeApiUrl(value: string): boolean;
14
22
  /**
15
23
  * Configuration options for building the authentication URL.
16
24
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solarpunkltd/swarm-id",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "description": "Swarm ID library for authentication and Bee API operations",
6
6
  "main": "dist/swarm-id.esm.js",