@passflow/core 0.20.0 → 0.21.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 (129) hide show
  1. package/README.md +54 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +6362 -0
  5. package/dist/index.d.ts +6362 -0
  6. package/dist/index.mjs +2644 -880
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +15 -7
  9. package/dist/lib/api/app.d.ts +0 -11
  10. package/dist/lib/api/app.d.ts.map +0 -1
  11. package/dist/lib/api/auth.d.ts +0 -42
  12. package/dist/lib/api/auth.d.ts.map +0 -1
  13. package/dist/lib/api/axios-client.d.ts +0 -109
  14. package/dist/lib/api/axios-client.d.ts.map +0 -1
  15. package/dist/lib/api/cli-auth.d.ts +0 -12
  16. package/dist/lib/api/cli-auth.d.ts.map +0 -1
  17. package/dist/lib/api/index.d.ts +0 -11
  18. package/dist/lib/api/index.d.ts.map +0 -1
  19. package/dist/lib/api/invitation.d.ts +0 -80
  20. package/dist/lib/api/invitation.d.ts.map +0 -1
  21. package/dist/lib/api/model.d.ts +0 -844
  22. package/dist/lib/api/model.d.ts.map +0 -1
  23. package/dist/lib/api/setting.d.ts +0 -13
  24. package/dist/lib/api/setting.d.ts.map +0 -1
  25. package/dist/lib/api/tenant.d.ts +0 -216
  26. package/dist/lib/api/tenant.d.ts.map +0 -1
  27. package/dist/lib/api/two-factor.d.ts +0 -137
  28. package/dist/lib/api/two-factor.d.ts.map +0 -1
  29. package/dist/lib/api/upgrade.d.ts +0 -39
  30. package/dist/lib/api/upgrade.d.ts.map +0 -1
  31. package/dist/lib/api/user.d.ts +0 -22
  32. package/dist/lib/api/user.d.ts.map +0 -1
  33. package/dist/lib/constants/index.d.ts +0 -33
  34. package/dist/lib/constants/index.d.ts.map +0 -1
  35. package/dist/lib/device/index.d.ts +0 -17
  36. package/dist/lib/device/index.d.ts.map +0 -1
  37. package/dist/lib/index.d.ts +0 -22
  38. package/dist/lib/index.d.ts.map +0 -1
  39. package/dist/lib/interceptors/fetch-registry.d.ts +0 -96
  40. package/dist/lib/interceptors/fetch-registry.d.ts.map +0 -1
  41. package/dist/lib/m2m/client.d.ts +0 -196
  42. package/dist/lib/m2m/client.d.ts.map +0 -1
  43. package/dist/lib/m2m/errors.d.ts +0 -107
  44. package/dist/lib/m2m/errors.d.ts.map +0 -1
  45. package/dist/lib/m2m/index.d.ts +0 -27
  46. package/dist/lib/m2m/index.d.ts.map +0 -1
  47. package/dist/lib/m2m/types.d.ts +0 -217
  48. package/dist/lib/m2m/types.d.ts.map +0 -1
  49. package/dist/lib/passflow.d.ts +0 -1224
  50. package/dist/lib/passflow.d.ts.map +0 -1
  51. package/dist/lib/pkce.d.ts +0 -13
  52. package/dist/lib/pkce.d.ts.map +0 -1
  53. package/dist/lib/platform/index.d.ts +0 -4
  54. package/dist/lib/platform/index.d.ts.map +0 -1
  55. package/dist/lib/platform/types.d.ts +0 -206
  56. package/dist/lib/platform/types.d.ts.map +0 -1
  57. package/dist/lib/platform/web-adapter.d.ts +0 -104
  58. package/dist/lib/platform/web-adapter.d.ts.map +0 -1
  59. package/dist/lib/services/auth-service.d.ts +0 -197
  60. package/dist/lib/services/auth-service.d.ts.map +0 -1
  61. package/dist/lib/services/index.d.ts +0 -8
  62. package/dist/lib/services/index.d.ts.map +0 -1
  63. package/dist/lib/services/invitation-service.d.ts +0 -44
  64. package/dist/lib/services/invitation-service.d.ts.map +0 -1
  65. package/dist/lib/services/logger.d.ts +0 -24
  66. package/dist/lib/services/logger.d.ts.map +0 -1
  67. package/dist/lib/services/tenant-service.d.ts +0 -200
  68. package/dist/lib/services/tenant-service.d.ts.map +0 -1
  69. package/dist/lib/services/tenant-user-membership.d.ts +0 -76
  70. package/dist/lib/services/tenant-user-membership.d.ts.map +0 -1
  71. package/dist/lib/services/token-cache-service.d.ts +0 -36
  72. package/dist/lib/services/token-cache-service.d.ts.map +0 -1
  73. package/dist/lib/services/two-factor-service.d.ts +0 -193
  74. package/dist/lib/services/two-factor-service.d.ts.map +0 -1
  75. package/dist/lib/services/user-service.d.ts +0 -41
  76. package/dist/lib/services/user-service.d.ts.map +0 -1
  77. package/dist/lib/storage/index.d.ts +0 -106
  78. package/dist/lib/storage/index.d.ts.map +0 -1
  79. package/dist/lib/store.d.ts +0 -175
  80. package/dist/lib/store.d.ts.map +0 -1
  81. package/dist/lib/token/delivery-manager.d.ts +0 -121
  82. package/dist/lib/token/delivery-manager.d.ts.map +0 -1
  83. package/dist/lib/token/index.d.ts +0 -4
  84. package/dist/lib/token/index.d.ts.map +0 -1
  85. package/dist/lib/token/membership.d.ts +0 -37
  86. package/dist/lib/token/membership.d.ts.map +0 -1
  87. package/dist/lib/token/service.d.ts +0 -47
  88. package/dist/lib/token/service.d.ts.map +0 -1
  89. package/dist/lib/token/token.d.ts +0 -55
  90. package/dist/lib/token/token.d.ts.map +0 -1
  91. package/dist/lib/types/index.d.ts +0 -24
  92. package/dist/lib/types/index.d.ts.map +0 -1
  93. package/dist/lib/upgrade/acr.d.ts +0 -85
  94. package/dist/lib/upgrade/acr.d.ts.map +0 -1
  95. package/dist/lib/upgrade/axios-adapter.d.ts +0 -81
  96. package/dist/lib/upgrade/axios-adapter.d.ts.map +0 -1
  97. package/dist/lib/upgrade/challenge.d.ts +0 -217
  98. package/dist/lib/upgrade/challenge.d.ts.map +0 -1
  99. package/dist/lib/upgrade/client.d.ts +0 -29
  100. package/dist/lib/upgrade/client.d.ts.map +0 -1
  101. package/dist/lib/upgrade/controller.d.ts +0 -435
  102. package/dist/lib/upgrade/controller.d.ts.map +0 -1
  103. package/dist/lib/upgrade/core.d.ts +0 -353
  104. package/dist/lib/upgrade/core.d.ts.map +0 -1
  105. package/dist/lib/upgrade/errors.d.ts +0 -208
  106. package/dist/lib/upgrade/errors.d.ts.map +0 -1
  107. package/dist/lib/upgrade/facade.d.ts +0 -188
  108. package/dist/lib/upgrade/facade.d.ts.map +0 -1
  109. package/dist/lib/upgrade/factors.d.ts +0 -97
  110. package/dist/lib/upgrade/factors.d.ts.map +0 -1
  111. package/dist/lib/upgrade/fetch-adapter.d.ts +0 -30
  112. package/dist/lib/upgrade/fetch-adapter.d.ts.map +0 -1
  113. package/dist/lib/upgrade/index.d.ts +0 -17
  114. package/dist/lib/upgrade/index.d.ts.map +0 -1
  115. package/dist/lib/upgrade/markers.d.ts +0 -64
  116. package/dist/lib/upgrade/markers.d.ts.map +0 -1
  117. package/dist/lib/upgrade/replay.d.ts +0 -132
  118. package/dist/lib/upgrade/replay.d.ts.map +0 -1
  119. package/dist/lib/upgrade/select.d.ts +0 -48
  120. package/dist/lib/upgrade/select.d.ts.map +0 -1
  121. package/dist/lib/upgrade/session.d.ts +0 -72
  122. package/dist/lib/upgrade/session.d.ts.map +0 -1
  123. package/dist/lib/upgrade/snapshot.d.ts +0 -196
  124. package/dist/lib/upgrade/snapshot.d.ts.map +0 -1
  125. package/dist/lib/upgrade/transport.d.ts +0 -69
  126. package/dist/lib/upgrade/transport.d.ts.map +0 -1
  127. package/dist/lib/utils/validation.d.ts +0 -54
  128. package/dist/lib/utils/validation.d.ts.map +0 -1
  129. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,844 +0,0 @@
