@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
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/query/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAuC,MAAM,kBAAkB,CAAA;AAEjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AA2B1E,MAAM,cAAc,GAA4E,IAAI,CAAA;AACpG,KAAK,cAAc,CAAA,CAAC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M,CAAA;AACf,CAAC;AAED,sFAAsF;AACtF,SAAS,QAAQ,CAAC,OAAe;IAC/B,MAAM,QAAQ,GAA8D,OAAO,CAAA;IACnF,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;IAChD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,kEAAkE;AAClE,SAAS,MAAM,CAAC,MAAyC;IACvD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAC5D,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // Written by tools/write-version.mjs from package.json on every build. Never edit it; it isn't in git.
2
2
  /** The version of the SDK that is running, as its package.json gives it. */
3
- export const version = "0.13.0";
3
+ export const version = "0.15.0";
4
4
  //# sourceMappingURL=version.gen.js.map
package/docs/admin.md CHANGED
@@ -95,6 +95,13 @@ section's basics, and its most common example, are in the package's README under
95
95
  token reaches, such as Flipstream's staff acting through a swap token. The organisation is
96
96
  checked before the key, so another organisation's key is `invalid` too. So is an answer that
97
97
  is someone else than the person asked for.
98
+ - **Removing someone from your organisation is a person's to do, in the console.** It can't be
99
+ undone. `flipstream.members.remove({ member_id })` never writes. It reads the person first, by
100
+ `get`'s rules above: `not_found` when there's no such person for you (an API key included),
101
+ `forbidden` when pulse-auth refuses the read, and `invalid` for another organisation's person.
102
+ Then it answers `needs_person` with `why`, and, where a console can be named (your own
103
+ `hosts.console`), the person's page in People as `url`, with what it shows as `sees`, as
104
+ `datasets.delete` does. There, Owners and Admins remove them.
98
105
 
99
106
  ## The workspaces you open
100
107
 
@@ -107,6 +114,20 @@ section's basics, and its most common example, are in the package's README under
107
114
  no workspace opens every one, whatever its role, a role read as none included.
108
115
  - **One you don't open is `not_found`,** exactly as one nobody has, so the answer says no more than
109
116
  that. A write sends nothing, and a hand-off isn't made.
117
+ - **A record the service refuses you is `not_found` too** (D578): its own refusal of the record's
118
+ read, a 403 with code `FORBIDDEN_EXCEPTION`, says it exists, so it's answered as one nobody has, as
119
+ a workspace you don't open is (D571). That holds for a workspace's own read, in every call under
120
+ one, and for a record named by its id. In a scope, the answer names the same request as a record
121
+ nobody has would.
122
+ - **Still `forbidden`:**
123
+ - your own read's refusal;
124
+ - a 403 that isn't the service's own refusal of the record: a page from something in front of
125
+ it, such as a proxy or a sign-in gate, or the service's refusal of the token
126
+ (`TOKEN_INVALID_EXCEPTION`). Those say nothing about the record;
127
+ - a 403 on a workspace's list read beside it;
128
+ - a write's own 403 once the record is read: a role that can read but not write.
129
+ - **Accepted knowingly:** a role the service refuses every record gets `not_found` for every id,
130
+ and so does a token whose scopes don't cover the route, since the service refuses both alike.
110
131
  - **When it's checked:**
