bwh-auth 0.6.4 → 0.6.5

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/dist/index.d.cts CHANGED
@@ -1,198 +1,196 @@
1
- import * as React from 'react';
2
-
3
- interface AuthEndpointConfig {
4
- csrfToken?: string;
5
- login?: string;
6
- signup?: string;
7
- forgotPassword?: string;
8
- resetPassword?: string;
9
- changePassword?: string;
10
- twoFactorVerify?: string;
11
- twoFactorResend?: string;
12
- twoFactorReport?: (token: string) => string;
13
- passkeyList?: string;
14
- passkeyRegisterOptions?: string;
15
- passkeyRegister?: string;
16
- passkeyDelete?: (id: number | string) => string;
17
- passkeyAuthOptions?: string;
18
- passkeyAuth?: string;
19
- }
20
- type AuthValidationErrors = Record<string, string[]>;
21
- type AuthSignupValues = Record<string, string | boolean>;
22
- interface AuthSignupField {
23
- name: string;
24
- label: React.ReactNode;
25
- type?: React.HTMLInputTypeAttribute;
26
- placeholder?: string;
27
- required?: boolean;
28
- autoComplete?: string;
29
- initialValue?: string | boolean;
30
- minLength?: number;
31
- maxLength?: number;
32
- pattern?: string;
33
- inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];
34
- helpText?: React.ReactNode;
35
- className?: string;
36
- containerClassName?: string;
37
- hiddenWhen?: (values: AuthSignupValues) => boolean;
38
- }
39
- interface Passkey {
40
- id: number;
41
- name: string;
42
- aaguid: string | null;
43
- created_at: string;
44
- updated_at: string;
45
- }
46
- interface AuthJsonResponse {
47
- success?: boolean;
48
- message?: string;
49
- error?: string;
50
- redirect?: string;
51
- requires_2fa?: boolean;
52
- attempt_token?: string;
53
- [key: string]: unknown;
1
+ import * as React from "react";
2
+ export interface AuthEndpointConfig {
3
+ csrfToken?: string;
4
+ login?: string;
5
+ signup?: string;
6
+ forgotPassword?: string;
7
+ resetPassword?: string;
8
+ changePassword?: string;
9
+ twoFactorVerify?: string;
10
+ twoFactorResend?: string;
11
+ twoFactorReport?: (token: string) => string;
12
+ passkeyList?: string;
13
+ passkeyRegisterOptions?: string;
14
+ passkeyRegister?: string;
15
+ passkeyDelete?: (id: number | string) => string;
16
+ passkeyAuthOptions?: string;
17
+ passkeyAuth?: string;
18
+ confirmPassword?: string;
19
+ passkeyConfirmOptions?: string;
20
+ passkeyConfirm?: string;
21
+ }
22
+ export type AuthValidationErrors = Record<string, string[]>;
23
+ export type AuthSignupValues = Record<string, string | boolean>;
24
+ export interface AuthSignupField {
25
+ name: string;
26
+ label: React.ReactNode;
27
+ type?: React.HTMLInputTypeAttribute;
28
+ placeholder?: string;
29
+ required?: boolean;
30
+ autoComplete?: string;
31
+ initialValue?: string | boolean;
32
+ minLength?: number;
33
+ maxLength?: number;
34
+ pattern?: string;
35
+ inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];
36
+ helpText?: React.ReactNode;
37
+ className?: string;
38
+ containerClassName?: string;
39
+ hiddenWhen?: (values: AuthSignupValues) => boolean;
40
+ }
41
+ export interface Passkey {
42
+ id: number;
43
+ name: string;
44
+ aaguid: string | null;
45
+ created_at: string;
46
+ updated_at: string;
54
47
  }
55
- type AuthButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
56
- type AuthButtonSize = 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg';
57
- type AuthButtonComponentProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
58
- variant?: AuthButtonVariant;
59
- size?: AuthButtonSize;
48
+ export interface AuthJsonResponse {
49
+ success?: boolean;
50
+ message?: string;
51
+ error?: string;
52
+ redirect?: string;
53
+ requires_2fa?: boolean;
54
+ attempt_token?: string;
55
+ [key: string]: unknown;
56
+ }
57
+ export type AuthButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
58
+ export type AuthButtonSize = 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg';
59
+ export type AuthButtonComponentProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
60
+ variant?: AuthButtonVariant;
61
+ size?: AuthButtonSize;
60
62
  };
61
- type AuthInputComponentProps = React.InputHTMLAttributes<HTMLInputElement>;
62
- type AuthLabelComponentProps = React.LabelHTMLAttributes<HTMLLabelElement>;
63
- type AuthContainerComponentProps = React.HTMLAttributes<HTMLDivElement>;
64
- type AuthTextareaComponentProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
63
+ export type AuthInputComponentProps = React.InputHTMLAttributes<HTMLInputElement>;
64
+ export type AuthLabelComponentProps = React.LabelHTMLAttributes<HTMLLabelElement>;
65
+ export type AuthContainerComponentProps = React.HTMLAttributes<HTMLDivElement>;
66
+ export type AuthTextareaComponentProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
65
67
  /** A controlled checkbox: the app's own, e.g. a design-system `Checkbox` with `onCheckedChange`. */
