cauthy-auth 0.19.0 → 0.22.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/dist/{cauthy-Bn3iv50y.d.ts → cauthy-DGAy45G2.d.ts} +1 -1
- package/dist/{cauthy-C29HCvag.d.mts → cauthy-XkIbG5gE.d.mts} +1 -1
- package/dist/client.d.mts +157 -2
- package/dist/client.d.ts +157 -2
- package/dist/client.js +37 -2
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +37 -2
- package/dist/client.mjs.map +1 -1
- package/dist/express.d.mts +2 -2
- package/dist/express.d.ts +2 -2
- package/dist/fastify.d.mts +2 -2
- package/dist/fastify.d.ts +2 -2
- package/dist/hono.d.mts +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +181 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -6
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +2 -2
- package/dist/next.d.ts +2 -2
- package/dist/react.d.mts +192 -1
- package/dist/react.d.ts +192 -1
- package/dist/react.js +279 -23
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +278 -23
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +3 -3
- package/dist/svelte.d.ts +3 -3
- package/dist/svelte.js +37 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -2
- package/dist/svelte.mjs.map +1 -1
- package/dist/{system-ZD_Wa8Bm.d.mts → system-BxMsSIu1.d.mts} +2 -0
- package/dist/{system-DhRr_WxR.d.ts → system-DTIeDXDP.d.ts} +2 -0
- package/dist/vue.d.mts +3 -3
- package/dist/vue.d.ts +3 -3
- package/dist/vue.js +37 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +37 -2
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/next.d.mts
CHANGED
package/dist/next.d.ts
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -174,6 +174,8 @@ interface SessionUser {
|
|
|
174
174
|
emailVerifyBy?: string;
|
|
175
175
|
/** The language the person reads in ("es", "en-US"), when Cauthy knows it. */
|
|
176
176
|
locale?: string;
|
|
177
|
+
/** A guest: a visitor's session before they sign up. No email; `account.upgrade` makes it an account, keeping `id`. */
|
|
178
|
+
isAnonymous?: boolean;
|
|
177
179
|
}
|
|
178
180
|
/** A value JSON can carry. What crosses from server to browser is typed as this, never `unknown`. */
|
|
179
181
|
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
@@ -265,6 +267,20 @@ interface AuthMethods {
|
|
|
265
267
|
* forms show it themselves.
|
|
266
268
|
*/
|
|
267
269
|
captchaSiteKey?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Whether the workspace signs some people in through their company's SSO,
|
|
272
|
+
* found by their work address (`signIn.ssoDiscover`, `signIn.sso`).
|
|
273
|
+
*/
|
|
274
|
+
sso: boolean;
|
|
275
|
+
}
|
|
276
|
+
/** A company's sign-in (an SSO connection of the workspace). */
|
|
277
|
+
interface SSOConnection {
|
|
278
|
+
/** What `signIn.sso({ connection })` takes. */
|
|
279
|
+
id: string;
|
|
280
|
+
/** The company's name, for "Continue with …". */
|
|
281
|
+
name: string;
|
|
282
|
+
/** The address can sign in no other way: a password, link or provider answers `sso_required`. */
|
|
283
|
+
enforced: boolean;
|
|
268
284
|
}
|
|
269
285
|
/**
|
|
270
286
|
* What holds a passkey, as its authenticator says: a security key (a YubiKey),
|
|
@@ -314,6 +330,82 @@ interface ConnectedAgent {
|
|
|
314
330
|
connectedAt: string;
|
|
315
331
|
lastUsedAt: string;
|
|
316
332
|
}
|
|
333
|
+
/** An organization the person belongs to, with what their role lets them do with its people. */
|
|
334
|
+
interface OrganizationSeat {
|
|
335
|
+
id: string;
|
|
336
|
+
/** The client system it is of (`pondari`). */
|
|
337
|
+
system: string;
|
|
338
|
+
name: string;
|
|
339
|
+
kind: string;
|
|
340
|
+
/** The person's role in it. */
|
|
341
|
+
role: string;
|
|
342
|
+
/** Cauthy's member powers, from the system's catalog: cauthy:members read and manage. */
|
|
343
|
+
can: {
|
|
344
|
+
readMembers: boolean;
|
|
345
|
+
manageMembers: boolean;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/** A person of an organization, as a member who may see them reads it. */
|
|
349
|
+
interface OrganizationPerson {
|
|
350
|
+
userId: string;
|
|
351
|
+
email: string;
|
|
352
|
+
name: string;
|
|
353
|
+
role: string;
|
|
354
|
+
/** The account's: `active`, `suspended`… A disabled member is still listed. */
|
|
355
|
+
status: string;
|
|
356
|
+
/** Invited and not yet accepted. */
|
|
357
|
+
invited: boolean;
|
|
358
|
+
/** Manages the organization's members. */
|
|
359
|
+
manager: boolean;
|
|
360
|
+
/** The signed-in person. */
|
|
361
|
+
you: boolean;
|
|
362
|
+
/** UTC, ISO 8601. */
|
|
363
|
+
since: string;
|
|
364
|
+
}
|
|
365
|
+
/** A role of the organization's system, as the catalog names it. */
|
|
366
|
+
interface OrganizationRoleChoice {
|
|
367
|
+
role: string;
|
|
368
|
+
name: string;
|
|
369
|
+
description: string;
|
|
370
|
+
/** Holding it manages the organization's members. */
|
|
371
|
+
manager: boolean;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The signed-in person's organizations, and their people. Seeing them needs
|
|
375
|
+
* cauthy:members read in the person's role; changing them needs manage. Cauthy
|
|
376
|
+
* decides, with the person's own session: the application authorizes nothing.
|
|
377
|
+
*/
|
|
378
|
+
interface OrganizationsClient {
|
|
379
|
+
/** The organizations the person belongs to; one system's only with `system`. */
|
|
380
|
+
list(system?: string): Promise<OrganizationSeat[]>;
|
|
381
|
+
/** The people of one, or null when the person may not see them. */
|
|
382
|
+
members(organizationId: string): Promise<OrganizationPerson[] | null>;
|
|
383
|
+
/** The roles a member may be given, or null when the person may not see them. */
|
|
384
|
+
roles(organizationId: string): Promise<OrganizationRoleChoice[] | null>;
|
|
385
|
+
/** Adds a person by their address; an address with no account gets one and its invitation. */
|
|
386
|
+
add(organizationId: string, form: {
|
|
387
|
+
email: string;
|
|
388
|
+
role: string;
|
|
389
|
+
name?: string;
|
|
390
|
+
locale?: string;
|
|
391
|
+
}): Promise<AuthResult<'added', {
|
|
392
|
+
member: OrganizationPerson;
|
|
393
|
+
}>>;
|
|
394
|
+
setRole(organizationId: string, userId: string, role: string): Promise<AuthResult<'changed', {
|
|
395
|
+
userId: string;
|
|
396
|
+
role: string;
|
|
397
|
+
}>>;
|
|
398
|
+
/** Removes a member; the person themself may always leave. */
|
|
399
|
+
remove(organizationId: string, userId: string): Promise<AuthResult<'removed', {
|
|
400
|
+
userId: string;
|
|
401
|
+
}>>;
|
|
402
|
+
/** Sends a member's invitation again. */
|
|
403
|
+
inviteAgain(organizationId: string, userId: string, form?: {
|
|
404
|
+
locale?: string;
|
|
405
|
+
}): Promise<AuthResult<'sent', {
|
|
406
|
+
userId: string;
|
|
407
|
+
}>>;
|
|
408
|
+
}
|
|
317
409
|
interface AccountSession {
|
|
318
410
|
/** "Mac · Chrome", or "" when the browser did not say. */
|
|
319
411
|
device: string;
|
|
@@ -436,6 +528,26 @@ interface AccountClient {
|
|
|
436
528
|
unlink(provider: string): Promise<AuthResult<'unlinked', {
|
|
437
529
|
provider: string;
|
|
438
530
|
}>>;
|
|
531
|
+
/**
|
|
532
|
+
* A guest becomes an account of their own with an address and a password —
|
|
533
|
+
* the same id, so what they did stays theirs. `email_taken`: the address has
|
|
534
|
+
* an account already; offer to sign in with it.
|
|
535
|
+
*/
|
|
536
|
+
upgrade(form: {
|
|
537
|
+
email: string;
|
|
538
|
+
password: string;
|
|
539
|
+
name?: string;
|
|
540
|
+
}): Promise<AuthResult<'signed_in', {
|
|
541
|
+
session: PublicSession;
|
|
542
|
+
}>>;
|
|
543
|
+
/** Where a guest goes to become the account of a provider's address (Google…). */
|
|
544
|
+
upgradeUrl(provider: string, options?: {
|
|
545
|
+
returnTo?: string;
|
|
546
|
+
}): string;
|
|
547
|
+
/** Sends a guest to `upgradeUrl`; they come back signed in as the account. */
|
|
548
|
+
upgradeWith(provider: string, options?: {
|
|
549
|
+
returnTo?: string;
|
|
550
|
+
}): void;
|
|
439
551
|
/** Where the account is signed in. */
|
|
440
552
|
sessions(): Promise<AccountSession[]>;
|
|
441
553
|
/** Signs the account out everywhere, here too. */
|
|
@@ -469,6 +581,17 @@ interface AccountClient {
|
|
|
469
581
|
}
|
|
470
582
|
interface AuthClient {
|
|
471
583
|
signIn: {
|
|
584
|
+
/**
|
|
585
|
+
* A guest session, before the visitor signs up: the application keeps what
|
|
586
|
+
* they do under `session.user.id`, and `account.upgrade` (or
|
|
587
|
+
* `account.upgradeWith`) makes it their account, same id. Only where the
|
|
588
|
+
* workspace allows guests (`anonymous_disabled` otherwise).
|
|
589
|
+
*/
|
|
590
|
+
anonymously(form?: {
|
|
591
|
+
captchaToken?: string;
|
|
592
|
+
}): Promise<AuthResult<'signed_in', {
|
|
593
|
+
session: PublicSession;
|
|
594
|
+
}>>;
|
|
472
595
|
/** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
|
|
473
596
|
email(form: {
|
|
474
597
|
email: string;
|
|
@@ -577,6 +700,38 @@ interface AuthClient {
|
|
|
577
700
|
social(provider: string, options?: {
|
|
578
701
|
returnTo?: string;
|
|
579
702
|
}): void;
|
|
703
|
+
/**
|
|
704
|
+
* Which company's sign-in a work address uses, if any (`found`), or
|
|
705
|
+
* `none`. It says so of the address's domain, never whether the address
|
|
706
|
+
* has an account.
|
|
707
|
+
*/
|
|
708
|
+
ssoDiscover(form: {
|
|
709
|
+
email: string;
|
|
710
|
+
}): Promise<AuthResult<'found', {
|
|
711
|
+
connection: SSOConnection;
|
|
712
|
+
}> | AuthResult<'none'>>;
|
|
713
|
+
/**
|
|
714
|
+
* Sends the browser to the person's company (found by `email`, or named
|
|
715
|
+
* by `connection`); it comes back signed in, at `returnTo`. A sign-in the
|
|
716
|
+
* company refused comes back with `?auth_error=`. Any other way of
|
|
717
|
+
* signing in answers `sso_required` for an address its company holds to
|
|
718
|
+
* SSO: send it here then.
|
|
719
|
+
*/
|
|
720
|
+
sso(target: {
|
|
721
|
+
email: string;
|
|
722
|
+
} | {
|
|
723
|
+
connection: string;
|
|
724
|
+
}, options?: {
|
|
725
|
+
returnTo?: string;
|
|
726
|
+
}): void;
|
|
727
|
+
/** Where `sso` sends the browser, for a plain link. */
|
|
728
|
+
ssoUrl(target: {
|
|
729
|
+
email: string;
|
|
730
|
+
} | {
|
|
731
|
+
connection: string;
|
|
732
|
+
}, options?: {
|
|
733
|
+
returnTo?: string;
|
|
734
|
+
}): string;
|
|
580
735
|
/** Where `social` sends the browser, for a plain link. */
|
|
581
736
|
socialUrl(provider: string, options?: {
|
|
582
737
|
returnTo?: string;
|
|
@@ -612,6 +767,8 @@ interface AuthClient {
|
|
|
612
767
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
613
768
|
/** The signed-in person's own account. */
|
|
614
769
|
account: AccountClient;
|
|
770
|
+
/** The signed-in person's organizations, and their people. */
|
|
771
|
+
organizations: OrganizationsClient;
|
|
615
772
|
/** Who is signed in, or null. */
|
|
616
773
|
getSession(): Promise<PublicSession | null>;
|
|
617
774
|
methods(): Promise<AuthMethods>;
|
|
@@ -723,6 +880,24 @@ interface AuthTexts {
|
|
|
723
880
|
linkWith: string;
|
|
724
881
|
unlink: string;
|
|
725
882
|
linked: string;
|
|
883
|
+
ssoOnly: string;
|
|
884
|
+
members: string;
|
|
885
|
+
membersHidden: string;
|
|
886
|
+
organizationMissing: string;
|
|
887
|
+
memberYou: string;
|
|
888
|
+
memberInvited: string;
|
|
889
|
+
memberManager: string;
|
|
890
|
+
memberRole: string;
|
|
891
|
+
memberAdd: string;
|
|
892
|
+
memberAdded: string;
|
|
893
|
+
memberRemove: string;
|
|
894
|
+
memberRemoveConfirm: string;
|
|
895
|
+
memberLeave: string;
|
|
896
|
+
memberLeaveConfirm: string;
|
|
897
|
+
memberInviteAgain: string;
|
|
898
|
+
memberInvitationSent: string;
|
|
899
|
+
yes: string;
|
|
900
|
+
cancel: string;
|
|
726
901
|
/** By error code; one missing shows what the server said. */
|
|
727
902
|
errors: Record<string, string>;
|
|
728
903
|
}
|
|
@@ -828,6 +1003,22 @@ interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuc
|
|
|
828
1003
|
* its own. Like the other forms, it carries no styles.
|
|
829
1004
|
*/
|
|
830
1005
|
declare function Account(props: AccountProps): react.JSX.Element;
|
|
1006
|
+
interface OrganizationMembersProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess' | 'createAccounts'> {
|
|
1007
|
+
/** The organization, by the id Cauthy gave it. */
|
|
1008
|
+
organizationId: string;
|
|
1009
|
+
/** The moment of a membership, as the application writes dates. Default: the browser's own way. */
|
|
1010
|
+
formatDate?: (iso: string) => string;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* The people of one of the signed-in person's organizations, administered
|
|
1014
|
+
* from the application. What it offers follows the person's role in the
|
|
1015
|
+
* system's catalog: cauthy:members read lists the people; manage adds them by
|
|
1016
|
+
* address (one with no account is invited), changes their role, sends an
|
|
1017
|
+
* invitation again and removes them. Anybody may leave. Cauthy checks each
|
|
1018
|
+
* change with the person's own session; the application authorizes nothing.
|
|
1019
|
+
* Like the other forms, it carries no styles.
|
|
1020
|
+
*/
|
|
1021
|
+
declare function OrganizationMembers(props: OrganizationMembersProps): react.JSX.Element;
|
|
831
1022
|
|
|
832
1023
|
interface SessionContext {
|
|
833
1024
|
/** The signed-in person and their organizations, or null. */
|
|
@@ -872,4 +1063,4 @@ declare function useSession(): SessionContext;
|
|
|
872
1063
|
*/
|
|
873
1064
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
874
1065
|
|
|
875
|
-
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, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
1066
|
+
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, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
package/dist/react.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ interface SessionUser {
|
|
|
174
174
|
emailVerifyBy?: string;
|
|
175
175
|
/** The language the person reads in ("es", "en-US"), when Cauthy knows it. */
|
|
176
176
|
locale?: string;
|
|
177
|
+
/** A guest: a visitor's session before they sign up. No email; `account.upgrade` makes it an account, keeping `id`. */
|
|
178
|
+
isAnonymous?: boolean;
|
|
177
179
|
}
|
|
178
180
|
/** A value JSON can carry. What crosses from server to browser is typed as this, never `unknown`. */
|
|
179
181
|
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
@@ -265,6 +267,20 @@ interface AuthMethods {
|
|
|
265
267
|
* forms show it themselves.
|
|
266
268
|
*/
|
|
267
269
|
captchaSiteKey?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Whether the workspace signs some people in through their company's SSO,
|
|
272
|
+
* found by their work address (`signIn.ssoDiscover`, `signIn.sso`).
|
|
273
|
+
*/
|
|
274
|
+
sso: boolean;
|
|
275
|
+
}
|
|
276
|
+
/** A company's sign-in (an SSO connection of the workspace). */
|
|
277
|
+
interface SSOConnection {
|
|
278
|
+
/** What `signIn.sso({ connection })` takes. */
|
|
279
|
+
id: string;
|
|
280
|
+
/** The company's name, for "Continue with …". */
|
|
281
|
+
name: string;
|
|
282
|
+
/** The address can sign in no other way: a password, link or provider answers `sso_required`. */
|
|
283
|
+
enforced: boolean;
|
|
268
284
|
}
|
|
269
285
|
/**
|
|
270
286
|
* What holds a passkey, as its authenticator says: a security key (a YubiKey),
|
|
@@ -314,6 +330,82 @@ interface ConnectedAgent {
|
|
|
314
330
|
connectedAt: string;
|
|
315
331
|
lastUsedAt: string;
|
|
316
332
|
}
|
|
333
|
+
/** An organization the person belongs to, with what their role lets them do with its people. */
|
|
334
|
+
interface OrganizationSeat {
|
|
335
|
+
id: string;
|
|
336
|
+
/** The client system it is of (`pondari`). */
|
|
337
|
+
system: string;
|
|
338
|
+
name: string;
|
|
339
|
+
kind: string;
|
|
340
|
+
/** The person's role in it. */
|
|
341
|
+
role: string;
|
|
342
|
+
/** Cauthy's member powers, from the system's catalog: cauthy:members read and manage. */
|
|
343
|
+
can: {
|
|
344
|
+
readMembers: boolean;
|
|
345
|
+
manageMembers: boolean;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/** A person of an organization, as a member who may see them reads it. */
|
|
349
|
+
interface OrganizationPerson {
|
|
350
|
+
userId: string;
|
|
351
|
+
email: string;
|
|
352
|
+
name: string;
|
|
353
|
+
role: string;
|
|
354
|
+
/** The account's: `active`, `suspended`… A disabled member is still listed. */
|
|
355
|
+
status: string;
|
|
356
|
+
/** Invited and not yet accepted. */
|
|
357
|
+
invited: boolean;
|
|
358
|
+
/** Manages the organization's members. */
|
|
359
|
+
manager: boolean;
|
|
360
|
+
/** The signed-in person. */
|
|
361
|
+
you: boolean;
|
|
362
|
+
/** UTC, ISO 8601. */
|
|
363
|
+
since: string;
|
|
364
|
+
}
|
|
365
|
+
/** A role of the organization's system, as the catalog names it. */
|
|
366
|
+
interface OrganizationRoleChoice {
|
|
367
|
+
role: string;
|
|
368
|
+
name: string;
|
|
369
|
+
description: string;
|
|
370
|
+
/** Holding it manages the organization's members. */
|
|
371
|
+
manager: boolean;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The signed-in person's organizations, and their people. Seeing them needs
|
|
375
|
+
* cauthy:members read in the person's role; changing them needs manage. Cauthy
|
|
376
|
+
* decides, with the person's own session: the application authorizes nothing.
|
|
377
|
+
*/
|
|
378
|
+
interface OrganizationsClient {
|
|
379
|
+
/** The organizations the person belongs to; one system's only with `system`. */
|
|
380
|
+
list(system?: string): Promise<OrganizationSeat[]>;
|
|
381
|
+
/** The people of one, or null when the person may not see them. */
|
|
382
|
+
members(organizationId: string): Promise<OrganizationPerson[] | null>;
|
|
383
|
+
/** The roles a member may be given, or null when the person may not see them. */
|
|
384
|
+
roles(organizationId: string): Promise<OrganizationRoleChoice[] | null>;
|
|
385
|
+
/** Adds a person by their address; an address with no account gets one and its invitation. */
|
|
386
|
+
add(organizationId: string, form: {
|
|
387
|
+
email: string;
|
|
388
|
+
role: string;
|
|
389
|
+
name?: string;
|
|
390
|
+
locale?: string;
|
|
391
|
+
}): Promise<AuthResult<'added', {
|
|
392
|
+
member: OrganizationPerson;
|
|
393
|
+
}>>;
|
|
394
|
+
setRole(organizationId: string, userId: string, role: string): Promise<AuthResult<'changed', {
|
|
395
|
+
userId: string;
|
|
396
|
+
role: string;
|
|
397
|
+
}>>;
|
|
398
|
+
/** Removes a member; the person themself may always leave. */
|
|
399
|
+
remove(organizationId: string, userId: string): Promise<AuthResult<'removed', {
|
|
400
|
+
userId: string;
|
|
401
|
+
}>>;
|
|
402
|
+
/** Sends a member's invitation again. */
|
|
403
|
+
inviteAgain(organizationId: string, userId: string, form?: {
|
|
404
|
+
locale?: string;
|
|
405
|
+
}): Promise<AuthResult<'sent', {
|
|
406
|
+
userId: string;
|
|
407
|
+
}>>;
|
|
408
|
+
}
|
|
317
409
|
interface AccountSession {
|
|
318
410
|
/** "Mac · Chrome", or "" when the browser did not say. */
|
|
319
411
|
device: string;
|
|
@@ -436,6 +528,26 @@ interface AccountClient {
|
|
|
436
528
|
unlink(provider: string): Promise<AuthResult<'unlinked', {
|
|
437
529
|
provider: string;
|
|
438
530
|
}>>;
|
|
531
|
+
/**
|
|
532
|
+
* A guest becomes an account of their own with an address and a password —
|
|
533
|
+
* the same id, so what they did stays theirs. `email_taken`: the address has
|
|
534
|
+
* an account already; offer to sign in with it.
|
|
535
|
+
*/
|
|
536
|
+
upgrade(form: {
|
|
537
|
+
email: string;
|
|
538
|
+
password: string;
|
|
539
|
+
name?: string;
|
|
540
|
+
}): Promise<AuthResult<'signed_in', {
|
|
541
|
+
session: PublicSession;
|
|
542
|
+
}>>;
|
|
543
|
+
/** Where a guest goes to become the account of a provider's address (Google…). */
|
|
544
|
+
upgradeUrl(provider: string, options?: {
|
|
545
|
+
returnTo?: string;
|
|
546
|
+
}): string;
|
|
547
|
+
/** Sends a guest to `upgradeUrl`; they come back signed in as the account. */
|
|
548
|
+
upgradeWith(provider: string, options?: {
|
|
549
|
+
returnTo?: string;
|
|
550
|
+
}): void;
|
|
439
551
|
/** Where the account is signed in. */
|
|
440
552
|
sessions(): Promise<AccountSession[]>;
|
|
441
553
|
/** Signs the account out everywhere, here too. */
|
|
@@ -469,6 +581,17 @@ interface AccountClient {
|
|
|
469
581
|
}
|
|
470
582
|
interface AuthClient {
|
|
471
583
|
signIn: {
|
|
584
|
+
/**
|
|
585
|
+
* A guest session, before the visitor signs up: the application keeps what
|
|
586
|
+
* they do under `session.user.id`, and `account.upgrade` (or
|
|
587
|
+
* `account.upgradeWith`) makes it their account, same id. Only where the
|
|
588
|
+
* workspace allows guests (`anonymous_disabled` otherwise).
|
|
589
|
+
*/
|
|
590
|
+
anonymously(form?: {
|
|
591
|
+
captchaToken?: string;
|
|
592
|
+
}): Promise<AuthResult<'signed_in', {
|
|
593
|
+
session: PublicSession;
|
|
594
|
+
}>>;
|
|
472
595
|
/** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
|
|
473
596
|
email(form: {
|
|
474
597
|
email: string;
|
|
@@ -577,6 +700,38 @@ interface AuthClient {
|
|
|
577
700
|
social(provider: string, options?: {
|
|
578
701
|
returnTo?: string;
|
|
579
702
|
}): void;
|
|
703
|
+
/**
|
|
704
|
+
* Which company's sign-in a work address uses, if any (`found`), or
|
|
705
|
+
* `none`. It says so of the address's domain, never whether the address
|
|
706
|
+
* has an account.
|
|
707
|
+
*/
|
|
708
|
+
ssoDiscover(form: {
|
|
709
|
+
email: string;
|
|
710
|
+
}): Promise<AuthResult<'found', {
|
|
711
|
+
connection: SSOConnection;
|
|
712
|
+
}> | AuthResult<'none'>>;
|
|
713
|
+
/**
|
|
714
|
+
* Sends the browser to the person's company (found by `email`, or named
|
|
715
|
+
* by `connection`); it comes back signed in, at `returnTo`. A sign-in the
|
|
716
|
+
* company refused comes back with `?auth_error=`. Any other way of
|
|
717
|
+
* signing in answers `sso_required` for an address its company holds to
|
|
718
|
+
* SSO: send it here then.
|
|
719
|
+
*/
|
|
720
|
+
sso(target: {
|
|
721
|
+
email: string;
|
|
722
|
+
} | {
|
|
723
|
+
connection: string;
|
|
724
|
+
}, options?: {
|
|
725
|
+
returnTo?: string;
|
|
726
|
+
}): void;
|
|
727
|
+
/** Where `sso` sends the browser, for a plain link. */
|
|
728
|
+
ssoUrl(target: {
|
|
729
|
+
email: string;
|
|
730
|
+
} | {
|
|
731
|
+
connection: string;
|
|
732
|
+
}, options?: {
|
|
733
|
+
returnTo?: string;
|
|
734
|
+
}): string;
|
|
580
735
|
/** Where `social` sends the browser, for a plain link. */
|
|
581
736
|
socialUrl(provider: string, options?: {
|
|
582
737
|
returnTo?: string;
|
|
@@ -612,6 +767,8 @@ interface AuthClient {
|
|
|
612
767
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
613
768
|
/** The signed-in person's own account. */
|
|
614
769
|
account: AccountClient;
|
|
770
|
+
/** The signed-in person's organizations, and their people. */
|
|
771
|
+
organizations: OrganizationsClient;
|
|
615
772
|
/** Who is signed in, or null. */
|
|
616
773
|
getSession(): Promise<PublicSession | null>;
|
|
617
774
|
methods(): Promise<AuthMethods>;
|
|
@@ -723,6 +880,24 @@ interface AuthTexts {
|
|
|
723
880
|
linkWith: string;
|
|
724
881
|
unlink: string;
|
|
725
882
|
linked: string;
|
|
883
|
+
ssoOnly: string;
|
|
884
|
+
members: string;
|
|
885
|
+
membersHidden: string;
|
|
886
|
+
organizationMissing: string;
|
|
887
|
+
memberYou: string;
|
|
888
|
+
memberInvited: string;
|
|
889
|
+
memberManager: string;
|
|
890
|
+
memberRole: string;
|
|
891
|
+
memberAdd: string;
|
|
892
|
+
memberAdded: string;
|
|
893
|
+
memberRemove: string;
|
|
894
|
+
memberRemoveConfirm: string;
|
|
895
|
+
memberLeave: string;
|
|
896
|
+
memberLeaveConfirm: string;
|
|
897
|
+
memberInviteAgain: string;
|
|
898
|
+
memberInvitationSent: string;
|
|
899
|
+
yes: string;
|
|
900
|
+
cancel: string;
|
|
726
901
|
/** By error code; one missing shows what the server said. */
|
|
727
902
|
errors: Record<string, string>;
|
|
728
903
|
}
|
|
@@ -828,6 +1003,22 @@ interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuc
|
|
|
828
1003
|
* its own. Like the other forms, it carries no styles.
|
|
829
1004
|
*/
|
|
830
1005
|
declare function Account(props: AccountProps): react.JSX.Element;
|
|
1006
|
+
interface OrganizationMembersProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess' | 'createAccounts'> {
|
|
1007
|
+
/** The organization, by the id Cauthy gave it. */
|
|
1008
|
+
organizationId: string;
|
|
1009
|
+
/** The moment of a membership, as the application writes dates. Default: the browser's own way. */
|
|
1010
|
+
formatDate?: (iso: string) => string;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* The people of one of the signed-in person's organizations, administered
|
|
1014
|
+
* from the application. What it offers follows the person's role in the
|
|
1015
|
+
* system's catalog: cauthy:members read lists the people; manage adds them by
|
|
1016
|
+
* address (one with no account is invited), changes their role, sends an
|
|
1017
|
+
* invitation again and removes them. Anybody may leave. Cauthy checks each
|
|
1018
|
+
* change with the person's own session; the application authorizes nothing.
|
|
1019
|
+
* Like the other forms, it carries no styles.
|
|
1020
|
+
*/
|
|
1021
|
+
declare function OrganizationMembers(props: OrganizationMembersProps): react.JSX.Element;
|
|
831
1022
|
|
|
832
1023
|
interface SessionContext {
|
|
833
1024
|
/** The signed-in person and their organizations, or null. */
|
|
@@ -872,4 +1063,4 @@ declare function useSession(): SessionContext;
|
|
|
872
1063
|
*/
|
|
873
1064
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
874
1065
|
|
|
875
|
-
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, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
1066
|
+
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, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|