@minca/core 0.3.1 → 0.4.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 (212) hide show
  1. package/README.md +2 -2
  2. package/dist/{session → hosting}/hosting.d.ts +1 -1
  3. package/dist/{session → hosting}/hosting.d.ts.map +1 -1
  4. package/dist/{session → hosting}/hosting.js.map +1 -1
  5. package/dist/index.d.ts +20 -28
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +16 -19
  8. package/dist/index.js.map +1 -1
  9. package/dist/network/mesh.d.ts.map +1 -1
  10. package/dist/network/mesh.js +13 -3
  11. package/dist/network/mesh.js.map +1 -1
  12. package/dist/network/network-manager.d.ts +5 -0
  13. package/dist/network/network-manager.d.ts.map +1 -1
  14. package/dist/network/network-manager.js +3 -0
  15. package/dist/network/network-manager.js.map +1 -1
  16. package/dist/network/peer-auth.d.ts +17 -5
  17. package/dist/network/peer-auth.d.ts.map +1 -1
  18. package/dist/network/peer-auth.js +19 -9
  19. package/dist/network/peer-auth.js.map +1 -1
  20. package/dist/network/rtc-transport.d.ts.map +1 -1
  21. package/dist/network/rtc-transport.js +1 -0
  22. package/dist/network/rtc-transport.js.map +1 -1
  23. package/dist/network/transport.d.ts +12 -0
  24. package/dist/network/transport.d.ts.map +1 -1
  25. package/dist/network/ws-transport.d.ts +1 -1
  26. package/dist/network/ws-transport.d.ts.map +1 -1
  27. package/dist/network/ws-transport.js +14 -4
  28. package/dist/network/ws-transport.js.map +1 -1
  29. package/dist/node/index.d.ts +1 -5
  30. package/dist/node/index.d.ts.map +1 -1
  31. package/dist/node/index.js +0 -3
  32. package/dist/node/index.js.map +1 -1
  33. package/dist/node/node-hosting.js +1 -1
  34. package/dist/node/node-records.js +1 -1
  35. package/dist/node/node-records.js.map +1 -1
  36. package/dist/node/node.d.ts.map +1 -1
  37. package/dist/node/node.js +18 -0
  38. package/dist/node/node.js.map +1 -1
  39. package/dist/node/space-mirrors.d.ts +1 -1
  40. package/dist/node/space-mirrors.d.ts.map +1 -1
  41. package/dist/node/space-mirrors.js +17 -5
  42. package/dist/node/space-mirrors.js.map +1 -1
  43. package/dist/node/space-peers.d.ts +2 -0
  44. package/dist/node/space-peers.d.ts.map +1 -1
  45. package/dist/node/space-peers.js +41 -8
  46. package/dist/node/space-peers.js.map +1 -1
  47. package/dist/node/space-runtime.d.ts +4 -2
  48. package/dist/node/space-runtime.d.ts.map +1 -1
  49. package/dist/node/space-runtime.js +3 -2
  50. package/dist/node/space-runtime.js.map +1 -1
  51. package/dist/node/space-standing.d.ts.map +1 -1
  52. package/dist/node/space-standing.js +12 -38
  53. package/dist/node/space-standing.js.map +1 -1
  54. package/dist/node/space-warrants.js +1 -1
  55. package/dist/node/space-warrants.js.map +1 -1
  56. package/dist/node/space-writing.d.ts.map +1 -1
  57. package/dist/node/space-writing.js +12 -32
  58. package/dist/node/space-writing.js.map +1 -1
  59. package/dist/node/stores.d.ts +2 -58
  60. package/dist/node/stores.d.ts.map +1 -1
  61. package/dist/node/stores.js +1 -74
  62. package/dist/node/stores.js.map +1 -1
  63. package/dist/node/types.d.ts +3 -3
  64. package/dist/node/types.d.ts.map +1 -1
  65. package/dist/node/writer-keys.d.ts +15 -14
  66. package/dist/node/writer-keys.d.ts.map +1 -1
  67. package/dist/node/writer-keys.js +3 -113
  68. package/dist/node/writer-keys.js.map +1 -1
  69. package/dist/records/key.d.ts +16 -19
  70. package/dist/records/key.d.ts.map +1 -1
  71. package/dist/records/key.js +53 -45
  72. package/dist/records/key.js.map +1 -1
  73. package/dist/records/rules.d.ts +1 -1
  74. package/dist/records/rules.d.ts.map +1 -1
  75. package/dist/records/rules.js +6 -4
  76. package/dist/records/rules.js.map +1 -1
  77. package/dist/storage/body-cache.d.ts +6 -3
  78. package/dist/storage/body-cache.d.ts.map +1 -1
  79. package/dist/storage/body-cache.js +37 -14
  80. package/dist/storage/body-cache.js.map +1 -1
  81. package/dist/storage/mirror.d.ts.map +1 -1
  82. package/dist/storage/mirror.js +35 -16
  83. package/dist/storage/mirror.js.map +1 -1
  84. package/dist/storage/segment.d.ts +6 -2
  85. package/dist/storage/segment.d.ts.map +1 -1
  86. package/dist/storage/segment.js +8 -4
  87. package/dist/storage/segment.js.map +1 -1
  88. package/dist/storage/shared-store.d.ts +32 -0
  89. package/dist/storage/shared-store.d.ts.map +1 -0
  90. package/dist/storage/{folder-reconcile.js → shared-store.js} +15 -15
  91. package/dist/storage/shared-store.js.map +1 -0
  92. package/dist/storage/storage-provider.d.ts +0 -9
  93. package/dist/storage/storage-provider.d.ts.map +1 -1
  94. package/dist/storage/storage-provider.js +8 -8
  95. package/dist/storage/storage-provider.js.map +1 -1
  96. package/dist/sync/sync-engine.d.ts +7 -0
  97. package/dist/sync/sync-engine.d.ts.map +1 -1
  98. package/dist/sync/sync-engine.js +179 -47
  99. package/dist/sync/sync-engine.js.map +1 -1
  100. package/dist/sync/sync-messages.d.ts +1 -1
  101. package/dist/sync/sync-messages.js +1 -1
  102. package/dist/types.d.ts +19 -0
  103. package/dist/types.d.ts.map +1 -1
  104. package/dist/types.js +4 -0
  105. package/dist/types.js.map +1 -1
  106. package/dist/utils/index.d.ts +5 -5
  107. package/dist/utils/index.d.ts.map +1 -1
  108. package/dist/utils/index.js +5 -5
  109. package/dist/utils/index.js.map +1 -1
  110. package/docs/README.md +3 -2
  111. package/docs/building-an-app.md +2 -2
  112. package/docs/node.md +24 -20
  113. package/docs/query-format.md +6 -5
  114. package/docs/records-and-queries.md +12 -13
  115. package/docs/storage.md +41 -15
  116. package/package.json +10 -19
  117. package/dist/identity/account-store.d.ts +0 -83
  118. package/dist/identity/account-store.d.ts.map +0 -1
  119. package/dist/identity/account-store.js +0 -234
  120. package/dist/identity/account-store.js.map +0 -1
  121. package/dist/identity/device-key.d.ts +0 -26
  122. package/dist/identity/device-key.d.ts.map +0 -1
  123. package/dist/identity/device-key.js +0 -48
  124. package/dist/identity/device-key.js.map +0 -1
  125. package/dist/identity/idb.d.ts +0 -19
  126. package/dist/identity/idb.d.ts.map +0 -1
  127. package/dist/identity/idb.js +0 -56
  128. package/dist/identity/idb.js.map +0 -1
  129. package/dist/node/worker.d.ts +0 -91
  130. package/dist/node/worker.d.ts.map +0 -1
  131. package/dist/node/worker.js +0 -344
  132. package/dist/node/worker.js.map +0 -1
  133. package/dist/node-worker.d.ts +0 -2
  134. package/dist/node-worker.d.ts.map +0 -1
  135. package/dist/node-worker.js +0 -16
  136. package/dist/node-worker.js.map +0 -1
  137. package/dist/session/account-hint.d.ts +0 -13
  138. package/dist/session/account-hint.d.ts.map +0 -1
  139. package/dist/session/account-hint.js +0 -54
  140. package/dist/session/account-hint.js.map +0 -1
  141. package/dist/session/channel-room.d.ts +0 -26
  142. package/dist/session/channel-room.d.ts.map +0 -1
  143. package/dist/session/channel-room.js +0 -56
  144. package/dist/session/channel-room.js.map +0 -1
  145. package/dist/session/connect-code.d.ts +0 -127
  146. package/dist/session/connect-code.d.ts.map +0 -1
  147. package/dist/session/connect-code.js +0 -408
  148. package/dist/session/connect-code.js.map +0 -1
  149. package/dist/session/connect.d.ts +0 -393
  150. package/dist/session/connect.d.ts.map +0 -1
  151. package/dist/session/connect.js +0 -587
  152. package/dist/session/connect.js.map +0 -1
  153. package/dist/session/connection.d.ts +0 -141
  154. package/dist/session/connection.d.ts.map +0 -1
  155. package/dist/session/connection.js +0 -344
  156. package/dist/session/connection.js.map +0 -1
  157. package/dist/session/index.d.ts +0 -24
  158. package/dist/session/index.d.ts.map +0 -1
  159. package/dist/session/index.js +0 -18
  160. package/dist/session/index.js.map +0 -1
  161. package/dist/session/pairing.d.ts +0 -97
  162. package/dist/session/pairing.d.ts.map +0 -1
  163. package/dist/session/pairing.js +0 -251
  164. package/dist/session/pairing.js.map +0 -1
  165. package/dist/session/places.d.ts +0 -71
  166. package/dist/session/places.d.ts.map +0 -1
  167. package/dist/session/places.js +0 -130
  168. package/dist/session/places.js.map +0 -1
  169. package/dist/session/popup.d.ts +0 -13
  170. package/dist/session/popup.d.ts.map +0 -1
  171. package/dist/session/popup.js +0 -23
  172. package/dist/session/popup.js.map +0 -1
  173. package/dist/session/stay-signed-in.d.ts +0 -48
  174. package/dist/session/stay-signed-in.d.ts.map +0 -1
  175. package/dist/session/stay-signed-in.js +0 -141
  176. package/dist/session/stay-signed-in.js.map +0 -1
  177. package/dist/storage/blob/directory.d.ts +0 -14
  178. package/dist/storage/blob/directory.d.ts.map +0 -1
  179. package/dist/storage/blob/directory.js +0 -87
  180. package/dist/storage/blob/directory.js.map +0 -1
  181. package/dist/storage/blob/memory.d.ts +0 -6
  182. package/dist/storage/blob/memory.d.ts.map +0 -1
  183. package/dist/storage/blob/memory.js +0 -20
  184. package/dist/storage/blob/memory.js.map +0 -1
  185. package/dist/storage/blob/s3.d.ts +0 -16
  186. package/dist/storage/blob/s3.d.ts.map +0 -1
  187. package/dist/storage/blob/s3.js +0 -91
  188. package/dist/storage/blob/s3.js.map +0 -1
  189. package/dist/storage/directory-access.d.ts +0 -36
  190. package/dist/storage/directory-access.d.ts.map +0 -1
  191. package/dist/storage/directory-access.js +0 -89
  192. package/dist/storage/directory-access.js.map +0 -1
  193. package/dist/storage/folder-adapter.d.ts +0 -100
  194. package/dist/storage/folder-adapter.d.ts.map +0 -1
  195. package/dist/storage/folder-adapter.js +0 -232
  196. package/dist/storage/folder-adapter.js.map +0 -1
  197. package/dist/storage/folder-reconcile.d.ts +0 -33
  198. package/dist/storage/folder-reconcile.d.ts.map +0 -1
  199. package/dist/storage/folder-reconcile.js.map +0 -1
  200. package/dist/storage/index.d.ts +0 -6
  201. package/dist/storage/index.d.ts.map +0 -1
  202. package/dist/storage/index.js +0 -5
  203. package/dist/storage/index.js.map +0 -1
  204. package/dist/storage/indexeddb-adapter.d.ts +0 -8
  205. package/dist/storage/indexeddb-adapter.d.ts.map +0 -1
  206. package/dist/storage/indexeddb-adapter.js +0 -128
  207. package/dist/storage/indexeddb-adapter.js.map +0 -1
  208. package/dist/storage/sqlite-adapter.d.ts +0 -57
  209. package/dist/storage/sqlite-adapter.d.ts.map +0 -1
  210. package/dist/storage/sqlite-adapter.js +0 -213
  211. package/dist/storage/sqlite-adapter.js.map +0 -1
  212. /package/dist/{session → hosting}/hosting.js +0 -0
