usebecky 0.0.0-stage → 0.2.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 (135) hide show
  1. package/README.md +701 -2
  2. package/dist/analytics/client.d.ts +219 -0
  3. package/dist/analytics/client.js +923 -0
  4. package/dist/analytics/cmp.d.ts +20 -0
  5. package/dist/analytics/cmp.js +166 -0
  6. package/dist/analytics/context.d.ts +29 -0
  7. package/dist/analytics/context.js +97 -0
  8. package/dist/auth/client.d.ts +401 -0
  9. package/dist/auth/client.js +1081 -0
  10. package/dist/auth/webauthn.d.ts +18 -0
  11. package/dist/auth/webauthn.js +138 -0
  12. package/dist/cli/ai.d.ts +54 -0
  13. package/dist/cli/ai.js +202 -0
  14. package/dist/cli/analytics.d.ts +53 -0
  15. package/dist/cli/analytics.js +357 -0
  16. package/dist/cli/config.d.ts +75 -0
  17. package/dist/cli/config.js +718 -0
  18. package/dist/cli/db.d.ts +48 -0
  19. package/dist/cli/db.js +215 -0
  20. package/dist/cli/deploy-api.d.ts +168 -0
  21. package/dist/cli/deploy-api.js +177 -0
  22. package/dist/cli/deploy-ci.d.ts +15 -0
  23. package/dist/cli/deploy-ci.js +54 -0
  24. package/dist/cli/deploy-detect.d.ts +64 -0
  25. package/dist/cli/deploy-detect.js +249 -0
  26. package/dist/cli/deploy-files.d.ts +112 -0
  27. package/dist/cli/deploy-files.js +778 -0
  28. package/dist/cli/deploy.d.ts +10 -0
  29. package/dist/cli/deploy.js +430 -0
  30. package/dist/cli/emails.d.ts +29 -0
  31. package/dist/cli/emails.js +122 -0
  32. package/dist/cli/framework.d.ts +135 -0
  33. package/dist/cli/framework.js +459 -0
  34. package/dist/cli/functions.d.ts +59 -0
  35. package/dist/cli/functions.js +426 -0
  36. package/dist/cli/hosting.d.ts +4 -0
  37. package/dist/cli/hosting.js +532 -0
  38. package/dist/cli/index.d.ts +2 -0
  39. package/dist/cli/index.js +9 -0
  40. package/dist/cli/payments.d.ts +35 -0
  41. package/dist/cli/payments.js +176 -0
  42. package/dist/cli/push.d.ts +36 -0
  43. package/dist/cli/push.js +172 -0
  44. package/dist/cli/run.d.ts +65 -0
  45. package/dist/cli/run.js +850 -0
  46. package/dist/cli/social.d.ts +52 -0
  47. package/dist/cli/social.js +532 -0
  48. package/dist/cli/tokens.d.ts +28 -0
  49. package/dist/cli/tokens.js +114 -0
  50. package/dist/cli/ui.d.ts +38 -0
  51. package/dist/cli/ui.js +140 -0
  52. package/dist/client.d.ts +94 -0
  53. package/dist/client.js +156 -0
  54. package/dist/db/query.d.ts +162 -0
  55. package/dist/db/query.js +336 -0
  56. package/dist/db/types.d.ts +93 -0
  57. package/dist/db/types.js +4 -0
  58. package/dist/forms/client.d.ts +65 -0
  59. package/dist/forms/client.js +106 -0
  60. package/dist/functions/client.d.ts +37 -0
  61. package/dist/functions/client.js +76 -0
  62. package/dist/index.d.ts +17 -0
  63. package/dist/index.js +16 -0
  64. package/dist/lib/dashboard-paths.d.ts +4 -0
  65. package/dist/lib/dashboard-paths.js +8 -0
  66. package/dist/lib/env.d.ts +9 -0
  67. package/dist/lib/env.js +55 -0
  68. package/dist/lib/errors.d.ts +22 -0
  69. package/dist/lib/errors.js +90 -0
  70. package/dist/lib/hosted.d.ts +2 -0
  71. package/dist/lib/hosted.js +7 -0
  72. package/dist/lib/http.d.ts +59 -0
  73. package/dist/lib/http.js +172 -0
  74. package/dist/lib/jwt.d.ts +1 -0
  75. package/dist/lib/jwt.js +31 -0
  76. package/dist/lib/locale.d.ts +12 -0
  77. package/dist/lib/locale.js +51 -0
  78. package/dist/lib/pkce.d.ts +20 -0
  79. package/dist/lib/pkce.js +124 -0
  80. package/dist/lib/storage-adapter.d.ts +15 -0
  81. package/dist/lib/storage-adapter.js +91 -0
  82. package/dist/lib/types.d.ts +339 -0
  83. package/dist/lib/types.js +1 -0
  84. package/dist/newsletter/client.d.ts +140 -0
  85. package/dist/newsletter/client.js +85 -0
  86. package/dist/payments/client.d.ts +352 -0
  87. package/dist/payments/client.js +323 -0
  88. package/dist/push/client.d.ts +110 -0
  89. package/dist/push/client.js +179 -0
  90. package/dist/realtime/client.d.ts +131 -0
  91. package/dist/realtime/client.js +513 -0
  92. package/dist/server/analytics.d.ts +176 -0
  93. package/dist/server/analytics.js +49 -0
  94. package/dist/server/cache.d.ts +74 -0
  95. package/dist/server/cache.js +154 -0
  96. package/dist/server/emails.d.ts +142 -0
  97. package/dist/server/emails.js +123 -0
  98. package/dist/server/events.d.ts +357 -0
  99. package/dist/server/events.js +219 -0
  100. package/dist/server/functions.d.ts +40 -0
  101. package/dist/server/functions.js +1 -0
  102. package/dist/server/http-utils.d.ts +10 -0
  103. package/dist/server/http-utils.js +115 -0
  104. package/dist/server/index.d.ts +195 -0
  105. package/dist/server/index.js +314 -0
  106. package/dist/server/payments.d.ts +218 -0
  107. package/dist/server/payments.js +150 -0
  108. package/dist/server/push.d.ts +85 -0
  109. package/dist/server/push.js +37 -0
  110. package/dist/server/usage.d.ts +43 -0
  111. package/dist/server/usage.js +8 -0
  112. package/dist/storage/client.d.ts +143 -0
  113. package/dist/storage/client.js +224 -0
  114. package/package.json +52 -4
  115. package/skill/usebecky/SKILL.md +339 -0
  116. package/skill/usebecky/references/access-rules.md +307 -0
  117. package/skill/usebecky/references/addons.md +68 -0
  118. package/skill/usebecky/references/analytics.md +166 -0
  119. package/skill/usebecky/references/android.md +434 -0
  120. package/skill/usebecky/references/auth.md +379 -0
  121. package/skill/usebecky/references/cache.md +51 -0
  122. package/skill/usebecky/references/components.md +127 -0
  123. package/skill/usebecky/references/emails.md +105 -0
  124. package/skill/usebecky/references/expo.md +147 -0
  125. package/skill/usebecky/references/functions.md +99 -0
  126. package/skill/usebecky/references/hosting.md +119 -0
  127. package/skill/usebecky/references/http-api.md +233 -0
  128. package/skill/usebecky/references/ios.md +355 -0
  129. package/skill/usebecky/references/payments.md +493 -0
  130. package/skill/usebecky/references/realtime.md +143 -0
  131. package/skill/usebecky/references/scheduled-jobs.md +82 -0
  132. package/skill/usebecky/references/sdk.md +838 -0
  133. package/skill/usebecky/references/storage.md +210 -0
  134. package/skill/usebecky/references/templates.md +191 -0
  135. package/skill/usebecky/references/wordpress.md +87 -0
