bwh-auth 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/index.cjs +538 -61
- package/dist/index.d.cts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +536 -61
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -136,10 +136,11 @@ interface PasskeyLoginButtonProps {
|
|
|
136
136
|
endpoints?: AuthEndpointConfig;
|
|
137
137
|
components: AuthButtonComponentInput;
|
|
138
138
|
className?: string;
|
|
139
|
+
disabled?: boolean;
|
|
139
140
|
onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
|
|
140
141
|
onError?: (message: string) => void;
|
|
141
142
|
}
|
|
142
|
-
declare function PasskeyLoginButton({ endpoints, components, className, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
143
|
+
declare function PasskeyLoginButton({ endpoints, components, className, disabled, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
143
144
|
|
|
144
145
|
interface PasskeySectionProps {
|
|
145
146
|
endpoints?: AuthEndpointConfig;
|
|
@@ -213,4 +214,73 @@ declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
|
213
214
|
declare function authenticateWithPasskey({ endpoints, mediation, signal }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
214
215
|
declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
interface ApiCredentialScope {
|
|
218
|
+
id: string;
|
|
219
|
+
description: string;
|
|
220
|
+
}
|
|
221
|
+
interface ApiCredentialToken {
|
|
222
|
+
id: string;
|
|
223
|
+
name: string;
|
|
224
|
+
scopes: string[];
|
|
225
|
+
created_at: string | null;
|
|
226
|
+
expires_at: string | null;
|
|
227
|
+
revoke_href: string;
|
|
228
|
+
}
|
|
229
|
+
interface ApiCredentialApp {
|
|
230
|
+
id: string;
|
|
231
|
+
name: string;
|
|
232
|
+
confidential: boolean;
|
|
233
|
+
redirect_uris: string[];
|
|
234
|
+
scopes: string[];
|
|
235
|
+
created_at: string | null;
|
|
236
|
+
delete_href: string;
|
|
237
|
+
}
|
|
238
|
+
/** The server's index response (`data`): every URL is finished; this component assembles none. */
|
|
239
|
+
interface ApiCredentialIndex {
|
|
240
|
+
scopes: ApiCredentialScope[];
|
|
241
|
+
token_lifetimes: string[];
|
|
242
|
+
/** Null while issuing is unavailable (the OAuth server is switched off). Revocation stays available. */
|
|
243
|
+
issue_token_href: string | null;
|
|
244
|
+
register_app_href: string | null;
|
|
245
|
+
tokens: ApiCredentialToken[];
|
|
246
|
+
apps: ApiCredentialApp[];
|
|
247
|
+
}
|
|
248
|
+
type IssuedApiCredential = {
|
|
249
|
+
kind: 'token';
|
|
250
|
+
name: string;
|
|
251
|
+
token: string;
|
|
252
|
+
expires_at?: string;
|
|
253
|
+
} | {
|
|
254
|
+
kind: 'app';
|
|
255
|
+
name: string;
|
|
256
|
+
client_id: string;
|
|
257
|
+
client_secret: string | null;
|
|
258
|
+
};
|
|
259
|
+
interface ApiCredentialEndpointLink {
|
|
260
|
+
label: string;
|
|
261
|
+
url: string;
|
|
262
|
+
}
|
|
263
|
+
interface ApiCredentialsSectionProps {
|
|
264
|
+
/** The credential service's index URL (GET). */
|
|
265
|
+
indexUrl: string;
|
|
266
|
+
components: AuthComponentInput;
|
|
267
|
+
/** Values a connector needs: the OpenAPI document, API base, OAuth authorize/token URLs, MCP URL. */
|
|
268
|
+
links?: ApiCredentialEndpointLink[];
|
|
269
|
+
csrfToken?: string;
|
|
270
|
+
onSuccess?: (message: string) => void;
|
|
271
|
+
onError?: (field: string, message: string) => void;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* A person's credentials for apps that use the API: personal API tokens (for
|
|
275
|
+
* connectors that ask for a key) and OAuth apps (for connectors that run the
|
|
276
|
+
* authorization-code flow).
|
|
277
|
+
*
|
|
278
|
+
* Each secret arrives once, in the response that created it, and lives only
|
|
279
|
+
* in this component's memory; afterwards only the lists are reloaded, so it is
|
|
280
|
+
* never part of page props or browser history.
|
|
281
|
+
*/
|
|
282
|
+
declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, onSuccess, onError }: ApiCredentialsSectionProps): React.JSX.Element;
|
|
283
|
+
/** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
|
|
284
|
+
declare function describeDuration(spec: string): string;
|
|
285
|
+
|
|
286
|
+
export { type ApiCredentialApp, type ApiCredentialEndpointLink, type ApiCredentialIndex, type ApiCredentialScope, type ApiCredentialToken, ApiCredentialsSection, type ApiCredentialsSectionProps, type AuthButtonComponent, type AuthButtonComponentInput, type AuthButtonComponentProps, type AuthButtonSize, type AuthButtonVariant, type AuthComponentInput, type AuthComponentOverrides, type AuthComponentSet, type AuthComponentSuperset, type AuthComponents, type AuthContainerComponentProps, type AuthEndpointConfig, type AuthInputComponentProps, type AuthJsonResponse, type AuthLabelComponentProps, type AuthSignupField, type AuthSignupValues, type AuthValidationErrors, ChangePasswordForm, type IssuedApiCredential, LoginForm, type LoginFormProps, type LoginRememberMeCheckboxProps, type Passkey, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, type RelyingApplication, ResetPasswordForm, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, describeDuration, getCsrfToken, getDefaultPasskeyName, isAbortError, isConditionalMediationAvailable, registerPasskey, relyingApplicationsFrom, safeApplicationHref };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,10 +136,11 @@ interface PasskeyLoginButtonProps {
|
|
|
136
136
|
endpoints?: AuthEndpointConfig;
|
|
137
137
|
components: AuthButtonComponentInput;
|
|
138
138
|
className?: string;
|
|
139
|
+
disabled?: boolean;
|
|
139
140
|
onSuccess?: (redirectUrl: string, result: AuthJsonResponse) => void;
|
|
140
141
|
onError?: (message: string) => void;
|
|
141
142
|
}
|
|
142
|
-
declare function PasskeyLoginButton({ endpoints, components, className, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
143
|
+
declare function PasskeyLoginButton({ endpoints, components, className, disabled, onSuccess, onError }: PasskeyLoginButtonProps): React.JSX.Element | null;
|
|
143
144
|
|
|
144
145
|
interface PasskeySectionProps {
|
|
145
146
|
endpoints?: AuthEndpointConfig;
|
|
@@ -213,4 +214,73 @@ declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
|
213
214
|
declare function authenticateWithPasskey({ endpoints, mediation, signal }?: AuthenticateWithPasskeyOptions): Promise<PasskeyAuthenticationResult>;
|
|
214
215
|
declare function registerPasskey({ endpoints, name, signal }?: RegisterPasskeyOptions): Promise<PasskeyRegistrationResult>;
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
interface ApiCredentialScope {
|
|
218
|
+
id: string;
|
|
219
|
+
description: string;
|
|
220
|
+
}
|
|
221
|
+
interface ApiCredentialToken {
|
|
222
|
+
id: string;
|
|
223
|
+
name: string;
|
|
224
|
+
scopes: string[];
|
|
225
|
+
created_at: string | null;
|
|
226
|
+
expires_at: string | null;
|
|
227
|
+
revoke_href: string;
|
|
228
|
+
}
|
|
229
|
+
interface ApiCredentialApp {
|
|
230
|
+
id: string;
|
|
231
|
+
name: string;
|
|
232
|
+
confidential: boolean;
|
|
233
|
+
redirect_uris: string[];
|
|
234
|
+
scopes: string[];
|
|
235
|
+
created_at: string | null;
|
|
236
|
+
delete_href: string;
|
|
237
|
+
}
|
|
238
|
+
/** The server's index response (`data`): every URL is finished; this component assembles none. */
|
|
239
|
+
interface ApiCredentialIndex {
|
|
240
|
+
scopes: ApiCredentialScope[];
|
|
241
|
+
token_lifetimes: string[];
|
|
242
|
+
/** Null while issuing is unavailable (the OAuth server is switched off). Revocation stays available. */
|
|
243
|
+
issue_token_href: string | null;
|
|
244
|
+
register_app_href: string | null;
|
|
245
|
+
tokens: ApiCredentialToken[];
|
|
246
|
+
apps: ApiCredentialApp[];
|
|
247
|
+
}
|
|
248
|
+
type IssuedApiCredential = {
|
|
249
|
+
kind: 'token';
|
|
250
|
+
name: string;
|
|
251
|
+
token: string;
|
|
252
|
+
expires_at?: string;
|
|
253
|
+
} | {
|
|
254
|
+
kind: 'app';
|
|
255
|
+
name: string;
|
|
256
|
+
client_id: string;
|
|
257
|
+
client_secret: string | null;
|
|
258
|
+
};
|
|
259
|
+
interface ApiCredentialEndpointLink {
|
|
260
|
+
label: string;
|
|
261
|
+
url: string;
|
|
262
|
+
}
|
|
263
|
+
interface ApiCredentialsSectionProps {
|
|
264
|
+
/** The credential service's index URL (GET). */
|
|
265
|
+
indexUrl: string;
|
|
266
|
+
components: AuthComponentInput;
|
|
267
|
+
/** Values a connector needs: the OpenAPI document, API base, OAuth authorize/token URLs, MCP URL. */
|
|
268
|
+
links?: ApiCredentialEndpointLink[];
|
|
269
|
+
csrfToken?: string;
|
|
270
|
+
onSuccess?: (message: string) => void;
|
|
271
|
+
onError?: (field: string, message: string) => void;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* A person's credentials for apps that use the API: personal API tokens (for
|
|
275
|
+
* connectors that ask for a key) and OAuth apps (for connectors that run the
|
|
276
|
+
* authorization-code flow).
|
|
277
|
+
*
|
|
278
|
+
* Each secret arrives once, in the response that created it, and lives only
|
|
279
|
+
* in this component's memory; afterwards only the lists are reloaded, so it is
|
|
280
|
+
* never part of page props or browser history.
|
|
281
|
+
*/
|
|
282
|
+
declare function ApiCredentialsSection({ indexUrl, components, links, csrfToken, onSuccess, onError }: ApiCredentialsSectionProps): React.JSX.Element;
|
|
283
|
+
/** PT4H → "4 hours", P30D → "30 days", P1Y → "1 year". Unknown shapes are shown as given. */
|
|
284
|
+
declare function describeDuration(spec: string): string;
|
|
285
|
+
|
|
286
|
+
export { type ApiCredentialApp, type ApiCredentialEndpointLink, type ApiCredentialIndex, type ApiCredentialScope, type ApiCredentialToken, ApiCredentialsSection, type ApiCredentialsSectionProps, type AuthButtonComponent, type AuthButtonComponentInput, type AuthButtonComponentProps, type AuthButtonSize, type AuthButtonVariant, type AuthComponentInput, type AuthComponentOverrides, type AuthComponentSet, type AuthComponentSuperset, type AuthComponents, type AuthContainerComponentProps, type AuthEndpointConfig, type AuthInputComponentProps, type AuthJsonResponse, type AuthLabelComponentProps, type AuthSignupField, type AuthSignupValues, type AuthValidationErrors, ChangePasswordForm, type IssuedApiCredential, LoginForm, type LoginFormProps, type LoginRememberMeCheckboxProps, type Passkey, PasskeyLoginButton, PasskeySection, PasswordResetRequestForm, type RelyingApplication, ResetPasswordForm, SignupForm, TwoFactorForm, arrayBufferToBase64url, authenticateWithPasskey, base64urlToArrayBuffer, describeDuration, getCsrfToken, getDefaultPasskeyName, isAbortError, isConditionalMediationAvailable, registerPasskey, relyingApplicationsFrom, safeApplicationHref };
|