@flipstream/sdk 0.15.0 → 0.16.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.
- package/CHANGELOG.md +49 -0
- package/dist/api/datasets.js +8 -8
- package/dist/api/datasets.js.map +1 -1
- package/dist/api/log.js +6 -10
- package/dist/api/log.js.map +1 -1
- package/dist/api/pathArgument.d.ts +7 -0
- package/dist/api/pathArgument.js +12 -0
- package/dist/api/pathArgument.js.map +1 -0
- package/dist/first-party/attempts.d.ts +1 -1
- package/dist/first-party/authProxyMark.d.ts +5 -2
- package/dist/first-party/authProxyMark.js +5 -2
- package/dist/first-party/authProxyMark.js.map +1 -1
- package/dist/first-party/calls/consent.d.ts +30 -18
- package/dist/first-party/calls/consent.js.map +1 -1
- package/dist/first-party/calls/device.d.ts +42 -20
- package/dist/first-party/calls/device.js.map +1 -1
- package/dist/first-party/calls/invitation.d.ts +99 -53
- package/dist/first-party/calls/invitation.js +23 -5
- package/dist/first-party/calls/invitation.js.map +1 -1
- package/dist/first-party/calls/logIn.d.ts +30 -10
- package/dist/first-party/calls/logIn.js.map +1 -1
- package/dist/first-party/calls/reset.d.ts +4 -1
- package/dist/first-party/calls/reset.js.map +1 -1
- package/dist/first-party/calls/signUp.d.ts +1 -1
- package/dist/first-party/calls/signUp.js +1 -1
- package/dist/first-party/calls/signUp.js.map +1 -1
- package/dist/first-party/calls/twoStepSetup.d.ts +28 -5
- package/dist/first-party/calls/twoStepSetup.js.map +1 -1
- package/dist/first-party/entry.d.ts +223 -199
- package/dist/first-party/entry.js +21 -19
- package/dist/first-party/entry.js.map +1 -1
- package/dist/first-party/hooks.d.ts +22 -7
- package/dist/first-party/hooks.js.map +1 -1
- package/dist/first-party/linkToken.d.ts +2 -3
- package/dist/first-party/linkToken.js +2 -3
- package/dist/first-party/linkToken.js.map +1 -1
- package/dist/first-party/links.d.ts +3 -3
- package/dist/first-party/links.js +4 -4
- package/dist/first-party/links.js.map +1 -1
- package/dist/first-party/proxy/app.d.ts +15 -8
- package/dist/first-party/proxy/app.js.map +1 -1
- package/dist/first-party/proxy/cases.d.ts +34 -17
- package/dist/first-party/proxy/cases.js +2 -3
- package/dist/first-party/proxy/cases.js.map +1 -1
- package/dist/first-party/proxy/decide.d.ts +6 -4
- package/dist/first-party/proxy/decide.js +2 -3
- package/dist/first-party/proxy/decide.js.map +1 -1
- package/dist/first-party/proxy/headers.d.ts +2 -3
- package/dist/first-party/proxy/headers.js.map +1 -1
- package/dist/first-party/proxy/pass-back.d.ts +14 -9
- package/dist/first-party/proxy/pass-back.js +2 -6
- package/dist/first-party/proxy/pass-back.js.map +1 -1
- package/dist/first-party/proxy/paths.d.ts +5 -7
- package/dist/first-party/proxy/paths.js +5 -7
- package/dist/first-party/proxy/paths.js.map +1 -1
- package/dist/first-party/proxy/stand-in.d.ts +2 -0
- package/dist/first-party/proxy/stand-in.js +28 -5
- package/dist/first-party/proxy/stand-in.js.map +1 -1
- package/dist/first-party/report.d.ts +20 -11
- package/dist/first-party/report.js.map +1 -1
- package/dist/first-party/result.d.ts +86 -18
- package/dist/first-party/result.js.map +1 -1
- package/dist/first-party/session/cell.d.ts +29 -5
- package/dist/first-party/session/cell.js +16 -2
- package/dist/first-party/session/cell.js.map +1 -1
- package/dist/first-party/session/closed.d.ts +6 -3
- package/dist/first-party/session/closed.js +6 -3
- package/dist/first-party/session/closed.js.map +1 -1
- package/dist/first-party/session/logout.d.ts +25 -5
- package/dist/first-party/session/logout.js +241 -43
- package/dist/first-party/session/logout.js.map +1 -1
- package/dist/first-party/session/owed.d.ts +85 -10
- package/dist/first-party/session/owed.js +111 -10
- package/dist/first-party/session/owed.js.map +1 -1
- package/dist/first-party/session/refresh.js +13 -6
- package/dist/first-party/session/refresh.js.map +1 -1
- package/dist/first-party/session/session.js +3 -6
- package/dist/first-party/session/session.js.map +1 -1
- package/dist/first-party/session/shared.js +49 -8
- package/dist/first-party/session/shared.js.map +1 -1
- package/dist/first-party/session/signIn.d.ts +10 -5
- package/dist/first-party/session/signIn.js +56 -10
- package/dist/first-party/session/signIn.js.map +1 -1
- package/dist/first-party/session/signInThrough.d.ts +2 -1
- package/dist/first-party/session/signInThrough.js +67 -18
- package/dist/first-party/session/signInThrough.js.map +1 -1
- package/dist/first-party/session/sync.js +39 -8
- package/dist/first-party/session/sync.js.map +1 -1
- package/dist/first-party/signInHooks.d.ts +43 -15
- package/dist/first-party/state.d.ts +20 -0
- package/dist/first-party/state.js +3 -0
- package/dist/first-party/state.js.map +1 -1
- package/dist/flipstream.d.ts +29 -10
- package/dist/flipstream.js +69 -20
- package/dist/flipstream.js.map +1 -1
- package/dist/version.gen.js +1 -1
- package/docs/first-party.md +52 -30
- package/package.json +1 -1
|
@@ -13,16 +13,14 @@ import { type AsPerson, type CallOptions, type Refused, type Result, type Sent,
|
|
|
13
13
|
import type { AuthSession } from './session/index.js';
|
|
14
14
|
import { type DeviceAnswerStop, type DeviceRequest, type DeviceStop } from './calls/device.js';
|
|
15
15
|
import type { Wire } from './wire.js';
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* What is known about the person in this browser, one meaning per kind.
|
|
18
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
19
|
+
*/
|
|
17
20
|
export type SessionState =
|
|
18
21
|
/**
|
|
19
|
-
* The first answer isn't in yet: the refresh cookie decides.
|
|
20
|
-
*
|
|
21
|
-
* whose answer came for a state another tab moved meanwhile is asked again, at most three more
|
|
22
|
-
* times. Its own timed retry after `unavailable` doesn't come back to it; the browser coming back
|
|
23
|
-
* online does: an `unavailable` tab goes to `restoring`, then the answer, within the same bound.
|
|
24
|
-
* A signed-in tab comes back to it when another tab signed in and this one missed the message: it
|
|
25
|
-
* asks the cookie again.
|
|
22
|
+
* The first answer isn't in yet: the refresh cookie decides.
|
|
23
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
26
24
|
*/
|
|
27
25
|
{
|
|
28
26
|
readonly kind: 'restoring';
|
|
@@ -33,16 +31,14 @@ export type SessionState =
|
|
|
33
31
|
readonly user_id: string;
|
|
34
32
|
readonly email: string;
|
|
35
33
|
/**
|
|
36
|
-
* Rises each time who is signed in, or what their token says they are (organization,
|
|
37
|
-
*
|
|
34
|
+
* Rises each time who is signed in, or what their token says they are (organization, roles), changes, and with each new sign-in.
|
|
35
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
38
36
|
*/
|
|
39
37
|
readonly revision: number;
|
|
40
38
|
}
|
|
41
39
|
/**
|
|
42
|
-
* pulse-auth can't be reached now.
|
|
43
|
-
*
|
|
44
|
-
* ask itself can take up to 15 s, and the tab stays `unavailable` until it answers. The browser
|
|
45
|
-
* coming back online asks at once, through `restoring`.
|
|
40
|
+
* pulse-auth can't be reached now.
|
|
41
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
46
42
|
*/
|
|
47
43
|
| {
|
|
48
44
|
readonly kind: 'unavailable';
|
|
@@ -50,60 +46,93 @@ export type SessionState =
|
|
|
50
46
|
}
|
|
51
47
|
/**
|
|
52
48
|
* pulse-auth answered outside its contract, or the app's own proxy refused: reported.
|
|
53
|
-
*
|
|
49
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
54
50
|
*/
|
|
55
51
|
| {
|
|
56
52
|
readonly kind: 'broken';
|
|
57
53
|
readonly status: number;
|
|
58
54
|
}
|
|
59
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* This browser lacks what the session needs (Web Locks, localStorage): nobody can sign in.
|
|
57
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
58
|
+
*/
|
|
60
59
|
| {
|
|
61
60
|
readonly kind: 'unsupported';
|
|
62
61
|
};
|
|
63
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Not a result: read from the address and this browser's attempt, with nothing sent.
|
|
64
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
65
|
+
*/
|
|
64
66
|
export type OpenedLink = {
|
|
65
67
|
readonly kind: 'ready';
|
|
66
68
|
readonly email: string;
|
|
67
69
|
readonly purpose: 'sign_in' | 'sign_up';
|
|
68
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Where the person was going, as given to `requestLink` or `requestSignUp`.
|
|
72
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
73
|
+
*/
|
|
69
74
|
readonly next: string | null;
|
|
70
75
|
}
|
|
71
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* This browser already used this link, or asked for it over 10 minutes ago.
|
|
78
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
79
|
+
*/
|
|
72
80
|
| {
|
|
73
81
|
readonly kind: 'spent';
|
|
74
82
|
readonly email: string;
|
|
75
83
|
readonly purpose: 'sign_in' | 'sign_up';
|
|
76
84
|
readonly next: string | null;
|
|
77
85
|
}
|
|
78
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Asked for in another browser, or not asked for at all.
|
|
88
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
89
|
+
*/
|
|
79
90
|
| {
|
|
80
91
|
readonly kind: 'other_browser';
|
|
81
92
|
}
|
|
82
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* The token's address, the address shown and the attempt's differ.
|
|
95
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
96
|
+
*/
|
|
83
97
|
| {
|
|
84
98
|
readonly kind: 'invalid';
|
|
85
99
|
}
|
|
86
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* No link's token on this page: off the landing, or a reload after the token was taken.
|
|
102
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
103
|
+
*/
|
|
87
104
|
| {
|
|
88
105
|
readonly kind: 'no_token';
|
|
89
106
|
}
|
|
90
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* An invitation's login link: send the person to the invitation page.
|
|
109
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
110
|
+
*/
|
|
91
111
|
| {
|
|
92
112
|
readonly kind: 'invitation';
|
|
93
113
|
};
|
|
94
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* A link `redeem` takes: only one `openedLink()` gave.
|
|
116
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
117
|
+
*/
|
|
95
118
|
export type ReadyLink = Extract<OpenedLink, {
|
|
96
119
|
readonly kind: 'ready';
|
|
97
120
|
}>;
|
|
98
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* A link this browser asked for that no longer works: `requestLinkAgain` sends a new one to its address.
|
|
123
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
124
|
+
*/
|
|
99
125
|
export type SpentLink = Extract<OpenedLink, {
|
|
100
126
|
readonly kind: 'spent';
|
|
101
127
|
}>;
|
|
102
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Where a redeem stops, short of a sign-in step.
|
|
130
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#redeem
|
|
131
|
+
*/
|
|
103
132
|
export type RedeemStop = ThroughProxy
|
|
104
133
|
/**
|
|
105
|
-
* The link is used up: pulse-auth refused it (expired, or used elsewhere), or its code step ran
|
|
106
|
-
*
|
|
134
|
+
* The link is used up: pulse-auth refused it (expired, or used elsewhere), or its code step ran out or locked.
|
|
135
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#redeem
|
|
107
136
|
*/
|
|
108
137
|
| {
|
|
109
138
|
readonly kind: 'dead_link';
|
|
@@ -112,31 +141,46 @@ export type RedeemStop = ThroughProxy
|
|
|
112
141
|
} | {
|
|
113
142
|
readonly kind: 'inactive';
|
|
114
143
|
}
|
|
115
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* A sign-in or sign-out overtook this press.
|
|
146
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#redeem
|
|
147
|
+
*/
|
|
116
148
|
| {
|
|
117
149
|
readonly kind: 'superseded';
|
|
118
150
|
};
|
|
119
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* A code's own refusals.
|
|
153
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
154
|
+
*/
|
|
120
155
|
export type TwoStepStop = {
|
|
121
156
|
readonly kind: 'wrong_code';
|
|
122
157
|
}
|
|
123
158
|
/**
|
|
124
|
-
* Too many wrong codes.
|
|
125
|
-
*
|
|
159
|
+
* Too many wrong codes.
|
|
160
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
126
161
|
*/
|
|
127
162
|
| {
|
|
128
163
|
readonly kind: 'locked';
|
|
129
164
|
readonly until: number;
|
|
130
165
|
};
|
|
131
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* What a code's check can stop at.
|
|
168
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
169
|
+
*/
|
|
132
170
|
export type TwoStepVerifyStop = Exclude<ThroughProxy, {
|
|
133
171
|
readonly kind: 'aborted';
|
|
134
172
|
}> | Refused | TwoStepStop
|
|
135
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* The code was not sent, so press again.
|
|
175
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
176
|
+
*/
|
|
136
177
|
| {
|
|
137
178
|
readonly kind: 'not_sent';
|
|
138
179
|
}
|
|
139
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* The challenge ran out, or none is pending (a reload): start the sign-in again.
|
|
182
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
183
|
+
*/
|
|
140
184
|
| {
|
|
141
185
|
readonly kind: 'expired';
|
|
142
186
|
} | {
|
|
@@ -144,117 +188,141 @@ export type TwoStepVerifyStop = Exclude<ThroughProxy, {
|
|
|
144
188
|
} | {
|
|
145
189
|
readonly kind: 'inactive';
|
|
146
190
|
}
|
|
147
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Issued setup codes are returned only for a signed-out browser or the same confirmed user.
|
|
193
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
194
|
+
*/
|
|
148
195
|
| {
|
|
149
196
|
readonly kind: 'superseded';
|
|
150
197
|
readonly backup_codes: readonly string[] | null;
|
|
151
198
|
};
|
|
152
199
|
/**
|
|
153
|
-
* What pulse-auth said about a sign-out (SDK-D1904).
|
|
154
|
-
*
|
|
200
|
+
* What pulse-auth said about a sign-out (SDK-D1904).
|
|
201
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
155
202
|
*/
|
|
156
203
|
export type SignOutTold =
|
|
157
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* pulse-auth ended the session: told by this tab, or by another tab first.
|
|
206
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
207
|
+
*/
|
|
158
208
|
{
|
|
159
209
|
readonly kind: 'confirmed';
|
|
160
210
|
}
|
|
161
211
|
/**
|
|
162
|
-
* Not confirmed: the sign-out stays pending and is sent again when the browser next reaches
|
|
163
|
-
*
|
|
164
|
-
* cookie; `invalid`: an answer outside the contract, reported.
|
|
212
|
+
* Not confirmed: the sign-out stays pending and is sent again when the browser next reaches pulse-auth.
|
|
213
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
165
214
|
*/
|
|
166
215
|
| {
|
|
167
216
|
readonly kind: 'unconfirmed';
|
|
168
217
|
readonly reason: 'unavailable' | 'refused' | 'invalid';
|
|
169
218
|
}
|
|
170
219
|
/**
|
|
171
|
-
* The record moved on since this sign-out: a sign-in, in any tab, or rarely a renewal by a tab
|
|
172
|
-
*
|
|
173
|
-
* it knew it was owed, and this call isn't told whether pulse-auth confirmed it. Nothing is
|
|
174
|
-
* pending for this sign-out; a sign-out made since is owed and sent on its own. Read
|
|
175
|
-
* `current()`. Another sign-out with no sign-in between is not `superseded`: this call is told
|
|
176
|
-
* what pulse-auth answered.
|
|
220
|
+
* 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.
|
|
221
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
177
222
|
*/
|
|
178
223
|
| {
|
|
179
224
|
readonly kind: 'superseded';
|
|
180
225
|
}
|
|
181
|
-
/**
|
|
226
|
+
/**
|
|
227
|
+
* This browser lacks what the session needs: nobody was signed in, nothing was sent.
|
|
228
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
229
|
+
*/
|
|
182
230
|
| {
|
|
183
231
|
readonly kind: 'unsupported';
|
|
184
232
|
};
|
|
185
|
-
/**
|
|
233
|
+
/**
|
|
234
|
+
* `createBrowserSession`'s options, each checked when the session is made.
|
|
235
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
236
|
+
*/
|
|
186
237
|
export interface BrowserSessionOptions {
|
|
187
238
|
/**
|
|
188
|
-
* Which app this is: `{ name, version }`, each 1 to 64 of RFC 9110's token characters, as the
|
|
189
|
-
*
|
|
239
|
+
* Which app this is: `{ name, version }`, each 1 to 64 of RFC 9110's token characters, as the main entry's `createFlipstream` takes it.
|
|
240
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
190
241
|
*/
|
|
191
242
|
readonly app: {
|
|
192
243
|
readonly name: string;
|
|
193
244
|
readonly version: string;
|
|
194
245
|
};
|
|
195
246
|
/**
|
|
196
|
-
* The same-origin path the app's own server forwards to pulse-auth, `/auth` by default
|
|
197
|
-
*
|
|
247
|
+
* The same-origin path the app's own server forwards to pulse-auth, `/auth` by default.
|
|
248
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
198
249
|
*/
|
|
199
250
|
readonly authPath?: string;
|
|
200
|
-
/**
|
|
251
|
+
/**
|
|
252
|
+
* Where a mailed login link lands: a plain path of this page's origin, such as `/login-link`.
|
|
253
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
254
|
+
*/
|
|
201
255
|
readonly landing: string;
|
|
202
256
|
/**
|
|
203
|
-
* Where an invitation's link lands.
|
|
204
|
-
*
|
|
205
|
-
* as an invitation's.
|
|
257
|
+
* Where an invitation's link lands.
|
|
258
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
206
259
|
*/
|
|
207
260
|
readonly invitationLanding?: string;
|
|
208
261
|
/**
|
|
209
|
-
* Where a reset link lands.
|
|
210
|
-
*
|
|
211
|
-
* reset's.
|
|
262
|
+
* Where a reset link lands.
|
|
263
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
212
264
|
*/
|
|
213
265
|
readonly resetLanding?: string;
|
|
214
266
|
/**
|
|
215
267
|
* Every host the main client can use is checked here, including the console for hand-offs.
|
|
216
|
-
*
|
|
268
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
217
269
|
*/
|
|
218
270
|
readonly hosts?: Hosts;
|
|
219
271
|
/**
|
|
220
272
|
* What the app's operator should know: an answer outside the contract, a browser fault, a bug.
|
|
221
|
-
*
|
|
222
|
-
* silences it; one that throws is caught.
|
|
273
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
223
274
|
*/
|
|
224
275
|
readonly onReport?: (report: SessionReport) => void;
|
|
225
276
|
}
|
|
226
|
-
/**
|
|
277
|
+
/**
|
|
278
|
+
* The session and the calls a person signs in and out with.
|
|
279
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
280
|
+
*/
|
|
227
281
|
export interface BrowserSession {
|
|
228
|
-
/**
|
|
282
|
+
/**
|
|
283
|
+
* Reads the authorisation request from this page's current address, including after close().
|
|
284
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#consentrequest
|
|
285
|
+
*/
|
|
229
286
|
readonly consentRequest: () => ConsentRequest;
|
|
230
287
|
/**
|
|
231
|
-
* Approves the request this session showed.
|
|
232
|
-
*
|
|
233
|
-
* A code may have been issued and a dynamically registered client claimed for that person’s account.
|
|
288
|
+
* Approves the request this session showed.
|
|
289
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#approveconsent-denyconsent
|
|
234
290
|
*/
|
|
235
291
|
readonly approveConsent: (request: AskingConsent, options?: CallOptions) => Promise<Result<{
|
|
236
292
|
readonly redirect_to: string;
|
|
237
293
|
}, ConsentStop>>;
|
|
238
294
|
/**
|
|
239
295
|
* Denies the request this session showed and returns the checked callback carrying the refusal.
|
|
240
|
-
*
|
|
296
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#approveconsent-denyconsent
|
|
241
297
|
*/
|
|
242
298
|
readonly denyConsent: (request: AskingConsent, options?: CallOptions) => Promise<Result<{
|
|
243
299
|
readonly redirect_to: string;
|
|
244
300
|
}, ConsentStop>>;
|
|
245
|
-
/**
|
|
301
|
+
/**
|
|
302
|
+
* Reads the signed-in person's two-step settings and remaining backup-code count.
|
|
303
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#twostepstatus
|
|
304
|
+
*/
|
|
246
305
|
readonly twoStepStatus: (options?: CallOptions) => Promise<Result<TwoStepStatus, AsPerson>>;
|
|
247
|
-
/**
|
|
306
|
+
/**
|
|
307
|
+
* Starts authenticator enrollment for the signed-in person on the Security page.
|
|
308
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#starttwostepsetup
|
|
309
|
+
*/
|
|
248
310
|
readonly startTwoStepSetup: (options?: CallOptions) => Promise<Result<TwoStepSetup, AsPerson | {
|
|
249
311
|
readonly kind: 'already_on';
|
|
250
312
|
}>>;
|
|
251
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* Starts enrollment for the exact setup returned by this session's logIn or redeem.
|
|
315
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#startsignintwostepsetup
|
|
316
|
+
*/
|
|
252
317
|
readonly startSignInTwoStepSetup: (setup: SignInSetup, options?: CallOptions) => Promise<Result<TwoStepSetup, Sent | {
|
|
253
318
|
readonly kind: 'expired';
|
|
254
319
|
} | {
|
|
255
320
|
readonly kind: 'superseded';
|
|
256
321
|
}>>;
|
|
257
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* The first code turns two-step on and gives ten backup codes once.
|
|
324
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#confirmtwostepsetup
|
|
325
|
+
*/
|
|
258
326
|
readonly confirmTwoStepSetup: (entry: {
|
|
259
327
|
readonly code: string;
|
|
260
328
|
}, options?: CallOptions) => Promise<Result<{
|
|
@@ -262,7 +330,10 @@ export interface BrowserSession {
|
|
|
262
330
|
}, AsPerson | Refused | TwoStepStop | {
|
|
263
331
|
readonly kind: 'not_started';
|
|
264
332
|
}>>;
|
|
265
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* A current code replaces the old set.
|
|
335
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#newbackupcodes
|
|
336
|
+
*/
|
|
266
337
|
readonly newBackupCodes: (entry: {
|
|
267
338
|
readonly code: string;
|
|
268
339
|
}, options?: CallOptions) => Promise<Result<{
|
|
@@ -270,7 +341,10 @@ export interface BrowserSession {
|
|
|
270
341
|
}, AsPerson | Refused | TwoStepStop | {
|
|
271
342
|
readonly kind: 'not_on';
|
|
272
343
|
}>>;
|
|
273
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* Turns off two-step for the signed-in person with a current code, when the deployment permits it.
|
|
346
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#turnofftwostep
|
|
347
|
+
*/
|
|
274
348
|
readonly turnOffTwoStep: (entry: {
|
|
275
349
|
readonly code: string;
|
|
276
350
|
}, options?: CallOptions) => Promise<Result<{
|
|
@@ -281,19 +355,13 @@ export interface BrowserSession {
|
|
|
281
355
|
readonly kind: 'required';
|
|
282
356
|
}>>;
|
|
283
357
|
/**
|
|
284
|
-
* The main SDK as the person this page shows.
|
|
285
|
-
*
|
|
286
|
-
* A kept client or scope answers `cancelled` after the person or rights change. After close
|
|
287
|
-
* the getter stays readable, and calls on the client reject with SessionClosedError.
|
|
358
|
+
* The main SDK as the person this page shows.
|
|
359
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#flipstream
|
|
288
360
|
*/
|
|
289
361
|
readonly flipstream: Flipstream;
|
|
290
362
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* with a TypeError naming the field. The link opens in this browser with purpose
|
|
294
|
-
* `sign_up` and `next: null`. Pulse-admin must allow the page's origin.
|
|
295
|
-
* Aborting after the send answers `aborted`. The organization may already exist and the link may
|
|
296
|
-
* have been mailed. The browser keeps the attempt so that link still works here.
|
|
363
|
+
* Asks pulse-admin to email a sign-up link that opens here with the `next` given.
|
|
364
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#requestsignup
|
|
297
365
|
*/
|
|
298
366
|
readonly requestSignUp: (request: {
|
|
299
367
|
readonly email: string;
|
|
@@ -304,37 +372,40 @@ export interface BrowserSession {
|
|
|
304
372
|
readonly terms_version: string;
|
|
305
373
|
readonly privacy_version: string;
|
|
306
374
|
};
|
|
375
|
+
readonly next: string | null;
|
|
307
376
|
}, options?: CallOptions) => Promise<Result<{
|
|
308
377
|
readonly email: string;
|
|
309
378
|
}, Sent | Refused |
|
|
310
|
-
/**
|
|
379
|
+
/**
|
|
380
|
+
* The browser could not store this attempt.
|
|
381
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#requestsignup
|
|
382
|
+
*/
|
|
311
383
|
{
|
|
312
384
|
readonly kind: 'unsupported';
|
|
313
385
|
}>>;
|
|
314
386
|
/**
|
|
315
|
-
*
|
|
316
|
-
* /
|
|
387
|
+
* Asks for a reset link; known and unknown addresses get the same answer.
|
|
388
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#requestpasswordreset
|
|
317
389
|
*/
|
|
318
390
|
readonly requestPasswordReset: (request: {
|
|
319
391
|
readonly email: string;
|
|
320
392
|
}, options?: CallOptions) => Promise<Result<{
|
|
321
393
|
readonly email: string;
|
|
322
394
|
}, Sent | Refused>>;
|
|
323
|
-
/**
|
|
395
|
+
/**
|
|
396
|
+
* Reads the reset link on this page, including after close().
|
|
397
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedreset
|
|
398
|
+
*/
|
|
324
399
|
readonly openedReset: () => OpenedReset;
|
|
325
400
|
/**
|
|
326
|
-
* Sets the link owner's password as typed and ends their sessions.
|
|
327
|
-
*
|
|
328
|
-
* reads `no_token`. Keep the form's submitted state while waiting. After `unavailable`, the reset
|
|
329
|
-
* may have reached pulse-auth and a retry can answer `dead_link` even though the password was set.
|
|
330
|
-
* In that case, ask the person to try signing in with the new password before requesting a new link.
|
|
331
|
-
* If the link's owner is signed in here and pulse-auth confirms revocation, current() already
|
|
332
|
-
* reads `signed_out` when this call settles. Another person signed in here stays signed in.
|
|
333
|
-
* An abort during the check or a wait of 15 seconds returns the known reset outcome while
|
|
334
|
-
* the check continues.
|
|
401
|
+
* Sets the link owner's password as typed and ends their sessions.
|
|
402
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#setpassword
|
|
335
403
|
*/
|
|
336
404
|
readonly setPassword: (
|
|
337
|
-
/**
|
|
405
|
+
/**
|
|
406
|
+
* The types allow other ready links here.
|
|
407
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#setpassword
|
|
408
|
+
*/
|
|
338
409
|
reset: Extract<OpenedReset, {
|
|
339
410
|
readonly kind: 'ready';
|
|
340
411
|
}>, entry: {
|
|
@@ -342,11 +413,17 @@ export interface BrowserSession {
|
|
|
342
413
|
}, options?: CallOptions) => Promise<Result<{
|
|
343
414
|
readonly kind: 'password_set';
|
|
344
415
|
}, Sent | Refused
|
|
345
|
-
/**
|
|
416
|
+
/**
|
|
417
|
+
* Expired, or used before.
|
|
418
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#setpassword
|
|
419
|
+
*/
|
|
346
420
|
| {
|
|
347
421
|
readonly kind: 'dead_link';
|
|
348
422
|
}
|
|
349
|
-
/**
|
|
423
|
+
/**
|
|
424
|
+
* pulse-auth wants at least 8 characters.
|
|
425
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#setpassword
|
|
426
|
+
*/
|
|
350
427
|
| {
|
|
351
428
|
readonly kind: 'password_too_short';
|
|
352
429
|
} | {
|
|
@@ -354,114 +431,77 @@ export interface BrowserSession {
|
|
|
354
431
|
}>>;
|
|
355
432
|
/**
|
|
356
433
|
* Signs in with an address and a password (sdk#467): `signed_in`, or a two-step code wanted.
|
|
357
|
-
*
|
|
358
|
-
* object, `null` included, is a TypeError; an array is an object here, so it is `refused` with
|
|
359
|
-
* the fields it lacks. A `signal` that is not an AbortSignal is a TypeError too, nothing sent
|
|
360
|
-
* either way. The same request
|
|
361
|
-
* pressed again while one is under way joins it; a different one is its own attempt. `aborted`:
|
|
362
|
-
* the sign-in may still complete, and `current()` tells; a code asked for once every caller of
|
|
363
|
-
* that request has left is dropped, and the next press asks again.
|
|
434
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#login
|
|
364
435
|
*/
|
|
365
436
|
readonly logIn: (request: LogInRequest, options?: CallOptions) => Promise<Result<SignInStep, LogInStop>>;
|
|
366
437
|
/**
|
|
367
438
|
* Whether the page was opened on `invitationLanding` with an invitation's token (sdk#472).
|
|
368
|
-
*
|
|
369
|
-
* invitation: pulse-auth answered an accept with a 2xx, or the invitation was found dead.
|
|
439
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedinvitation
|
|
370
440
|
*/
|
|
371
441
|
readonly openedInvitation: () => OpenedInvitation;
|
|
372
442
|
/**
|
|
373
|
-
* What the invitation is for: `personal` (it names its recipient) or `shared`.
|
|
374
|
-
*
|
|
375
|
-
* `dead_link`: unknown, revoked, expired or spent, and openedInvitation() reads `no_token`.
|
|
443
|
+
* What the invitation is for: `personal` (it names its recipient) or `shared`.
|
|
444
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#previewinvitation
|
|
376
445
|
*/
|
|
377
446
|
readonly previewInvitation: (
|
|
378
|
-
/**
|
|
447
|
+
/**
|
|
448
|
+
* The types allow other ready proofs here.
|
|
449
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#previewinvitation
|
|
450
|
+
*/
|
|
379
451
|
opened: Extract<OpenedInvitation, {
|
|
380
452
|
readonly kind: 'ready';
|
|
381
453
|
}>, options?: CallOptions) => Promise<Result<Invitation, Sent | {
|
|
382
454
|
readonly kind: 'dead_link';
|
|
383
455
|
}>>;
|
|
384
456
|
/**
|
|
385
|
-
* Accepting makes the account and signs the person in, as `logIn` does: `signed_in` with
|
|
386
|
-
*
|
|
387
|
-
* previewInvitation() returned, as it is (a copy is a TypeError), narrowed on its `kind`: a
|
|
388
|
-
* personal one with no address and an optional password, a shared one with both. Empty names,
|
|
389
|
-
* and a shared accept's empty address or password, are `refused`; a privacy policy not
|
|
390
|
-
* accepted is `privacy_policy_required`; nothing is sent then. Once pulse-auth answers the
|
|
391
|
-
* request with a 2xx (an accepted answer, or `superseded` or `invalid` after it), or `dead_link`,
|
|
392
|
-
* openedInvitation() reads `no_token`, also when this caller aborted after the send; while such
|
|
393
|
-
* a request is out, and when it ends otherwise, `ready`. `dead_link` also covers an invitation
|
|
394
|
-
* edited to another address since its link was sent: ask for it to be sent again. After
|
|
395
|
-
* `unavailable`, or an abort after the send that left `ready`, the account may already exist: a
|
|
396
|
-
* later `dead_link` then means "log in", with the password or by a login link. A second press
|
|
397
|
-
* with a different entry while one is out is its own attempt (SDK-D1908), and can find the
|
|
398
|
-
* invitation used (sdk#549). `changed`:
|
|
399
|
-
* preview it again. `superseded`: read `current()`. On `signed_in`, `continue_to` null: send
|
|
400
|
-
* the person to `continue.login_url` when the invitation has a `continue`; otherwise they are
|
|
401
|
-
* signed in here.
|
|
457
|
+
* Accepting makes the account and signs the person in, as `logIn` does: `signed_in` with `continue_to`, or a two-step code or set-up wanted.
|
|
458
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#acceptinvitation
|
|
402
459
|
*/
|
|
403
460
|
readonly acceptInvitation: AcceptInvitation;
|
|
404
461
|
/**
|
|
405
|
-
* Looks up a device's code as typed (sdk#471): the request to show the person, or
|
|
406
|
-
*
|
|
407
|
-
* An open read straight to pulse-auth, with no cookie and no token: it changes nothing, so it
|
|
408
|
-
* may run on load, and works whoever is signed in. An empty code is `refused`, with nothing
|
|
409
|
-
* sent. A request that is not an object, or a `signal` that is not an AbortSignal, is a
|
|
410
|
-
* TypeError, nothing sent.
|
|
462
|
+
* Looks up a device's code as typed (sdk#471): the request to show the person, or `unknown_code` (unknown, expired or already used; pulse-auth says the same for all three) or `already_denied`.
|
|
463
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#lookupdevice
|
|
411
464
|
*/
|
|
412
465
|
readonly lookUpDevice: (request: {
|
|
413
466
|
readonly user_code: string;
|
|
414
467
|
}, options?: CallOptions) => Promise<Result<DeviceRequest, Sent | Refused | DeviceStop>>;
|
|
415
468
|
/**
|
|
416
|
-
* Approves the request `lookUpDevice()` answered on this session, as the signed-in person, only
|
|
417
|
-
*
|
|
418
|
-
* TypeError, nothing sent. Nobody signed in, or another person by the time it would be sent:
|
|
419
|
-
* `signed_out`, nothing sent. `unknown_code`: the code is unknown, expired or already used
|
|
420
|
-
* (pulse-auth says the same for all three); a press on it would be sent again, but pulse-auth no
|
|
421
|
-
* 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
|
|
422
|
-
* out, or may already have acted on it, for the person signed in now; nothing was sent. Once the
|
|
423
|
-
* first settles, a press is sent again if nothing was sent, or after a 429, which arrives as
|
|
424
|
-
* `unavailable`. After the send, `signed_out`, `aborted`, `invalid` or any other `unavailable`
|
|
425
|
-
* may leave the device answered as the person who pressed: another press answers `answered`, and
|
|
426
|
-
* a fresh look-up doesn't change that. Only signing in again lets a press be sent. An answer that
|
|
427
|
-
* isn't the decision pressed is `invalid` and reported.
|
|
469
|
+
* Approves the request `lookUpDevice()` answered on this session, as the signed-in person, only on a press.
|
|
470
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#approvedevice-denydevice
|
|
428
471
|
*/
|
|
429
472
|
readonly approveDevice: (device: DeviceRequest, options?: CallOptions) => Promise<Result<{
|
|
430
473
|
readonly kind: 'approved';
|
|
431
474
|
}, AsPerson | DeviceAnswerStop>>;
|
|
432
|
-
/**
|
|
475
|
+
/**
|
|
476
|
+
* Denies the request `lookUpDevice()` answered on this session, as `approveDevice` approves it.
|
|
477
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#approvedevice-denydevice
|
|
478
|
+
*/
|
|
433
479
|
readonly denyDevice: (device: DeviceRequest, options?: CallOptions) => Promise<Result<{
|
|
434
480
|
readonly kind: 'denied';
|
|
435
481
|
}, AsPerson | DeviceAnswerStop>>;
|
|
436
|
-
/**
|
|
482
|
+
/**
|
|
483
|
+
* The session's state, the same object until it changes.
|
|
484
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
485
|
+
*/
|
|
437
486
|
readonly current: () => SessionState;
|
|
438
487
|
/**
|
|
439
|
-
* `listener` runs on every change of `current()`.
|
|
440
|
-
*
|
|
441
|
-
* `reportError`, and on a host without one (a server render, Node) it is thrown again from
|
|
442
|
-
* a microtask, which Node raises as an uncaughtException, as its own `EventTarget` does.
|
|
488
|
+
* `listener` runs on every change of `current()`.
|
|
489
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#current-subscribe
|
|
443
490
|
*/
|
|
444
491
|
readonly subscribe: (listener: () => void) => () => void;
|
|
445
|
-
/**
|
|
492
|
+
/**
|
|
493
|
+
* Restores the session from the refresh cookie, once, after subscribing.
|
|
494
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#start
|
|
495
|
+
*/
|
|
446
496
|
readonly start: () => void;
|
|
447
497
|
/**
|
|
448
|
-
* Ends this session object: its listeners, timers and channel, for tests and hot reloading.
|
|
449
|
-
*
|
|
450
|
-
* a sign-out in another tab or with an answer that can't be read, is still revoked with a
|
|
451
|
-
* `/logout`), but nothing new is sent: a call still waiting to send answers `unavailable`, and a
|
|
452
|
-
* sign-out whose first try hadn't gone out is told `unconfirmed`, its logout left pending for
|
|
453
|
-
* another tab or the next page load. A call made after it throws, or rejects, with a
|
|
454
|
-
* `SessionClosedError`, `subscribe` and `start` included. The local reads `current`, `consentRequest`,
|
|
455
|
-
* `openedLink`, `openedReset`, `openedInvitation` and the `flipstream` getter stay readable, and a previous unsubscribe stays safe to call. Not a
|
|
456
|
-
* sign-out: the person stays signed in, in every tab.
|
|
498
|
+
* Ends this session object: its listeners, timers and channel, for tests and hot reloading.
|
|
499
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#close
|
|
457
500
|
*/
|
|
458
501
|
readonly close: () => void;
|
|
459
502
|
/**
|
|
460
|
-
* Stores this browser's attempt, then asks for a login link.
|
|
461
|
-
*
|
|
462
|
-
* out or `undefined` included, is a TypeError, with nothing stored or sent: a `next` lost on the
|
|
463
|
-
* way would otherwise mail a link this browser can't redeem. "Send again" is the same call
|
|
464
|
-
* again. `aborted`: the mail may still have gone out.
|
|
503
|
+
* Stores this browser's attempt, then asks for a login link.
|
|
504
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#requestlink
|
|
465
505
|
*/
|
|
466
506
|
readonly requestLink: (request: {
|
|
467
507
|
readonly email: string;
|
|
@@ -470,32 +510,25 @@ export interface BrowserSession {
|
|
|
470
510
|
readonly email: string;
|
|
471
511
|
}, ThroughProxy | Refused>>;
|
|
472
512
|
/**
|
|
473
|
-
* The login link this page was opened with, checked against this browser's attempt.
|
|
474
|
-
*
|
|
475
|
-
* renders twice). Each call answers an equal answer in a new, frozen object, and every object
|
|
476
|
-
* it gave works for `redeem` and `requestLinkAgain`.
|
|
513
|
+
* The login link this page was opened with, checked against this browser's attempt.
|
|
514
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#openedlink
|
|
477
515
|
*/
|
|
478
516
|
readonly openedLink: () => OpenedLink;
|
|
479
517
|
/**
|
|
480
|
-
* Signs in with a ready link, checking it again first.
|
|
481
|
-
*
|
|
482
|
-
* the sign-in may still complete, and `current()` tells.
|
|
518
|
+
* Signs in with a ready link, checking it again first.
|
|
519
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#redeem
|
|
483
520
|
*/
|
|
484
521
|
readonly redeem: (link: ReadyLink, options?: CallOptions) => Promise<Result<SignInStep, RedeemStop>>;
|
|
485
522
|
/**
|
|
486
|
-
* A new login link to the address of a link this browser asked for, with its `next`.
|
|
487
|
-
*
|
|
523
|
+
* A new login link to the address of a link this browser asked for, with its `next`.
|
|
524
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#requestlinkagain
|
|
488
525
|
*/
|
|
489
526
|
readonly requestLinkAgain: (link: ReadyLink | SpentLink, options?: CallOptions) => Promise<Result<{
|
|
490
527
|
readonly email: string;
|
|
491
528
|
}, ThroughProxy>>;
|
|
492
529
|
/**
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
* They exist nowhere else, and the state turns `signed_in` before this call answers, so a
|
|
496
|
-
* screen that leaves on `signed_in` takes this answer first. Once the code is sent, an abort is
|
|
497
|
-
* ignored and the call answers what pulse-auth said. `not_sent`: the code was not sent, so press
|
|
498
|
-
* again. Before 0.15.0, this was `aborted`.
|
|
530
|
+
* Sends the person's two-step or backup code and finishes the sign-in.
|
|
531
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#verifytwostep
|
|
499
532
|
*/
|
|
500
533
|
readonly verifyTwoStep: (entry: {
|
|
501
534
|
readonly code: string;
|
|
@@ -504,8 +537,8 @@ export interface BrowserSession {
|
|
|
504
537
|
readonly backup_codes: readonly string[] | null;
|
|
505
538
|
}, TwoStepVerifyStop>>;
|
|
506
539
|
/**
|
|
507
|
-
*
|
|
508
|
-
*
|
|
540
|
+
* Signs out here and in every tab, only on a press.
|
|
541
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#signout
|
|
509
542
|
*/
|
|
510
543
|
readonly signOut: () => {
|
|
511
544
|
readonly told: Promise<SignOutTold>;
|
|
@@ -534,16 +567,7 @@ export interface EntryParts {
|
|
|
534
567
|
/** The session's wrapping, for `createBrowserSession` and the tests. */
|
|
535
568
|
export declare function entryOver(parts: EntryParts): BrowserSession;
|
|
536
569
|
/**
|
|
537
|
-
* The browser session, for a page on the app's own origin.
|
|
538
|
-
*
|
|
539
|
-
* a second session made in the same page load gets no token, so its `openedLink()` says
|
|
540
|
-
* `no_token`. Make one session per page load, and keep it (outside React's render). Every option is checked here, so a wrong one
|
|
541
|
-
* fails when the session is made, not on a person's first click.
|
|
542
|
-
*
|
|
543
|
-
* ```ts
|
|
544
|
-
* const session = createBrowserSession({ app: { name: 'account', version: '1.4.0' }, landing: '/login-link' })
|
|
545
|
-
* session.subscribe(render)
|
|
546
|
-
* session.start()
|
|
547
|
-
* ```
|
|
570
|
+
* The browser session, for a page on the app's own origin.
|
|
571
|
+
* @see https://github.com/flipstream-io/sdk/blob/main/sdks/typescript/docs/first-party.md#createbrowsersession
|
|
548
572
|
*/
|
|
549
573
|
export declare function createBrowserSession(options: BrowserSessionOptions): BrowserSession;
|