@flipstream/sdk 0.13.0 → 0.15.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 (278) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +143 -21
  3. package/dist/api/backend.d.ts +7 -0
  4. package/dist/api/backend.js +7 -0
  5. package/dist/api/backend.js.map +1 -1
  6. package/dist/api/credentials.js +4 -4
  7. package/dist/api/credentials.js.map +1 -1
  8. package/dist/api/datasets.js +30 -50
  9. package/dist/api/datasets.js.map +1 -1
  10. package/dist/api/handoff.d.ts +1 -1
  11. package/dist/api/handoff.js +7 -0
  12. package/dist/api/handoff.js.map +1 -1
  13. package/dist/api/log.d.ts +4 -4
  14. package/dist/api/log.js +23 -42
  15. package/dist/api/log.js.map +1 -1
  16. package/dist/api/me.d.ts +5 -3
  17. package/dist/api/me.js +3 -3
  18. package/dist/api/me.js.map +1 -1
  19. package/dist/api/members.d.ts +40 -17
  20. package/dist/api/members.js +66 -29
  21. package/dist/api/members.js.map +1 -1
  22. package/dist/api/ownRecord.d.ts +46 -0
  23. package/dist/api/ownRecord.js +57 -0
  24. package/dist/api/ownRecord.js.map +1 -0
  25. package/dist/api/refusal.d.ts +14 -0
  26. package/dist/api/refusal.js +23 -0
  27. package/dist/api/refusal.js.map +1 -0
  28. package/dist/api/wallet.d.ts +2 -1
  29. package/dist/api/wallet.js +18 -24
  30. package/dist/api/wallet.js.map +1 -1
  31. package/dist/api/workspaces.d.ts +7 -2
  32. package/dist/api/workspaces.js +14 -8
  33. package/dist/api/workspaces.js.map +1 -1
  34. package/dist/auth/discovery.js +4 -5
  35. package/dist/auth/discovery.js.map +1 -1
  36. package/dist/auth/transport.d.ts +6 -2
  37. package/dist/auth/transport.js +5 -3
  38. package/dist/auth/transport.js.map +1 -1
  39. package/dist/core/call.d.ts +9 -4
  40. package/dist/core/call.js +12 -8
  41. package/dist/core/call.js.map +1 -1
  42. package/dist/core/fetch.d.ts +20 -1
  43. package/dist/core/fetch.js +50 -3
  44. package/dist/core/fetch.js.map +1 -1
  45. package/dist/core/hosts.d.ts +11 -0
  46. package/dist/core/hosts.js +13 -0
  47. package/dist/core/hosts.js.map +1 -0
  48. package/dist/core/identify.d.ts +12 -2
  49. package/dist/core/identify.js +31 -19
  50. package/dist/core/identify.js.map +1 -1
  51. package/dist/core/inPlaceOf.d.ts +6 -0
  52. package/dist/core/inPlaceOf.js +17 -0
  53. package/dist/core/inPlaceOf.js.map +1 -0
  54. package/dist/core/invalid.d.ts +32 -9
  55. package/dist/core/invalid.js +36 -23
  56. package/dist/core/invalid.js.map +1 -1
  57. package/dist/core/notFound.d.ts +2 -2
  58. package/dist/core/notFound.js.map +1 -1
  59. package/dist/core/read.d.ts +4 -10
  60. package/dist/core/read.js +1 -11
  61. package/dist/core/read.js.map +1 -1
  62. package/dist/core/result.d.ts +14 -10
  63. package/dist/core/result.js +1 -0
  64. package/dist/core/result.js.map +1 -1
  65. package/dist/core/shared.d.ts +15 -9
  66. package/dist/core/shared.js +8 -6
  67. package/dist/core/shared.js.map +1 -1
  68. package/dist/core/signal.d.ts +7 -0
  69. package/dist/core/signal.js +9 -0
  70. package/dist/core/signal.js.map +1 -1
  71. package/dist/first-party/asPerson.d.ts +13 -0
  72. package/dist/first-party/asPerson.js +144 -0
  73. package/dist/first-party/asPerson.js.map +1 -0
  74. package/dist/first-party/attempts.d.ts +71 -0
  75. package/dist/first-party/attempts.js +132 -0
  76. package/dist/first-party/attempts.js.map +1 -0
  77. package/dist/first-party/authProxyMark.d.ts +7 -0
  78. package/dist/first-party/authProxyMark.js +8 -0
  79. package/dist/first-party/authProxyMark.js.map +1 -0
  80. package/dist/first-party/browser.d.ts +55 -0
  81. package/dist/first-party/browser.js +137 -0
  82. package/dist/first-party/browser.js.map +1 -0
  83. package/dist/first-party/browserSession.d.ts +95 -0
  84. package/dist/first-party/browserSession.js +242 -0
  85. package/dist/first-party/browserSession.js.map +1 -0
  86. package/dist/first-party/calls/consent.d.ts +77 -0
  87. package/dist/first-party/calls/consent.js +174 -0
  88. package/dist/first-party/calls/consent.js.map +1 -0
  89. package/dist/first-party/calls/device.d.ts +75 -0
  90. package/dist/first-party/calls/device.js +133 -0
  91. package/dist/first-party/calls/device.js.map +1 -0
  92. package/dist/first-party/calls/invitation.d.ts +198 -0
  93. package/dist/first-party/calls/invitation.js +240 -0
  94. package/dist/first-party/calls/invitation.js.map +1 -0
  95. package/dist/first-party/calls/logIn.d.ts +41 -0
  96. package/dist/first-party/calls/logIn.js +48 -0
  97. package/dist/first-party/calls/logIn.js.map +1 -0
  98. package/dist/first-party/calls/reset.d.ts +58 -0
  99. package/dist/first-party/calls/reset.js +163 -0
  100. package/dist/first-party/calls/reset.js.map +1 -0
  101. package/dist/first-party/calls/signUp.d.ts +21 -0
  102. package/dist/first-party/calls/signUp.js +72 -0
  103. package/dist/first-party/calls/signUp.js.map +1 -0
  104. package/dist/first-party/calls/twoStepSetup.d.ts +55 -0
  105. package/dist/first-party/calls/twoStepSetup.js +168 -0
  106. package/dist/first-party/calls/twoStepSetup.js.map +1 -0
  107. package/dist/first-party/claims.d.ts +88 -0
  108. package/dist/first-party/claims.js +181 -0
  109. package/dist/first-party/claims.js.map +1 -0
  110. package/dist/first-party/enrollment.d.ts +10 -0
  111. package/dist/first-party/enrollment.js +44 -0
  112. package/dist/first-party/enrollment.js.map +1 -0
  113. package/dist/first-party/entry.d.ts +549 -0
  114. package/dist/first-party/entry.js +580 -0
  115. package/dist/first-party/entry.js.map +1 -0
  116. package/dist/first-party/hooks.d.ts +66 -0
  117. package/dist/first-party/hooks.js +19 -0
  118. package/dist/first-party/hooks.js.map +1 -0
  119. package/dist/first-party/http.d.ts +191 -0
  120. package/dist/first-party/http.js +364 -0
  121. package/dist/first-party/http.js.map +1 -0
  122. package/dist/first-party/index.d.ts +14 -0
  123. package/dist/first-party/index.js +3 -0
  124. package/dist/first-party/index.js.map +1 -0
  125. package/dist/first-party/landed.d.ts +32 -0
  126. package/dist/first-party/landed.js +50 -0
  127. package/dist/first-party/landed.js.map +1 -0
  128. package/dist/first-party/landedProof.d.ts +12 -0
  129. package/dist/first-party/landedProof.js +20 -0
  130. package/dist/first-party/landedProof.js.map +1 -0
  131. package/dist/first-party/linkToken.d.ts +16 -0
  132. package/dist/first-party/linkToken.js +29 -0
  133. package/dist/first-party/linkToken.js.map +1 -0
  134. package/dist/first-party/links.d.ts +100 -0
  135. package/dist/first-party/links.js +84 -0
  136. package/dist/first-party/links.js.map +1 -0
  137. package/dist/first-party/locks.d.ts +36 -0
  138. package/dist/first-party/locks.js +64 -0
  139. package/dist/first-party/locks.js.map +1 -0
  140. package/dist/first-party/personTransport.d.ts +38 -0
  141. package/dist/first-party/personTransport.js +177 -0
  142. package/dist/first-party/personTransport.js.map +1 -0
  143. package/dist/first-party/proxy/app.d.ts +25 -0
  144. package/dist/first-party/proxy/app.js +94 -0
  145. package/dist/first-party/proxy/app.js.map +1 -0
  146. package/dist/first-party/proxy/bound.d.ts +5 -0
  147. package/dist/first-party/proxy/bound.js +13 -0
  148. package/dist/first-party/proxy/bound.js.map +1 -0
  149. package/dist/first-party/proxy/cases.d.ts +54 -0
  150. package/dist/first-party/proxy/cases.js +412 -0
  151. package/dist/first-party/proxy/cases.js.map +1 -0
  152. package/dist/first-party/proxy/decide.d.ts +29 -0
  153. package/dist/first-party/proxy/decide.js +140 -0
  154. package/dist/first-party/proxy/decide.js.map +1 -0
  155. package/dist/first-party/proxy/freeze.d.ts +2 -0
  156. package/dist/first-party/proxy/freeze.js +10 -0
  157. package/dist/first-party/proxy/freeze.js.map +1 -0
  158. package/dist/first-party/proxy/handler.d.ts +23 -0
  159. package/dist/first-party/proxy/handler.js +190 -0
  160. package/dist/first-party/proxy/handler.js.map +1 -0
  161. package/dist/first-party/proxy/headers.d.ts +8 -0
  162. package/dist/first-party/proxy/headers.js +20 -0
  163. package/dist/first-party/proxy/headers.js.map +1 -0
  164. package/dist/first-party/proxy/hop.d.ts +9 -0
  165. package/dist/first-party/proxy/hop.js +37 -0
  166. package/dist/first-party/proxy/hop.js.map +1 -0
  167. package/dist/first-party/proxy/host.d.ts +5 -0
  168. package/dist/first-party/proxy/host.js +11 -0
  169. package/dist/first-party/proxy/host.js.map +1 -0
  170. package/dist/first-party/proxy/index.d.ts +7 -0
  171. package/dist/first-party/proxy/index.js +6 -0
  172. package/dist/first-party/proxy/index.js.map +1 -0
  173. package/dist/first-party/proxy/pass-back.d.ts +21 -0
  174. package/dist/first-party/proxy/pass-back.js +51 -0
  175. package/dist/first-party/proxy/pass-back.js.map +1 -0
  176. package/dist/first-party/proxy/paths.d.ts +17 -0
  177. package/dist/first-party/proxy/paths.js +36 -0
  178. package/dist/first-party/proxy/paths.js.map +1 -0
  179. package/dist/first-party/proxy/shown.d.ts +5 -0
  180. package/dist/first-party/proxy/shown.js +16 -0
  181. package/dist/first-party/proxy/shown.js.map +1 -0
  182. package/dist/first-party/proxy/stand-in.d.ts +47 -0
  183. package/dist/first-party/proxy/stand-in.js +318 -0
  184. package/dist/first-party/proxy/stand-in.js.map +1 -0
  185. package/dist/first-party/report.d.ts +47 -0
  186. package/dist/first-party/report.js +38 -0
  187. package/dist/first-party/report.js.map +1 -0
  188. package/dist/first-party/result.d.ts +82 -0
  189. package/dist/first-party/result.js +40 -0
  190. package/dist/first-party/result.js.map +1 -0
  191. package/dist/first-party/session/cell.d.ts +177 -0
  192. package/dist/first-party/session/cell.js +89 -0
  193. package/dist/first-party/session/cell.js.map +1 -0
  194. package/dist/first-party/session/closed.d.ts +8 -0
  195. package/dist/first-party/session/closed.js +12 -0
  196. package/dist/first-party/session/closed.js.map +1 -0
  197. package/dist/first-party/session/index.d.ts +3 -0
  198. package/dist/first-party/session/index.js +3 -0
  199. package/dist/first-party/session/index.js.map +1 -0
  200. package/dist/first-party/session/logout.d.ts +82 -0
  201. package/dist/first-party/session/logout.js +328 -0
  202. package/dist/first-party/session/logout.js.map +1 -0
  203. package/dist/first-party/session/owed.d.ts +30 -0
  204. package/dist/first-party/session/owed.js +27 -0
  205. package/dist/first-party/session/owed.js.map +1 -0
  206. package/dist/first-party/session/refresh.d.ts +19 -0
  207. package/dist/first-party/session/refresh.js +229 -0
  208. package/dist/first-party/session/refresh.js.map +1 -0
  209. package/dist/first-party/session/results.d.ts +38 -0
  210. package/dist/first-party/session/results.js +74 -0
  211. package/dist/first-party/session/results.js.map +1 -0
  212. package/dist/first-party/session/session.d.ts +2 -0
  213. package/dist/first-party/session/session.js +379 -0
  214. package/dist/first-party/session/session.js.map +1 -0
  215. package/dist/first-party/session/shared.d.ts +34 -0
  216. package/dist/first-party/session/shared.js +104 -0
  217. package/dist/first-party/session/shared.js.map +1 -0
  218. package/dist/first-party/session/sharedSignal.d.ts +27 -0
  219. package/dist/first-party/session/sharedSignal.js +55 -0
  220. package/dist/first-party/session/sharedSignal.js.map +1 -0
  221. package/dist/first-party/session/signIn.d.ts +43 -0
  222. package/dist/first-party/session/signIn.js +294 -0
  223. package/dist/first-party/session/signIn.js.map +1 -0
  224. package/dist/first-party/session/signInThrough.d.ts +5 -0
  225. package/dist/first-party/session/signInThrough.js +95 -0
  226. package/dist/first-party/session/signInThrough.js.map +1 -0
  227. package/dist/first-party/session/sync.d.ts +17 -0
  228. package/dist/first-party/session/sync.js +143 -0
  229. package/dist/first-party/session/sync.js.map +1 -0
  230. package/dist/first-party/session/tokens.d.ts +18 -0
  231. package/dist/first-party/session/tokens.js +64 -0
  232. package/dist/first-party/session/tokens.js.map +1 -0
  233. package/dist/first-party/session/types.d.ts +270 -0
  234. package/dist/first-party/session/types.js +3 -0
  235. package/dist/first-party/session/types.js.map +1 -0
  236. package/dist/first-party/sessionWire.d.ts +31 -0
  237. package/dist/first-party/sessionWire.js +91 -0
  238. package/dist/first-party/sessionWire.js.map +1 -0
  239. package/dist/first-party/signInHooks.d.ts +57 -0
  240. package/dist/first-party/signInHooks.js +2 -0
  241. package/dist/first-party/signInHooks.js.map +1 -0
  242. package/dist/first-party/state.d.ts +51 -0
  243. package/dist/first-party/state.js +52 -0
  244. package/dist/first-party/state.js.map +1 -0
  245. package/dist/first-party/strip.d.ts +1 -0
  246. package/dist/first-party/strip.js +8 -0
  247. package/dist/first-party/strip.js.map +1 -0
  248. package/dist/first-party/twoStepLock.d.ts +26 -0
  249. package/dist/first-party/twoStepLock.js +58 -0
  250. package/dist/first-party/twoStepLock.js.map +1 -0
  251. package/dist/first-party/twoStepSession.d.ts +21 -0
  252. package/dist/first-party/twoStepSession.js +31 -0
  253. package/dist/first-party/twoStepSession.js.map +1 -0
  254. package/dist/first-party/wire.d.ts +63 -0
  255. package/dist/first-party/wire.js +5 -0
  256. package/dist/first-party/wire.js.map +1 -0
  257. package/dist/flipstream.d.ts +132 -36
  258. package/dist/flipstream.js +94 -47
  259. package/dist/flipstream.js.map +1 -1
  260. package/dist/index.d.ts +2 -2
  261. package/dist/index.js +3 -2
  262. package/dist/index.js.map +1 -1
  263. package/dist/node/keychainChild.js +60 -25
  264. package/dist/node/keychainChild.js.map +1 -1
  265. package/dist/node/keychainError.d.ts +4 -1
  266. package/dist/node/keychainError.js.map +1 -1
  267. package/dist/node/keychainStore.js +42 -8
  268. package/dist/node/keychainStore.js.map +1 -1
  269. package/dist/node/session.js +9 -8
  270. package/dist/node/session.js.map +1 -1
  271. package/dist/query/query.d.ts +52 -8
  272. package/dist/query/query.js +133 -19
  273. package/dist/query/query.js.map +1 -1
  274. package/dist/version.gen.js +1 -1
  275. package/docs/admin.md +53 -4
  276. package/docs/first-party.md +278 -0
  277. package/docs/node-sign-in.md +8 -4
  278. package/package.json +34 -5
