cauthy-auth 0.20.0 → 0.23.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 +133 -3
- package/dist/client.d.ts +133 -3
- package/dist/client.js +54 -0
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +54 -0
- 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 +178 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +178 -5
- 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 +171 -2
- package/dist/react.d.ts +171 -2
- package/dist/react.js +261 -3
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +260 -3
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +54 -0
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +54 -0
- 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 +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +54 -0
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +54 -0
- 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[] | {
|
|
@@ -328,6 +330,82 @@ interface ConnectedAgent {
|
|
|
328
330
|
connectedAt: string;
|
|
329
331
|
lastUsedAt: string;
|
|
330
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
|
+
}
|
|
331
409
|
interface AccountSession {
|
|
332
410
|
/** "Mac · Chrome", or "" when the browser did not say. */
|
|
333
411
|
device: string;
|
|
@@ -450,6 +528,26 @@ interface AccountClient {
|
|
|
450
528
|
unlink(provider: string): Promise<AuthResult<'unlinked', {
|
|
451
529
|
provider: string;
|
|
452
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;
|
|
453
551
|
/** Where the account is signed in. */
|
|
454
552
|
sessions(): Promise<AccountSession[]>;
|
|
455
553
|
/** Signs the account out everywhere, here too. */
|
|
@@ -483,6 +581,17 @@ interface AccountClient {
|
|
|
483
581
|
}
|
|
484
582
|
interface AuthClient {
|
|
485
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
|
+
}>>;
|
|
486
595
|
/** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
|
|
487
596
|
email(form: {
|
|
488
597
|
email: string;
|
|
@@ -497,13 +606,34 @@ interface AuthClient {
|
|
|
497
606
|
}): Promise<AuthResult<'signed_in', {
|
|
498
607
|
session: PublicSession;
|
|
499
608
|
}>>;
|
|
500
|
-
/** While the second step is asked for: whether the account has an authenticator app,
|
|
609
|
+
/** While the second step is asked for: whether the account has an authenticator app, the phone (masked) a code can be sent to, and phones that approve sign-ins. */
|
|
501
610
|
mfaMethods(): Promise<AuthResult<'ok', {
|
|
502
611
|
totp: boolean;
|
|
503
612
|
phone: {
|
|
504
613
|
number: string;
|
|
505
614
|
channel: string;
|
|
506
615
|
} | null;
|
|
616
|
+
push: {
|
|
617
|
+
devices: number;
|
|
618
|
+
} | null;
|
|
619
|
+
}>>;
|
|
620
|
+
/**
|
|
621
|
+
* Sends a push to the account's phones (the application's app, with
|
|
622
|
+
* cauthy-expo): show `number`, which the person picks on the phone, then
|
|
623
|
+
* call `mfaPushWait`.
|
|
624
|
+
*/
|
|
625
|
+
mfaPush(): Promise<AuthResult<'sent', {
|
|
626
|
+
number: number;
|
|
627
|
+
}>>;
|
|
628
|
+
/**
|
|
629
|
+
* Waits for the phone's answer, listening (server-sent events) rather than
|
|
630
|
+
* asking again and again, and signs in when it approves. `denied`: turned
|
|
631
|
+
* down on the phone; `expired`: nobody answered in time.
|
|
632
|
+
*/
|
|
633
|
+
mfaPushWait(o?: {
|
|
634
|
+
signal?: AbortSignal;
|
|
635
|
+
}): Promise<AuthResult<'signed_in', {
|
|
636
|
+
session: PublicSession;
|
|
507
637
|
}>>;
|
|
508
638
|
/** Sends a code to the account's phone, by SMS or WhatsApp; `mfa` takes it. A few per sign-in. */
|
|
509
639
|
mfaSendCode(): Promise<AuthResult<'sent', {
|
|
@@ -658,6 +788,8 @@ interface AuthClient {
|
|
|
658
788
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
659
789
|
/** The signed-in person's own account. */
|
|
660
790
|
account: AccountClient;
|
|
791
|
+
/** The signed-in person's organizations, and their people. */
|
|
792
|
+
organizations: OrganizationsClient;
|
|
661
793
|
/** Who is signed in, or null. */
|
|
662
794
|
getSession(): Promise<PublicSession | null>;
|
|
663
795
|
methods(): Promise<AuthMethods>;
|
|
@@ -704,6 +836,10 @@ interface AuthTexts {
|
|
|
704
836
|
sendCodeSms: string;
|
|
705
837
|
sendCodeWhatsapp: string;
|
|
706
838
|
codeSent: string;
|
|
839
|
+
/** The second step approved on the phone; "{n}" is the number to pick. */
|
|
840
|
+
pushSend: string;
|
|
841
|
+
pushPick: string;
|
|
842
|
+
pushWaiting: string;
|
|
707
843
|
phone: string;
|
|
708
844
|
phoneHelp: string;
|
|
709
845
|
phoneOn: string;
|
|
@@ -770,6 +906,23 @@ interface AuthTexts {
|
|
|
770
906
|
unlink: string;
|
|
771
907
|
linked: string;
|
|
772
908
|
ssoOnly: string;
|
|
909
|
+
members: string;
|
|
910
|
+
membersHidden: string;
|
|
911
|
+
organizationMissing: string;
|
|
912
|
+
memberYou: string;
|
|
913
|
+
memberInvited: string;
|
|
914
|
+
memberManager: string;
|
|
915
|
+
memberRole: string;
|
|
916
|
+
memberAdd: string;
|
|
917
|
+
memberAdded: string;
|
|
918
|
+
memberRemove: string;
|
|
919
|
+
memberRemoveConfirm: string;
|
|
920
|
+
memberLeave: string;
|
|
921
|
+
memberLeaveConfirm: string;
|
|
922
|
+
memberInviteAgain: string;
|
|
923
|
+
memberInvitationSent: string;
|
|
924
|
+
yes: string;
|
|
925
|
+
cancel: string;
|
|
773
926
|
/** By error code; one missing shows what the server said. */
|
|
774
927
|
errors: Record<string, string>;
|
|
775
928
|
}
|
|
@@ -875,6 +1028,22 @@ interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuc
|
|
|
875
1028
|
* its own. Like the other forms, it carries no styles.
|
|
876
1029
|
*/
|
|
877
1030
|
declare function Account(props: AccountProps): react.JSX.Element;
|
|
1031
|
+
interface OrganizationMembersProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess' | 'createAccounts'> {
|
|
1032
|
+
/** The organization, by the id Cauthy gave it. */
|
|
1033
|
+
organizationId: string;
|
|
1034
|
+
/** The moment of a membership, as the application writes dates. Default: the browser's own way. */
|
|
1035
|
+
formatDate?: (iso: string) => string;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* The people of one of the signed-in person's organizations, administered
|
|
1039
|
+
* from the application. What it offers follows the person's role in the
|
|
1040
|
+
* system's catalog: cauthy:members read lists the people; manage adds them by
|
|
1041
|
+
* address (one with no account is invited), changes their role, sends an
|
|
1042
|
+
* invitation again and removes them. Anybody may leave. Cauthy checks each
|
|
1043
|
+
* change with the person's own session; the application authorizes nothing.
|
|
1044
|
+
* Like the other forms, it carries no styles.
|
|
1045
|
+
*/
|
|
1046
|
+
declare function OrganizationMembers(props: OrganizationMembersProps): react.JSX.Element;
|
|
878
1047
|
|
|
879
1048
|
interface SessionContext {
|
|
880
1049
|
/** The signed-in person and their organizations, or null. */
|
|
@@ -919,4 +1088,4 @@ declare function useSession(): SessionContext;
|
|
|
919
1088
|
*/
|
|
920
1089
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
921
1090
|
|
|
922
|
-
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 SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
1091
|
+
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[] | {
|
|
@@ -328,6 +330,82 @@ interface ConnectedAgent {
|
|
|
328
330
|
connectedAt: string;
|
|
329
331
|
lastUsedAt: string;
|
|
330
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
|
+
}
|
|
331
409
|
interface AccountSession {
|
|
332
410
|
/** "Mac · Chrome", or "" when the browser did not say. */
|
|
333
411
|
device: string;
|
|
@@ -450,6 +528,26 @@ interface AccountClient {
|
|
|
450
528
|
unlink(provider: string): Promise<AuthResult<'unlinked', {
|
|
451
529
|
provider: string;
|
|
452
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;
|
|
453
551
|
/** Where the account is signed in. */
|
|
454
552
|
sessions(): Promise<AccountSession[]>;
|
|
455
553
|
/** Signs the account out everywhere, here too. */
|
|
@@ -483,6 +581,17 @@ interface AccountClient {
|
|
|
483
581
|
}
|
|
484
582
|
interface AuthClient {
|
|
485
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
|
+
}>>;
|
|
486
595
|
/** With address and password. `mfa_required`: ask for the code and call `signIn.mfa`. */
|
|
487
596
|
email(form: {
|
|
488
597
|
email: string;
|
|
@@ -497,13 +606,34 @@ interface AuthClient {
|
|
|
497
606
|
}): Promise<AuthResult<'signed_in', {
|
|
498
607
|
session: PublicSession;
|
|
499
608
|
}>>;
|
|
500
|
-
/** While the second step is asked for: whether the account has an authenticator app,
|
|
609
|
+
/** While the second step is asked for: whether the account has an authenticator app, the phone (masked) a code can be sent to, and phones that approve sign-ins. */
|
|
501
610
|
mfaMethods(): Promise<AuthResult<'ok', {
|
|
502
611
|
totp: boolean;
|
|
503
612
|
phone: {
|
|
504
613
|
number: string;
|
|
505
614
|
channel: string;
|
|
506
615
|
} | null;
|
|
616
|
+
push: {
|
|
617
|
+
devices: number;
|
|
618
|
+
} | null;
|
|
619
|
+
}>>;
|
|
620
|
+
/**
|
|
621
|
+
* Sends a push to the account's phones (the application's app, with
|
|
622
|
+
* cauthy-expo): show `number`, which the person picks on the phone, then
|
|
623
|
+
* call `mfaPushWait`.
|
|
624
|
+
*/
|
|
625
|
+
mfaPush(): Promise<AuthResult<'sent', {
|
|
626
|
+
number: number;
|
|
627
|
+
}>>;
|
|
628
|
+
/**
|
|
629
|
+
* Waits for the phone's answer, listening (server-sent events) rather than
|
|
630
|
+
* asking again and again, and signs in when it approves. `denied`: turned
|
|
631
|
+
* down on the phone; `expired`: nobody answered in time.
|
|
632
|
+
*/
|
|
633
|
+
mfaPushWait(o?: {
|
|
634
|
+
signal?: AbortSignal;
|
|
635
|
+
}): Promise<AuthResult<'signed_in', {
|
|
636
|
+
session: PublicSession;
|
|
507
637
|
}>>;
|
|
508
638
|
/** Sends a code to the account's phone, by SMS or WhatsApp; `mfa` takes it. A few per sign-in. */
|
|
509
639
|
mfaSendCode(): Promise<AuthResult<'sent', {
|
|
@@ -658,6 +788,8 @@ interface AuthClient {
|
|
|
658
788
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
659
789
|
/** The signed-in person's own account. */
|
|
660
790
|
account: AccountClient;
|
|
791
|
+
/** The signed-in person's organizations, and their people. */
|
|
792
|
+
organizations: OrganizationsClient;
|
|
661
793
|
/** Who is signed in, or null. */
|
|
662
794
|
getSession(): Promise<PublicSession | null>;
|
|
663
795
|
methods(): Promise<AuthMethods>;
|
|
@@ -704,6 +836,10 @@ interface AuthTexts {
|
|
|
704
836
|
sendCodeSms: string;
|
|
705
837
|
sendCodeWhatsapp: string;
|
|
706
838
|
codeSent: string;
|
|
839
|
+
/** The second step approved on the phone; "{n}" is the number to pick. */
|
|
840
|
+
pushSend: string;
|
|
841
|
+
pushPick: string;
|
|
842
|
+
pushWaiting: string;
|
|
707
843
|
phone: string;
|
|
708
844
|
phoneHelp: string;
|
|
709
845
|
phoneOn: string;
|
|
@@ -770,6 +906,23 @@ interface AuthTexts {
|
|
|
770
906
|
unlink: string;
|
|
771
907
|
linked: string;
|
|
772
908
|
ssoOnly: string;
|
|
909
|
+
members: string;
|
|
910
|
+
membersHidden: string;
|
|
911
|
+
organizationMissing: string;
|
|
912
|
+
memberYou: string;
|
|
913
|
+
memberInvited: string;
|
|
914
|
+
memberManager: string;
|
|
915
|
+
memberRole: string;
|
|
916
|
+
memberAdd: string;
|
|
917
|
+
memberAdded: string;
|
|
918
|
+
memberRemove: string;
|
|
919
|
+
memberRemoveConfirm: string;
|
|
920
|
+
memberLeave: string;
|
|
921
|
+
memberLeaveConfirm: string;
|
|
922
|
+
memberInviteAgain: string;
|
|
923
|
+
memberInvitationSent: string;
|
|
924
|
+
yes: string;
|
|
925
|
+
cancel: string;
|
|
773
926
|
/** By error code; one missing shows what the server said. */
|
|
774
927
|
errors: Record<string, string>;
|
|
775
928
|
}
|
|
@@ -875,6 +1028,22 @@ interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuc
|
|
|
875
1028
|
* its own. Like the other forms, it carries no styles.
|
|
876
1029
|
*/
|
|
877
1030
|
declare function Account(props: AccountProps): react.JSX.Element;
|
|
1031
|
+
interface OrganizationMembersProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess' | 'createAccounts'> {
|
|
1032
|
+
/** The organization, by the id Cauthy gave it. */
|
|
1033
|
+
organizationId: string;
|
|
1034
|
+
/** The moment of a membership, as the application writes dates. Default: the browser's own way. */
|
|
1035
|
+
formatDate?: (iso: string) => string;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* The people of one of the signed-in person's organizations, administered
|
|
1039
|
+
* from the application. What it offers follows the person's role in the
|
|
1040
|
+
* system's catalog: cauthy:members read lists the people; manage adds them by
|
|
1041
|
+
* address (one with no account is invited), changes their role, sends an
|
|
1042
|
+
* invitation again and removes them. Anybody may leave. Cauthy checks each
|
|
1043
|
+
* change with the person's own session; the application authorizes nothing.
|
|
1044
|
+
* Like the other forms, it carries no styles.
|
|
1045
|
+
*/
|
|
1046
|
+
declare function OrganizationMembers(props: OrganizationMembersProps): react.JSX.Element;
|
|
878
1047
|
|
|
879
1048
|
interface SessionContext {
|
|
880
1049
|
/** The signed-in person and their organizations, or null. */
|
|
@@ -919,4 +1088,4 @@ declare function useSession(): SessionContext;
|
|
|
919
1088
|
*/
|
|
920
1089
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
921
1090
|
|
|
922
|
-
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 SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
1091
|
+
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 };
|