66
- interface AuthCheckboxComponentProps {
67
- id: string;
68
- checked: boolean;
69
- onCheckedChange: (checked: boolean) => void;
68
+ export interface AuthCheckboxComponentProps {
69
+ id: string;
70
+ checked: boolean;
71
+ onCheckedChange: (checked: boolean) => void;
70
72
  }
71
73
  /** A small inline label, e.g. a design-system `Badge`. */
72
- type AuthBadgeComponentProps = React.HTMLAttributes<HTMLSpanElement>;
73
- interface AuthRadioGroupOption {
74
- value: string;
75
- label: React.ReactNode;
74
+ export type AuthBadgeComponentProps = React.HTMLAttributes<HTMLSpanElement>;
75
+ export interface AuthRadioGroupOption {
76
+ value: string;
77
+ label: React.ReactNode;
76
78
  }
77
79
  /** A controlled set of radio options, rendered however the app renders radio groups. */
78
- interface AuthRadioGroupComponentProps {
79
- name: string;
80
- value: string;
81
- onValueChange: (value: string) => void;
82
- options: AuthRadioGroupOption[];
83
- }
84
- interface AuthComponentSet {
85
- Button: React.ComponentType<AuthButtonComponentProps>;
86
- Card: React.ComponentType<AuthContainerComponentProps>;
87
- CardContent: React.ComponentType<AuthContainerComponentProps>;
88
- CardDescription: React.ComponentType<AuthContainerComponentProps>;
89
- CardHeader: React.ComponentType<AuthContainerComponentProps>;
90
- CardTitle: React.ComponentType<AuthContainerComponentProps>;
91
- Input: React.ComponentType<AuthInputComponentProps>;
92
- Label: React.ComponentType<AuthLabelComponentProps>;
93
- /** Optional; native elements are rendered when omitted. */
94
- Textarea?: React.ComponentType<AuthTextareaComponentProps>;
95
- Checkbox?: React.ComponentType<AuthCheckboxComponentProps>;
96
- RadioGroup?: React.ComponentType<AuthRadioGroupComponentProps>;
97
- /** Optional: the "Sensitive" badge in the scope picker. A `<span>` is rendered when omitted. */
98
- Badge?: React.ComponentType<AuthBadgeComponentProps>;
99
- /** Optional: the warning shown for a sensitive scope group. A styled `<p>` is rendered when omitted. */
100
- Alert?: React.ComponentType<AuthContainerComponentProps>;
101
- }
102
- type AuthComponents = AuthComponentSet;
103
- type AuthComponentOverrides = Partial<AuthComponentSet>;
104
- type AuthButtonComponent = AuthComponentSet['Button'];
105
- type AuthComponentSuperset = AuthComponentSet & Record<string, React.ComponentType<any>>;
106
- type AuthComponentInput = AuthComponentSet | AuthComponentSuperset;
107
- type AuthButtonComponentInput = Pick<AuthComponentSet, 'Button'> & Record<string, React.ComponentType<any>>;
108
-
80
+ export interface AuthRadioGroupComponentProps {
81
+ name: string;
82
+ value: string;
83
+ onValueChange: (value: string) => void;
84
+ options: AuthRadioGroupOption[];
85
+ }
86
+ export interface AuthComponentSet {
87
+ Button: React.ComponentType<AuthButtonComponentProps>;
88
+ Card: React.ComponentType<AuthContainerComponentProps>;
89
+ CardContent: React.ComponentType<AuthContainerComponentProps>;
90
+ CardDescription: React.ComponentType<AuthContainerComponentProps>;
91
+ CardHeader: React.ComponentType<AuthContainerComponentProps>;
92
+ CardTitle: React.ComponentType<AuthContainerComponentProps>;
93
+ Input: React.ComponentType<AuthInputComponentProps>;
94
+ Label: React.ComponentType<AuthLabelComponentProps>;
95
+ /** Optional; native elements are rendered when omitted. */
96
+ Textarea?: React.ComponentType<AuthTextareaComponentProps>;
97
+ Checkbox?: React.ComponentType<AuthCheckboxComponentProps>;
98
+ RadioGroup?: React.ComponentType<AuthRadioGroupComponentProps>;
99
+ /** Optional: the "Sensitive" badge in the scope picker. A `<span>` is rendered when omitted. */
100
+ Badge?: React.ComponentType<AuthBadgeComponentProps>;
101
+ /** Optional: the warning shown for a sensitive scope group. A styled `<p>` is rendered when omitted. */
102
+ Alert?: React.ComponentType<AuthContainerComponentProps>;
103
+ }
104
+ export type AuthComponents = AuthComponentSet;
105
+ export type AuthComponentOverrides = Partial<AuthComponentSet>;
106
+ export type AuthButtonComponent = AuthComponentSet['Button'];
107
+ export type AuthComponentSuperset = AuthComponentSet & Record<string, React.ComponentType<any>>;
108
+ export type AuthComponentInput = AuthComponentSet | AuthComponentSuperset;
109
+ export type AuthButtonComponentInput = Pick<AuthComponentSet, 'Button'> & Record<string, React.ComponentType<any>>;
109
110
  interface AuthFormProps {
110
- endpoints?: AuthEndpointConfig;
111
- components: AuthComponentInput;
112
- onSuccess?: (result: AuthJsonResponse) => void;
113
- onError?: (message: string) => void;
114
- }
115
- interface LoginRememberMeCheckboxProps {
116
- id: string;
117
- checked: boolean;
118
- onCheckedChange: (checked: boolean) => void;
119
- 'aria-labelledby'?: string;
120
- 'data-test'?: string;
121
- }
122
- interface LoginFormProps extends AuthFormProps {
123
- /** Render only the controls when the consumer owns the card and heading. */
124
- unwrapped?: boolean;
125
- passkeySeparator?: React.ReactNode;
126
- enablePasskeys?: boolean;
127
- enablePasskeyAutofill?: boolean;
128
- initialEmail?: string;
129
- onEmailChange?: (email: string) => void;
130
- rememberMeCheckbox?: React.ComponentType<LoginRememberMeCheckboxProps>;
131
- rememberMeLabel?: React.ReactNode;
132
- rememberMeDataTest?: string;
133
- onSubmitStart?: () => void;
134
- onTwoFactorRequired?: (result: AuthJsonResponse & {
135
- attempt_token?: string;
136
- }) => void;
137
- onPasskeySuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
111
+ endpoints?: AuthEndpointConfig;
112
+ components: AuthComponentInput;
113
+ onSuccess?: (result: AuthJsonResponse) => void;
114
+ onError?: (message: string) => void;
115
+ }
116
+ export interface LoginRememberMeCheckboxProps {
117
+ id: string;
118
+ checked: boolean;
119
+ onCheckedChange: (checked: boolean) => void;
120
+ 'aria-labelledby'?: string;
121
+ 'data-test'?: string;
122
+ }
123
+ export interface LoginFormProps extends AuthFormProps {
124
+ /** Render only the controls when the consumer owns the card and heading. */
125
+ unwrapped?: boolean;
126
+ passkeySeparator?: React.ReactNode;
127
+ enablePasskeys?: boolean;
128
+ enablePasskeyAutofill?: boolean;
129
+ initialEmail?: string;
130
+ onEmailChange?: (email: string) => void;
131
+ rememberMeCheckbox?: React.ComponentType<LoginRememberMeCheckboxProps>;
132
+ rememberMeLabel?: React.ReactNode;
133
+ rememberMeDataTest?: string;
134
+ onSubmitStart?: () => void;
135
+ onTwoFactorRequired?: (result: AuthJsonResponse & {
136
+ attempt_token?: string;
137
+ }) => void;
138
+ onPasskeySuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
138
139
  }
139
140
  interface SignupFormProps extends Omit<AuthFormProps, 'onSuccess'> {
140
- fields?: AuthSignupField[];
141
- initialValues?: AuthSignupValues;
142
- errors?: AuthValidationErrors;
143
- submitMode?: 'fetch' | 'native';
144
- title?: React.ReactNode;
145
- description?: React.ReactNode;
146
- submitLabel?: React.ReactNode;
147
- submittingLabel?: React.ReactNode;
148
- onSuccess?: (result: AuthJsonResponse, values: AuthSignupValues) => void | Promise<void>;
149
- }
150
- interface PasswordResetRequestFormProps extends AuthFormProps {
151
- onSubmitStart?: () => void;
152
- submitClassName?: string;
153
- }
154
- interface ResetPasswordFormProps extends PasswordResetRequestFormProps {
155
- token?: string;
156
- email?: string;
157
- /** Override field IDs when the embedding page already uses the default ID. */
158
- idPrefix?: string;
159
- minPasswordLength?: number;
160
- validatePasswordConfirmation?: boolean;
161
- passwordLabel?: React.ReactNode;
162
- passwordConfirmationLabel?: React.ReactNode;
163
- passwordHelpText?: React.ReactNode;
141
+ fields?: AuthSignupField[];
142
+ initialValues?: AuthSignupValues;
143
+ errors?: AuthValidationErrors;
144
+ submitMode?: 'fetch' | 'native';
145
+ title?: React.ReactNode;
146
+ description?: React.ReactNode;
147
+ submitLabel?: React.ReactNode;
148
+ submittingLabel?: React.ReactNode;
149
+ onSuccess?: (result: AuthJsonResponse, values: AuthSignupValues) => void | Promise<void>;
150
+ }
151
+ export interface PasswordResetRequestFormProps extends AuthFormProps {
152
+ onSubmitStart?: () => void;
153
+ submitClassName?: string;
154
+ }
155
+ export interface ResetPasswordFormProps extends PasswordResetRequestFormProps {
156
+ token?: string;
157
+ email?: string;
158
+ /** Override field IDs when the embedding page already uses the default ID. */
159
+ idPrefix?: string;
160
+ minPasswordLength?: number;
161
+ validatePasswordConfirmation?: boolean;
162
+ passwordLabel?: React.ReactNode;
163
+ passwordConfirmationLabel?: React.ReactNode;
164
+ passwordHelpText?: React.ReactNode;
164
165
  }
165
166
  interface TwoFactorFormProps extends AuthFormProps {
166
- attemptToken: string;
167
- appEnv?: string;
168
- onReportSuspicious?: (result: AuthJsonResponse) => void;
169
- }
170
- declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, unwrapped, passkeySeparator, enablePasskeys, enablePasskeyAutofill, }: LoginFormProps): React.JSX.Element;
171
- declare function SignupForm({ endpoints, components, onSuccess, onError, fields, initialValues, errors, submitMode, title, description, submitLabel, submittingLabel, }: SignupFormProps): React.JSX.Element;
172
- declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName }: PasswordResetRequestFormProps): React.JSX.Element;
173
- declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName, token: initialToken, email: initialEmail, idPrefix, minPasswordLength, validatePasswordConfirmation, passwordLabel, passwordConfirmationLabel, passwordHelpText, }: ResetPasswordFormProps): React.JSX.Element;
174
- declare function ChangePasswordForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
175
- declare function TwoFactorForm({ endpoints, components, attemptToken, appEnv, onSuccess, onError, onReportSuspicious }: TwoFactorFormProps): React.JSX.Element;
176
-
167
+ attemptToken: string;
168
+ appEnv?: string;
169
+ onReportSuspicious?: (result: AuthJsonResponse) => void;
170
+ }
171
+ export declare function LoginForm({ endpoints, components, onSuccess, onError, initialEmail, onEmailChange, rememberMeCheckbox: RememberMeCheckbox, rememberMeLabel, rememberMeDataTest, onSubmitStart, onTwoFactorRequired, onPasskeySuccess, unwrapped, passkeySeparator, enablePasskeys, enablePasskeyAutofill }: LoginFormProps): React.JSX.Element;
172
+ export declare function SignupForm({ endpoints, components, onSuccess, onError, fields, initialValues, errors, submitMode, title, description, submitLabel, submittingLabel }: SignupFormProps): React.JSX.Element;
173
+ export declare function PasswordResetRequestForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName }: PasswordResetRequestFormProps): React.JSX.Element;
174
+ export declare function ResetPasswordForm({ endpoints, components, onSuccess, onError, onSubmitStart, submitClassName, token: initialToken, email: initialEmail, idPrefix, minPasswordLength, validatePasswordConfirmation, passwordLabel, passwordConfirmationLabel, passwordHelpText }: ResetPasswordFormProps): React.JSX.Element;
175
+ export declare function ChangePasswordForm({ endpoints, components, onSuccess, onError }: AuthFormProps): React.JSX.Element;
176
+ export declare function TwoFactorForm({ endpoints, components, attemptToken, appEnv, onSuccess, onError, onReportSuspicious }: TwoFactorFormProps): React.JSX.Element;
177
177
  interface PasskeyLoginButtonProps {
178
- endpoints?: AuthEndpointConfig;
179
- components: AuthButtonComponentInput;
180
- className?: string;
181
- disabled?: boolean;
182
- remember?: boolean | (() => boolean);
183
- onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
184
- onError?: (message: string) => void;
185
- }
186
- declare function PasskeyLoginButton({ endpoints, components, className, disabled, remember, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
187
-
178
+ endpoints?: AuthEndpointConfig;
179
+ components: AuthButtonComponentInput;
180
+ className?: string;
181
+ disabled?: boolean;
182
+ remember?: boolean | (() => boolean);
183
+ onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
184
+ onError?: (message: string) => void;
185
+ }
186
+ export declare function PasskeyLoginButton({ endpoints, components, className, disabled, remember, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
188
187
  interface PasskeySectionProps {
189
- endpoints?: AuthEndpointConfig;
190
- components: AuthComponentInput;
191
- onSuccess?: (message: string) => void;
192
- onError?: (field: string, message: string) => void;
188
+ endpoints?: AuthEndpointConfig;
189
+ components: AuthComponentInput;
190
+ onSuccess?: (message: string) => void;
191
+ onError?: (field: string, message: string) => void;
193
192
  }
194
- declare function PasskeySection({ endpoints, components, onSuccess, onError }: PasskeySectionProps): React.JSX.Element;
195
-
193
+ export declare function PasskeySection({ endpoints, components, onSuccess, onError }: PasskeySectionProps): React.JSX.Element;
196
194
  /**
197
195
  * The sibling applications an identity provider reports for the signed-in person.
198
196
  *
@@ -202,10 +200,10 @@ declare function PasskeySection({ endpoints, components, onSuccess, onError }: P
202
200
  * What they cannot afford to do differently is decide which entries are safe to render, so
203
201
  * that decision lives here and the transport stays the application's business.
204
202
  */
205
- interface RelyingApplication {
206
- key: string;
207
- name: string;
208
- url: string;
203
+ export interface RelyingApplication {
204
+ key: string;
205
+ name: string;
206
+ url: string;
209
207
  }
210
208
  /**
211
209
  * Reduce a URL from the wire to one that is safe to put in an `href`, or reject it.
@@ -221,7 +219,7 @@ interface RelyingApplication {
221
219
  * provider told us something unexpected, and guessing a base for it would be inventing a
222
220
  * destination rather than validating one.
223
221
  */
224
- declare function safeApplicationHref(url: string): string | null;
222
+ export declare function safeApplicationHref(url: string): string | null;
225
223
  /**
226
224
  * Validate whatever the page handed over into a list that is safe to render.
227
225
  *
@@ -229,187 +227,195 @@ declare function safeApplicationHref(url: string): string | null;
229
227
  * malformed entry, or a provider that has grown a field, must not be able to take down the
230
228
  * page it appears on. Anything that is not a well-formed list degrades to an empty menu.
231
229
  */
232
- declare function relyingApplicationsFrom(value: unknown): RelyingApplication[];
233
-
234
- declare function getCsrfToken(explicitToken?: string): string;
235
- declare function base64urlToArrayBuffer(b64: string): ArrayBuffer;
236
- declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
237
- declare function isAbortError(error: unknown): boolean;
230
+ export declare function relyingApplicationsFrom(value: unknown): RelyingApplication[];
231
+ export declare function getCsrfToken(explicitToken?: string): string;
232
+ export declare function base64urlToArrayBuffer(b64: string): ArrayBuffer;
233
+ export declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
234
+ export declare function isAbortError(error: unknown): boolean;
238
235
  interface AuthenticateWithPasskeyOptions {
239
- endpoints?: AuthEndpointConfig;
240
- mediation?: CredentialMediationRequirement;
241
- signal?: AbortSignal;
242
- /** Read after the browser ceremony, immediately before the sign-in request. */
243
- remember?: boolean | (() => boolean);
236
+ endpoints?: AuthEndpointConfig;
237
+ mediation?: CredentialMediationRequirement;
238
+ signal?: AbortSignal;
239
+ /** Read after the browser ceremony, immediately before the sign-in request. */
240
+ remember?: boolean | (() => boolean);
244
241
  }
245
242
  interface PasskeyAuthenticationResult {
246
- redirectUrl: string;
247
- result: AuthJsonResponse;
243
+ redirectUrl: string;
244
+ result: AuthJsonResponse;
248
245
  }
249
246
  interface RegisterPasskeyOptions {
250
- endpoints?: AuthEndpointConfig;
251
- name?: string;
252
- signal?: AbortSignal;
247
+ endpoints?: AuthEndpointConfig;
248
+ name?: string;
249
+ signal?: AbortSignal;
253
250
  }
254
251
  interface PasskeyRegistrationResult {
255
- result: AuthJsonResponse;
252
+ result: AuthJsonResponse;
256
253
  }
257
- declare function getDefaultPasskeyName(): string;
258
- declare function isConditionalMediationAvailable(): Promise<boolean>;
259
- declare function authenticateWithPasskey({ endpoints, mediation, signal, remember }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
260
- declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
261
-
254
+ export declare function getDefaultPasskeyName(): string;
255
+ export declare function isConditionalMediationAvailable(): Promise<boolean>;
256
+ export declare function authenticateWithPasskey({ endpoints, mediation, signal, remember }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
257
+ export declare class PasswordConfirmationRequiredError extends Error {
258
+ constructor();
259
+ }
260
+ export declare function confirmPasswordForPasskey({ password, endpoints, signal }: {
261
+ password: string;
262
+ endpoints?: AuthEndpointConfig;
263
+ signal?: AbortSignal;
264
+ }): Promise<void>;
265
+ export declare function confirmPasskey({ endpoints, signal }?: {
266
+ endpoints?: AuthEndpointConfig;
267
+ signal?: AbortSignal;
268
+ }): Promise<void>;
269
+ export declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
262
270
  /**
263
271
  * Pure selection logic for the scope picker. Implications are a picker-only
264
272
  * cascade: the credential still stores exactly the ids that end up selected,
265
273
  * and the server never infers one scope from another.
266
274
  */
267
275
  /** scope id => scope ids it needs, e.g. `{ 'billing:write': ['billing:read'] }`. */
268
- type ScopeImplications = Record<string, string[]>;
276
+ export type ScopeImplications = Record<string, string[]>;
269
277
  /** Transitive closure of `implications`, with self-references and cycles dropped. */
270
- declare function closeImplications(implications: ScopeImplications): ScopeImplications;
278
+ export declare function closeImplications(implications: ScopeImplications): ScopeImplications;
271
279
  /** Keeps only entries whose key and every requirement are offered; drops entries left empty. */
272
- declare function restrictImplications(implications: ScopeImplications | undefined, offered: Set<string>): ScopeImplications;
280
+ export declare function restrictImplications(implications: ScopeImplications | undefined, offered: Set<string>): ScopeImplications;
273
281
  /** Orders `ids` by `catalog`, removing duplicates and ids not in it. */
274
- declare function inCatalogOrder(ids: Iterable<string>, catalog: string[]): string[];
282
+ export declare function inCatalogOrder(ids: Iterable<string>, catalog: string[]): string[];
275
283
  /** Ticking: adds the ids and everything they need. */
276
- declare function withScopes(selected: string[], ids: string[], closed: ScopeImplications): Set<string>;
284
+ export declare function withScopes(selected: string[], ids: string[], closed: ScopeImplications): Set<string>;
277
285
  /** Unticking: removes the ids and every selected scope that needs one of them. */
278
- declare function withoutScopes(selected: string[], ids: string[], closed: ScopeImplications): Set<string>;
286
+ export declare function withoutScopes(selected: string[], ids: string[], closed: ScopeImplications): Set<string>;
279
287
  /** Selected scopes that need `id`, in catalog order: why `id` is ticked beyond the person's own choice. */
280
- declare function neededBy(id: string, selected: string[], closed: ScopeImplications): string[];
281
- declare function sameSelection(a: string[], b: string[]): boolean;
282
-
288
+ export declare function neededBy(id: string, selected: string[], closed: ScopeImplications): string[];
289
+ export declare function sameSelection(a: string[], b: string[]): boolean;
283
290
  /** A named set of related scopes (`scopes` are ids from the sibling scope list). */
284
- interface ApiCredentialScopeGroup {
285
- id: string;
286
- label: string;
287
- description: string | null;
288
- /** A sensitive group is one parent checkbox, with its scopes behind a disclosure. */
289
- sensitive: boolean;
290
- scopes: string[];
291
+ export interface ApiCredentialScopeGroup {
292
+ id: string;
293
+ label: string;
294
+ description: string | null;
295
+ /** A sensitive group is one parent checkbox, with its scopes behind a disclosure. */
296
+ sensitive: boolean;
297
+ scopes: string[];
291
298
  }
292
299
  /** A one-click selection: choosing it replaces the selection with exactly `scopes`. */
293
- interface ApiCredentialScopePreset {
294
- id: string;
295
- label: string;
296
- description: string;
297
- scopes: string[];
298
- }
299
- interface ScopePickerProps {
300
- idPrefix: string;
301
- scopes: ApiCredentialScope[];
302
- /** Absent or empty: a flat list, as before groups existed. */
303
- groups?: ApiCredentialScopeGroup[];
304
- presets?: ApiCredentialScopePreset[];
305
- implications?: ScopeImplications;
306
- selected: string[];
307
- onChange: (next: string[]) => void;
308
- components: AuthComponentInput;
309
- }
310
- declare function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected, onChange, components }: ScopePickerProps): React.JSX.Element;
311
-
312
- interface ApiCredentialScope {
313
- id: string;
314
- description: string;
315
- }
316
- interface ApiCredentialToken {
317
- id: string;
318
- name: string;
319
- scopes: string[];
320
- created_at: string | null;
321
- expires_at: string | null;
322
- revoke_href: string;
323
- /** True for a token that carries an MCP connection scope. */
324
- connection?: boolean;
325
- }
326
- interface ApiCredentialApp {
327
- id: string;
328
- name: string;
329
- confidential: boolean;
330
- redirect_uris: string[];
331
- scopes: string[];
332
- created_at: string | null;
333
- delete_href: string;
300
+ export interface ApiCredentialScopePreset {
301
+ id: string;
302
+ label: string;
303
+ description: string;
304
+ scopes: string[];
305
+ }
306
+ export interface ScopePickerProps {
307
+ idPrefix: string;
308
+ scopes: ApiCredentialScope[];
309
+ /** Absent or empty: a flat list, as before groups existed. */
310
+ groups?: ApiCredentialScopeGroup[];
311
+ presets?: ApiCredentialScopePreset[];
312
+ implications?: ScopeImplications;
313
+ selected: string[];
314
+ onChange: (next: string[]) => void;
315
+ components: AuthComponentInput;
316
+ }
317
+ export declare function ScopePicker({ idPrefix, scopes, groups, presets, implications, selected, onChange, components }: ScopePickerProps): React.JSX.Element;
318
+ export interface ApiCredentialScope {
319
+ id: string;
320
+ description: string;
321
+ }
322
+ export interface ApiCredentialToken {
323
+ id: string;
324
+ name: string;
325
+ scopes: string[];
326
+ created_at: string | null;
327
+ expires_at: string | null;
328
+ revoke_href: string;
329
+ /** True for a token that carries an MCP connection scope. */
330
+ connection?: boolean;
331
+ }
332
+ export interface ApiCredentialApp {
333
+ id: string;
334
+ name: string;
335
+ confidential: boolean;
336
+ redirect_uris: string[];
337
+ scopes: string[];
338
+ created_at: string | null;
339
+ delete_href: string;
334
340
  }
335
341
  /** The server's index response (`data`): every URL is finished; this component assembles none. */
336
- interface ApiCredentialIndex {
337
- scopes: ApiCredentialScope[];
338
- token_lifetimes: string[];
339
- /** Null while issuing is unavailable (the OAuth server is switched off). Revocation stays available. */
340
- issue_token_href: string | null;
341
- register_app_href: string | null;
342
- tokens: ApiCredentialToken[];
343
- apps: ApiCredentialApp[];
344
- /**
345
- * Grouped picker data, all optional and presentation only: the credential still
346
- * stores explicit scope ids. `scope_*` serves the OAuth-app form and, unless the
347
- * matching `token_*` key is present, the token form. Without groups the picker is a flat list.
348
- */
349
- scope_groups?: ApiCredentialScopeGroup[];
350
- scope_presets?: ApiCredentialScopePreset[];
351
- /** scope id => scope ids it needs: ticking a scope ticks them, unticking one unticks what needs it. */
352
- scope_implications?: ScopeImplications;
353
- /** A narrower scope list for personal tokens, when the server offers one. */
354
- token_scopes?: ApiCredentialScope[];
355
- token_scope_groups?: ApiCredentialScopeGroup[];
356
- token_scope_presets?: ApiCredentialScopePreset[];
357
- token_scope_implications?: ScopeImplications;
358
- /** Offered to personal tokens only: MCP connection scopes, listed after the token scopes. */
359
- token_connection_scopes?: ApiCredentialScope[];
360
- /** The lifetimes a token carrying a connection scope may have; replaces `token_lifetimes` for it. */
361
- connection_token_lifetimes?: string[];
362
- }
363
- type IssuedApiCredential = {
364
- kind: 'token';
365
- name: string;
366
- token: string;
367
- expires_at?: string;
342
+ export interface ApiCredentialIndex {
343
+ scopes: ApiCredentialScope[];
344
+ token_lifetimes: string[];
345
+ /** Null while issuing is unavailable (the OAuth server is switched off). Revocation stays available. */
346
+ issue_token_href: string | null;
347
+ register_app_href: string | null;
348
+ tokens: ApiCredentialToken[];
349
+ apps: ApiCredentialApp[];
350
+ /**
351
+ * Grouped picker data, all optional and presentation only: the credential still
352
+ * stores explicit scope ids. `scope_*` serves the OAuth-app form and, unless the
353
+ * matching `token_*` key is present, the token form. Without groups the picker is a flat list.
354
+ */
355
+ scope_groups?: ApiCredentialScopeGroup[];
356
+ scope_presets?: ApiCredentialScopePreset[];
357
+ /** scope id => scope ids it needs: ticking a scope ticks them, unticking one unticks what needs it. */
358
+ scope_implications?: ScopeImplications;
359
+ /** A narrower scope list for personal tokens, when the server offers one. */
360
+ token_scopes?: ApiCredentialScope[];
361
+ token_scope_groups?: ApiCredentialScopeGroup[];
362
+ token_scope_presets?: ApiCredentialScopePreset[];
363
+ token_scope_implications?: ScopeImplications;
364
+ /** Offered to personal tokens only: MCP connection scopes, listed after the token scopes. */
365
+ token_connection_scopes?: ApiCredentialScope[];
366
+ /** The lifetimes a token carrying a connection scope may have; replaces `token_lifetimes` for it. */
367
+ connection_token_lifetimes?: string[];
368
+ }
369
+ export type IssuedApiCredential = {
370
+ kind: 'token';
371
+ name: string;
372
+ token: string;
373
+ expires_at?: string;
368
374
  } | {
369
- kind: 'app';
370
- name: string;
371
- client_id: string;
372
- client_secret: string | null;
375
+ kind: 'app';
376
+ name: string;
377
+ client_id: string;
378
+ client_secret: string | null;
373
379
  };
374
- interface ApiCredentialEndpointLink {
375
- label: string;
376
- url: string;
380
+ export interface ApiCredentialEndpointLink {
381
+ label: string;
382
+ url: string;
377
383
  }
378
384
  /**
379
385
  * The outcome of one credential request: on success the parsed JSON body
380
386
  * (the component reads its `data` when present), on failure the message to show.
381
387
  */
382
- type ApiCredentialRequestResult = {
383
- ok: true;
384
- status: number;
385
- payload: unknown;
388
+ export type ApiCredentialRequestResult = {
389
+ ok: true;
390
+ status: number;
391
+ payload: unknown;
386
392
  } | {
387
- ok: false;
388
- status: number;
389
- message: string;
393
+ ok: false;
394
+ status: number;
395
+ message: string;
390
396
  };
391
397
  /**
392
398
  * Performs one credential request in place of the built-in `fetch`, so an app
393
399
  * can route it through its own client (session-expiry redirect, CSRF, retries).
394
400
  */
395
- type ApiCredentialRequest = (method: 'GET' | 'POST' | 'DELETE', url: string, body?: object) => Promise<ApiCredentialRequestResult>;
396
- interface ApiCredentialsSectionProps {
397
- /** The credential service's index URL (GET). */
398
- indexUrl: string;
399
- components: AuthComponentInput;
400
- /** Values a connector needs: the OpenAPI document, API base, OAuth authorize/token URLs, MCP URL. */
401
- links?: ApiCredentialEndpointLink[];
402
- csrfToken?: string;
403
- /** Replaces the built-in `fetch` for every credential request; `csrfToken` is then the app's to send. */
404
- request?: ApiCredentialRequest;
405
- onSuccess?: (message: string) => void;
406
- onError?: (field: string, message: string) => void;
407
- /**
408
- * `stacked` (default) puts the token and OAuth-app sections one under the other.
409
- * `columns` lays them side by side when the container is wide enough (about 960px);
410
- * narrower containers stack them.
411
- */
412
- layout?: 'stacked' | 'columns';
401
+ export type ApiCredentialRequest = (method: 'GET' | 'POST' | 'DELETE', url: string, body?: object) => Promise<ApiCredentialRequestResult>;
402
+ export interface ApiCredentialsSectionProps {
403
+ /** The credential service's index URL (GET). */
404
+ indexUrl: string;
405
+ components: AuthComponentInput;
406
+ /** Values a connector needs: the OpenAPI document, API base, OAuth authorize/token URLs, MCP URL. */
407
+ links?: ApiCredentialEndpointLink[];
408
+ csrfToken?: string;
409
+ /** Replaces the built-in `fetch` for every credential request; `csrfToken` is then the app's to send. */
410
+ request?: ApiCredentialRequest;
411
+ onSuccess?: (message: string) => void;
412
+ onError?: (field: string, message: string) => void;
413
+ /**
414
+ * `stacked` (default) puts the token and OAuth-app sections one under the other.
415
+ * `columns` lays them side by side when the container is wide enough (about 960px);
416
+ * narrower containers stack them.
417
+ */
418
+ layout?: 'stacked' | 'columns';
413
419
  }
414
420
  /**
415
421
  * A person's credentials for apps that use the API: personal API tokens (for
@@ -420,9 +426,7 @@ interface ApiCredentialsSectionProps {
420
426
  * in this component's memory; afterwards only the lists are reloaded, so it is
421
427
  * never part of page props or browser history.
422
428
  */
423
- declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError, layout }: ApiCredentialsSectionProps): React.JSX.Element;
429
+ export declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, request, onSuccess, onError, layout }: ApiCredentialsSectionProps): React.JSX.Element;
424
430
  /** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
425
- declare function describeDuration(spec: string): string;
426
-
427
- export { ApiCredentialsSection, ChangePasswordForm, LoginForm, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, ResetPasswordForm, ScopePicker, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, closeImplications, describeDuration, getCsrfToken, getDefaultPasskeyName, inCatalogOrder, isAbortError, isConditionalMediationAvailable, neededBy, registerPasskey, relyingApplicationsFrom, restrictImplications, safeApplicationHref, sameSelection, withScopes, withoutScopes };
428
- export type { ApiCredentialApp, ApiCredentialEndpointLink, ApiCredentialIndex, ApiCredentialRequest, ApiCredentialRequestResult, ApiCredentialScope, ApiCredentialScopeGroup, ApiCredentialScopePreset, ApiCredentialToken, ApiCredentialsSectionProps, AuthBadgeComponentProps, AuthButtonComponent, AuthButtonComponentInput, AuthButtonComponentProps, AuthButtonSize, AuthButtonVariant, AuthCheckboxComponentProps, AuthComponentInput, AuthComponentOverrides, AuthComponentSet, AuthComponentSuperset, AuthComponents, AuthContainerComponentProps, AuthEndpointConfig, AuthInputComponentProps, AuthJsonResponse, AuthLabelComponentProps, AuthRadioGroupComponentProps, AuthRadioGroupOption, AuthSignupField, AuthSignupValues, AuthTextareaComponentProps, AuthValidationErrors, IssuedApiCredential, LoginFormProps, LoginRememberMeCheckboxProps, Passkey, PasswordResetRequestFormProps, RelyingApplication, ResetPasswordFormProps, ScopeImplications, ScopePickerProps };
431
+ export declare function describeDuration(spec: string): string;
432
+ export {};