111
132
  - **A workspace named up front** (a workspace's own calls, its logbook's `list` and `add`, its
112
133
  datasets' `list` and `count`): your organisation and you are read first. One you don't open is
@@ -116,8 +137,19 @@ section's basics, and its most common example, are in the package's README under
116
137
  yours, then the workspace's, then the list's, is the answer.
117
138
  - **A record named by its id** (an entry's `get`, `update` and `remove`; a dataset's `get`,
118
139
  `pause`, `resume` and `delete`): its workspace is known only once the record is read, so you're
119
- read beside it, and the service's own failure of that read is passed on as it came. Your
120
- organisation's failure, then the record's, then yours, is the answer.
140
+ read beside it, and the service's own failure of that read is passed on as it came, but its own
141
+ refusal of the record, which is `not_found` (D578, above). The answer is your organisation's
142
+ failure, then yours, then the record's, then its checks: another organisation's record is
143
+ `invalid`, and one in a workspace you don't open is `not_found`.
144
+ - A sign-in whose read of you fails, such as one the sign-in service refuses or one that isn't
145
+ a person, gets that failure whether the record exists or not, so it can't tell the two apart.
146
+ Once your read has failed, the call answers without waiting for the record.
147
+ - A sign-in that isn't a person, such as a service account, gets `not_found` with the sign-in
148
+ service's code, `USER_NOT_FOUND`: the same kind as a record nobody has, so read `error.code`
149
+ to tell the two apart.
150
+ - Another organisation's record answering `invalid` still says it exists, to a token the service
151
+ answers other organisations' records for, such as Flipstream's own staff's. That's intended:
152
+ such a record is never shown as yours.
121
153
  - **You're read as `flipstream.me()` reads you:** who your token belongs to, then that person, under
122
154
  the call's deadline. That's one more round trip to the sign-in service per call, two reads in a
123
155
  row, with nothing cached. In a scope, the calls of one piece of work share it (see "One piece of
@@ -181,10 +213,26 @@ section's basics, and its most common example, are in the package's README under
181
213
  - **Closing a scope ends its reads still on their way,** and a call still waiting on one answers
182
214
  `aborted`. A call that takes a closed scope reads its own, as outside a scope: a late refetch is
183
215
  fine.
184
- - **A shared read goes out under a trace of its own,** never a caller's `traceparent`, and every call
216
+ - **A shared read goes out under a trace of its own,** never a call's `traceparent`, and every call
185
217
  it answers names that trace in `trace_id` (see "Finding a request in Logs" in
186
218
  [README.md](../README.md)): the read's whose failure is the call's answer, else the call's own
187
219
  requests', else the first shared read the call asked for.
220
+ - **Or under the scope's trace, when you give it one:** `flipstream.scope({ traceparent })` and
221
+ `withScope(run, { traceparent })` take your W3C trace context, as a call's `traceparent` does
222
+ (#409). Every shared read the scope sends to the admin host, your organisation's and a
223
+ workspace's own, goes out under its trace-id and flags, with a parent-id of its own for each
224
+ attempt, and the calls those reads answer name that trace-id. So one command is one trace.
225
+ - Your reads of you go to the sign-in service, which no request carries a trace to, so they carry
226
+ none, with or without it.
227
+ - From a browser, the SDK sends the admin host no trace yet, until its CORS allows one (see
228
+ "Which app sent a request" in [README.md](../README.md)), so there the option changes nothing.
229
+ - A call names the request that answered it as its `trace_id`. So a call answered by shared
230
+ reads alone, such as `me()`, names the scope's trace-id, even when it was given its own
231
+ `traceparent`.
232
+ - One that isn't a valid version-00 traceparent, a value that isn't a string included, is dropped
233
+ silently, as a call's is, and the shared reads keep traces of their own.
234
+ - It never reaches a call's own requests: those take the call's own `traceparent`, or a trace of
235
+ their own. And a call's own `traceparent` never reaches a shared read.
188
236
 
189
237
  ## Workspaces
190
238
 
@@ -360,7 +408,8 @@ orThrow(await flipstream.log.remove({ log_id: added.id })) // null
360
408
  nothing else: never a credential, a setting or its parameters, beyond its account's id. The
361
409
  service's answer embeds the dataset's sign-in, so a body that isn't the service's JSON is never
362
410
  kept either: a failure of the dataset's own read or write gives its kind and status, with no
363
- `text`. The reads of your organisation and the workspace beside it keep theirs.
411
+ `text`. The reads of your organisation and the workspace beside it keep theirs, but the service's
412
+ own refusal of the workspace, which is `not_found` (see "The workspaces you open").
364
413
  - `type` is one of the types `datasetTypes.list()` gives, such as `'google_search_console'`, or
365
414
  a type this version doesn't know yet, kept as it came, so a new kind of dataset never makes the
366
415
  list unreadable. It's `null` when the service holds no type for it.
@@ -0,0 +1,278 @@
1
+ # The browser session, for Flipstream's own apps
2
+
3
+ `@flipstream/sdk/first-party` keeps a person signed in to pulse-auth in the browser, with no token
4
+ in the page's hands: the refresh cookie is httpOnly and reaches only the app's own `/auth` proxy,
5
+ and the access token lives in the tab's memory. It is for Flipstream's own apps, served on a
6
+ Flipstream origin, behind a proxy that meets the contract below. Other apps sign in on their
7
+ server ("On your web app's server" in the [README](../README.md)).
8
+
9
+ ## The calls
10
+
11
+ ```ts
12
+ // boot.ts: the link-token import and the line that takes the token out of the address, nothing
13
+ // else. It keeps the history entry's state.
14
+ import { strip } from '@flipstream/sdk/first-party/link-token'
15
+
16
+ const cleaned = strip(location.href)
17
+ if (cleaned !== null) history.replaceState(history.state, '', cleaned)
18
+ ```
19
+
20
+ ```ts
21
+ // main.ts, the app's entry module. A module's imports are all evaluated before its first
22
+ // statement, so ./boot goes first: the token is gone before the SDK or anything else is evaluated.
23
+ import './boot'
24
+ import { createBrowserSession } from '@flipstream/sdk/first-party'
25
+
26
+ const session = createBrowserSession({
27
+ app: { name: 'account', version: '1.4.0' },
28
+ landing: '/login-link', // where a login link lands: a path on this origin
29
+ // authPath: '/auth', // where the app's proxy is (the default)
30
+ // invitationLanding, resetLanding: the paths an invitation's and a reset's link land on
31
+ // hosts: { auth, admin, query, wallet, console }, // as the main entry's `hosts`
32
+ // onReport: (report) => …, // an answer outside the contract; console.warn by default
33
+ })
34
+ session.subscribe(() => { document.body.dataset.session = session.current().kind }) // render from current()
35
+ session.start()
36
+
37
+ // On the landing page: the link is read as the page loads, and redeemed only on the person's press.
38
+ const link = session.openedLink()
39
+ document.querySelector('#sign-in')?.addEventListener('click', () => {
40
+ if (link.kind !== 'ready') return
41
+ void session.redeem(link).then((signedIn) => {
42
+ if (signedIn.ok && signedIn.data.kind === 'two_step') {
43
+ // ask for the code, then session.verifyTwoStep({ code })
44
+ }
45
+ })
46
+ })
47
+ ```
48
+
49
+ | Call | What it does |
50
+ | --- | --- |
51
+ | `current()`, `subscribe(listener)` | The session's state (`restoring`, `signed_out`, `signed_in`, `unavailable`, `broken`, `unsupported`), the same object until it changes, for `useSyncExternalStore`. `restoring` ends within 60 s of `start()`, ordinarily 15. `unavailable` carries `retry_in_ms`. The session asks pulse-auth again by itself after that wait, and stays `unavailable` while it asks. `retry_in_ms` counts from when the state was published; the ask itself can take up to 15 s, and the tab stays `unavailable` until it answers. Its answer moves the tab on, or to `unavailable` again with the next wait. A tab shows `restoring` again only when the browser comes back online, which asks at once without waiting out `retry_in_ms`, or, when it is signed in, when another tab signed in and this one missed the message. The call that published finishes; a listener's throw goes to the page's `error` event through `reportError`, and on a host without one (a server render, Node) it is thrown again from a microtask, which Node raises as an uncaughtException, as its own `EventTarget` does. |
52
+ | `flipstream` | The main SDK as the signed-in person. Read the getter for each piece of work, for example `await session.flipstream.me()`. |
53
+ | `requestLink({ email, next }, { signal })` | Mails a login link. Empty text is `refused`, with nothing sent. `next` is a path or `null`; anything else, left out included, is a `TypeError`. |
54
+ | `openedLink()` | On the landing: whether a link's token was there, and for whom (`ready`, `spent`, `other_browser`, `invalid`, `no_token`, `invitation`). |
55
+ | `redeem(link, { signal })` | Signs in with the `ready` link `openedLink()` gave: `signed_in`, or a two-step code wanted. Call it only on a press, never as the page loads: a prerender, a speculative load or a restored tab runs the page's script without one, and the link works once. If redeem answers `superseded`, read `current()`. If the press was overtaken before the link was sent, pressing it again sends it, unless the sign-in that overtook it used this link: then `current()` is `signed_in` and the link reads `spent`. If it was sent and the sign-in was lost, every later press in this page keeps `superseded`. Ask for a new link. |
56
+ | `requestLinkAgain(link, { signal })` | A new link for the same address and next page. |
57
+ | `twoStepStatus({ signal })` | Reads whether two-step is enabled or required and how many backup codes remain. |
58
+ | `startTwoStepSetup({ signal })` | Starts enrollment for the signed-in person on the Security page. Returns the manual-entry `secret` and the `otpauth_uri` for a QR code. |
59
+ | `startSignInTwoStepSetup(setup, { signal })` | Starts enrollment for the `two_step_setup` returned by this session's `logIn` or `redeem`. Pass its frozen `setup` object unchanged. A copy or an object from another session rejects with a TypeError before sending. A sign-in ended by another tab gives `superseded`. An elapsed challenge gives `expired`. |
60
+ | `confirmTwoStepSetup({ code }, { signal })` | On the signed-in security page, confirms setup with the first authenticator code and returns ten backup codes. |
61
+ | `newBackupCodes({ code }, { signal })` | Replaces the old backup codes with ten new ones. Show the codes from this answer while the person can save them. |
62
+ | `turnOffTwoStep({ code }, { signal })` | Turns off two-step for the signed-in person. A deployment that requires it answers `required`. |
63
+ | `verifyTwoStep({ code }, { signal })` | The code, or a backup code, as typed. The state turns `signed_in` before this call answers, so a screen that leaves on `signed_in` takes this answer first: the backup codes exist nowhere else. Once the code is sent an abort is ignored. `not_sent`: the code was not sent, so press again. Before 0.15.0, this was `aborted`. When a sign-in or sign-out overtakes setup verification, `error.kind` is `superseded`. It also answers `superseded` if this tab cannot write its session state. Its `backup_codes` contains the ten issued codes only if the browser is signed out or the session can confirm the same user ID at delivery. Otherwise the field is `null`, including for a plain verify. |
64
+ | `signOut()` | Signed out here and in every tab at once; `told` settles with what pulse-auth said. `superseded`: the record moved on since this sign-out: a sign-in, in any tab, or rarely a renewal by a tab that hadn't heard of it. That tab's cookie replaced the old one; it sent this logout first when it knew it was owed, and this call isn't told whether pulse-auth confirmed it. Nothing is pending for this sign-out; a sign-out made since is owed and sent on its own. Read `current()`. Another sign-out with no sign-in between (a second press, or one in another tab) is not `superseded`: this call is told what pulse-auth answered. A logout pulse-auth didn't confirm stays owed, and this tab stays signed out: it is retried, backing off, while the service is unreachable (no network, a 5xx, a 429); when it was refused (a 401 or 403) or answered outside the contract, it is kept, not retried on a timer: each tab that holds it sends it once, and a check of the shared state while that try is out sends nothing more; it is sent again at the next page load, the next sign-in, or a restore the tab runs: its own timed retry after `unavailable`, the browser coming back online while the tab is `unavailable`, or `start()`. It is still written down as owed once storage takes writes, so a reload owes it too. |
65
+ | `requestSignUp({ email, first_name, last_name, organization, accepted: { terms_version, privacy_version } }, { signal })` | Asks pulse-admin to email a sign-up link that opens in this browser. Success acknowledges the request. It says nothing about mail delivery, whether the address already has an account or whether the person can sign in. Disable the submit button while the call is pending because each press starts another request. For `refused`, check the named form fields, including `accepted.terms_version` and `accepted.privacy_version`. A nonblank version with surrounding whitespace rejects with a `TypeError` naming the field. For `unsupported`, read `current()`: an unsupported state means a browser dependency is missing, any other state means storage refused this write. A timeout, connection or CORS failure, 429 or 5xx gives `unavailable`. An unexpected response gives `invalid` and is reported. An abort after sending gives `aborted`: the organization may exist and the link may have been mailed. The stored attempt lets that link work here. |
66
+ | `requestPasswordReset({ email }, { signal })` | Asks for a reset link. Known and unknown addresses get the same answer. The email may still arrive after an abort. |
67
+ | `openedReset()` | Reads the reset proof on the configured reset landing, including after close. |
68
+ | `setPassword(proof, { password }, { signal })` | Sets the link owner's password and ends their sessions. Stops include `dead_link`, `password_too_short` and `inactive`. An abort after dispatch may leave the password set and the sessions ended. After `password_set` or `dead_link`, `openedReset()` reads `no_token`. After `unavailable`, the reset may have reached pulse-auth and a retry can answer `dead_link` even though the password was set. In that case, ask the person to try signing in with the new password before requesting a new link. Keep the form's submitted state while `setPassword` is pending. If the link's owner is signed in here and pulse-auth confirms revocation, `current()` already reads `signed_out` when this call settles. Another person signed in here stays signed in. An abort during that check or a wait of 15 seconds returns the known reset outcome while the check continues. |
69
+ | `close()` | Ends this session object: its listeners, timers and channel. A request already sent settles with its real outcome (a sign-in already sent that then loses, to a sign-out in another tab or with an answer that can't be read, is still revoked with a `/logout`), but nothing new is sent: a call still waiting to send answers `unavailable`, and a sign-out whose first try hadn't gone out is told `unconfirmed`, its logout left pending. A logout storage refused to record is left for the next session in this page that looks, made before or after the close, which sends it before it restores. It is lost, and the person's own sign-in may restore, when it was never written down: the page closed while storage still refused; the shared record read signed out or was lost, and another tab that never heard of it restored the cookie first; or storage came back too shortly before to have taken it: a logout retried on the back-off is written at its next try, 30 seconds later at most, and one kept without a timer at the tab's next check of the shared state (another tab's write, the tab shown again or back online, a token asked for). A sign-out made after `close()` (a sign-in answered after it, or a `signOut()` racing it) reaches only this page, not the other tabs. If the stored record is lost while the cookie stays, the page can't tell whose cookie it is, and the logout still goes, even when someone signed in since. A session left open with a sign-out it couldn't write down gives way as the slot does: a sign-in or a sign-out another tab recorded after that sign-out speaks for the cookie, so the session drops its own sign-out. After a sign-in it sends no logout and restores that person; after a sign-out it sends that one's logout. The same holds when the shared record read signed out or was lost, and another tab that never heard of the sign-out restored the cookie first: that restore is recorded at a new generation, so the sign-out is lost and the person it signed out is restored, as with the slot. A restore against a record that still reads signed in keeps its generation, so the sign-out stands and its logout goes, unless the refresh answers another person. Then a new generation starts, and the sign-out is told `superseded`, with no logout sent: the browser's one cookie is that person's now, so no logout from it could reach the person signed out. The same new generation also ends a sign-in this browser refused to keep, whose revoke storage couldn't record: when a tab that never heard of it refreshes with that sign-in's cookie and gets another person, the revoke is lost and that sign-in's session lives on. This is a known limit, fixed by sdk#552. Every call after it throws or rejects with `SessionClosedError`, `subscribe` and `start` included, except the reads: `consentRequest()`, `current()`, `openedLink()`, `openedReset()`, `openedInvitation()` and the `flipstream` getter stay readable, and an unsubscribe handed out before stays safe to call. |
70
+ | `consentRequest()` | Reads the current page address, including after close. A callback outside HTTP or HTTPS reads as `invalid`. For `asking`, show the client ID, callback host and requested scopes. To return here after sign-in, pass this page's path and query to `requestLink` as `next`. |
71
+ | `approveConsent(request, { signal })`, `denyConsent(request, { signal })` | On a press, send the choice as the signed-in person. Pass the exact request this session showed. A copy or a request issued by another session rejects with a TypeError. On success, navigate to the checked `redirect_to`. With nobody signed in, `signed_out` sends nothing. A second press returns `answered` while the first is pending. Once it settles, try again if nothing was sent, or after a 429, which arrives as `unavailable`, or after `unknown_client`, `invalid_scope` or `invalid_target`. Approve renews once on `login_required`. If its retry never goes out or again gets `login_required`, the page can press again. `unknown_client` means the app or callback could not be identified. `invalid_scope` and `invalid_target` mean the app may not ask for that scope or resource. An answer outside the contract gives `invalid` and is reported. After the send, `aborted`, `signed_out` or `unavailable` may leave the request answered as the person who pressed. When the outcome is uncertain, another press returns `answered`. Reload or sign in again to make a fresh press. Approval may have issued a code and claimed a dynamically registered client for that person’s account. |
72
+ | `logIn({ email, password }, { signal })` | Signs in with an address and the password as typed: `signed_in`, or a two-step code wanted (`two_step`, `two_step_setup`). Only on a press. Empty fields are `refused`, with nothing sent. `invalid_credentials` covers a wrong password, no such account and no password set: pulse-auth says one thing for all. `too_many_attempts` comes with no end time, because pulse-auth has none to give. `superseded`: a sign-in or sign-out, in any tab, came after the press; read `current()`. A refusal is never folded into it. `aborted`: the sign-in may still complete, and `current()` tells; a code asked for once every caller of that request has left is dropped, and the next press asks again. A `signal` that is not an AbortSignal is a TypeError, with nothing sent. |
73
+ | `openedInvitation()` | On `invitationLanding`: whether the page was opened with an invitation's token (`ready`, `no_token`). Nothing sent, and readable after `close()`. It reads `no_token` once this page is done with the invitation: pulse-auth answered an accept with a 2xx, or the invitation was found dead. |
74
+ | `previewInvitation(opened, { signal })` | What the `ready` invitation is for, straight from pulse-auth with no cookie: `personal` (it names its recipient, `email`) or `shared` (it names nobody), with `organization_name` (`''` when the deployment doesn't say), `app_name`, `roles`, `privacy_policy_url` (or `null`) and `continue` (`{ name, url, login_url }` of the app it goes on to, or `null`). The first preview marks the invitation as opened at pulse-auth. `dead_link`: unknown, revoked, expired or spent; pulse-auth says one thing for all. |
75
+ | `acceptInvitation(invitation, entry, { signal })` | Makes the account and signs the person in, through the proxy, as `logIn` does. Pass the invitation `previewInvitation` returned, as it is (a copy is a `TypeError`), narrowed on its `kind`: a personal one takes `{ first_name, last_name, privacy_policy_accepted }` and an optional `password` (without one the account signs in by link only), a shared one also `email` and `password`. Empty names, and a shared accept's empty address or password, are `refused`; a privacy policy not accepted is `privacy_policy_required`; nothing is sent then. `signed_in` carries `continue_to`, a fresh one-time link into the invitation's app, or `null`: then, when the invitation has a `continue`, send the person to `continue.login_url`; without one, they are signed in here. A deployment that requires two-step answers `two_step` or `two_step_setup`, as `logIn` does, and `verifyTwoStep` then ends it the same way: to `continue.login_url` when there is a `continue`, otherwise signed in here. `changed`: the invitation was edited since the preview; preview it again. `dead_link`: unknown, revoked, expired or spent, or edited to another address since its link was sent: ask for it to be sent again. `password_too_short`, `account_exists` (log in first) and `superseded` (read `current()`) are as their names say. Once pulse-auth answers the accept with a 2xx (an accepted answer, or `superseded` or `invalid` after it), or `dead_link`, `openedInvitation()` reads `no_token`, also when the caller aborted after the send: this page is done with the invitation (spent, unless it allows more than one use). After `unavailable` the account may already exist and `openedInvitation()` stays `ready`. After `aborted` once the accept was sent, the request goes on: `openedInvitation()` reads `ready` while it is out, then `no_token` if pulse-auth answered a 2xx or `dead_link`, and `ready` otherwise. While it stays `ready` the account may already exist: a later `dead_link` then means "log in", with the password or by a login link. A second press with a different entry while one is out is its own attempt, not joined to the first, and can find the invitation used (sdk#549). With no privacy policy at the preview, pulse-auth's privacy refusal is `changed`: preview again. |
76
+ | `lookUpDevice({ user_code }, { signal })` | Device sign-in: looks up the code a device shows, as typed, and answers the request to show the person: `user_code` as pulse-auth formats it, `client_id`, `client_name` (the name the client declares for itself: for a client registered by metadata document or dynamically, nobody has checked it, so show `client_id` beside it; `null` when pulse-auth can't resolve the client), `scopes` and `expires_at` (epoch ms). An open read straight to pulse-auth, with no cookie and no token: it changes nothing, so it may run on load, and works whoever is signed in, or nobody. `unknown_code`: unknown, expired or already used, which pulse-auth doesn't tell apart. `already_denied`: the request was denied before; only a look-up says so. An empty code is `refused`, with nothing sent. A request that is not an object, or a `signal` that is not an AbortSignal, is a TypeError, with nothing sent. |
77
+ | `approveDevice(request, { signal })`, `denyDevice(request, { signal })` | Answers the request `lookUpDevice()` answered on this session, straight to pulse-auth as the signed-in person, only on a press: `approved` or `denied`. Any other object, a copy of it or one from another session included, is a TypeError, with nothing sent. Nobody signed in, or another person by the time it would be sent: `signed_out`, with nothing sent. `unknown_code`: the code is unknown, expired or already used (pulse-auth says the same for all three); a press on it would be sent again, but pulse-auth no longer holds it: ask the device for a new code. `answered`: a press from this page on this code (looked up again included) is still out, or may already have acted on it, for the person signed in now; nothing was sent. Once the first settles, a press is sent again if nothing was sent, or after a 429, which arrives as `unavailable`. After the send, `signed_out`, `aborted`, `invalid` or any other `unavailable` may leave the device answered as the person who pressed: another press answers `answered`, and a fresh look-up doesn't change that. Only signing in again lets a press be sent. An answer that isn't the decision pressed is `invalid` and reported. |
78
+
79
+ Every call that asks a server answers `{ ok: true, data }` or `{ ok: false, error }` and rejects
80
+ only on a programming error. A call whose `signal` aborts answers `aborted` at once (`verifyTwoStep`: `not_sent` before its send), which always means it may have happened: read `current()`. Once `verifyTwoStep` sends its code, it answers what pulse-auth said. The code-delivery exceptions are described below. Once the service confirms a password reset, an abort ends only that caller's wait for the session check.
81
+
82
+ Whatever a call hands out is frozen all the way down: the state, every answer, the links, each
83
+ `Result` with its data and error, and each report (but not a report's `cause`, which is what was
84
+ thrown, as it was). A result may be shared, and none of its holders can change it under another.
85
+
86
+ ## Setting up two-step verification
87
+
88
+ When `logIn`, `redeem` or `acceptInvitation` answers `two_step_setup`, pass its `setup` object to `startSignInTwoStepSetup(setup)` before asking for the
89
+ first authenticator code. Display its secret or draw a QR code from its URI. Finish the sign-in
90
+ with `verifyTwoStep({ code })`. Take its ten backup codes before leaving the code screen.
91
+ On a signed-in Security page, call `startTwoStepSetup()` and then `confirmTwoStepSetup({ code })`.
92
+
93
+ Overlapping starts for one sign-in challenge or signed-in person share an enrollment. Aborting
94
+ one caller ends its own wait. If everyone leaves before dispatch, nothing is sent. A caller who
95
+ returns while the sent request is pending can join it. A late answer for a cleared or replaced
96
+ challenge returns `expired`. If a sign-in or sign-out in another tab ended it, the call returns `superseded`.
97
+
98
+ `verifyTwoStep`, `confirmTwoStepSetup` and `newBackupCodes` can issue codes that the service
99
+ shows once. After dispatch, a caller's abort still allows the issued codes or a service refusal
100
+ to reach the screen. A request that times out answers `unavailable`. If the service requires a
101
+ credential renewal before it accepts a signed-in call, an aborted caller's request is never
102
+ replayed. Confirmation and replacement deliver issued backup codes if the browser is signed out
103
+ or the session confirms the original user ID at delivery. A different or unconfirmed recipient
104
+ gives `signed_out`.
105
+
106
+ Use the secret and backup codes only on the screen that requested them. Do not write them to
107
+ storage, reports, logs or tab messages. A locked code call gives `until` in epoch milliseconds,
108
+ the latest time the address's lock can end. A new code call for that address respects the same lock.
109
+
110
+ ## Using the main SDK
111
+
112
+ A call goes out only as the person the tab shows when the call is made. Wait for
113
+ `session.current().kind === 'signed_in'` before starting work and read `session.flipstream`
114
+ where you call it. A bearer call made while nobody is shown answers at once with `no_token`
115
+ when signed out or unsupported, or `unavailable` while restoring, unavailable or broken.
116
+ That call is never retried or sent later. Health can run without a token.
117
+
118
+ A client belongs to the person shown when you read `session.flipstream`. If nobody is shown then,
119
+ it belongs to the first person shown at a later getter read or client call. Avoid keeping it in
120
+ a module. The client and its method groups are frozen, including inside `withScope`. A kept client or its warm scope answers
121
+ `cancelled` when the person or rights change, including between the reads of one `me()`.
122
+ The call checks its arguments first, then an already-aborted signal, then the session state. After `close()`,
123
+ a new client call rejects with `SessionClosedError` and synchronous scope creation throws it.
124
+ An admitted call can deliver its final outstanding answer. If it needs another send or renewal,
125
+ it answers `cancelled`. A write answered `cancelled` may have run, so read the current state before trying it again. [Workspace writes](admin.md#workspaces) explains how to check.
126
+ The client returns the main SDK's usual results.
127
+ Every bearer request, the client's and a family's as the person, retries and the replay after a renewal included,
128
+ asks the browser not to use its HTTP cache (`cache: 'no-store'`): it is never answered from that cache, and its answer
129
+ isn't stored there for another person or after a sign-out. The main entry's own clients ask the same for every request
130
+ that carries their token; health, which carries none, keeps the default.
131
+
132
+ ## The proxy's contract
133
+
134
+ The calls that read or set the refresh cookie go to the app's own server at `authPath`, which
135
+ passes them to pulse-auth. Everything else goes straight to its host with `credentials: 'omit'`.
136
+ Direct requests omit cookies. Direct bearer requests and health use manual redirects. A redirect on the request itself answers `invalid` and is reported once, with status 0 for an opaque browser redirect. Open family requests also use manual redirects. The wire returns the status and the family reports it once. On a service host sharing the page's origin, a bearer cannot go to or below `authPath`. Escaped slash, backslash and percent on that origin are refused.
137
+ The proxy is the app's to run. The rules are `@flipstream/sdk/first-party/proxy`, and the stand-in
138
+ an app checks a proxy with is `@flipstream/sdk/first-party/proxy/stand-in`. Neither is for the page.
139
+ The session relies on all of this:
140
+
141
+ **The paths.** Six, each `POST` with a JSON body, forwarded with `authPath` taken off: `refresh`,
142
+ `login-link` (the request and the redeem), `logout`, `mfa/verify`, `login` and
143
+ `invitations/accept`. This release sends all six: `invitations/accept` is `acceptInvitation`'s. The path handed to the function is the
144
+ raw target under the proxy, the query included, with no decoding and no case folding, unless the
145
+ proxy normalises the target, as below. One leading
146
+ slash is ignored. Two are not, and nor is a trailing slash or a different case. A path the app
147
+ does not serve is a 404 with no `X-Auth-Proxy` header, including when the method or the origin
148
+ would also have failed, unless the proxy normalises the target, as below. An app leaves a path out, and may add one of its own: a `*` there is one
149
+ whole segment of letters, digits, hyphen and underscore. Match the six paths exactly, anchored.
150
+ After the normalising below, any other path under `authPath` is a 404 with no `X-Auth-Proxy`
151
+ header. A proxy may answer 404 to a target that is not byte for byte a listed path, or normalise
152
+ it and forward exactly the path it becomes. Normalising cuts the target at `#`, drops the query,
153
+ decodes `%XX` once, resolves `.` and `..`, and merges repeated slashes. A final `.` or `..` keeps
154
+ the slash, and a `..` above the root is not a target. It does not fold case and
155
+ it does not drop a trailing slash, so `REFRESH` and `refresh/` stay a 404. It never forwards a
156
+ query. On a normalised target the rows check the Origin and the method. The rest of the guard
157
+ (Content-Type, `Sec-Fetch-Site`, a header given twice) is the app's to keep, as on the listed path. `/login` is for password sign-in; `/invitations/accept`
158
+ is for accepting an invitation. A proxy must not answer these paths with a
159
+ redirect: the app then sees an answer outside the contract (`onReport`, status 0 in a browser and
160
+ the 3xx in Node), not "can't reach". That holds for these same-origin cookie calls always. A call
161
+ to another origin, the wire's `open` and the sign-up post, sees the redirect only when the browser
162
+ lets the page see the answer. A redirect without CORS headers, or one on the preflight, makes
163
+ `fetch` reject first, and the page sees a network failure. A sign-out the proxy answers with a
164
+ redirect is reported and stays owed, but isn't retried on a timer: the next page load, the next
165
+ sign-in or a restore the tab runs sends it again, each try reported (sdk#503).
166
+
167
+ **The guard.** Once the path matches, anything but exactly `POST` is a 403 with
168
+ `X-Auth-Proxy: refused`. So is a header given twice, or already joined with a comma. The request
169
+ is refused when:
170
+
171
+ - its `Origin` isn't exactly the app's own origin, the literal `null`, the other scheme, another
172
+ port and a longer host that merely starts with the app's origin included (every
173
+ `*.flipstream.io` host is same-site, so the cookie alone doesn't tell a sibling app from this
174
+ one);
175
+ - it has a `Sec-Fetch-Site` other than `same-origin` (`cross-site`, `same-site` and `none` are
176
+ refused; a request without one is allowed);
177
+ - its `Content-Type` media type, the part before a parameter, compared without case, isn't
178
+ `application/json`. A charset is allowed. `application/jsonp`, `application/json-seq`,
179
+ `application/x-json` and `text/json` are refused.
180
+
181
+ **`X-Auth-Proxy: refused`** goes on every refusal (in nginx, with `always`) and never on one of
182
+ pulse-auth's answers. The session reads it before the status, so a refusal is never read as
183
+ pulse-auth's own 403: a call answers `proxy_refused`, the state is `broken` with status 403, and
184
+ `onReport` hears `{ kind: 'answer', path, status: 403 }`, with `path` the server's own path. It is
185
+ a deployment fault: nothing the person can fix.
186
+
187
+ **What it passes on.** `AUTH_PROXY_COOKIES` names the cookies that exist, `refresh_token` and
188
+ `__Host-refresh_token`. The app lists which of them it passes, in `cookies`, and there is no
189
+ default. On a host with sibling hosts that serve other people's content, a plain `refresh_token`
190
+ in the jar can only be one a sibling set, and passing it on would let that host fix the session.
191
+ A deployed host with siblings lists only `__Host-refresh_token`. A dev proxy lists both, because
192
+ pulse-auth sets the plain name today and localhost has no siblings. Only a listed name is passed
193
+ on, by exact name, with a value, in the order the browser wrote them. A name the app does not list
194
+ is dropped on the way up and on the way back, so no credential is left in the jar that this proxy
195
+ will never read. Left alone, pulse-auth would read the last of two cookies with one name. Through the proxy it
196
+ gets the first. Only a `__Host-` name is safe from a cookie another host set, which is why a
197
+ deployed host lists only that one. A name written twice is passed on once, with its first value.
198
+ A value that holds `=` is kept whole. On the way back, a `Set-Cookie` for a listed name is kept
199
+ byte for byte, attributes included, an empty value included, because that is how a cookie is
200
+ cleared. Any other is dropped.
201
+ `Host` is removed; the upstream keeps its own. `Authorization`, `Proxy-Authorization`,
202
+ `Forwarded`, `X-Real-IP`, `CF-Connecting-IP`, `True-Client-IP`, `X-Client-IP`,
203
+ `X-Cluster-Client-IP`, `Fastly-Client-IP` and every `X-Forwarded-*` name do not arrive as the
204
+ browser wrote them. The hop-by-hop headers are dropped on the way up and on the way back, by name
205
+ without case: `Connection`, `Keep-Alive`, `Proxy-Authenticate`, `Proxy-Connection`, `TE`,
206
+ `Trailer`, `Transfer-Encoding`, `Upgrade`, and any header the `Connection` value names. The
207
+ handler sets no client address: it runs where the browser does, and a proxy in front of real
208
+ users sets the address it measured, in its own configuration. What the browser gets must decode
209
+ to the body pulse-auth sent. A proxy that pipes the body keeps `Content-Length` and
210
+ `Content-Encoding`. A proxy that reads the body through fetch gets it decoded and drops both.
211
+ Nothing is added, a CORS header included. A redirect is not followed. Every proxy answers within
212
+ 30 seconds, with a 504 when pulse-auth did not. The session counts on that bound.
213
+
214
+ **What it never keeps.** No query string in its logs: a link's token travels in one.
215
+
216
+ Production is nginx, in both apps. For dev and preview, `authProxyHandler` is the handler, and
217
+ what it accepts it does right. Its bound is for the whole call, its body included. Vite mounts it with `server.middlewares.use('/auth', authProxyHandler(app, upstream))`.
218
+ A server that does not strip the mount must. The handler below strips `/auth` and leaves everything else at 404.
219
+
220
+ ```ts
221
+ import { createServer, type IncomingMessage, type ServerResponse } from 'node:http'
222
+ import type { AuthProxyApp } from '@flipstream/sdk/first-party/proxy'
223
+ import { authProxyHandler } from '@flipstream/sdk/first-party/proxy/stand-in'
224
+
225
+ const app: AuthProxyApp = { origin: 'https://app.example.test', cookies: ['__Host-refresh_token'] }
226
+ const handle = authProxyHandler(app, 'http://127.0.0.1:9')
227
+ const server = createServer((request: IncomingMessage, response: ServerResponse) => {
228
+ const url = request.url ?? '/'
229
+ if (url === '/auth' || url.startsWith('/auth/')) {
230
+ const rest = url.slice('/auth'.length)
231
+ request.url = rest === '' ? '/' : rest
232
+ handle(request, response)
233
+ return
234
+ }
235
+ request.resume()
236
+ response.writeHead(404)
237
+ response.end()
238
+ })
239
+ server.listen(0, '127.0.0.1')
240
+ ```
241
+
242
+ The same package builds the rows, and the stand-in reads each one. An empty list means the row holds.
243
+ Run the rows against the proxy as a browser reaches it; when a front proxy stands before yours, run them with that hop configured or through it.
244
+ Never point `run` at a deployed proxy: its upstream is the real service. `run` takes an `http:` address, path included.
245
+
246
+ ```ts
247
+ import { authProxyCases, type AuthProxyApp } from '@flipstream/sdk/first-party/proxy'
248
+ import { startAuthStandIn } from '@flipstream/sdk/first-party/proxy/stand-in'
249
+
250
+ const app: AuthProxyApp = { origin: 'https://app.example.test', cookies: ['__Host-refresh_token'] }
251
+ const standIn = await startAuthStandIn()
252
+ const proxy = 'http://127.0.0.1:9'
253
+ for (const row of authProxyCases(app)) {
254
+ const found = await standIn.run(row, proxy)
255
+ if (found.length > 0) console.log(row.name, found)
256
+ }
257
+ await standIn.close()
258
+ ```
259
+
260
+ ## What else the app needs
261
+
262
+ - **CORS.** Pulse-admin, pulse-auth and pulse-wallet must allow the app's origin and the `Authorization`
263
+ header in preflight. Writes also need `Content-Type` in the allowed headers and `POST`, `PUT` and `DELETE` among the allowed methods. The deployed query host also needs `Flipstream-Client` and `traceparent`.
264
+ A redirect on the preflight is a browser network failure. The call reads `unavailable`, with the usual network retries for a read and no redirect report.
265
+ Password reset also calls pulse-auth directly from the app’s origin.
266
+ Sign-up calls pulse-admin directly. Check that it allows the app's origin before going live. If the browser refuses the preflight, each sign-up press stores an attempt and answers `unavailable` without notifying `onReport`.
267
+ - **Web Locks, localStorage and a native `fetch`.** Without them, or on a page whose origin isn't
268
+ http or https (a sandboxed frame, a file, an extension's page), the state is `unsupported` and
269
+ nobody can sign in there. A native `fetch` keeps `cache: 'no-store'` and `redirect: 'manual'`.
270
+ The entry checks the page's global `Request`, when the session is made and again before each
271
+ request as the person: one that doesn't keep `cache: 'no-store'` (a page with no native fetch,
272
+ where a polyfill such as whatwg-fetch fills it in) makes the session `unsupported`, and one
273
+ swapped in later makes each such call `unavailable`, with nothing sent. A test environment whose
274
+ `Request` doesn't keep `cache` gets an unsupported session too, as a browser without Web Locks
275
+ does. The SDK checks `Request`, not `fetch`: a page that replaces `window.fetch` itself must
276
+ keep each request's `cache` and `redirect` as given, since the SDK can't see inside it.
277
+ - **One session per page load.** A second `createBrowserSession` in the same page gets no link
278
+ token: the first took it.
@@ -207,7 +207,11 @@ if (signedOut.cleared === 'failed') {
207
207
  reboot;
208
208
  - `refused`: any other refusal, in the keychain's own words;
209
209
  - `timeout`: the step took longer than its `timeoutMs`;
210
- - `helper`: the helper process couldn't start, or ended before it answered (`exit` says how);
210
+ - `helper`: the helper process couldn't start, or ended before it answered (`exit` says how).
211
+ One that couldn't start for want of file descriptors (`EMFILE`, your process's own limit, or
212
+ `ENFILE`, the whole system's table) has the spawn's own error, with that `code`, as the
213
+ error's `cause`, when Node reports it in time: a hint for your logs, not a promise, so never
214
+ let your app depend on it;
211
215
  - `missing`: `@napi-rs/keyring` isn't installed, and the message names it;
212
216
  - `too-long`: the tokens are over 2,560 bytes, so nothing was saved.
213
217
 
@@ -242,9 +246,9 @@ if (signedOut.cleared === 'failed') {
242
246
  the same 30 s. The helper never keeps your app running. It's `process.execPath`, so it needs a
243
247
  Node that runs a script: not an Electron app (without `ELECTRON_RUN_AS_NODE`), a Node
244
248
  single-executable application, or a compiled Bun binary. A bundle must keep `keychainChild.js`
245
- beside the module, with `zod` and `@napi-rs/keyring` resolvable from there, and
246
- `import.meta.url` set. Where it doesn't (an esbuild CommonJS bundle, say), only the keychain's
247
- steps fail, as `store_failed`.
249
+ beside the module, with `@napi-rs/keyring` resolvable from there, and `import.meta.url` set.
250
+ Where it doesn't (an esbuild CommonJS bundle, say), only the keychain's steps fail, as
251
+ `store_failed`.
248
252
  - Through `session.token()`, a keychain read that takes longer than the caller's wait, 15 s
249
253
  unless you pass `createSession({ waitMs })`, is `unavailable`. On macOS a read can wait on
250
254
  an access dialog, every time, for an item another program saved: give `waitMs` as long as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipstream/sdk",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "TypeScript SDK for the Flipstream APIs: typed requests and checked answers, in Node and in browsers.",
5
5
  "keywords": [
6
6
  "flipstream",
@@ -29,12 +29,40 @@
29
29
  "types": "./dist/node/index.d.ts",
30
30
  "default": "./dist/node/index.js"
31
31
  },
32
+ "./first-party": {
33
+ "types": "./dist/first-party/index.d.ts",
34
+ "default": "./dist/first-party/index.js"
35
+ },
36
+ "./first-party/link-token": {
37
+ "types": "./dist/first-party/strip.d.ts",
38
+ "default": "./dist/first-party/strip.js"
39
+ },
40
+ "./first-party/proxy": {
41
+ "types": "./dist/first-party/proxy/index.d.ts",
42
+ "default": "./dist/first-party/proxy/index.js"
43
+ },
44
+ "./first-party/proxy/stand-in": {
45
+ "types": "./dist/first-party/proxy/stand-in.d.ts",
46
+ "default": "./dist/first-party/proxy/stand-in.js"
47
+ },
32
48
  "./recorded/*": "./dist/recorded/*"
33
49
  },
34
50
  "typesVersions": {
35
51
  "*": {
36
52
  "node": [
37
53
  "./dist/node/index.d.ts"
54
+ ],
55
+ "first-party": [
56
+ "./dist/first-party/index.d.ts"
57
+ ],
58
+ "first-party/link-token": [
59
+ "./dist/first-party/strip.d.ts"
60
+ ],
61
+ "first-party/proxy": [
62
+ "./dist/first-party/proxy/index.d.ts"
63
+ ],
64
+ "first-party/proxy/stand-in": [
65
+ "./dist/first-party/proxy/stand-in.d.ts"
38
66
  ]
39
67
  }
40
68
  },
@@ -53,13 +81,14 @@
53
81
  "typecheck": "node tools/write-version.mjs && tsc -p tsconfig.json --noEmit",
54
82
  "contract": "npm run build && node --expose-gc scripts/contract.mjs",
55
83
  "smoke": "npm run build && node scripts/smoke.mjs",
56
- "browser": "npm run build && node scripts/browser.mjs",
84
+ "browser": "npm run build && tsc -p browser/first-party/tsconfig.json && node scripts/browser.mjs && node scripts/first-party-bundle.mjs && node scripts/first-party-browser.mjs",
57
85
  "check:lock-live": "npm run build && node scripts/lock-live.mjs",
86
+ "check:keychain-locked-live": "npm run build && node scripts/live/keychain-locked.mjs",
58
87
  "spec:types": "node tools/spec-types.mjs",
59
- "unit": "npm run build && node --test test/*/*.test.mjs",
88
+ "unit": "npm run build && node --test ${UNIT_TEST_CONCURRENCY:+--test-concurrency=$UNIT_TEST_CONCURRENCY} test/*/*.test.mjs",
60
89
  "pack:check": "npm run build && node tools/check-pack.mjs",
61
90
  "install:check": "npm run build && node tools/check-install.mjs",
62
- "api:report": "npm run build && api-extractor run --local && api-extractor run --local --config api-extractor.node.json",
91
+ "api:report": "npm run build && api-extractor run --local && api-extractor run --local --config api-extractor.node.json && api-extractor run --local --config api-extractor.first-party.json && api-extractor run --local --config api-extractor.link-token.json && api-extractor run --local --config api-extractor.proxy.json && api-extractor run --local --config api-extractor.proxy-stand-in.json",
63
92
  "lint:package": "npm run build && publint --strict && attw --pack . --ignore-rules cjs-resolves-to-esm",
64
93
  "lint": "eslint --max-warnings 0 ."
65
94
  },
@@ -97,7 +126,7 @@
97
126
  "publint": "0.3.24",
98
127
  "typescript": "5.9.3",
99
128
  "typescript-eslint": "8.70.0",
100
- "vite": "8.3.0"
129
+ "vite": "8.3.3"
101
130
  },
102
131
  "dependencies": {
103
132
  "zod": "4.6.6"