1
- import type { AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from '@simplewebauthn/browser';
2
- import type { AxiosRequestConfig } from 'axios';
3
- import type { PlatformAdapter } from '../platform';
4
- import type { Tokens } from '../types';
5
- import type { UpgradeAssertion, UpgradeFactor } from '../upgrade/factors';
6
- export type RequestOptions<D> = {
7
- data?: D;
8
- config?: AxiosRequestConfig;
9
- };
10
- export declare enum RequestMethod {
11
- GET = "get",
12
- POST = "post",
13
- PUT = "put",
14
- PATCH = "patch",
15
- DELETE = "delete"
16
- }
17
- export declare enum PassflowEndpointPaths {
18
- signin = "/auth/login",
19
- signup = "/auth/register",
20
- pkceExchange = "/auth/pkce_exchange",
21
- signInWithProvider = "/auth/federated/start/",
22
- passwordless = "/auth/passwordless/start",
23
- passwordlessComplete = "/auth/passwordless/complete",
24
- logout = "/user/logout",
25
- refresh = "/auth/refresh",
26
- validateSession = "/user/me",
27
- sendPasswordResetEmail = "/auth/password/reset",
28
- resetPassword = "/auth/password/change",
29
- appSettings = "/app/settings",
30
- passkeyRegisterStart = "/auth/passkey/register/start",
31
- passkeyRegisterComplete = "/auth/passkey/register/complete",
32
- passkeyAuthenticateStart = "/auth/passkey/authenticate/start",
33
- passkeyAuthenticateComplete = "/auth/passkey/authenticate/complete",
34
- passkeyValidate = "/auth/validate",
35
- settingsAll = "/settings",
36
- settingsPasswordPolicy = "/settings/password",
37
- settingsPasskey = "/settings/passkey",
38
- userPasskey = "/user/passkey",
39
- addUserPasskey = "/user/passkey/add/start",
40
- completeAddUserPasskey = "/user/passkey/add/complete",
41
- joinInvitation = "/user/tenant/join",
42
- tenantPath = "/user/tenant",
43
- invitationsPath = "/user/tenant/:tenantID/invitations",
44
- requestInvitation = "/user/invite",
45
- invitationDelete = "/user/invite/:invitationID",
46
- invitationResend = "/user/invite/:invitationID/resend",
47
- invitationGetLink = "/user/invite/:invitationID/link",
48
- twoFactor = "/user/2fa",
49
- twoFactorStatus = "/user/2fa/status",
50
- twoFactorSetupBegin = "/user/2fa/setup/begin",
51
- twoFactorSetupConfirm = "/user/2fa/setup/confirm",
52
- twoFactorVerify = "/auth/2fa/verify",
53
- twoFactorRecovery = "/auth/2fa/recovery",
54
- twoFactorRegenerateCodes = "/user/2fa/recovery-codes/regenerate",
55
- twoFactorSetupMagicLink = "/auth/2fa-setup",// :token param appended in API call
56
- TwoFactorMethodsAvailable = "/v2/user/2fa/methods/available",
57
- TwoFactorMethodsRegistered = "/v2/user/2fa/methods",
58
- TwoFactorSetupStart = "/v2/user/2fa/setup/start",
59
- TwoFactorSetupComplete = "/v2/user/2fa/setup/complete",
60
- TwoFactorMethodRemove = "/v2/user/2fa/methods/:id",
61
- TwoFactorChallenge = "/v2/auth/2fa/challenge",
62
- TwoFactorVerifyV2 = "/v2/auth/2fa/verify",
63
- TwoFactorAlternative = "/v2/auth/2fa/alternative",
64
- TwoFactorTrustedDevices = "/v2/user/2fa/trusted-devices",
65
- TwoFactorTrustedDeviceRevoke = "/v2/user/2fa/trusted-devices/:id",
66
- cliAuthStatus = "/cli/auth/status/:sessionId",
67
- cliAuthComplete = "/cli/auth/complete",
68
- upgradeStart = "/auth/upgrade/start"
69
- }
70
- export declare enum PassflowAdminEndpointPaths {
71
- passkeyRegisterStart = "/admin/auth/passkey/register/start",
72
- passkeyRegisterComplete = "/admin/auth/passkey/register/complete",
73
- passkeyAuthenticateStart = "/admin/auth/passkey/authenticate/start",
74
- passkeyAuthenticateComplete = "/admin/auth/passkey/authenticate/complete",
75
- passkeyValidate = "/admin/auth/validate",
76
- logout = "/admin/auth/logout"
77
- }
78
- /**
79
- * BFF (Backend-for-Frontend) configuration for secure token storage.
80
- * When enabled, tokens are sent to the BFF server which stores them in httpOnly cookies.
81
- */
82
- export type TokenExchangeConfig = {
83
- /**
84
- * Enable token exchange mode. When true, authorization code is sent to your server
85
- * for token exchange instead of being exchanged directly from the browser.
86
- */
87
- enabled: boolean;
88
- /**
89
- * URL to send authorization code for server-side token exchange.
90
- * Your server exchanges the code for tokens and stores them in httpOnly cookies.
91
- * @example '/api/auth/callback'
92
- */
93
- callbackUrl: string;
94
- /**
95
- * URL to call for token refresh. BFF reads refresh_token from httpOnly cookie
96
- * and returns new tokens (also stored in cookies).
97
- * @example '/api/auth/refresh'
98
- */
99
- refreshUrl?: string;
100
- /**
101
- * URL to call for logout. BFF clears httpOnly cookies.
102
- * @example '/api/auth/logout'
103
- */
104
- logoutUrl?: string;
105
- /**
106
- * URL to check authentication status (whether httpOnly cookies are valid).
107
- * @example '/api/auth/status'
108
- */
109
- statusUrl?: string;
110
- };
111
- /** @deprecated Use TokenExchangeConfig instead */
112
- export type BFFConfig = TokenExchangeConfig;
113
- export type PassflowConfig = {
114
- url?: string;
115
- appId?: string;
116
- scopes?: string[];
117
- createTenantForNewUser?: boolean;
118
- parseQueryParams?: boolean;
119
- keyStoragePrefix?: string;
120
- /**
121
- * Token exchange configuration for secure server-side token handling.
122
- * When enabled, authorization code is sent to your server which exchanges it
123
- * for tokens and stores them in httpOnly cookies. Tokens never touch the browser.
124
- */
125
- tokenExchange?: TokenExchangeConfig;
126
- /**
127
- * Platform adapter for cross-platform compatibility.
128
- * Defaults to WebAdapter (browser APIs) if not provided.
129
- * Pass a custom adapter to support React Native or other platforms.
130
- */
131
- platform?: PlatformAdapter;
132
- /**
133
- * Assurance upgrade (step-up) configuration. Construction-time only: the
134
- * prompt handler is deliberately NOT here, because it is a lifetime-scoped
135
- * resource that has to be torn down, which configuration cannot express.
136
- */
137
- upgrade?: PassflowUpgradeConfig;
138
- };
139
- export type PassflowUpgradeConfig = {
140
- /** Relying-party id forwarded verbatim to `POST /auth/upgrade/start` for passkey upgrades. */
141
- relyingPartyId?: string;
142
- /** Overrides the factor set offered during an upgrade. Defaults to what this SDK can complete. */
143
- factors?: readonly UpgradeFactor[];
144
- };
145
- /**
146
- * Passflow's own API, as an interception scope — "domain 1".
147
- *
148
- * A challenge arriving from here is handled with zero configuration, because
149
- * `url` is an input the SDK already takes and whatever it points at is
150
- * unambiguously ours.
151
- */
152
- export type UpgradeDomain = {
153
- /** The API origin, e.g. `https://api.passflow.dev`. */
154
- origin: string;
155
- /** The path prefix when `url` carries one, normalised without a trailing slash. */
156
- pathPrefix?: string;
157
- };
158
- /**
159
- * Resolves domain 1 from `PassflowConfig.url`.
160
- *
161
- * `url` is OPTIONAL, and the absent case is specified rather than guessed: the
162
- * domain is EMPTY (`null`), and nothing throws. Throwing would break apps that
163
- * never enabled step-up, and substituting a default origin — `PASSFLOW_CLOUD_URL`,
164
- * the document origin, the origin the first 401 came from — would be the SDK
165
- * inferring a trust boundary it has no information about. An empty domain is not
166
- * silent: the first parseable challenge on an attached surface must raise a
167
- * diagnostic naming `url` as the fix.
168
- *
169
- * Note this deliberately does NOT mirror `AxiosClient`'s `url || PASSFLOW_CLOUD_URL`
170
- * fallback. That fallback decides where to send our own traffic; this decides
171
- * whose 401s may drive a security prompt, and the two questions do not share an
172
- * answer.
173
- */
174
- export declare const resolveUpgradeDomain: (url?: string) => UpgradeDomain | null;
175
- /** The raw `POST /auth/upgrade/start` body, snake_case exactly as the server sends it. */
176
- export type UpgradeStartWire = {
177
- challenge_id: string;
178
- method: string;
179
- /** RFC 3339. The server enforces the TTL; the SDK carries this for display only. */
180
- expires_at: string;
181
- /** WebAuthn assertion options, present only for a passkey upgrade. */
182
- webauthn?: PublicKeyCredentialRequestOptionsJSON;
183
- /** Masked delivery target (`j***@x.com`), present only for email / SMS OTP. */
184
- code_sent_to?: string;
185
- };
186
- /**
187
- * The `upgrade` field of `POST /auth/refresh` — the commit round.
188
- *
189
- * The server types `assertion` as `json.RawMessage`, so a new factor can extend
190
- * the payload without a wire-format change.
191
- */
192
- export type UpgradeRefreshField = {
193
- type: string;
194
- assertion: UpgradeAssertion;
195
- };
196
- export type PassflowAuthorizationResponse = Tokens & {
197
- /**
198
- * The authorization code a PKCE app answers with in place of tokens. The SDK
199
- * redeems it, so a response handed back to a caller never carries one.
200
- */
201
- code?: string;
202
- /** Where the server sends the user next; a password reset answers with its link's redirect. */
203
- redirect_url?: string;
204
- requires_2fa?: boolean;
205
- challenge_id?: string;
206
- tfa_token?: string;
207
- token_delivery?: 'json_body' | 'cookie' | 'mobile';
208
- cookies?: string[];
209
- csrf_token?: string;
210
- };
211
- export type PassflowValidationResponse = Tokens & {
212
- redirect_url: string;
213
- requires_2fa?: boolean;
214
- challenge_id?: string;
215
- tfa_token?: string;
216
- };
217
- export type PassflowSuccessResponse = {
218
- result: 'ok';
219
- };
220
- export type PassflowLogoutResponse = {
221
- status: 'ok';
222
- };
223
- export interface PassflowSessionValidationResponse {
224
- valid: boolean;
225
- user?: {
226
- id: string;
227
- email?: string;
228
- username?: string;
229
- [key: string]: unknown;
230
- };
231
- expires_at?: number;
232
- }
233
- export type PassflowResponseError = {
234
- error: {
235
- id: string;
236
- message: string;
237
- status: number;
238
- location: string;
239
- time: string;
240
- };
241
- };
242
- export declare class PassflowError extends Error {
243
- id: string;
244
- message: string;
245
- status: number;
246
- location: string;
247
- time: string;
248
- constructor(error: PassflowResponseError['error']);
249
- }
250
- export type PassflowSignInPayload = {
251
- password: string;
252
- scopes?: string[];
253
- invite_token?: string;
254
- code_challenge?: string;
255
- } & ({
256
- email: string;
257
- phone?: never;
258
- username?: never;
259
- } | {
260
- phone: string;
261
- email?: never;
262
- username?: never;
263
- } | {
264
- username: string;
265
- email?: never;
266
- phone?: never;
267
- });
268
- export type PassflowSignInExtendedPayload = PassflowSignInPayload & {
269
- device: string;
270
- os: OS;
271
- };
272
- export type PassflowAddressPayload = {
273
- formatted?: string;
274
- street_address?: string;
275
- locality?: string;
276
- region?: string;
277
- postal_code?: string;
278
- country?: string;
279
- };
280
- export type PassflowUserPayload = {
281
- password: string;
282
- username?: string;
283
- email?: string;
284
- given_name?: string;
285
- family_name?: string;
286
- middle_name?: string;
287
- nickname?: string;
288
- preferred_username?: string;
289
- phone_number?: string;
290
- profile?: string;
291
- picture?: string;
292
- website?: string;
293
- gender?: string;
294
- birthday?: Date;
295
- timezone?: string;
296
- locale?: string;
297
- addresses?: PassflowAddressPayload;
298
- } & ({
299
- email: string;
300
- } | {
301
- phone_number: string;
302
- });
303
- export type PassflowSignUpPayload = {
304
- user: PassflowUserPayload;
305
- scopes?: string[];
306
- create_tenant?: boolean;
307
- anonymous?: boolean;
308
- invite_token?: string;
309
- code_challenge?: string;
310
- };
311
- export type PassflowPasswordlessSignInPayload = {
312
- challenge_type: InternalStrategyChallenge;
313
- redirect_url: string;
314
- scopes?: string[];
315
- create_tenant?: boolean;
316
- invite_token?: string;
317
- } & ({
318
- email: string;
319
- phone?: never;
320
- } | {
321
- phone: string;
322
- email?: never;
323
- });
324
- export type PassflowPasswordlessResponse = {
325
- challenge_id: string;
326
- expires_at: Date | string;
327
- };
328
- export type PassflowPasswordlessSignInExtendedPayload = PassflowPasswordlessSignInPayload & {
329
- device: string;
330
- os: OS;
331
- };
332
- export type PassflowPasswordlessSignInCompletePayload = {
333
- challenge_id: string;
334
- otp: string;
335
- device?: string;
336
- scopes?: string[];
337
- challenge_type?: InternalStrategyChallenge;
338
- };
339
- export declare enum Providers {
340
- google = "google",
341
- facebook = "facebook"
342
- }
343
- export type FimStrategy = {
344
- fim_type: Providers;
345
- };
346
- export type InternalStrategyIdentity = 'id' | 'email' | 'phone' | 'username' | 'anonymous' | 'none';
347
- export type InternalStrategyChallenge = 'password' | 'otp' | 'magic_link' | 'recovery_codes' | 'guardian' | 'none';
348
- export type InternalStrategyTransport = 'email' | 'sms' | 'push' | 'socket' | 'authenticator' | 'none';
349
- export type InternalStrategy = {
350
- identity: InternalStrategyIdentity;
351
- challenge: InternalStrategyChallenge;
352
- transport: InternalStrategyTransport;
353
- };
354
- export type OtherStrategy = Record<string, never>;
355
- export type AuthTypeStrategy = 'internal' | 'passkey' | 'webauthn' | 'fim' | 'pkce' | 'anonymous';
356
- export type AuthStrategies = {
357
- type: Extract<AuthTypeStrategy, 'internal'>;
358
- strategy: InternalStrategy;
359
- } | {
360
- type: Extract<AuthTypeStrategy, 'fim'>;
361
- strategy: FimStrategy;
362
- } | {
363
- type: Exclude<AuthTypeStrategy, 'internal' | 'fim'>;
364
- strategy: OtherStrategy;
365
- };
366
- export type AppType = 'web' | 'spa' | 'bff' | 'android' | 'ios' | 'desktop' | 'm2m' | 'other';
367
- export type TokenDeliveryMethod = 'json_body' | 'cookie' | '';
368
- export type AppSettings = {
369
- id: string;
370
- secret: string;
371
- active: boolean;
372
- name: string;
373
- description: string;
374
- offline: boolean;
375
- type: AppType;
376
- redirect_urls: string[] | null;
377
- origins: string[] | null;
378
- custom_email_templates: boolean;
379
- auth_strategies: AuthStrategies[];
380
- force_passwordless_login: boolean;
381
- pkce_enabled: boolean;
382
- custom_sms_messages: boolean;
383
- registration_allowed: boolean;
384
- invite_only_registration: boolean;
385
- passwordless_registration_allowed: boolean;
386
- anonymous_registration_allowed: boolean;
387
- create_tenant_on_registration: 'never' | 'always' | 'optional';
388
- fim_merge_by_email_allowed: boolean;
389
- debug_otp_code_allowed: boolean;
390
- debug_otp_code_for_registration: string;
391
- defaults: DefaultAppSettings;
392
- login_app_theme: LoginWebAppTheme;
393
- login_app_settings?: unknown;
394
- token_delivery_method?: TokenDeliveryMethod;
395
- };
396
- export type DefaultAppSettings = {
397
- app_id: string;
398
- redirect: string;
399
- scopes: string[];
400
- create_tenant_for_new_user: boolean;
401
- };
402
- export declare enum OS {
403
- web = "web",
404
- ios = "ios",
405
- android = "android"
406
- }
407
- /**
408
- * Maps platform.getDeviceType() return values to the OS enum.
409
- * The OS enum values match the getDeviceType() strings exactly,
410
- * so this is a safe cast.
411
- */
412
- export declare function getOSFromDeviceType(deviceType: 'web' | 'ios' | 'android'): OS;
413
- export type PassflowPasskeyRegisterStartPayload = {
414
- passkey_display_name?: string;
415
- passkey_username?: string;
416
- invite_token?: string;
417
- scopes: string[];
418
- create_tenant?: boolean;
419
- relying_party_id: string;
420
- redirect_url: string;
421
- code_challenge?: string;
422
- };
423
- export type PassflowPasskeyRegisterStartExtendedPayload = PassflowPasskeyRegisterStartPayload & {
424
- device: string;
425
- os: OS;
426
- };
427
- export type PassflowPasskeyStart = {
428
- challenge_id: string;
429
- publicKey: PublicKeyCredentialCreationOptionsJSON;
430
- };
431
- export type PassflowPasskeyCompleteMessageWithTokens = Tokens;
432
- export type PassflowPasskeyPayload = {
433
- device: string;
434
- challenge_id: string;
435
- };
436
- export type PassflowPasskeyRegisterPayload = PassflowPasskeyPayload & {
437
- passkey_data: RegistrationResponseJSON;
438
- };
439
- export type PassflowPasskeyAuthenticatePayload = PassflowPasskeyPayload & {
440
- passkey_data: AuthenticationResponseJSON;
441
- };
442
- export type PassflowPasskeyAuthenticateStartPayload = {
443
- relying_party_id: string;
444
- scopes?: string[];
445
- user_id?: string;
446
- invite_token?: string;
447
- code_challenge?: string;
448
- };
449
- export type PassflowPasskeyAuthenticateStartExtendedPayload = PassflowPasskeyAuthenticateStartPayload & {
450
- device: string;
451
- os: OS;
452
- };
453
- export type PassflowFederatedAuthPayload = {
454
- provider: Providers;
455
- redirect_url: string;
456
- scopes?: string[];
457
- invite_token?: string;
458
- create_tenant?: boolean;
459
- };
460
- export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
461
- device?: string;
462
- };
463
- export type PassflowValidatePayload = {
464
- otp: string;
465
- device: string;
466
- challenge_id: string;
467
- };
468
- export type PassflowPasskeyProviderOption = 'none' | 'required' | 'preferred' | 'discouraged';
469
- export type PassflowSettingsAll = {
470
- password_policy: PassflowPasswordPolicySettings;
471
- passkey_provider: PassflowPasskeySettings;
472
- };
473
- export type PassflowPasswordPolicySettings = {
474
- restrict_min_password_length: boolean;
475
- min_password_length: number;
476
- reject_compromised: boolean;
477
- enforce_password_strength: 'none' | 'weak' | 'average' | 'strong';
478
- require_lowercase: boolean;
479
- require_uppercase: boolean;
480
- require_number: boolean;
481
- require_symbol: boolean;
482
- };
483
- export type PassflowPasskeySettings = {
484
- id: string;
485
- display_name: string;
486
- registration?: {
487
- user_verification: PassflowPasskeyProviderOption;
488
- authenticator_attachment: 'platform' | 'cross-platform' | 'any';
489
- discoverable_key: PassflowPasskeyProviderOption;
490
- attestation_metadata: PassflowPasskeyProviderOption;
491
- extensions: unknown;
492
- };
493
- authentication?: {
494
- user_verification: PassflowPasskeyProviderOption;
495
- attestation_metadata: PassflowPasskeyProviderOption;
496
- extensions: unknown;
497
- };
498
- };
499
- type PassflowCredentialFlags = {
500
- user_present: boolean;
501
- user_verified: boolean;
502
- backup_eligible: boolean;
503
- backup_state: boolean;
504
- };
505
- type PassflowEnrolmentAuthenticator = {
506
- aaguid: string;
507
- sign_count: number;
508
- clone_warning: boolean;
509
- attachment: 'platform' | 'cross-platform';
510
- };
511
- export type PassflowUserPasskey = {
512
- id: string;
513
- user_id: string;
514
- name: string;
515
- strategy: InternalStrategy;
516
- challenge_type: InternalStrategyChallenge;
517
- strategy_hash: string;
518
- enrolled_at: Date | string;
519
- enrollment_challenge_id: string;
520
- confirmed_at: Date | string;
521
- last_auth_at: Date | string;
522
- public_key: string;
523
- attestation_type: string;
524
- transport: string[];
525
- flags: PassflowCredentialFlags;
526
- authenticator: PassflowEnrolmentAuthenticator;
527
- archived: boolean;
528
- archived_at: Date | string;
529
- count?: number;
530
- enrolled_with_app_id?: string;
531
- };
532
- export type PassflowSendPasswordResetEmailPayload = {
533
- reset_page_url?: string;
534
- redirect_url?: string;
535
- } & ({
536
- email: string;
537
- phone?: never;
538
- username?: never;
539
- } | {
540
- phone: string;
541
- email?: never;
542
- username?: never;
543
- } | {
544
- username: string;
545
- email?: never;
546
- phone?: never;
547
- });
548
- export type PassflowInviteResponse = {
549
- link: string;
550
- };
551
- export type PassflowInvitePayload = {
552
- invite_token: string;
553
- scopes: string[];
554
- };
555
- export type PassflowUserWithRoles = {
556
- user_id: string;
557
- username: string;
558
- email: string;
559
- phone_number: string;
560
- tenant_id: string;
561
- group_id: string;
562
- role_id: string;
563
- preferred_username?: string;
564
- given_name?: string;
565
- family_name?: string;
566
- nickname?: string;
567
- picture?: string;
568
- roles: {
569
- [role_id: string]: string;
570
- };
571
- };
572
- export type PassflowGroup = {
573
- id: string;
574
- name: string;
575
- default: boolean;
576
- updated_at: string;
577
- created_at: string;
578
- };
579
- export type PassflowRole = {
580
- id: string;
581
- tenant_id: string;
582
- name: string;
583
- };
584
- export type PassflowTenantResponse = {
585
- tenant_id: string;
586
- tenant_name: string;
587
- users_in_groups?: PassflowUserInGroup[];
588
- groups?: PassflowGroup[];
589
- roles?: PassflowRole[];
590
- };
591
- /**
592
- * Represents a user's membership in a group with their assigned roles
593
- */
594
- export type PassflowUserInGroup = {
595
- user: {
596
- id: string;
597
- name?: string | null;
598
- email?: string | null;
599
- phone?: string | null;
600
- };
601
- group_id: string;
602
- roles?: {
603
- id: string;
604
- }[];
605
- };
606
- export type PassflowCreateTenantPayload = {
607
- name: string;
608
- };
609
- export type LoginWebAppTemplateType = 'default' | 'simple' | 'extendable';
610
- export type LoginWebAppTemplateColorScheme = 'system' | 'light' | 'dark';
611
- export type LoginWebAppStyle = {
612
- primary_color: string;
613
- text_color: string;
614
- secondary_text_color: string;
615
- background_color: string;
616
- card_color: string;
617
- input_background_color: string;
618
- input_border_color: string;
619
- button_text_color: string;
620
- divider_color: string;
621
- federated_button_background_color: string;
622
- federated_button_text_color: string;
623
- logo_url: string;
624
- passkey_button_background_color: string;
625
- passkey_button_text_color: string;
626
- background_image: string;
627
- custom_css: string;
628
- };
629
- export type LoginWebAppTheme = {
630
- template_type: LoginWebAppTemplateType;
631
- application_name: string;
632
- remove_passflow_logo: boolean;
633
- description: string;
634
- color_scheme: LoginWebAppTemplateColorScheme;
635
- light_style: LoginWebAppStyle;
636
- dark_style: LoginWebAppStyle;
637
- };
638
- export type PassflowCreateTokenResponse = PassflowTenantResponse;
639
- export declare function pathWithParams(template: string, params: Record<string, string>): string;
640
- /**
641
- * Two-Factor authentication policy
642
- */
643
- export declare enum TwoFactorPolicy {
644
- Disabled = "disabled",
645
- Optional = "optional",
646
- Required = "required"
647
- }
648
- /**
649
- * Two-Factor error codes
650
- */
651
- export type TwoFactorErrorCode = 'INVALID_CODE' | 'CODE_EXPIRED' | 'TOO_MANY_ATTEMPTS' | 'SETUP_NOT_STARTED' | 'ALREADY_ENABLED' | 'NOT_ENABLED' | 'INVALID_RECOVERY_CODE' | 'NO_RECOVERY_CODES_REMAINING' | 'INVALID_CHALLENGE' | 'TIME_DRIFT_DETECTED';
652
- export type TwoFactorConfirmRequest = {
653
- code: string;
654
- };
655
- export type TwoFactorVerifyRequest = {
656
- code: string;
657
- tfa_token: string;
658
- trust_device?: boolean;
659
- };
660
- export type TwoFactorRecoveryRequest = {
661
- recovery_code: string;
662
- tfa_token: string;
663
- trust_device?: boolean;
664
- };
665
- export type TwoFactorDisableRequest = {
666
- code: string;
667
- };
668
- export type TwoFactorRegenerateRequest = {
669
- code: string;
670
- };
671
- export type TwoFactorStatusResponse = {
672
- enabled: boolean;
673
- policy: TwoFactorPolicy;
674
- recovery_codes_remaining: number;
675
- totp_digits?: 6 | 8;
676
- };
677
- export type TwoFactorSetupResponse = {
678
- secret: string;
679
- qr_code: string;
680
- totp_digits?: 6 | 8;
681
- };
682
- export type TwoFactorConfirmResponse = {
683
- success: true;
684
- recovery_codes: string[];
685
- };
686
- export type TwoFactorVerifyResponse = Tokens & {
687
- success: true;
688
- /** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
689
- code?: string;
690
- };
691
- /**
692
- * Options for the call that completes a sign-in with its second factor.
693
- */
694
- export type TwoFactorCompletionOptions = {
695
- /**
696
- * Ask the server to trust this device, so later sign-ins from it skip the
697
- * second factor where the app allows that. The server keeps the trust in
698
- * an HttpOnly cookie; nothing is stored by the SDK.
699
- */
700
- trustDevice?: boolean;
701
- };
702
- /**
703
- * A device the user trusted to stand in for their second factor on this app.
704
- */
705
- export type TwoFactorTrustedDevice = {
706
- id: string;
707
- user_agent?: string;
708
- created_at: string;
709
- last_used_at?: string;
710
- expires_at: string;
711
- /** True for the device the request came from. */
712
- current: boolean;
713
- };
714
- /** GET /v2/user/2fa/trusted-devices */
715
- export type TwoFactorTrustedDevicesResponse = {
716
- devices: TwoFactorTrustedDevice[];
717
- };
718
- export type TwoFactorRecoveryResponse = Tokens & {
719
- success: true;
720
- remaining_recovery_codes: number;
721
- /** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
722
- code?: string;
723
- };
724
- export type TwoFactorDisableResponse = {
725
- success: true;
726
- };
727
- export type TwoFactorRegenerateResponse = {
728
- success: true;
729
- recovery_codes: string[];
730
- };
731
- /**
732
- * Two-Factor magic link error codes
733
- */
734
- export type TwoFactorSetupMagicLinkErrorCode = 'INVALID_TOKEN' | 'EXPIRED_TOKEN' | 'REVOKED_TOKEN' | 'RATE_LIMITED' | 'SERVER_ERROR';
735
- /**
736
- * Two-Factor magic link error details
737
- */
738
- export type TwoFactorSetupMagicLinkError = {
739
- code: TwoFactorSetupMagicLinkErrorCode;
740
- message: string;
741
- retryAfter?: number;
742
- };
743
- /**
744
- * Response from magic link validation endpoint
745
- * Backend returns scoped session token for 2FA setup operations
746
- */
747
- export type TwoFactorSetupMagicLinkValidationResponse = {
748
- success: boolean;
749
- sessionToken?: string;
750
- userId?: string;
751
- expiresIn?: number;
752
- appId?: string | null;
753
- error?: TwoFactorSetupMagicLinkError;
754
- };
755
- /**
756
- * Internal session state for magic link 2FA setup
757
- * Stored in memory only, not persisted across page reloads
758
- */
759
- export type TwoFactorSetupMagicLinkSession = {
760
- sessionToken: string;
761
- userId: string;
762
- appId?: string | null;
763
- scope: '2fa_setup';
764
- timestamp: number;
765
- expiresAt: number;
766
- };
767
- /**
768
- * Two-Factor method types
769
- */
770
- export type TwoFactorMethod = 'totp' | 'email_otp' | 'sms_otp' | 'passkey' | 'push_fcm' | 'push_webpush' | 'recovery_codes';
771
- /**
772
- * Challenge Request for v2 2FA flow
773
- */
774
- export interface TwoFactorChallengeRequest {
775
- first_factor_method?: string;
776
- trust_device?: boolean;
777
- }
778
- /**
779
- * Challenge Response from v2 2FA flow
780
- */
781
- export interface TwoFactorChallengeResponse {
782
- challenge_id: string;
783
- method: TwoFactorMethod;
784
- alternative_methods: TwoFactorMethod[];
785
- expires_at: string;
786
- code_sent_to?: string;
787
- webauthn_options?: unknown;
788
- }
789
- /**
790
- * Verify Request for v2 2FA flow
791
- */
792
- export interface TwoFactorVerifyRequestV2 {
793
- challenge_id: string;
794
- method: TwoFactorMethod;
795
- response: string;
796
- trust_device?: boolean;
797
- }
798
- /**
799
- * Verify Response from v2 2FA flow
800
- */
801
- export interface TwoFactorVerifyResponseV2 {
802
- success: boolean;
803
- access_token?: string;
804
- refresh_token?: string;
805
- /** On a PKCE app; `TwoFactorService` redeems it, so its callers never see one. */
806
- code?: string;
807
- device_trusted?: boolean;
808
- }
809
- /**
810
- * Registered Two-Factor Method
811
- */
812
- export interface RegisteredTwoFactorMethod {
813
- id: string;
814
- method: TwoFactorMethod;
815
- name: string;
816
- created_at: string;
817
- last_used_at?: string;
818
- }
819
- /**
820
- * Alternative Method Request
821
- */
822
- export interface TwoFactorAlternativeRequest {
823
- challenge_id: string;
824
- method: TwoFactorMethod;
825
- }
826
- export interface CLIAuthStatusResponse {
827
- status: 'pending' | 'completed' | 'expired' | 'failed';
828
- expires_at?: string;
829
- challenge?: Record<string, unknown>;
830
- access_token?: string;
831
- refresh_token?: string;
832
- user_id?: string;
833
- expires_in?: number;
834
- error?: string;
835
- }
836
- export interface CLIAuthCompleteRequest {
837
- session_id: string;
838
- access_token: string;
839
- refresh_token: string;
840
- user_id: string;
841
- expires_in: number;
842
- }
843
- export {};
844
- //# sourceMappingURL=model.d.ts.map