@solarpunkltd/swarm-id 0.8.2 → 0.10.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.
Files changed (35) hide show
  1. package/README.md +17 -7
  2. package/dist/bus/account-bus.d.ts +12 -0
  3. package/dist/bus/messages.d.ts +12 -0
  4. package/dist/bus/signaling-transport.d.ts +2 -0
  5. package/dist/chunks/ccip-BEanftc1.js +2 -0
  6. package/dist/chunks/ccip-BEanftc1.js.map +1 -0
  7. package/dist/chunks/{chat-binding-DgECjSWW.js → chat-binding-gSvKTm5l.js} +15 -15
  8. package/dist/chunks/chat-binding-gSvKTm5l.js.map +1 -0
  9. package/dist/chunks/index-BbRV2bja.js +2 -0
  10. package/dist/chunks/index-BbRV2bja.js.map +1 -0
  11. package/dist/index.d.ts +5 -1
  12. package/dist/internal.d.ts +3 -1
  13. package/dist/internal.esm.js +1 -1
  14. package/dist/internal.esm.js.map +1 -1
  15. package/dist/schemas.d.ts +59 -0
  16. package/dist/swarm-id-button-frame.d.ts +77 -0
  17. package/dist/swarm-id-client.d.ts +64 -69
  18. package/dist/swarm-id-proxy.d.ts +47 -55
  19. package/dist/swarm-id.esm.js +1 -1
  20. package/dist/swarm-id.esm.js.map +1 -1
  21. package/dist/sync/device-state.d.ts +16 -7
  22. package/dist/sync/index.d.ts +2 -1
  23. package/dist/sync/published-wallet-link.d.ts +27 -0
  24. package/dist/types.d.ts +374 -64
  25. package/dist/utils/button-view.d.ts +16 -0
  26. package/dist/utils/ens-name.d.ts +33 -0
  27. package/dist/utils/ens.d.ts +13 -0
  28. package/dist/utils/json-rpc.d.ts +5 -0
  29. package/dist/utils/personal-sign.d.ts +17 -0
  30. package/dist/utils/postage-stamp-association.d.ts +24 -25
  31. package/dist/utils/site-allow-list.d.ts +0 -4
  32. package/dist/utils/storage-probe.d.ts +20 -10
  33. package/dist/utils/wallet-link.d.ts +70 -0
  34. package/package.json +2 -1
  35. package/dist/chunks/chat-binding-DgECjSWW.js.map +0 -1
@@ -17,15 +17,11 @@
17
17
  */
18
18
  import { Bee, BatchId, EthAddress, PrivateKey, Topic } from "@ethersphere/bee-js";
19
19
  import { z } from "zod";
20
- import { type AccountStateSnapshot, type ConnectedApp, type Device, type PostageStamp } from "../schemas";
20
+ import { type AccountSettings, type AccountStateSnapshot, type ConnectedApp, type Device, type PostageStamp } from "../schemas";
21
+ import type { WalletLink } from "../utils/wallet-link";
21
22
  import { type UploadTarget } from "../proxy/upload";
22
23
  import type { SyncResult } from "./types";
23
24
  export declare const DEVICE_STATE_TOPIC_PREFIX = "swarm-id-devstate-v1";
