cauthy-auth 0.10.0 → 0.12.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 +3 -2
- package/dist/cli.js +299 -20
- package/dist/client.d.mts +88 -5
- package/dist/client.d.ts +88 -5
- package/dist/client.js +202 -11
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +200 -11
- package/dist/client.mjs.map +1 -1
- package/dist/index.js +128 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -5
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +110 -5
- package/dist/react.d.ts +110 -5
- package/dist/react.js +338 -20
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +335 -20
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +198 -11
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +198 -11
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +198 -11
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +198 -11
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -210,6 +210,15 @@ interface PublicSession {
|
|
|
210
210
|
|
|
211
211
|
type AuthField = 'email' | 'password' | 'newPassword' | 'name' | 'code';
|
|
212
212
|
|
|
213
|
+
/** Whether this browser can use a passkey at all. */
|
|
214
|
+
declare function canUsePasskeys(): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Whether this browser offers passkeys in the autofill of a field marked
|
|
217
|
+
* `autocomplete="username webauthn"`, so the person picks one without
|
|
218
|
+
* looking for a button.
|
|
219
|
+
*/
|
|
220
|
+
declare function canAutofillPasskeys(): Promise<boolean>;
|
|
221
|
+
|
|
213
222
|
/** What went wrong, in a form the screen can show. */
|
|
214
223
|
interface AuthError {
|
|
215
224
|
/** Stable, for translating: `invalid_credentials`, `invalid_email`, `too_short`, `email_taken`, `unavailable`… */
|
|
@@ -235,8 +244,29 @@ interface AuthMethods {
|
|
|
235
244
|
/** Whether people may create an account themselves. */
|
|
236
245
|
signUp: boolean;
|
|
237
246
|
magicLink: boolean;
|
|
238
|
-
/** Whether to offer a passkey.
|
|
247
|
+
/** Whether to offer a passkey. */
|
|
239
248
|
passkey: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the passkey is used on this page itself. False: `signIn.passkey`
|
|
251
|
+
* sends the person to Cauthy's page for that step alone, and they come back
|
|
252
|
+
* signed in. That happens only when this page is outside the domain the
|
|
253
|
+
* workspace's passkeys belong to.
|
|
254
|
+
*/
|
|
255
|
+
passkeyHere: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Whether Cauthy's page can use the passkey, for that step alone: where a
|
|
258
|
+
* page that cannot, or a browser that refuses to here, sends the person.
|
|
259
|
+
*/
|
|
260
|
+
passkeyOnCauthy: boolean;
|
|
261
|
+
}
|
|
262
|
+
/** A passkey of the signed-in account. Moments are UTC. */
|
|
263
|
+
interface Passkey {
|
|
264
|
+
id: string;
|
|
265
|
+
/** What the person called it ("My laptop"), or "". */
|
|
266
|
+
name: string;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
/** When it last signed the person in, or null. */
|
|
269
|
+
lastUsedAt: string | null;
|
|
240
270
|
}
|
|
241
271
|
/** A person's own account, as their account screen shows it. */
|
|
242
272
|
interface Account$1 {
|
|
@@ -340,6 +370,22 @@ interface AccountClient {
|
|
|
340
370
|
sessions(): Promise<AccountSession[]>;
|
|
341
371
|
/** Signs the account out everywhere, here too. */
|
|
342
372
|
signOutEverywhere(): Promise<AuthResult<'signed_out'>>;
|
|
373
|
+
/** The account's passkeys. */
|
|
374
|
+
passkeys(): Promise<Passkey[]>;
|
|
375
|
+
/**
|
|
376
|
+
* Makes a passkey on this device, on this page: the browser asks the person
|
|
377
|
+
* for their fingerprint, face or screen lock. An account with a password
|
|
378
|
+
* proves it again first. `cancelled`: the person closed the browser's prompt.
|
|
379
|
+
*/
|
|
380
|
+
addPasskey(form?: {
|
|
381
|
+
password?: string;
|
|
382
|
+
name?: string;
|
|
383
|
+
}): Promise<AuthResult<'added', {
|
|
384
|
+
passkey: Passkey;
|
|
385
|
+
}>>;
|
|
386
|
+
removePasskey(id: string): Promise<AuthResult<'removed', {
|
|
387
|
+
id: string;
|
|
388
|
+
}>>;
|
|
343
389
|
}
|
|
344
390
|
interface AuthClient {
|
|
345
391
|
signIn: {
|
|
@@ -372,12 +418,49 @@ interface AuthClient {
|
|
|
372
418
|
}): Promise<AuthResult<'signed_in', {
|
|
373
419
|
session: PublicSession;
|
|
374
420
|
}>>;
|
|
375
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* Signs in with a passkey, on this page: the browser asks the person for
|
|
423
|
+
* their fingerprint, face or screen lock. When this page cannot use the
|
|
424
|
+
* workspace's passkeys (`methods().passkeyHere` is false), the browser goes
|
|
425
|
+
* to Cauthy's page for that step alone and comes back signed in, at
|
|
426
|
+
* `returnTo`: then the answer is `redirected`. `cancelled`: the person
|
|
427
|
+
* closed the browser's prompt.
|
|
428
|
+
*/
|
|
376
429
|
passkey(options?: {
|
|
377
430
|
returnTo?: string;
|
|
378
431
|
locale?: string;
|
|
379
|
-
}):
|
|
380
|
-
|
|
432
|
+
}): Promise<AuthResult<'signed_in', {
|
|
433
|
+
session: PublicSession;
|
|
434
|
+
}> | AuthResult<'redirected'>>;
|
|
435
|
+
/**
|
|
436
|
+
* Offers the person's passkeys in the browser's autofill of the email
|
|
437
|
+
* field, which must carry `autocomplete="username webauthn"`, and signs in
|
|
438
|
+
* with the one they pick. It waits until they pick one or `signal`
|
|
439
|
+
* aborts: abort it before calling `passkey` or sending the form.
|
|
440
|
+
* `cancelled`: aborted, or this browser or page cannot (then there is
|
|
441
|
+
* nothing to offer, and the passkey button still works).
|
|
442
|
+
*/
|
|
443
|
+
passkeyAutofill(options?: {
|
|
444
|
+
signal?: AbortSignal;
|
|
445
|
+
}): Promise<AuthResult<'signed_in', {
|
|
446
|
+
session: PublicSession;
|
|
447
|
+
}>>;
|
|
448
|
+
/**
|
|
449
|
+
* Google One Tap: Google's prompt over the page offers the Google account
|
|
450
|
+
* the browser already has, and signs in with it in one tap, as the Google
|
|
451
|
+
* sign-in does (the same account). Needs the workspace's Google sign-in,
|
|
452
|
+
* and the page's address among the Google client's authorized JavaScript
|
|
453
|
+
* origins. Waits until the person picks an account or closes the prompt
|
|
454
|
+
* (`cancelled`), or `signal` aborts. `one_tap_unavailable`: the workspace
|
|
455
|
+
* has no Google sign-in.
|
|
456
|
+
*/
|
|
457
|
+
googleOneTap(options?: {
|
|
458
|
+
signal?: AbortSignal;
|
|
459
|
+
context?: 'signin' | 'signup' | 'use';
|
|
460
|
+
}): Promise<AuthResult<'signed_in', {
|
|
461
|
+
session: PublicSession;
|
|
462
|
+
}>>;
|
|
463
|
+
/** Where `passkey` sends the browser when this page cannot use the passkey itself. */
|
|
381
464
|
passkeyUrl(options?: {
|
|
382
465
|
returnTo?: string;
|
|
383
466
|
locale?: string;
|
|
@@ -489,6 +572,13 @@ interface AuthTexts {
|
|
|
489
572
|
keepCodes: string;
|
|
490
573
|
passkeys: string;
|
|
491
574
|
managePasskeys: string;
|
|
575
|
+
passkeysHelp: string;
|
|
576
|
+
noPasskeys: string;
|
|
577
|
+
passkeyName: string;
|
|
578
|
+
addPasskey: string;
|
|
579
|
+
removePasskey: string;
|
|
580
|
+
passkeyAdded: string;
|
|
581
|
+
passkeyUnnamed: string;
|
|
492
582
|
sessions: string;
|
|
493
583
|
signOutEverywhere: string;
|
|
494
584
|
unknownDevice: string;
|
|
@@ -567,6 +657,21 @@ interface AuthFormProps {
|
|
|
567
657
|
};
|
|
568
658
|
}
|
|
569
659
|
declare function SignIn(props: AuthFormProps): react.JSX.Element;
|
|
660
|
+
interface GoogleOneTapProps {
|
|
661
|
+
/** Where to go once signed in. Without it (and without `onSuccess`), the page stays and its session updates. */
|
|
662
|
+
returnTo?: string;
|
|
663
|
+
/** Called once signed in, instead of going to `returnTo`. */
|
|
664
|
+
onSuccess?: () => void;
|
|
665
|
+
/** The prompt's words: sign in (default), sign up, or use the application. */
|
|
666
|
+
context?: 'signin' | 'signup' | 'use';
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Google One Tap: put it on any page, and a person who is not signed in sees
|
|
670
|
+
* Google's prompt with the Google account the browser has; one tap signs them
|
|
671
|
+
* in. It draws nothing of its own, and shows nothing to somebody signed in or
|
|
672
|
+
* where the workspace has no Google sign-in.
|
|
673
|
+
*/
|
|
674
|
+
declare function GoogleOneTap(props: GoogleOneTapProps): null;
|
|
570
675
|
declare function SignUp(props: AuthFormProps): react.JSX.Element;
|
|
571
676
|
declare function ForgotPassword(props: AuthFormProps): react.JSX.Element;
|
|
572
677
|
/** The page a "choose a new password" link opens: `pages.resetPassword`. */
|
|
@@ -629,4 +734,4 @@ declare function useSession(): SessionContext;
|
|
|
629
734
|
*/
|
|
630
735
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
631
736
|
|
|
632
|
-
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, ForgotPassword, type JsonValue, type LinkedIdentity, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, createAuthClient, definePolicy, useAuth, useSession };
|
|
737
|
+
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
package/dist/react.d.ts
CHANGED
|
@@ -210,6 +210,15 @@ interface PublicSession {
|
|
|
210
210
|
|
|
211
211
|
type AuthField = 'email' | 'password' | 'newPassword' | 'name' | 'code';
|
|
212
212
|
|
|
213
|
+
/** Whether this browser can use a passkey at all. */
|
|
214
|
+
declare function canUsePasskeys(): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Whether this browser offers passkeys in the autofill of a field marked
|
|
217
|
+
* `autocomplete="username webauthn"`, so the person picks one without
|
|
218
|
+
* looking for a button.
|
|
219
|
+
*/
|
|
220
|
+
declare function canAutofillPasskeys(): Promise<boolean>;
|
|
221
|
+
|
|
213
222
|
/** What went wrong, in a form the screen can show. */
|
|
214
223
|
interface AuthError {
|
|
215
224
|
/** Stable, for translating: `invalid_credentials`, `invalid_email`, `too_short`, `email_taken`, `unavailable`… */
|
|
@@ -235,8 +244,29 @@ interface AuthMethods {
|
|
|
235
244
|
/** Whether people may create an account themselves. */
|
|
236
245
|
signUp: boolean;
|
|
237
246
|
magicLink: boolean;
|
|
238
|
-
/** Whether to offer a passkey.
|
|
247
|
+
/** Whether to offer a passkey. */
|
|
239
248
|
passkey: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the passkey is used on this page itself. False: `signIn.passkey`
|
|
251
|
+
* sends the person to Cauthy's page for that step alone, and they come back
|
|
252
|
+
* signed in. That happens only when this page is outside the domain the
|
|
253
|
+
* workspace's passkeys belong to.
|
|
254
|
+
*/
|
|
255
|
+
passkeyHere: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Whether Cauthy's page can use the passkey, for that step alone: where a
|
|
258
|
+
* page that cannot, or a browser that refuses to here, sends the person.
|
|
259
|
+
*/
|
|
260
|
+
passkeyOnCauthy: boolean;
|
|
261
|
+
}
|
|
262
|
+
/** A passkey of the signed-in account. Moments are UTC. */
|
|
263
|
+
interface Passkey {
|
|
264
|
+
id: string;
|
|
265
|
+
/** What the person called it ("My laptop"), or "". */
|
|
266
|
+
name: string;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
/** When it last signed the person in, or null. */
|
|
269
|
+
lastUsedAt: string | null;
|
|
240
270
|
}
|
|
241
271
|
/** A person's own account, as their account screen shows it. */
|
|
242
272
|
interface Account$1 {
|
|
@@ -340,6 +370,22 @@ interface AccountClient {
|
|
|
340
370
|
sessions(): Promise<AccountSession[]>;
|
|
341
371
|
/** Signs the account out everywhere, here too. */
|
|
342
372
|
signOutEverywhere(): Promise<AuthResult<'signed_out'>>;
|
|
373
|
+
/** The account's passkeys. */
|
|
374
|
+
passkeys(): Promise<Passkey[]>;
|
|
375
|
+
/**
|
|
376
|
+
* Makes a passkey on this device, on this page: the browser asks the person
|
|
377
|
+
* for their fingerprint, face or screen lock. An account with a password
|
|
378
|
+
* proves it again first. `cancelled`: the person closed the browser's prompt.
|
|
379
|
+
*/
|
|
380
|
+
addPasskey(form?: {
|
|
381
|
+
password?: string;
|
|
382
|
+
name?: string;
|
|
383
|
+
}): Promise<AuthResult<'added', {
|
|
384
|
+
passkey: Passkey;
|
|
385
|
+
}>>;
|
|
386
|
+
removePasskey(id: string): Promise<AuthResult<'removed', {
|
|
387
|
+
id: string;
|
|
388
|
+
}>>;
|
|
343
389
|
}
|
|
344
390
|
interface AuthClient {
|
|
345
391
|
signIn: {
|
|
@@ -372,12 +418,49 @@ interface AuthClient {
|
|
|
372
418
|
}): Promise<AuthResult<'signed_in', {
|
|
373
419
|
session: PublicSession;
|
|
374
420
|
}>>;
|
|
375
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* Signs in with a passkey, on this page: the browser asks the person for
|
|
423
|
+
* their fingerprint, face or screen lock. When this page cannot use the
|
|
424
|
+
* workspace's passkeys (`methods().passkeyHere` is false), the browser goes
|
|
425
|
+
* to Cauthy's page for that step alone and comes back signed in, at
|
|
426
|
+
* `returnTo`: then the answer is `redirected`. `cancelled`: the person
|
|
427
|
+
* closed the browser's prompt.
|
|
428
|
+
*/
|
|
376
429
|
passkey(options?: {
|
|
377
430
|
returnTo?: string;
|
|
378
431
|
locale?: string;
|
|
379
|
-
}):
|
|
380
|
-
|
|
432
|
+
}): Promise<AuthResult<'signed_in', {
|
|
433
|
+
session: PublicSession;
|
|
434
|
+
}> | AuthResult<'redirected'>>;
|
|
435
|
+
/**
|
|
436
|
+
* Offers the person's passkeys in the browser's autofill of the email
|
|
437
|
+
* field, which must carry `autocomplete="username webauthn"`, and signs in
|
|
438
|
+
* with the one they pick. It waits until they pick one or `signal`
|
|
439
|
+
* aborts: abort it before calling `passkey` or sending the form.
|
|
440
|
+
* `cancelled`: aborted, or this browser or page cannot (then there is
|
|
441
|
+
* nothing to offer, and the passkey button still works).
|
|
442
|
+
*/
|
|
443
|
+
passkeyAutofill(options?: {
|
|
444
|
+
signal?: AbortSignal;
|
|
445
|
+
}): Promise<AuthResult<'signed_in', {
|
|
446
|
+
session: PublicSession;
|
|
447
|
+
}>>;
|
|
448
|
+
/**
|
|
449
|
+
* Google One Tap: Google's prompt over the page offers the Google account
|
|
450
|
+
* the browser already has, and signs in with it in one tap, as the Google
|
|
451
|
+
* sign-in does (the same account). Needs the workspace's Google sign-in,
|
|
452
|
+
* and the page's address among the Google client's authorized JavaScript
|
|
453
|
+
* origins. Waits until the person picks an account or closes the prompt
|
|
454
|
+
* (`cancelled`), or `signal` aborts. `one_tap_unavailable`: the workspace
|
|
455
|
+
* has no Google sign-in.
|
|
456
|
+
*/
|
|
457
|
+
googleOneTap(options?: {
|
|
458
|
+
signal?: AbortSignal;
|
|
459
|
+
context?: 'signin' | 'signup' | 'use';
|
|
460
|
+
}): Promise<AuthResult<'signed_in', {
|
|
461
|
+
session: PublicSession;
|
|
462
|
+
}>>;
|
|
463
|
+
/** Where `passkey` sends the browser when this page cannot use the passkey itself. */
|
|
381
464
|
passkeyUrl(options?: {
|
|
382
465
|
returnTo?: string;
|
|
383
466
|
locale?: string;
|
|
@@ -489,6 +572,13 @@ interface AuthTexts {
|
|
|
489
572
|
keepCodes: string;
|
|
490
573
|
passkeys: string;
|
|
491
574
|
managePasskeys: string;
|
|
575
|
+
passkeysHelp: string;
|
|
576
|
+
noPasskeys: string;
|
|
577
|
+
passkeyName: string;
|
|
578
|
+
addPasskey: string;
|
|
579
|
+
removePasskey: string;
|
|
580
|
+
passkeyAdded: string;
|
|
581
|
+
passkeyUnnamed: string;
|
|
492
582
|
sessions: string;
|
|
493
583
|
signOutEverywhere: string;
|
|
494
584
|
unknownDevice: string;
|
|
@@ -567,6 +657,21 @@ interface AuthFormProps {
|
|
|
567
657
|
};
|
|
568
658
|
}
|
|
569
659
|
declare function SignIn(props: AuthFormProps): react.JSX.Element;
|
|
660
|
+
interface GoogleOneTapProps {
|
|
661
|
+
/** Where to go once signed in. Without it (and without `onSuccess`), the page stays and its session updates. */
|
|
662
|
+
returnTo?: string;
|
|
663
|
+
/** Called once signed in, instead of going to `returnTo`. */
|
|
664
|
+
onSuccess?: () => void;
|
|
665
|
+
/** The prompt's words: sign in (default), sign up, or use the application. */
|
|
666
|
+
context?: 'signin' | 'signup' | 'use';
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Google One Tap: put it on any page, and a person who is not signed in sees
|
|
670
|
+
* Google's prompt with the Google account the browser has; one tap signs them
|
|
671
|
+
* in. It draws nothing of its own, and shows nothing to somebody signed in or
|
|
672
|
+
* where the workspace has no Google sign-in.
|
|
673
|
+
*/
|
|
674
|
+
declare function GoogleOneTap(props: GoogleOneTapProps): null;
|
|
570
675
|
declare function SignUp(props: AuthFormProps): react.JSX.Element;
|
|
571
676
|
declare function ForgotPassword(props: AuthFormProps): react.JSX.Element;
|
|
572
677
|
/** The page a "choose a new password" link opens: `pages.resetPassword`. */
|
|
@@ -629,4 +734,4 @@ declare function useSession(): SessionContext;
|
|
|
629
734
|
*/
|
|
630
735
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
631
736
|
|
|
632
|
-
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, ForgotPassword, type JsonValue, type LinkedIdentity, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, createAuthClient, definePolicy, useAuth, useSession };
|
|
737
|
+
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|