@@ -0,0 +1,401 @@
1
+ import type { ConsentRef } from '../analytics/client.ts';
2
+ import { UseBeckyError } from '../lib/errors.ts';
3
+ import type { HttpClient } from '../lib/http.ts';
4
+ import type { StorageAdapter } from '../lib/storage-adapter.ts';
5
+ import type { AuthChangeEvent, AuthSettings, Factor, OAuthProvider, Passkey, Result, Session, User } from '../lib/types.ts';
6
+ import { type PasskeyCreate, type PasskeyGet } from './webauthn.ts';
7
+ export type AuthListener = (event: AuthChangeEvent, session: Session | null) => void;
8
+ export interface AuthClientOptions {
9
+ http: HttpClient;
10
+ storage: StorageAdapter;
11
+ storageKey: string;
12
+ autoRefresh: boolean;
13
+ detectSessionInUrl: boolean;
14
+ cookie: boolean;
15
+ /** The visitor's consent state, sent with sign-ups (server-side tagging, see `analytics.consentRef()`). */
16
+ consent?: () => Promise<ConsentRef | undefined>;
17
+ }
18
+ /** Normalize a session from the API (fills expires_at, user). */
19
+ export declare function normalizeSession(raw: any): Session | null;
20
+ export declare class AuthClient {
21
+ private http;
22
+ private consentRef;
23
+ private storage;
24
+ private storageKey;
25
+ private autoRefresh;
26
+ private cookie;
27
+ private session;
28
+ private listeners;
29
+ private refreshPromise;
30
+ private refreshTimer;
31
+ private retryCount;
32
+ private urlError;
33
+ /** Resolves when the stored session (and any session in the URL) has been loaded. */
34
+ readonly ready: Promise<void>;
35
+ /** MFA (TOTP authenticator apps). */
36
+ readonly mfa: {
37
+ /** Start enrolling an authenticator app. Show `uri` as a QR code, then call verify(id, code). */
38
+ enroll: (options?: {
39
+ friendlyName?: string;
40
+ }) => Promise<Result<{
41
+ id: string;
42
+ type: 'totp';
43
+ secret: string;
44
+ uri: string;
45
+ }>>;
46
+ /** Verify a 6-digit code. Upgrades the session to `aal2`. */
47
+ verify: (factorId: string, code: string) => Promise<Result<{
48
+ user: User;
49
+ session: Session;
50
+ }>>;
51
+ /** Remove a factor. */
52
+ unenroll: (factorId: string) => Promise<Result<{
53
+ id: string;
54
+ }>>;
55
+ /** The signed-in user's factors (fresh from the server). */
56
+ listFactors: () => Promise<Result<{
57
+ all: Factor[];
58
+ totp: Factor[];
59
+ }>>;
60
+ /** Current assurance level ('aal1' | 'aal2') and the next level the user can reach. */
61
+ getAssuranceLevel: () => {
62
+ currentLevel: 'aal1' | 'aal2' | null;
63
+ nextLevel: 'aal1' | 'aal2' | null;
64
+ };
65
+ };
66
+ /**
67
+ * Passkeys of the signed-in user (Face ID, fingerprint, device PIN or a password manager). Turn them on in
68
+ * Dashboard → Auth → Sign-in methods → Passkeys. Sign in with one: `baas.auth.signInWithPasskey()`.
69
+ */
70
+ readonly passkeys: {
71
+ /** Add a passkey for the signed-in user (opens the browser's passkey sheet). A guest becomes a permanent user. */
72
+ register: (options?: {
73
+ friendlyName?: string;
74
+ create?: PasskeyCreate;
75
+ }) => Promise<Result<{
76
+ passkey: Passkey;
77
+ }>>;
78
+ /** The signed-in user's passkeys. */
79
+ list: () => Promise<Result<{
80
+ passkeys: Passkey[];
81
+ }>>;
82
+ /** Give a passkey a name the user recognizes ("Work laptop"). */
83
+ rename: (id: string, friendlyName: string) => Promise<Result<{
84
+ passkey: Passkey;
85
+ }>>;
86
+ /** Remove a passkey. The last way to sign in can't be removed (error `last_sign_in_method`). */
87
+ remove: (id: string) => Promise<Result<{
88
+ id: string;
89
+ }>>;
90
+ };
91
+ constructor(opts: AuthClientOptions);
92
+ private initialize;
93
+ /** Parse `#access_token=...` after an OAuth / magic link / recovery redirect, then clean the URL. */
94
+ private readSessionFromLocation;
95
+ private locationHasPkceParams;
96
+ /**
97
+ * PKCE: after a social sign-in the page comes back with `?code=...` (or `?error=...`). Swap the code for a
98
+ * session with the verifier signInWith() saved, then clean the URL. A `?code=` that this client didn't
99
+ * start (no saved verifier, e.g. your app's own parameter) is left alone.
100
+ */
101
+ private readCodeFromLocation;
102
+ private get verifierKey();
103
+ private readVerifier;
104
+ private removeVerifier;
105
+ /** Set while a linkIdentity() redirect is under way: its code is finished with the signed-in user's token. */
106
+ private get linkKey();
107
+ /** The access token for finishing a link (refreshed when about to expire; never waits for `ready`). */
108
+ private linkToken;
109
+ /**
110
+ * POST /auth/v1/token?grant_type=pkce. The verifier is forgotten afterwards unless the request never
111
+ * reached the server (offline: try again with the same code). The visitor's consent state goes along: the server
112
+ * uses it only when this sign-in created the account (sign_up for a server-side tagging extension).
113
+ */
114
+ private exchangeCode;
115
+ private sessionFromParams;
116
+ private fetchFullUser;
117
+ /** The current session from memory (no network). `null` when signed out. */
118
+ getSession(): {
119
+ data: {
120
+ session: Session | null;
121
+ };
122
+ error: UseBeckyError | null;
123
+ };
124
+ /**
125
+ * Listen for sign-in, sign-out and token refreshes. Called once right away with
126
+ * `INITIAL_SESSION`. Returns a function that stops listening.
127
+ */
128
+ onAuthStateChange(callback: AuthListener): () => void;
129
+ private emit;
130
+ /** Access token for API calls; refreshes it first when it is about to expire. */
131
+ getAccessToken(): Promise<string | null>;
132
+ /**
133
+ * @internal The server said `token` is expired/invalid. Refresh (once, shared) and return the
134
+ * new token, or the current one if another call already refreshed.
135
+ */
136
+ handleRejectedToken(token: string): Promise<string | null>;
137
+ private setSession;
138
+ private persist;
139
+ private writeCookie;
140
+ private readStored;
141
+ /** Keep tabs in sync: another tab signed in, refreshed or signed out. */
142
+ private watchOtherTabs;
143
+ private clearTimer;
144
+ private scheduleRefresh;
145
+ /**
146
+ * Get a new access token now. Concurrent calls share one request, and only one browser tab
147
+ * refreshes at a time (the others pick up its result).
148
+ */
149
+ refreshSession(): Promise<Result<{
150
+ session: Session | null;
151
+ }>>;
152
+ private withLock;
153
+ private doRefresh;
154
+ private sessionResult;
155
+ /**
156
+ * Create an account. `session` is null when the project requires email confirmation.
157
+ * `captchaToken`: the token from the Turnstile / hCaptcha widget, when bot protection is on
158
+ * (Dashboard → Auth → Settings). Without it you get `error.code === 'captcha_required'`.
159
+ * `locale`: the language of the confirmation email, like `'de'` (default: the user's browser language).
160
+ */
161
+ signUp(credentials: {
162
+ email: string;
163
+ password: string;
164
+ data?: Record<string, unknown>;
165
+ redirectTo?: string;
166
+ captchaToken?: string;
167
+ locale?: string;
168
+ }): Promise<Result<{
169
+ user: User;
170
+ session: Session | null;
171
+ }>>;
172
+ /**
173
+ * Sign in with email + password. If `data.mfaRequired`, ask for a code and call `mfa.verify()`.
174
+ * Pass `captchaToken` when bot protection is on.
175
+ */
176
+ signIn(credentials: {
177
+ email: string;
178
+ password: string;
179
+ captchaToken?: string;
180
+ }): Promise<Result<{
181
+ user: User;
182
+ session: Session;
183
+ mfaRequired?: boolean;
184
+ }>>;
185
+ /**
186
+ * Sign in with Google, GitHub or Apple. In a browser this redirects to the provider and
187
+ * back to `redirectTo` (default: the current page). Elsewhere it returns the URL to open.
188
+ *
189
+ * Uses PKCE: the server sends back a one-time `?code=` (never tokens in the URL) and this client swaps
190
+ * it for a session with a secret it kept in `storage` — automatically in a browser, or with
191
+ * `setSessionFromUrl(url)` in a React Native / Expo app. `flowType: 'implicit'` uses the older flow
192
+ * (tokens in the `#fragment`); it is also used when the runtime has no `crypto.getRandomValues`.
193
+ */
194
+ signInWith(provider: OAuthProvider, options?: {
195
+ redirectTo?: string;
196
+ skipBrowserRedirect?: boolean;
197
+ flowType?: 'pkce' | 'implicit';
198
+ }): Promise<Result<{
199
+ provider: string;
200
+ url: string;
201
+ }>>;
202
+ /**
203
+ * Sign in with an ID token from a native sign-in SDK: Sign in with Apple (iOS / macOS) or Google
204
+ * Sign-In / Credential Manager (Android, iOS). Pass the raw `nonce` if you used one (Apple: you gave
205
+ * Apple its SHA-256). The token's audience (your bundle ID or client ID) must be listed in
206
+ * Dashboard → Auth → Sign-in methods → "iOS bundle ID / Android client IDs (for native sign-in)".
207
+ *
208
+ * await baas.auth.signInWithIdToken({ provider: 'apple', token: identityToken, nonce: rawNonce })
209
+ */
210
+ signInWithIdToken(credentials: {
211
+ provider: 'apple' | 'google';
212
+ token: string;
213
+ nonce?: string;
214
+ }): Promise<Result<{
215
+ user: User;
216
+ session: Session;
217
+ mfaRequired?: boolean;
218
+ }>>;
219
+ /**
220
+ * Email a sign-in link (and a 6-digit code you can pass to `verifyCode`).
221
+ * Pass `createUser: true` to also let new people sign up this way, and `captchaToken` when bot
222
+ * protection is on. `locale`: the email's language, like `'de'` (default: the user's saved or browser language).
223
+ */
224
+ sendMagicLink(email: string, options?: {
225
+ redirectTo?: string;
226
+ createUser?: boolean;
227
+ captchaToken?: string;
228
+ locale?: string;
229
+ }): Promise<Result<{}>>;
230
+ /** Sign in with the 6-digit code from an email. */
231
+ verifyCode(email: string, code: string, type?: 'magiclink' | 'signup' | 'recovery' | 'invite' | 'email_change'): Promise<Result<{
232
+ user: User;
233
+ session: Session;
234
+ }>>;
235
+ /**
236
+ * Email a password-reset link. After the redirect you get `PASSWORD_RECOVERY`; then call `updateUser({ password })`.
237
+ * Pass `captchaToken` when bot protection is on. `locale`: the email's language, like `'de'`.
238
+ */
239
+ resetPassword(email: string, options?: {
240
+ redirectTo?: string;
241
+ captchaToken?: string;
242
+ locale?: string;
243
+ }): Promise<Result<{}>>;
244
+ /** Resend the confirmation or magic-link email. `locale`: the email's language, like `'de'`. */
245
+ resend(email: string, type?: 'signup' | 'magiclink', options?: {
246
+ locale?: string;
247
+ }): Promise<Result<{}>>;
248
+ /**
249
+ * Change the signed-in user's email, password or metadata (`data`). `locale`: the language of the
250
+ * email-change confirmation, like `'de'`. To remember a language for all later emails, save it in
251
+ * `data`: `updateUser({ data: { locale: 'de' } })`.
252
+ */
253
+ updateUser(attrs: {
254
+ email?: string;
255
+ password?: string;
256
+ data?: Record<string, unknown>;
257
+ locale?: string;
258
+ }): Promise<Result<{
259
+ user: User;
260
+ }>>;
261
+ /** Sign out on this device (or `{ everywhere: true }` for all devices). */
262
+ signOut(options?: {
263
+ everywhere?: boolean;
264
+ }): Promise<{
265
+ data: null;
266
+ error: UseBeckyError | null;
267
+ }>;
268
+ /** The signed-in user, fresh from the server. `user` is null when signed out. */
269
+ getUser(): Promise<Result<{
270
+ user: User | null;
271
+ }>>;
272
+ /** Use tokens you got elsewhere (e.g. a deep link in a mobile app). */
273
+ setSessionTokens(tokens: {
274
+ access_token: string;
275
+ refresh_token: string;
276
+ }): Promise<Result<{
277
+ session: Session;
278
+ }>>;
279
+ /**
280
+ * Finish a redirect sign-in from a URL you received yourself (React Native / Expo deep links).
281
+ * Handles both the PKCE `?code=` (social sign-in) and `#access_token=` (email links). In browsers this
282
+ * happens automatically.
283
+ */
284
+ setSessionFromUrl(url: string): Promise<Result<{
285
+ session: Session;
286
+ }>>;
287
+ /**
288
+ * Swap the one-time `code` from a social sign-in redirect (`redirectTo?code=...`) for a session, using
289
+ * the PKCE verifier that `signInWith()` kept. Usually you call `setSessionFromUrl(url)` instead, which
290
+ * calls this. Codes work once, for 5 minutes, and only in the app that started the sign-in.
291
+ */
292
+ exchangeCodeForSession(authCode: string): Promise<Result<{
293
+ session: Session;
294
+ }>>;
295
+ /**
296
+ * Sign in with a passkey: the browser shows the passkeys saved for this site, no email needed.
297
+ * `autofill: true` waits for the person to pick a passkey from the email field's autofill list (add
298
+ * `autocomplete="username webauthn"` to that input); cancel it with `signal`.
299
+ */
300
+ signInWithPasskey(options?: {
301
+ autofill?: boolean;
302
+ signal?: AbortSignal;
303
+ get?: PasskeyGet;
304
+ }): Promise<Result<{
305
+ user: User;
306
+ session: Session;
307
+ mfaRequired?: boolean;
308
+ }>>;
309
+ private passkeyRegister;
310
+ private passkeyList;
311
+ private passkeyRename;
312
+ private passkeyRemove;
313
+ /**
314
+ * Text a 6-digit sign-in code to a phone number (with country code, like `+49 170 1234567`), then call
315
+ * `verifyPhone(phone, code)`. New numbers get an account on verify unless `createUser: false`.
316
+ * Turn it on in Dashboard → Auth → Sign-in methods → Phone. Pass `captchaToken` when bot protection is on.
317
+ */
318
+ signInWithPhone(phone: string, options?: {
319
+ createUser?: boolean;
320
+ captchaToken?: string;
321
+ }): Promise<Result<{}>>;
322
+ /**
323
+ * Finish phone sign-in with the code from the text message. `type: 'phone_change'` finishes
324
+ * `updatePhone()` for the signed-in user instead.
325
+ */
326
+ verifyPhone(phone: string, code: string, options?: {
327
+ type?: 'sms' | 'phone_change';
328
+ }): Promise<Result<{
329
+ user: User;
330
+ session: Session;
331
+ }>>;
332
+ /** Change the signed-in user's phone number: texts a code to the new number. Then `verifyPhone(phone, code, { type: 'phone_change' })`. */
333
+ updatePhone(phone: string, options?: {
334
+ captchaToken?: string;
335
+ }): Promise<Result<{}>>;
336
+ /**
337
+ * Sign in as a guest: a real user (with an id your tables and access rules can use) but no email or password
338
+ * yet. Later, `linkEmail()`, `linkIdentity()` or `passkeys.register()` keep the same user and data.
339
+ * Turn guests on in Dashboard → Auth → Sign-in methods → Guests.
340
+ */
341
+ signInAnonymously(options?: {
342
+ data?: Record<string, unknown>;
343
+ captchaToken?: string;
344
+ }): Promise<Result<{
345
+ user: User;
346
+ session: Session;
347
+ }>>;
348
+ /** Give the signed-in user (usually a guest) an email and password. Same user id; a confirmation email is sent when the project asks for one. */
349
+ linkEmail(credentials: {
350
+ email: string;
351
+ password: string;
352
+ redirectTo?: string;
353
+ }): Promise<Result<{
354
+ user: User;
355
+ session: Session;
356
+ }>>;
357
+ /**
358
+ * Add a social account (Google, GitHub, Apple, ...) to the signed-in user, keeping the same user id. In a
359
+ * browser this redirects to the provider and back to `redirectTo`, where the session is picked up like after
360
+ * `signInWith()`. Elsewhere it returns the URL to open (finish with `setSessionFromUrl(url)`).
361
+ */
362
+ linkIdentity(provider: OAuthProvider, options?: {
363
+ redirectTo?: string;
364
+ skipBrowserRedirect?: boolean;
365
+ }): Promise<Result<{
366
+ provider: string;
367
+ url: string;
368
+ }>>;
369
+ /** Link a native Sign in with Apple / Google ID token to the signed-in user (see `signInWithIdToken`). */
370
+ linkIdToken(credentials: {
371
+ provider: 'apple' | 'google';
372
+ token: string;
373
+ nonce?: string;
374
+ }): Promise<Result<{
375
+ user: User;
376
+ session: Session;
377
+ }>>;
378
+ /**
379
+ * Sign in with a company account (Okta, Microsoft Entra ID, Google Workspace, ...). Pass the work email or its
380
+ * domain (`{ domain: 'acme.com' }`), or the connection's `providerId`. Redirects like `signInWith()` (PKCE);
381
+ * elsewhere returns the URL to open. Set up connections in Dashboard → Auth → Single sign-on (Business plan).
382
+ */
383
+ signInWithSSO(options: {
384
+ domain?: string;
385
+ providerId?: string;
386
+ redirectTo?: string;
387
+ skipBrowserRedirect?: boolean;
388
+ }): Promise<Result<{
389
+ url: string;
390
+ }>>;
391
+ /** Which sign-in methods the project has turned on (for building a login screen). */
392
+ settings(): Promise<Result<AuthSettings>>;
393
+ private mfaEnroll;
394
+ private mfaVerify;
395
+ private mfaUnenroll;
396
+ private mfaListFactors;
397
+ private assuranceLevel;
398
+ /** Stop timers (for tests / server-side scripts). */
399
+ dispose(): void;
400
+ }
401
+ export declare function notSignedIn(): UseBeckyError;