@@ -0,0 +1,229 @@
1
+ import { unhandled as unhandledError } from '../report.js';
2
+ import { ABANDON_AFTER_MS } from '../http.js';
3
+ import { endTwoStep } from './cell.js';
4
+ const AFTER_PASSWORD_RESET = Symbol('after password reset');
5
+ export function createRefresher(deps, cell, { shared, withState, withCookie, broadcast }, { publish, hold, release, nextBackoff }, { sendLogout, notConfirmed }) {
6
+ const { http, report } = deps;
7
+ /**
8
+ * The refresh's outcome, or `unavailable` after 15 s, so no caller (a page load, every API
9
+ * request) waits on a pulse-auth that never answers. The request itself goes on: pulse-auth
10
+ * may have rotated the cookie already, and a later answer is still adopted.
11
+ */
12
+ const answerWithin = (attempt) => new Promise((resolve) => {
13
+ const timer = setTimeout(() => {
14
+ resolve('unavailable');
15
+ }, ABANDON_AFTER_MS);
16
+ void attempt.then((outcome) => {
17
+ clearTimeout(timer);
18
+ resolve(outcome);
19
+ }, (cause) => {
20
+ // Refresh attempts settle and browser storage absorbs throws. If a future check rejects,
21
+ // report it here and release its caller without waiting for the deadline.
22
+ clearTimeout(timer);
23
+ resolve('unavailable');
24
+ report({ kind: 'threw', step: 'refresh', cause });
25
+ });
26
+ });
27
+ const startRefresh = (stale) => {
28
+ if (!cell.supported)
29
+ return Promise.resolve('signed-out');
30
+ if (cell.refreshInFlight !== null)
31
+ return cell.refreshInFlight;
32
+ const attempt = withCookie(async () => {
33
+ // Closed while this waited for the lock: nothing new is sent, neither the refresh nor a
34
+ // logout owed; another tab does that work (SDK-D1930). What is owed stays recorded.
35
+ if (cell.closed)
36
+ return 'unavailable';
37
+ const state = shared();
38
+ if (stale !== AFTER_PASSWORD_RESET &&
39
+ cell.held !== null &&
40
+ cell.held.access.token !== stale &&
41
+ cell.held.generation === state.generation) {
42
+ return 'ok';
43
+ }
44
+ if (state.logoutPending !== null &&
45
+ state.logoutPending.generation === state.generation) {
46
+ // Signed out, but pulse-auth never heard: finish that instead of quietly signing
47
+ // back in with a cookie that may still be valid; one that doesn't get through stays owed
48
+ // (SDK-D1963).
49
+ const answer = await sendLogout(state.generation);
50
+ if (answer.kind !== 'confirmed')
51
+ notConfirmed(answer, state.generation, state.serial);
52
+ if (cell.held !== null)
53
+ release({ status: 'signed-out' });
54
+ return 'signed-out';
55
+ }
56
+ const pinned = state.generation;
57
+ const answer = await http.refresh();
58
+ switch (answer.kind) {
59
+ case 'token': {
60
+ const decided = await withState((state) => {
61
+ // A sign-in or sign-out moved the state while this was in flight: the answer
62
+ // is stale. The rotated cookie it left is the signed-out session's, which that
63
+ // generation's pending logout revokes next.
64
+ if (state.generation !== pinned)
65
+ return { write: null, result: 'stale' };
66
+ // The same person, whatever their claims now (sdk#535). A record with no person (written
67
+ // before it was kept, or by a console) is compared with the token this tab holds at the
68
+ // pinned generation, a person this tab knows. With neither, nothing is assumed
69
+ // (SDK-D2023, amended in PR 551 S2).
70
+ const held = cell.held;
71
+ const known = state.person ?? (held !== null && held.generation === pinned ? held.access.person : null);
72
+ const samePerson = known === null || known === answer.access.person;
73
+ const next = state.signedIn && samePerson
74
+ ? {
75
+ ...state,
76
+ serial: state.serial + 1,
77
+ principal: answer.access.fingerprint,
78
+ person: answer.access.person,
79
+ }
80
+ : // A session the shared state doesn't know yet (a new browser, or Local
81
+ // Storage cleared while the cookie stayed), or another person behind the same
82
+ // cookie (sdk#535): it becomes the current one, at a new generation, as a sign-in
83
+ // does. Nothing is owed. No logout owed for the old person's cookie is lost: the
84
+ // browser's one cookie is this person's now, so none could reach that session. But
85
+ // an unrecorded sign-out (in another tab's or another page's memory, such as a
86
+ // refused sign-in's revoke) is ended by the new generation, even when it was owed
87
+ // for this very cookie: the known limit, SDK-D2024, fixed by sdk#552.
88
+ {
89
+ generation: state.generation + 1,
90
+ signedIn: true,
91
+ serial: state.serial + 1,
92
+ logoutPending: null,
93
+ principal: answer.access.fingerprint,
94
+ person: answer.access.person,
95
+ };
96
+ return {
97
+ write: next,
98
+ result: 'ok',
99
+ then: () => {
100
+ // A new generation ends this tab's own code screen as the other tabs end theirs: a
101
+ // code typed after it reads superseded (PR 551 S3, round 2 S1).
102
+ if (next.generation !== state.generation)
103
+ endTwoStep(cell);
104
+ hold(answer.access, next.generation, next.serial, 'here');
105
+ },
106
+ };
107
+ });
108
+ return decided.ran ? decided.value : 'unavailable';
109
+ }
110
+ case 'signed-out': {
111
+ const decided = await withState((state) => {
112
+ if (state.generation !== pinned)
113
+ return { write: null, result: 'stale' };
114
+ const write = state.signedIn
115
+ ? {
116
+ ...state,
117
+ generation: state.generation + 1,
118
+ signedIn: false,
119
+ logoutPending: null,
120
+ principal: null,
121
+ person: null,
122
+ }
123
+ : null;
124
+ return {
125
+ write,
126
+ result: 'signed-out',
127
+ then: () => {
128
+ release({ status: 'signed-out' });
129
+ if (write !== null) {
130
+ broadcast({ type: 'signed-out', generation: write.generation });
131
+ }
132
+ },
133
+ };
134
+ });
135
+ return decided.ran ? decided.value : 'unavailable';
136
+ }
137
+ case 'unavailable':
138
+ return 'unavailable';
139
+ case 'broken':
140
+ report({ kind: 'answer', path: '/refresh', status: answer.httpStatus });
141
+ // The cookie and the shared state are left alone: one bad answer shouldn't
142
+ // throw away a session that may be fine. This tab just can't use it now.
143
+ release({ status: 'broken', httpStatus: answer.httpStatus });
144
+ return 'broken';
145
+ default: {
146
+ const unhandled = answer;
147
+ throw unhandledError('refresh answer', unhandled);
148
+ }
149
+ }
150
+ }).then((locked) => (locked.ran ? locked.value : 'unavailable'), (error) => {
151
+ // Not expected: the run handles its own answers. A refresh never rejects, or a
152
+ // page load would wait on it forever.
153
+ report({ kind: 'threw', step: 'refresh', cause: error });
154
+ return 'unavailable';
155
+ });
156
+ cell.refreshInFlight = attempt;
157
+ void attempt.finally(() => {
158
+ if (cell.refreshInFlight === attempt)
159
+ cell.refreshInFlight = null;
160
+ });
161
+ return attempt;
162
+ };
163
+ const refresh = (stale) => answerWithin(startRefresh(stale));
164
+ const checkAfterReset = async () => {
165
+ // Earlier refreshes can predate the reset, including a restore that first discovers a session.
166
+ while (cell.refreshInFlight !== null)
167
+ await cell.refreshInFlight;
168
+ if (cell.closed || !cell.supported || (cell.held === null && !shared().signedIn))
169
+ return 'signed-out';
170
+ return startRefresh(AFTER_PASSWORD_RESET);
171
+ };
172
+ const runRestore = async (tries) => {
173
+ clearTimeout(cell.restoreTimer);
174
+ const outcome = await refresh(cell.held?.access.token ?? null);
175
+ // A token that arrived meanwhile (another tab's, by message) already said so.
176
+ if (cell.held !== null && outcome !== 'broken')
177
+ return;
178
+ switch (outcome) {
179
+ case 'ok':
180
+ return;
181
+ case 'signed-out':
182
+ if (cell.status.status !== 'signed-out')
183
+ publish({ status: 'signed-out' });
184
+ return;
185
+ case 'broken':
186
+ return;
187
+ case 'stale':
188
+ // The state moved while the answer was in flight: ask again, for the state as it
189
+ // is now. A few times at most; then this is just "can't reach".
190
+ // Closed meanwhile: nothing more is started.
191
+ if (cell.closed)
192
+ break;
193
+ if (tries < 3) {
194
+ await restore(tries + 1);
195
+ return;
196
+ }
197
+ break;
198
+ case 'unavailable':
199
+ break;
200
+ default: {
201
+ const unhandled = outcome;
202
+ throw new Error(`unhandled outcome ${String(unhandled)}`);
203
+ }
204
+ }
205
+ const retryInMs = nextBackoff();
206
+ publish({ status: 'unavailable', retryInMs });
207
+ // Two restores that overlap each get here: the later one's timer replaces the earlier one's,
208
+ // or close() could clear only the handle it can see.
209
+ clearTimeout(cell.restoreTimer);
210
+ if (cell.closed)
211
+ return;
212
+ cell.restoreTimer = setTimeout(() => {
213
+ if (!cell.closed)
214
+ void restore();
215
+ }, retryInMs);
216
+ };
217
+ let activeRestores = 0;
218
+ const restore = async (tries = 0) => {
219
+ activeRestores++;
220
+ try {
221
+ await runRestore(tries);
222
+ }
223
+ finally {
224
+ activeRestores--;
225
+ }
226
+ };
227
+ return { refresh, refreshAfterPasswordReset: () => answerWithin(checkAfterReset()), restore, restoring: () => activeRestores > 0 };
228
+ }
229
+ //# sourceMappingURL=refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../src/first-party/session/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAyC,MAAM,WAAW,CAAA;AAM7E,MAAM,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,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;gBAChB,MAAK;YACP,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,SAAS,GAAU,OAAO,CAAA;gBAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAC3D,CAAC;QACH,CAAC;QACD,MAAM,SAAS,GAAG,WAAW,EAAE,CAAA;QAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAA;QAC7C,6FAA6F;QAC7F,qDAAqD;QACrD,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/B,IAAI,IAAI,CAAC,MAAM;YAAE,OAAM;QACvB,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,MAAM;gBAAE,KAAK,OAAO,EAAE,CAAA;QAClC,CAAC,EAAE,SAAS,CAAC,CAAA;IACf,CAAC,CAAA;IAED,IAAI,cAAc,GAAG,CAAC,CAAA;IACtB,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC,EAAiB,EAAE;QACjD,cAAc,EAAE,CAAA;QAChB,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC;gBAAS,CAAC;YACT,cAAc,EAAE,CAAA;QAClB,CAAC;IACH,CAAC,CAAA;IAED,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,GAAG,CAAC,EAAE,CAAA;AACpI,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { SignInSetup } from '../hooks.js';
2
+ import type { RedeemResult, SupersededVerify, TwoStepResult } from './types.js';
3
+ /** What a redeem or a verify came to, inside the lock: every case either can meet. */
4
+ export type Settled = {
5
+ readonly kind: 'signed-in';
6
+ readonly backupCodes: readonly string[] | null;
7
+ } | SupersededVerify | {
8
+ readonly kind: 'two-step';
9
+ } | {
10
+ readonly kind: 'two-step-setup';
11
+ readonly setup: SignInSetup;
12
+ } | {
13
+ readonly kind: 'dead-link';
14
+ } | {
15
+ readonly kind: 'wrong-code';
16
+ } | {
17
+ readonly kind: 'locked';
18
+ } | {
19
+ readonly kind: 'expired';
20
+ } | {
21
+ readonly kind: 'no-account';
22
+ } | {
23
+ readonly kind: 'inactive';
24
+ } | {
25
+ readonly kind: 'proxy-refused';
26
+ } | {
27
+ readonly kind: 'unavailable';
28
+ } | {
29
+ readonly kind: 'unknown';
30
+ readonly status: number;
31
+ };
32
+ export declare function redeemResultOf(settled: Settled): RedeemResult;
33
+ /**
34
+ * `answeredAt`: this tab's clock when pulse-auth answered. `keptUntil`: the end of a lock this
35
+ * browser was already told about for the address, while still ahead (`twoStepLock.ts`): a
36
+ * lock isn't moved by a code tried during it, so that end stands.
37
+ */
38
+ export declare function twoStepResultOf(settled: Settled, answeredAt: number, keptUntil: number | null): TwoStepResult;
@@ -0,0 +1,74 @@
1
+ import { firstLockEnd, MINUTE_MS, TWO_STEP_LOCKOUT_MS } from '../twoStepLock.js';
2
+ import { unhandled as unhandledError } from '../report.js';
3
+ export function redeemResultOf(settled) {
4
+ switch (settled.kind) {
5
+ // A link's redeem never sets two-step up, so it never has backup codes to carry.
6
+ case 'signed-in':
7
+ return { kind: 'signed-in' };
8
+ case 'two-step-setup':
9
+ return settled;
10
+ case 'superseded':
11
+ case 'two-step':
12
+ case 'dead-link':
13
+ case 'no-account':
14
+ case 'inactive':
15
+ case 'proxy-refused':
16
+ case 'unavailable':
17
+ return { kind: settled.kind };
18
+ case 'unknown':
19
+ return { kind: 'unknown', status: settled.status };
20
+ // A code's refusal can't answer a link: outside pulse-auth's contract.
21
+ case 'wrong-code':
22
+ case 'locked':
23
+ case 'expired':
24
+ return { kind: 'unknown', status: 400 };
25
+ default: {
26
+ const unhandled = settled;
27
+ throw unhandledError('result', unhandled);
28
+ }
29
+ }
30
+ }
31
+ /**
32
+ * `answeredAt`: this tab's clock when pulse-auth answered. `keptUntil`: the end of a lock this
33
+ * browser was already told about for the address, while still ahead (`twoStepLock.ts`): a
34
+ * lock isn't moved by a code tried during it, so that end stands.
35
+ */
36
+ export function twoStepResultOf(settled, answeredAt, keptUntil) {
37
+ switch (settled.kind) {
38
+ case 'locked':
39
+ return keptUntil === null
40
+ ? {
41
+ kind: 'locked',
42
+ minutes: TWO_STEP_LOCKOUT_MS / MINUTE_MS,
43
+ until: firstLockEnd(answeredAt),
44
+ }
45
+ : {
46
+ kind: 'locked',
47
+ minutes: Math.ceil((keptUntil - answeredAt) / MINUTE_MS),
48
+ until: keptUntil,
49
+ };
50
+ case 'signed-in':
51
+ return { kind: 'signed-in', backupCodes: settled.backupCodes };
52
+ case 'superseded':
53
+ return settled;
54
+ case 'wrong-code':
55
+ case 'expired':
56
+ case 'no-account':
57
+ case 'inactive':
58
+ case 'proxy-refused':
59
+ case 'unavailable':
60
+ return { kind: settled.kind };
61
+ case 'unknown':
62
+ return { kind: 'unknown', status: settled.status };
63
+ // A link's answers can't answer a code: outside pulse-auth's contract.
64
+ case 'two-step':
65
+ case 'two-step-setup':
66
+ case 'dead-link':
67
+ return { kind: 'unknown', status: 200 };
68
+ default: {
69
+ const unhandled = settled;
70
+ throw unhandledError('result', unhandled);
71
+ }
72
+ }
73
+ }
74
+ //# sourceMappingURL=results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/first-party/session/results.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAEhF,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,cAAc,CAAA;AAkB1D,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,iFAAiF;QACjF,KAAK,WAAW;YACd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IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAA;QAChE,KAAK,YAAY;YACf,OAAO,OAAO,CAAA;QAChB,KAAK,YAAY,CAAC;QAClB,KAAK,SAAS,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,eAAe,CAAC;QACrB,KAAK,aAAa;YAChB,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAA;QAC/B,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;QACpD,uEAAuE;QACvE,KAAK,UAAU,CAAC;QAChB,KAAK,gBAAgB,CAAC;QACtB,KAAK,WAAW;YACd,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;QACzC,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,SAAS,GAAU,OAAO,CAAA;YAChC,MAAM,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { type AuthSession, type SessionDeps } from './types.js';
2
+ export declare function createAuthSession(deps: SessionDeps): AuthSession;