24
- /** Account settings carried in a device view (mirrors `account.settings`). */
25
- declare const SettingsSchema: z.ZodObject<{
26
- appSessionDuration: z.ZodOptional<z.ZodNumber>;
27
- }, z.core.$strip>;
28
- export type AccountSettings = z.infer<typeof SettingsSchema>;
29
25
  /**
30
26
  * One device's view of the account. `connectedApps`/`postageStamps` carry their
31
27
  * Phase 1 LWW/tombstone clocks; scalars carry their own per-field `at`.
@@ -85,6 +81,14 @@ export declare const DeviceStateSnapshotSchemaV1: z.ZodObject<{
85
81
  }, z.core.$strip>>;
86
82
  at: z.ZodNumber;
87
83
  }, z.core.$strip>;
84
+ walletLink: z.ZodDefault<z.ZodObject<{
85
+ value: z.ZodOptional<z.ZodObject<{
86
+ message: z.ZodString;
87
+ walletSignature: z.ZodString;
88
+ accountSignature: z.ZodString;
89
+ }, z.core.$strip>>;
90
+ at: z.ZodNumber;
91
+ }, z.core.$strip>>;
88
92
  accountPublicKey: z.ZodString;
89
93
  accountCreatedAt: z.ZodNumber;
90
94
  partitionCount: z.ZodDefault<z.ZodNumber>;
@@ -106,6 +110,10 @@ export interface DeviceStateView {
106
110
  value: AccountSettings | undefined;
107
111
  at: number;
108
112
  };
113
+ walletLink: {
114
+ value: WalletLink | undefined;
115
+ at: number;
116
+ };
109
117
  accountPublicKey: string;
110
118
  accountCreatedAt: number;
111
119
  partitionCount: number;
@@ -118,9 +126,11 @@ export interface FoldedAccount {
118
126
  accountName: string;
119
127
  defaultPostageStampBatchID: BatchId | undefined;
120
128
  settings: AccountSettings | undefined;
129
+ walletLink: WalletLink | undefined;
121
130
  accountNameAt: number;
122
131
  defaultStampAt: number;
123
132
  settingsAt: number;
133
+ walletLinkAt: number;
124
134
  createdAt: number;
125
135
  publicKey: string;
126
136
  partitionCount: number;
@@ -197,4 +207,3 @@ export declare function readLatestDeviceState(opts: {
197
207
  * unchanged from Phase 1.
198
208
  */
199
209
  export declare function foldAccount(views: DeviceStateSnapshot[], rosterDevices: Device[], accountId: string): FoldedAccount;
200
- export {};
@@ -3,7 +3,8 @@ export { mergeSnapshotWithRemote, mergeConnectedApps, mergePostageStamps, mergeD
3
3
  export { createSyncAccount } from "./sync-account";
4
4
  export type { SyncAccountOptions, SyncAccountFunction } from "./sync-account";
5
5
  export { deviceStateTopic, accountStateToDeviceView, writeDeviceState, publishDeviceState, readLatestDeviceState, foldAccount, deserializeDeviceState, DeviceStateSnapshotSchemaV1, DEVICE_STATE_TOPIC_PREFIX, } from "./device-state";
6
- export type { DeviceStateSnapshot, DeviceStateView, FoldedAccount, AccountSettings, } from "./device-state";
6
+ export type { DeviceStateSnapshot, DeviceStateView, FoldedAccount, } from "./device-state";
7
+ export type { AccountSettings } from "../schemas";
7
8
  export { rosterTopic, readRoster, ensureInRoster, ROSTER_TOPIC_PREFIX, } from "./device-roster";
8
9
  export { foldAccountFromSwarm, foldedToSyncedAccount, } from "./fold-account-from-swarm";
9
10
  export type { FoldAccountResult } from "./fold-account-from-swarm";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The wallet link as the account last published it (docs/Wallet-Link.md).
3
+ *
4
+ * "Show my ENS name on sites" reaches an open site's frame over the account
5
+ * bus, and the bus keeps no mailbox. A change made while no page of a site was
6
+ * open is written only to Swarm, so a site's frame restored on its next load
7
+ * reads it here. The read is the restored-session check's own fold, which
8
+ * `foldAccountFromSwarm` shares between the two while both are in flight.
9
+ */
10
+ import type { Bee } from "@ethersphere/bee-js";
11
+ import type { WalletLink } from "../utils/wallet-link";
12
+ export interface PublishedWalletLink {
13
+ /** Absent when the setting was last turned off */
14
+ walletLink: WalletLink | undefined;
15
+ /** The link's own last-writer-wins clock */
16
+ walletLinkAt: number;
17
+ }
18
+ /**
19
+ * Answers `undefined` for an account that never published and for a Swarm
20
+ * that could not be read. Neither says anything about the setting, so the
21
+ * frame keeps what it holds.
22
+ */
23
+ export declare function readPublishedWalletLink(opts: {
24
+ bee: Bee;
25
+ derivationKey: string;
26
+ accountId: string;
27
+ }): Promise<PublishedWalletLink | undefined>;