@@ -1,141 +0,0 @@
1
- /**
2
- * @module session/connection
3
- * An app's side of an account home, as one object any UI can draw — the twin
4
- * of `createMincaAuth`, for apps that never sign anyone in themselves.
5
- *
6
- * ```ts
7
- * const connection = createMincaConnection({
8
- * home: 'https://minca-home.example/connect', // a default; people can bring their own
9
- * request: { name: 'Todo', access: 'write', scope: 'account' },
10
- * network: { relays },
11
- * });
12
- * button.onclick = () => connection.connect(); // from a click: it opens a popup
13
- * connection.subscribe(({ status, node }) => …);
14
- * ```
15
- *
16
- * It remembers the grant between visits and starts the node from it; when the
17
- * grant runs out it says so (`expired`), and connecting again renews it. When
18
- * the home disconnects the app, it forgets the grant and says so.
19
- *
20
- * It keeps a grant for each account the person connects, each made out to a
21
- * key of its own, and acts for one at a time: `use(did)` switches, with no
22
- * trip to the home, since the grant is already here. It learns of an account
23
- * only when the person connects it.
24
- *
25
- * The home is the person's, not the app's: `home` is only a default.
26
- * `connect('minca.example.com')` uses theirs, and it is remembered — for
27
- * reconnecting, and for linking to their account settings.
28
- */
29
- import type { NodeNetworkConfig, P2PNode } from '../node/types.js';
30
- import type { StoreFactory } from '../node/stores.js';
31
- import { type ConnectRequest, type Grant, type SeededAppKey, type Proposed } from './connect.js';
32
- import type { AutomationProposal } from '../space/own-automations.js';
33
- import { type WorkerLike } from '../node/worker.js';
34
- import { type KeyValueStore } from './stay-signed-in.js';
35
- export interface MincaConnectionConfig {
36
- /** The account home to suggest — the person can use their own instead */
37
- readonly home: string;
38
- /** What to ask for */
39
- readonly request: Omit<ConnectRequest, 'v' | 'audience' | 'proof'>;
40
- /** Relays and always-on nodes the node connects to. Omit to stay offline. */
41
- readonly network?: NodeNetworkConfig;
42
- /** Where the grants are kept. Default `localStorage`. */
43
- readonly storage?: KeyValueStore | null;
44
- /** Where the node keeps its data. Default: this site's IndexedDB. */
45
- readonly stores?: (grant: Grant) => StoreFactory;
46
- /**
47
- * Runs the node in a worker, off the page's main thread
48
- * (`@minca/core/node-worker`). Called each time the node starts;
49
- * the worker ends when it closes. Not with `stores`.
50
- */
51
- readonly worker?: () => WorkerLike;
52
- /** Where the app's keys are kept, one per account, by name. Default: this site's IndexedDB (`appKey`). */
53
- readonly keys?: {
54
- get(name: string): Promise<SeededAppKey>;
55
- forget(name: string): Promise<void>;
56
- };
57
- /**
58
- * Which connected account to act for on starting, such as the one the
59
- * address names. Default: the one used last here, else the first.
60
- */
61
- readonly account?: (accounts: ReadonlyArray<ConnectedAccount>) => string | null | undefined;
62
- }
63
- /**
64
- * `starting` — looking for a grant from an earlier visit, or switching account.
65
- * `disconnected` — none; show a way to connect. `error` says why, when the home disconnected the app.
66
- * `connecting` — the home is open, waiting on the person.
67
- * `ready` — `node` acts for the account.
68
- * `expired` — the grant ran out; connecting again renews it.
69
- */
70
- export type ConnectionStatus = 'starting' | 'disconnected' | 'connecting' | 'ready' | 'expired';
71
- /** An account this app holds a grant for */
72
- export interface ConnectedAccount {
73
- readonly did: string;
74
- /** The name the home gave when it granted, for showing which is which */
75
- readonly name: string;
76
- /** When its grant runs out, in seconds since the epoch */
77
- readonly expiresAt: number;
78
- }
79
- export interface MincaConnectionState {
80
- readonly status: ConnectionStatus;
81
- /** The home this app connects to: the person's own, once they chose one, else the default */
82
- readonly home: string;
83
- /** The grant of the account acted for */
84
- readonly grant: Grant | null;
85
- readonly node: P2PNode | null;
86
- readonly error: string | null;
87
- /** Every account connected here, in the order they were first connected */
88
- readonly accounts: ReadonlyArray<ConnectedAccount>;
89
- }
90
- export interface MincaConnection {
91
- getState(): MincaConnectionState;
92
- subscribe(listener: (state: MincaConnectionState) => void): () => void;
93
- /** Picks up a grant from an earlier visit. Safe to call more than once. */
94
- start(): Promise<void>;
95
- /**
96
- * Opens the home and asks, with a new key. Call it from a click. Acts for
97
- * whichever account the person chooses there: a new one, or one connected
98
- * already, whose grant this renews.
99
- * @param home The person's own home — `minca.example.com` is enough. Default: the one in `state.home`.
100
- */
101
- connect(home?: string): Promise<void>;
102
- /** Acts for another connected account. The home is not asked: its grant is here already. */
103
- use(did: string): Promise<void>;
104
- /**
105
- * Forgets an account's grant and its key (default the one acted for), and
106
- * acts for the next connected account, if any. The account is untouched.
107
- */
108
- disconnect(did?: string): Promise<void>;
109
- /**
110
- * Opens the person's account home in a window of its own, at the account
111
- * this app acts for: its settings, or a `section` of them such as
112
- * `notifications`. The home is never framed, since it holds the keys. Call
113
- * it from a click.
114
- */
115
- openHome(section?: string): void;
116
- /**
117
- * Keeps this tab's node open while the tab is put away, as a call must;
118
- * returns what lets it go. Otherwise a tab whose node is its own closes it
119
- * when put away, and opens it again on coming back.
120
- */
121
- keepAwake(): () => void;
122
- /**
123
- * Offers the person automations that notify them — "notify me when…" — once connected.
124
- * Opens the home; call it from a click.
125
- * @returns What they kept
126
- */
127
- propose(automations: ReadonlyArray<AutomationProposal>): Promise<Proposed>;
128
- }
129
- /**
130
- * Opens the account home in a window of its own, at the account a connection
131
- * acts for: `connection.openHome`, for a connection made some other way.
132
- */
133
- export declare function openAccountHome({ home, grant, }: {
134
- readonly home: string;
135
- readonly grant: {
136
- readonly home: string;
137
- readonly did: string;
138
- } | null;
139
- }, section?: string): void;
140
- export declare function createMincaConnection(config: MincaConnectionConfig): MincaConnection;
141
- //# sourceMappingURL=connection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/session/connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAUL,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KA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E,aAAa,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC5E;AAKD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,EACE,IAAI,EACJ,KAAK,GACN,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,EACpG,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAGN;AAuCD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAmSpF"}
@@ -1,344 +0,0 @@
1
- import { appKey, connectToHome, homeAddress, forgetAppKey, grantStore, proposeToHome, startConnectedNode, watchGrant, grantExpired, } from './connect.js';
2
- import { accountHomeLink } from './account-hint.js';
3
- import { popupFeatures } from './popup.js';
4
- import { WORKER_NOT_STARTED } from '../node/worker.js';
5
- import { defaultStorage, guardedStorage } from './stay-signed-in.js';
6
- import { markStep } from '../utils/step.js';
7
- const accountsOf = (kept) => kept.map(({ grant }) => Object.freeze({ did: grant.did, name: grant.name, expiresAt: grant.expiresAt }));
8
- /**
9
- * Opens the account home in a window of its own, at the account a connection
10
- * acts for: `connection.openHome`, for a connection made some other way.
11
- */
12
- export function openAccountHome({ home, grant, }, section) {
13
- const link = accountHomeLink(grant?.home ?? home, grant?.did ?? null, section);
14
- globalThis.open(link, 'minca-account', popupFeatures(720, 820));
15
- }
16
- const ANOTHER_TAB = 'Minca is open in another tab or window. It carries on here once that one is put away or closed.';
17
- /** Said when opening the account takes far longer than it should: nothing has failed, but something waits */
18
- const SLOW_START = 'Opening your account is taking longer than it should. If Minca is open in other tabs, closing them may help; reloading this page starts again.';
19
- /** How long opening may take before that is said */
20
- const SLOW_START_MS = 10_000;
21
- /** Whether the page is out of view: put away, or being left */
22
- const hidden = () => globalThis.document?.visibilityState === 'hidden';
23
- /** Settles once the page is in view (at once without a document) */
24
- function inView() {
25
- const page = globalThis.document;
26
- if (!page || page.visibilityState !== 'hidden')
27
- return Promise.resolve();
28
- return new Promise((resolve) => {
29
- const check = () => {
30
- if (page.visibilityState === 'hidden')
31
- return;
32
- page.removeEventListener('visibilitychange', check);
33
- resolve();
34
- };
35
- page.addEventListener('visibilitychange', check);
36
- });
37
- }
38
- /** Holds a Web Lock, once granted, until the returned function lets go (nothing to hold without Web Locks) */
39
- function holdLock(name) {
40
- const locks = globalThis.navigator?.locks;
41
- if (!locks)
42
- return Promise.resolve(() => { });
43
- return new Promise((granted) => {
44
- locks
45
- .request(name, () => new Promise((letGo) => granted(() => letGo())))
46
- .catch(() => granted(() => { }));
47
- });
48
- }
49
- export function createMincaConnection(config) {
50
- const storage = defaultStorage(config.storage);
51
- const grants = grantStore(storage);
52
- const kept = guardedStorage(storage);
53
- const HOME = 'minca.home';
54
- const LAST = 'minca.account';
55
- const rememberedHome = kept.get(HOME);
56
- const keys = config.keys ?? { get: appKey, forget: forgetAppKey };
57
- let state = Object.freeze({
58
- status: 'starting',
59
- home: rememberedHome ?? homeAddress(config.home),
60
- grant: null,
61
- node: null,
62
- error: null,
63
- accounts: accountsOf(grants.list()),
64
- });
65
- const listeners = new Set();
66
- const update = (patch) => {
67
- state = Object.freeze({ ...state, accounts: accountsOf(grants.list()), ...patch });
68
- for (const listener of listeners)
69
- listener(state);
70
- };
71
- // An account connected or let go in another tab shows in this one's list.
72
- globalThis.addEventListener?.('storage', (event) => {
73
- if (event.key === null || event.key === 'minca.grants')
74
- update({});
75
- });
76
- let started = null;
77
- let unwatch = null;
78
- /**
79
- * The node this tab runs itself (a dedicated worker's, or the page's), and
80
- * the turn it holds. Two such nodes on one site's stores get in each
81
- * other's way, and a browser that freezes background tabs (an iPhone's)
82
- * would freeze one holding the stores: so one runs at a time per account,
83
- * in the tab in view, and it closes when the tab is put away.
84
- */
85
- let ownTurn = null;
86
- /**
87
- * The grant this tab closed its node for when put away, to open again on
88
- * coming back: cleared by anything else that opens or stops, and checked
89
- * against the grants then, so it never opens what was since replaced.
90
- */
91
- let putAway = null;
92
- /** How many keep the node running while the tab is put away (`keepAwake`), as a call must */
93
- let awake = 0;
94
- /** Stops acting for the account acted for, if any, saying in the same breath what comes next */
95
- async function stop(next) {
96
- unwatch?.();
97
- unwatch = null;
98
- putAway = null;
99
- const node = state.node;
100
- const turn = ownTurn;
101
- ownTurn = null;
102
- update({ ...next, node: null });
103
- // Its turn goes once its stores are closed, not before.
104
- await node?.close().finally(() => turn?.release());
105
- }
106
- function followVisibility() {
107
- if (hidden()) {
108
- // Whatever its status: an expired tab's node holds the stores, and its turn, all the same.
109
- if (!ownTurn || awake > 0)
110
- return;
111
- markStep('connection: put away, closing the node');
112
- const kept = ownTurn.kept;
113
- void stop({ status: state.status === 'expired' ? 'expired' : 'starting' });
114
- putAway = kept;
115
- return;
116
- }
117
- const back = putAway;
118
- putAway = null;
119
- // Only the grant still kept for that account, to the same key: another tab may have let it go or renewed it.
120
- const still = back && grants.get(back.grant.did);
121
- if (back && still?.keyName === back.keyName) {
122
- markStep('connection: back, opening the node again');
123
- void open(still).catch(failed);
124
- }
125
- }
126
- globalThis.document?.addEventListener('visibilitychange', followVisibility);
127
- // Left (reloaded, closed, or kept frozen to come back to): closed now, for the next page's turn.
128
- globalThis.addEventListener?.('pagehide', followVisibility);
129
- globalThis.addEventListener?.('pageshow', followVisibility);
130
- /**
131
- * Forgets an account. Let go here, it acts for the next one, or for none;
132
- * disconnected at the home (`error`), for none, rather than another account
133
- * unasked. With `keyName`, only the grant to that key: another tab may have
134
- * connected the account again meanwhile, and its newer grant stays, for
135
- * this tab to take up.
136
- */
137
- async function leave(did, error, keyName) {
138
- const now = grants.get(did);
139
- const replaced = keyName !== undefined && now !== null && now.keyName !== keyName;
140
- if (!replaced)
141
- grants.forget(did);
142
- if (state.grant?.did === did) {
143
- const next = replaced ? now : error ? null : grants.list()[0];
144
- if (next) {
145
- await open(next).catch(failed);
146
- if (error && !replaced)
147
- update({ error });
148
- }
149
- else
150
- await stop({ status: 'disconnected', grant: null, error });
151
- }
152
- else
153
- update({});
154
- if (now && !replaced)
155
- await keys.forget(now.keyName).catch(() => { });
156
- }
157
- const failed = (error) => update({
158
- status: 'disconnected',
159
- grant: null,
160
- error: `Your account couldn't be opened here: ${error instanceof Error ? error.message : String(error)}`,
161
- });
162
- /** Counts opens, so one overtaken by a later one closes what it started */
163
- let opening = 0;
164
- async function open({ grant, keyName }) {
165
- const mine = ++opening;
166
- // A grant that ran out starts nothing: connecting again renews it, with a new key.
167
- const late = grantExpired(grant);
168
- await stop({ status: late ? 'expired' : 'starting', home: grant.home, grant, error: null });
169
- kept.set(LAST, grant.did);
170
- markStep(`connection: starting the account kept here${late ? ', whose grant ran out' : ''}`);
171
- if (late)
172
- return;
173
- const key = await keys.get(keyName);
174
- markStep('connection: app key ready, starting the node');
175
- const start = (worker) => startConnectedNode({
176
- grant,
177
- key,
178
- ...(config.network ? { network: config.network } : {}),
179
- ...(config.stores ? { stores: config.stores(grant) } : {}),
180
- ...(worker ? { worker } : {}),
181
- });
182
- const made = config.worker?.();
183
- // A dedicated worker's node is this tab's own; a shared worker's, every tab's.
184
- let release = null;
185
- const takeTurn = async () => {
186
- await inView();
187
- markStep('connection: waiting for any other tab to close its node');
188
- // Said only if it takes a while: another tab or window in view has it.
189
- const slow = setTimeout(() => update({ error: ANOTHER_TAB }), 5000);
190
- const letGo = await holdLock(`minca-node:${grant.did}`);
191
- clearTimeout(slow);
192
- if (state.error === ANOTHER_TAB)
193
- update({ error: null });
194
- return letGo;
195
- };
196
- let node;
197
- // Nothing failed, but the person should hear that something waits, and what to try.
198
- const slow = setTimeout(() => {
199
- if (mine === opening && state.status === 'starting' && !state.error)
200
- update({ error: SLOW_START });
201
- }, SLOW_START_MS);
202
- try {
203
- if (!made || typeof made.terminate === 'function')
204
- release = await takeTurn();
205
- // A browser whose worker never starts still gets a node, in the page. A
206
- // worker that started and refused says why instead.
207
- node = made
208
- ? await start(() => made).catch(async (error) => {
209
- if (!(error instanceof Error) || error.name !== WORKER_NOT_STARTED)
210
- throw error;
211
- markStep('connection: the node’s worker did not start; starting the node in the page');
212
- release ??= await takeTurn();
213
- return start();
214
- })
215
- : await start();
216
- }
217
- catch (error) {
218
- release?.();
219
- throw error;
220
- }
221
- finally {
222
- clearTimeout(slow);
223
- }
224
- const turn = release;
225
- // Switched again while this one started: it is not wanted.
226
- if (mine !== opening) {
227
- await node.close().finally(() => turn?.());
228
- return;
229
- }
230
- markStep('connection: ready');
231
- ownTurn = turn ? { kept: { grant, keyName }, release: turn } : null;
232
- update({ status: 'ready', home: grant.home, grant, node, error: null });
233
- // Opened in a tab put away meanwhile.
234
- followVisibility();
235
- unwatch = watchGrant(node, grant, {
236
- // Writes stop working when the note runs out; say so rather than fail quietly.
237
- onExpired: () => update({ status: 'expired' }),
238
- // The home disconnected this app: nothing it writes counts any more, so stop.
239
- onRevoked: () => state.node === node &&
240
- void leave(grant.did, `Your account home disconnected this app from ${grant.name}.`, keyName),
241
- });
242
- }
243
- const connection = {
244
- getState: () => state,
245
- subscribe(listener) {
246
- listeners.add(listener);
247
- return () => listeners.delete(listener);
248
- },
249
- start() {
250
- started ??= (async () => {
251
- const all = grants.list();
252
- const wanted = config.account?.(accountsOf(all)) ?? kept.get(LAST);
253
- const first = all.find((each) => each.grant.did === wanted) ?? all[0];
254
- if (!first) {
255
- update({ status: 'disconnected' });
256
- return;
257
- }
258
- await open(first).catch(failed);
259
- })();
260
- return started;
261
- },
262
- async connect(home) {
263
- const was = state.status;
264
- let address;
265
- try {
266
- address = home === undefined ? state.home : homeAddress(home);
267
- }
268
- catch (error) {
269
- update({ error: error instanceof Error ? error.message : String(error) });
270
- return;
271
- }
272
- // A new key each time, whichever account the person chooses at the home: a key that
273
- // asked once may hold a note from any account the home was signed in as.
274
- const keyName = `account-${globalThis.crypto.randomUUID()}`;
275
- // An app acting for an account goes on doing so while the person adds another.
276
- if (was !== 'ready')
277
- update({ status: 'connecting', error: null });
278
- else
279
- update({ error: null });
280
- let grant;
281
- try {
282
- // Nothing awaited before this: the popup must open inside the click.
283
- grant = await connectToHome({ home: address, request: config.request, key: keys.get(keyName) });
284
- }
285
- catch (error) {
286
- await keys.forget(keyName).catch(() => { });
287
- update({
288
- status: was === 'expired' || was === 'ready' ? was : 'disconnected',
289
- error: error instanceof Error ? error.message : String(error),
290
- });
291
- return;
292
- }
293
- const before = grants.get(grant.did);
294
- grants.save(grant, keyName);
295
- kept.set(HOME, address);
296
- update({ home: address });
297
- // The grant is kept even if its node won't start now: starting again, or `use`, tries again.
298
- await open({ grant, keyName }).catch(failed);
299
- // The key it replaced is no use to this app now. The home keeps it, to revoke if the person disconnects.
300
- if (before && before.keyName !== keyName)
301
- await keys.forget(before.keyName).catch(() => { });
302
- },
303
- async use(did) {
304
- if (state.grant?.did === did && state.status !== 'disconnected')
305
- return;
306
- const found = grants.get(did);
307
- if (!found)
308
- throw new Error('This app isn’t connected to that account. Connect it first.');
309
- await open(found).catch(failed);
310
- },
311
- async disconnect(did) {
312
- const target = did ?? state.grant?.did;
313
- if (target)
314
- await leave(target, null);
315
- },
316
- openHome: (section) => openAccountHome(state, section),
317
- keepAwake() {
318
- awake++;
319
- let kept = true;
320
- return () => {
321
- if (!kept)
322
- return;
323
- kept = false;
324
- awake--;
325
- followVisibility();
326
- };
327
- },
328
- async propose(automations) {
329
- if (!state.grant)
330
- throw new Error('Connect to your account home first.');
331
- const answer = await proposeToHome({
332
- home: state.grant.home,
333
- automations,
334
- ...(config.request.name ? { name: config.request.name } : {}),
335
- });
336
- // The home's window closes now: take what it wrote rather than wait to meet it over the network.
337
- if (Array.isArray(answer.versions) && answer.versions.length > 0)
338
- await state.node?.automations.take(answer.versions).catch(() => 0);
339
- return answer;
340
- },
341
- };
342
- return connection;
343
- }
344
- //# sourceMappingURL=connection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.js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,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9D,CAAC,CAAC;YACH,iGAAiG;YACjG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAC9D,MAAM,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACrE,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * @module session
3
- * What an app and an account home say to each other, and the pieces signing
4
- * in is made of. The sign-in flow itself is `createMincaAuth` in `@minca/auth`.
5
- *
6
- * Browser-only — it reaches for IndexedDB, WebAuthn and the File System Access
7
- * API when used — so it lives on its own entry point, away from the
8
- * isomorphic core.
9
- */
10
- export { createMincaConnection, openAccountHome } from './connection.js';
11
- export type { MincaConnection, MincaConnectionConfig, MincaConnectionState, ConnectionStatus, ConnectedAccount, } from './connection.js';
12
- export { connectToHome, connectCarrier, keyProof, checkKeyProof, checkGrant, proposeToHome, isProposeRequest, homeAddress, receiveConnectRequest, startConnectedNode, nodeOptionsFromGrant, joinGranted, grantSigner, grantExpired, usableGrant, watchGrant, grantTerms, requestTerms, GRANT_VERSION, appKey, forgetAppKey, MAX_GRANT_DAYS, } from './connect.js';
13
- export type { ConnectRequest, ConnectOptions, ProposeRequest, Proposed, Grant, CarryGrant, GrantedSpace, IncomingRequest, AppKey, SeededAppKey, KeyTerms, } from './connect.js';
14
- export { browserPlace, pickPod, rememberPod, recallPod, forgetPod, listAccounts, inspectPod, storesFor, describeStores, podToReopen, deleteBrowserData, } from './places.js';
15
- export type { Place, PodContents } from './places.js';
16
- export { createStaySignedIn, STAY_SIGNED_IN_CHOICES, defaultStorage, guardedStorage, rememberedSessionKey, } from './stay-signed-in.js';
17
- export type { StaySignedIn, StaySignedInStore, KeyValueStore } from './stay-signed-in.js';
18
- export { offerToPhone, receiveFromDesktop, readPairingTicket, clearPairingTicket } from './pairing.js';
19
- export { readAccountHint, clearAccountHint } from './account-hint.js';
20
- export { popupFeatures } from './popup.js';
21
- export type { PairingStage, PairingOffer, Handover } from './pairing.js';
22
- export { answerConnectCode, connectWithCode, connectCodeIn, connectCodeUrl, newConnectCode, receiveConnectCode, } from './connect-code.js';
23
- export type { ConnectCodeStage, CodeAsking } from './connect-code.js';
24
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,QAAQ,EACR,KAAK,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,MAAM,EACN,YAAY,EACZ,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * @module session
3
- * What an app and an account home say to each other, and the pieces signing
4
- * in is made of. The sign-in flow itself is `createMincaAuth` in `@minca/auth`.
5
- *
6
- * Browser-only — it reaches for IndexedDB, WebAuthn and the File System Access
7
- * API when used — so it lives on its own entry point, away from the
8
- * isomorphic core.
9
- */
10
- export { createMincaConnection, openAccountHome } from './connection.js';
11
- export { connectToHome, connectCarrier, keyProof, checkKeyProof, checkGrant, proposeToHome, isProposeRequest, homeAddress, receiveConnectRequest, startConnectedNode, nodeOptionsFromGrant, joinGranted, grantSigner, grantExpired, usableGrant, watchGrant, grantTerms, requestTerms, GRANT_VERSION, appKey, forgetAppKey, MAX_GRANT_DAYS, } from './connect.js';
12
- export { browserPlace, pickPod, rememberPod, recallPod, forgetPod, listAccounts, inspectPod, storesFor, describeStores, podToReopen, deleteBrowserData, } from './places.js';
13
- export { createStaySignedIn, STAY_SIGNED_IN_CHOICES, defaultStorage, guardedStorage, rememberedSessionKey, } from './stay-signed-in.js';
14
- export { offerToPhone, receiveFromDesktop, readPairingTicket, clearPairingTicket } from './pairing.js';
15
- export { readAccountHint, clearAccountHint } from './account-hint.js';
16
- export { popupFeatures } from './popup.js';
17
- export { answerConnectCode, connectWithCode, connectCodeIn, connectCodeUrl, newConnectCode, receiveConnectCode, } from './connect-code.js';
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAQzE,OAAO,EACL,aAAa,EACb,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,cAAc,CAAC;AActB,OAAO,EACL,YAAY,EACZ,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}