@authyon/auth 0.2.0-beta.15 → 0.2.0-beta.17

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 CHANGED
@@ -227,18 +227,34 @@ Métodos de sessão/auth ficam soltos no client; os que giram em torno de um rec
227
227
 
228
228
  ### `authyon.organization`
229
229
 
230
- | Método | Endpoint |
231
- | ----------------------------------------------------- | ---------------------------------------------- |
232
- | `organization.list({ search?, skip?, take? })` | `GET /auth/tenants` |
233
- | `organization.create(params?)` | `POST /auth/tenants` |
234
- | `organization.get(organizationId)` | `GET /auth/tenants/{id}` |
235
- | `organization.rename(organizationId, name)` | `PATCH /auth/tenants/{id}` |
236
- | `organization.switch(slug)` | `POST /auth/switch-tenant` |
237
- | `organization.current()` | — (lê `activeOrganization` da sessão em cache) |
238
- | `organization.members.list(organizationId, params?)` | `GET /auth/tenants/{id}/members` |
239
- | `organization.members.invite(organizationId, params)` | `POST /auth/tenants/{id}/members` |
240
- | `organization.members.remove(organizationId, userId)` | `DELETE /auth/tenants/{id}/members/{userId}` |
241
- | `organization.roles.list(organizationId)` | `GET /auth/tenants/{id}/roles` |
230
+ | Método | Endpoint |
231
+ | ---------------------------------------------------------------- | --------------------------------------------------- |
232
+ | `organization.list({ search?, skip?, take? })` | `GET /auth/tenants` |
233
+ | `organization.create(params?)` | `POST /auth/tenants` |
234
+ | `organization.get(organizationId)` | `GET /auth/tenants/{id}` |
235
+ | `organization.rename(organizationId, name)` | `PATCH /auth/tenants/{id}` |
236
+ | `organization.switch(slug)` | `POST /auth/switch-tenant` |
237
+ | `organization.current()` | — (lê `activeOrganization` da sessão em cache) |
238
+ | `organization.members.list(organizationId, params?)` | `GET /auth/tenants/{id}/members` |
239
+ | `organization.members.invite(organizationId, params)` | `POST /auth/tenants/{id}/members` |
240
+ | `organization.members.remove(organizationId, userId)` | `DELETE /auth/tenants/{id}/members/{userId}` |
241
+ | `organization.roles.list(organizationId)` | `GET /auth/tenants/{id}/roles` |
242
+ | `organization.invites.list(organizationId)` | `GET /auth/tenants/{id}/invites` |
243
+ | `organization.invites.create(organizationId, params)` | `POST /auth/tenants/{id}/invites` |
244
+ | `organization.invites.resend(organizationId, inviteId, params?)` | `POST /auth/tenants/{id}/invites/{inviteId}/resend` |
245
+ | `organization.invites.revoke(organizationId, inviteId)` | `DELETE /auth/tenants/{id}/invites/{inviteId}` |
246
+ | `organization.invites.preview(token)` | `POST /auth/tenant-invites/preview` (público) |
247
+ | `organization.invites.accept(params)` | `POST /auth/tenant-invites/accept` (público) |
248
+
249
+ `organization.members.invite` adiciona um usuário que já existe no ambiente. Para convidar
250
+ um e-mail que talvez ainda não tenha conta, use `organization.invites.create`: a resposta
251
+ sempre traz o `acceptUrl` completo e `sendEmail: false` só gera o link, sem enviar e-mail.
252
+ O link vale 7 dias, uma única vez, e não pode ser lido de novo depois. Na página de aceite,
253
+ leia o `token` da URL, chame `preview(token)` e, se `accountExists` for falso, peça senha
254
+ (e usuário quando `usernameRequired`) antes de `accept`. Aceitar não faz login.
255
+ Passe `redirectUri` no `create` para indicar para onde mandar a pessoa depois do aceite: ele
256
+ precisa estar cadastrado (match exato) nos redirect URIs do ambiente e volta em `preview` e
257
+ `accept` — a página hospedada da Authyon redireciona sozinha; numa página própria, é com você.
242
258
 
243
259
  ### `authyon.twoFactor`
244
260
 
@@ -291,6 +307,7 @@ await authyon.security.approvals.confirm(approvalId, {
291
307
 
292
308
  | Método | Endpoint |
293
309
  | ---------------------------------------- | ------------------------------------------------- |
310
+ | `security.methods()` | `GET /auth/me` (campo `security`) |
294
311
  | `security.approvals.get(id)` | `GET /auth/authorizations/{id}` |
295
312
  | `security.approvals.webauthnOptions(id)` | `POST /auth/authorizations/{id}/webauthn/options` |
296
313
  | `security.approvals.confirm(id, input?)` | `POST /auth/authorizations/{id}/confirm` |
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Security methods active on the user's account, as returned in the
3
+ * `security` field of `GET /auth/me` and `POST /auth/validate`.
4
+ */
5
+ interface SecurityMethods {
6
+ /** A password is set (false for accounts created only through SSO or magic link). */
7
+ password: boolean;
8
+ /** Authenticator app (TOTP one-time codes). */
9
+ authenticator: boolean;
10
+ /** One-time codes sent by email. */
11
+ emailCode: boolean;
12
+ /** At least one passkey registered. */
13
+ passkey: boolean;
14
+ passkeyCount: number;
15
+ /** Unused recovery codes left. */
16
+ recoveryCodes: number;
17
+ /** SSO providers linked to the account, e.g. `["google", "github"]`. */
18
+ sso: string[];
19
+ /** Any second factor is active (authenticator, email code or passkey). */
20
+ twoFactor: boolean;
21
+ }
1
22
  /** Lifecycle of an approval. */
2
23
  type ApprovalStatus = "pending" | "approved" | "denied" | "consumed" | "expired";
3
24
  /**
@@ -130,6 +151,11 @@ interface SubjectApprovals {
130
151
  }
131
152
  /** The `security` namespace an end-user client exposes. */
132
153
  interface SubjectSecurity {
154
+ /**
155
+ * GET /auth/me — which security methods the signed-in user has active
156
+ * (password, authenticator, email code, passkeys, recovery codes, SSO).
157
+ */
158
+ methods(): Promise<SecurityMethods>;
133
159
  /** Approve or reject what your backend asked the customer to confirm. */
134
160
  readonly approvals: SubjectApprovals;
135
161
  }
@@ -198,6 +224,86 @@ interface InviteMemberInput {
198
224
  email: string;
199
225
  roles: string[];
200
226
  }
227
+ /**
228
+ * POST /auth/tenants/{organizationId}/invites — invite an address that may not
229
+ * have an account yet; accepting creates it. `sendEmail` defaults to `true`;
230
+ * `false` only returns the link, for delivery through your own channel.
231
+ */
232
+ interface OrganizationInviteInput {
233
+ email: string;
234
+ roles?: string[];
235
+ sendEmail?: boolean;
236
+ /**
237
+ * Where to send the invitee after they accept. Must be registered exactly in
238
+ * the environment's redirect URIs (the same list SSO and magic link use);
239
+ * otherwise the API rejects the invite. Comes back on `preview` and `accept`.
240
+ */
241
+ redirectUri?: string;
242
+ }
243
+ /** Returned when an invite is created or re-issued. `acceptUrl` is only ever
244
+ * readable here — the API keeps a hash of the token, not the token. */
245
+ interface OrganizationInviteIssued {
246
+ id: string;
247
+ tenantId: string;
248
+ email: string;
249
+ roles: string[];
250
+ acceptUrl: string;
251
+ expiresAt: string;
252
+ emailSent: boolean;
253
+ redirectUri: string | null;
254
+ }
255
+ type OrganizationInviteStatus = "pending" | "accepted" | "revoked" | "expired";
256
+ interface OrganizationInvite {
257
+ id: string;
258
+ tenantId: string;
259
+ email: string;
260
+ roles: string[];
261
+ status: OrganizationInviteStatus;
262
+ createdAt: string;
263
+ expiresAt: string;
264
+ emailSentAt: string | null;
265
+ acceptedAt: string | null;
266
+ acceptedByUserId: string | null;
267
+ revokedAt: string | null;
268
+ invitedByUserId: string | null;
269
+ redirectUri: string | null;
270
+ }
271
+ /** POST /auth/tenant-invites/preview — what an accept page shows before the invitee commits. */
272
+ interface OrganizationInvitePreview {
273
+ tenantId: string;
274
+ tenantName: string;
275
+ email: string;
276
+ roles: string[];
277
+ expiresAt: string;
278
+ /** True: accepting only needs the token. False: send a password (and a username when `usernameRequired`). */
279
+ accountExists: boolean;
280
+ usernameRequired: boolean;
281
+ /** Where the issuer asked to send the invitee after accepting, or `null`. */
282
+ redirectUri: string | null;
283
+ }
284
+ /** POST /auth/tenant-invites/accept — everything but `token` is ignored when the address already has an account. */
285
+ interface AcceptOrganizationInviteInput {
286
+ token: string;
287
+ username?: string;
288
+ password?: string;
289
+ firstName?: string;
290
+ lastName?: string;
291
+ /**
292
+ * @deprecated Use `publicMetadata` / `privateMetadata` through
293
+ * `@authyon/server` (`environment.tenants.invites.accept`), which runs on
294
+ * your backend with the environment credential. Still accepted for now.
295
+ */
296
+ customFields?: Record<string, unknown>;
297
+ }
298
+ interface OrganizationInviteAccepted {
299
+ tenantId: string;
300
+ tenantName: string;
301
+ userId: string;
302
+ /** True when accepting created the account (email already confirmed). The invitee still signs in normally. */
303
+ accountCreated: boolean;
304
+ /** Where the issuer asked to send the invitee, or `null`. Redirecting is up to the accept page. */
305
+ redirectUri: string | null;
306
+ }
201
307
  /** Authenticated user profile. */
202
308
  interface User {
203
309
  id: string;
@@ -214,6 +320,8 @@ interface User {
214
320
  activeOrganization?: Organization | null;
215
321
  /** Actions the user must complete before continuing (e.g. confirm e-mail). */
216
322
  pendencies?: string[];
323
+ /** Security methods active on the account (authenticator, email code, passkey, SSO…). */
324
+ security?: SecurityMethods;
217
325
  }
218
326
  /** Token pair issued by login / refresh / tenant switch. */
219
327
  interface Session {
@@ -543,11 +651,53 @@ declare class AuthyonClient {
543
651
  * (`user.activities()`, `@authyon/server`'s `environment.users.list()`).
544
652
  */
545
653
  list: (organizationId: string, params?: PaginationOptions) => Promise<Paged<OrganizationMember>>;
546
- /** POST /auth/tenants/{organizationId}/members — invite a member by e-mail. */
654
+ /**
655
+ * POST /auth/tenants/{organizationId}/members — add an existing
656
+ * environment user by e-mail (no e-mail is sent). To invite an address
657
+ * that may not have an account yet, use `organization.invites.create`.
658
+ */
547
659
  invite: (organizationId: string, params: InviteMemberInput) => Promise<void>;
548
660
  /** DELETE /auth/tenants/{organizationId}/members/{userId} — remove a member. */
549
661
  remove: (organizationId: string, userId: string) => Promise<void>;
550
662
  };
663
+ /**
664
+ * Invites by e-mail or by link. Managing them requires the
665
+ * `tenants:members:invite` permission on the organization; `preview` and
666
+ * `accept` are public — the token in the link is the credential.
667
+ */
668
+ invites: {
669
+ /** GET /auth/tenants/{organizationId}/invites — every invite with its status, newest first. */
670
+ list: (organizationId: string) => Promise<OrganizationInvite[]>;
671
+ /**
672
+ * POST /auth/tenants/{organizationId}/invites — invite an address.
673
+ * Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
674
+ * mail it and you deliver the link yourself. The link is valid for 7
675
+ * days, once, and can't be read again later.
676
+ */
677
+ create: (organizationId: string, params: OrganizationInviteInput) => Promise<OrganizationInviteIssued>;
678
+ /**
679
+ * POST /auth/tenants/{organizationId}/invites/{inviteId}/resend — issue
680
+ * a new link (the previous one stops working), mailing it unless
681
+ * `sendEmail` is `false`.
682
+ */
683
+ resend: (organizationId: string, inviteId: string, params?: {
684
+ sendEmail?: boolean;
685
+ }) => Promise<OrganizationInviteIssued>;
686
+ /** DELETE /auth/tenants/{organizationId}/invites/{inviteId} — revoke a pending invite. */
687
+ revoke: (organizationId: string, inviteId: string) => Promise<void>;
688
+ /**
689
+ * POST /auth/tenant-invites/preview — public. Read the `token` query
690
+ * parameter of the invite link and pick the form: one click when
691
+ * `accountExists`, sign-up otherwise.
692
+ */
693
+ preview: (token: string) => Promise<OrganizationInvitePreview>;
694
+ /**
695
+ * POST /auth/tenant-invites/accept — public. Joins the organization; for
696
+ * an address with no account, also creates it (password required) with
697
+ * the e-mail already confirmed. Does not sign the user in.
698
+ */
699
+ accept: (params: AcceptOrganizationInviteInput) => Promise<OrganizationInviteAccepted>;
700
+ };
551
701
  roles: {
552
702
  /** GET /auth/tenants/{organizationId}/roles — roles available in the organization. */
553
703
  list: (organizationId: string) => Promise<Role[]>;
@@ -728,4 +878,4 @@ declare function hasPermissionGroup(source: AuthyonPermissionSource | readonly s
728
878
  /** Converts Authyon's `subject:action` permission strings to authorization rules. */
729
879
  declare function createAuthyonRules(source?: AuthyonPermissionSource, options?: AuthyonAbilityOptions): AbilityRule[];
730
880
 
731
- export { type TwoFactorMethod as $, AuthyonClient as A, type InviteMemberInput as B, type ConfirmApprovalInput as C, type LoginInput as D, type LoginResult as E, FetchHttpAdapter as F, type OrganizationMember as G, type HttpAdapter as H, type IntrospectResult as I, type PaginationOptions as J, type PermissionGroup as K, LoggingHttpAdapter as L, type Role as M, type SessionControllerOptions as N, type Organization as O, type Paged as P, type SessionInfo as Q, type RegisterInput as R, type Session as S, type TokenStorage as T, type SessionSnapshot as U, type SessionSnapshotListener as V, type SessionStatus as W, type SsoProvider as X, type SubjectApprovals as Y, type SubjectSecurity as Z, type TwoFactorChallenge as _, type HttpLoggerOptions as a, type TwoFactorStatus as a0, type User as a1, type ValidateResult as a2, type VerifyTwoFactorInput as a3, type WebAuthnAssertion as a4, type WebAuthnCeremonyStart as a5, type WebAuthnCredential as a6, createAuthyonAbility as a7, createAuthyonRules as a8, createClient as a9, hasPermission as aa, hasPermissionGroup as ab, type AbilityConditions as b, type AbilityEvent as c, type AbilityListener as d, type AbilityRule as e, type AbilitySubject as f, type Activity as g, type Approval as h, type ApprovalAssurance as i, type ApprovalPayload as j, type ApprovalStatus as k, type ApprovalWebAuthnOptions as l, type AuthEvent as m, type AuthState as n, type AuthStateListener as o, type AuthenticatorSetup as p, AuthyonAbility as q, AuthyonAbilityBuilder as r, type AuthyonAbilityOptions as s, type AuthyonClientOptions as t, type AuthyonPermissionSource as u, AuthyonSessionController as v, type CreateOrganizationInput as w, type HttpAdapterRequest as x, type HttpLogEvent as y, type HttpLogger as z };
881
+ export { type SessionInfo as $, AuthyonClient as A, type HttpLogger as B, type ConfirmApprovalInput as C, type InviteMemberInput as D, type LoginInput as E, FetchHttpAdapter as F, type LoginResult as G, type HttpAdapter as H, type IntrospectResult as I, type OrganizationInvite as J, type OrganizationInviteAccepted as K, LoggingHttpAdapter as L, type OrganizationInviteInput as M, type OrganizationInviteIssued as N, type Organization as O, type OrganizationInvitePreview as P, type OrganizationInviteStatus as Q, type OrganizationMember as R, type Paged as S, type TokenStorage as T, type PaginationOptions as U, type PermissionGroup as V, type RegisterInput as W, type Role as X, type SecurityMethods as Y, type Session as Z, type SessionControllerOptions as _, type HttpLoggerOptions as a, type SessionSnapshot as a0, type SessionSnapshotListener as a1, type SessionStatus as a2, type SsoProvider as a3, type SubjectApprovals as a4, type SubjectSecurity as a5, type TwoFactorChallenge as a6, type TwoFactorMethod as a7, type TwoFactorStatus as a8, type User as a9, type ValidateResult as aa, type VerifyTwoFactorInput as ab, type WebAuthnAssertion as ac, type WebAuthnCeremonyStart as ad, type WebAuthnCredential as ae, createAuthyonAbility as af, createAuthyonRules as ag, createClient as ah, hasPermission as ai, hasPermissionGroup as aj, type AbilityConditions as b, type AbilityEvent as c, type AbilityListener as d, type AbilityRule as e, type AbilitySubject as f, type AcceptOrganizationInviteInput as g, type Activity as h, type Approval as i, type ApprovalAssurance as j, type ApprovalPayload as k, type ApprovalStatus as l, type ApprovalWebAuthnOptions as m, type AuthEvent as n, type AuthState as o, type AuthStateListener as p, type AuthenticatorSetup as q, AuthyonAbility as r, AuthyonAbilityBuilder as s, type AuthyonAbilityOptions as t, type AuthyonClientOptions as u, type AuthyonPermissionSource as v, AuthyonSessionController as w, type CreateOrganizationInput as x, type HttpAdapterRequest as y, type HttpLogEvent as z };
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Security methods active on the user's account, as returned in the
3
+ * `security` field of `GET /auth/me` and `POST /auth/validate`.
4
+ */
5
+ interface SecurityMethods {
6
+ /** A password is set (false for accounts created only through SSO or magic link). */
7
+ password: boolean;
8
+ /** Authenticator app (TOTP one-time codes). */
9
+ authenticator: boolean;
10
+ /** One-time codes sent by email. */
11
+ emailCode: boolean;
12
+ /** At least one passkey registered. */
13
+ passkey: boolean;
14
+ passkeyCount: number;
15
+ /** Unused recovery codes left. */
16
+ recoveryCodes: number;
17
+ /** SSO providers linked to the account, e.g. `["google", "github"]`. */
18
+ sso: string[];
19
+ /** Any second factor is active (authenticator, email code or passkey). */
20
+ twoFactor: boolean;
21
+ }
1
22
  /** Lifecycle of an approval. */
2
23
  type ApprovalStatus = "pending" | "approved" | "denied" | "consumed" | "expired";
3
24
  /**
@@ -130,6 +151,11 @@ interface SubjectApprovals {
130
151
  }
131
152
  /** The `security` namespace an end-user client exposes. */
132
153
  interface SubjectSecurity {
154
+ /**
155
+ * GET /auth/me — which security methods the signed-in user has active
156
+ * (password, authenticator, email code, passkeys, recovery codes, SSO).
157
+ */
158
+ methods(): Promise<SecurityMethods>;
133
159
  /** Approve or reject what your backend asked the customer to confirm. */
134
160
  readonly approvals: SubjectApprovals;
135
161
  }
@@ -198,6 +224,86 @@ interface InviteMemberInput {
198
224
  email: string;
199
225
  roles: string[];
200
226
  }
227
+ /**
228
+ * POST /auth/tenants/{organizationId}/invites — invite an address that may not
229
+ * have an account yet; accepting creates it. `sendEmail` defaults to `true`;
230
+ * `false` only returns the link, for delivery through your own channel.
231
+ */
232
+ interface OrganizationInviteInput {
233
+ email: string;
234
+ roles?: string[];
235
+ sendEmail?: boolean;
236
+ /**
237
+ * Where to send the invitee after they accept. Must be registered exactly in
238
+ * the environment's redirect URIs (the same list SSO and magic link use);
239
+ * otherwise the API rejects the invite. Comes back on `preview` and `accept`.
240
+ */
241
+ redirectUri?: string;
242
+ }
243
+ /** Returned when an invite is created or re-issued. `acceptUrl` is only ever
244
+ * readable here — the API keeps a hash of the token, not the token. */
245
+ interface OrganizationInviteIssued {
246
+ id: string;
247
+ tenantId: string;
248
+ email: string;
249
+ roles: string[];
250
+ acceptUrl: string;
251
+ expiresAt: string;
252
+ emailSent: boolean;
253
+ redirectUri: string | null;
254
+ }
255
+ type OrganizationInviteStatus = "pending" | "accepted" | "revoked" | "expired";
256
+ interface OrganizationInvite {
257
+ id: string;
258
+ tenantId: string;
259
+ email: string;
260
+ roles: string[];
261
+ status: OrganizationInviteStatus;
262
+ createdAt: string;
263
+ expiresAt: string;
264
+ emailSentAt: string | null;
265
+ acceptedAt: string | null;
266
+ acceptedByUserId: string | null;
267
+ revokedAt: string | null;
268
+ invitedByUserId: string | null;
269
+ redirectUri: string | null;
270
+ }
271
+ /** POST /auth/tenant-invites/preview — what an accept page shows before the invitee commits. */
272
+ interface OrganizationInvitePreview {
273
+ tenantId: string;
274
+ tenantName: string;
275
+ email: string;
276
+ roles: string[];
277
+ expiresAt: string;
278
+ /** True: accepting only needs the token. False: send a password (and a username when `usernameRequired`). */
279
+ accountExists: boolean;
280
+ usernameRequired: boolean;
281
+ /** Where the issuer asked to send the invitee after accepting, or `null`. */
282
+ redirectUri: string | null;
283
+ }
284
+ /** POST /auth/tenant-invites/accept — everything but `token` is ignored when the address already has an account. */
285
+ interface AcceptOrganizationInviteInput {
286
+ token: string;
287
+ username?: string;
288
+ password?: string;
289
+ firstName?: string;
290
+ lastName?: string;
291
+ /**
292
+ * @deprecated Use `publicMetadata` / `privateMetadata` through
293
+ * `@authyon/server` (`environment.tenants.invites.accept`), which runs on
294
+ * your backend with the environment credential. Still accepted for now.
295
+ */
296
+ customFields?: Record<string, unknown>;
297
+ }
298
+ interface OrganizationInviteAccepted {
299
+ tenantId: string;
300
+ tenantName: string;
301
+ userId: string;
302
+ /** True when accepting created the account (email already confirmed). The invitee still signs in normally. */
303
+ accountCreated: boolean;
304
+ /** Where the issuer asked to send the invitee, or `null`. Redirecting is up to the accept page. */
305
+ redirectUri: string | null;
306
+ }
201
307
  /** Authenticated user profile. */
202
308
  interface User {
203
309
  id: string;
@@ -214,6 +320,8 @@ interface User {
214
320
  activeOrganization?: Organization | null;
215
321
  /** Actions the user must complete before continuing (e.g. confirm e-mail). */
216
322
  pendencies?: string[];
323
+ /** Security methods active on the account (authenticator, email code, passkey, SSO…). */
324
+ security?: SecurityMethods;
217
325
  }
218
326
  /** Token pair issued by login / refresh / tenant switch. */
219
327
  interface Session {
@@ -543,11 +651,53 @@ declare class AuthyonClient {
543
651
  * (`user.activities()`, `@authyon/server`'s `environment.users.list()`).
544
652
  */
545
653
  list: (organizationId: string, params?: PaginationOptions) => Promise<Paged<OrganizationMember>>;
546
- /** POST /auth/tenants/{organizationId}/members — invite a member by e-mail. */
654
+ /**
655
+ * POST /auth/tenants/{organizationId}/members — add an existing
656
+ * environment user by e-mail (no e-mail is sent). To invite an address
657
+ * that may not have an account yet, use `organization.invites.create`.
658
+ */
547
659
  invite: (organizationId: string, params: InviteMemberInput) => Promise<void>;
548
660
  /** DELETE /auth/tenants/{organizationId}/members/{userId} — remove a member. */
549
661
  remove: (organizationId: string, userId: string) => Promise<void>;
550
662
  };
663
+ /**
664
+ * Invites by e-mail or by link. Managing them requires the
665
+ * `tenants:members:invite` permission on the organization; `preview` and
666
+ * `accept` are public — the token in the link is the credential.
667
+ */
668
+ invites: {
669
+ /** GET /auth/tenants/{organizationId}/invites — every invite with its status, newest first. */
670
+ list: (organizationId: string) => Promise<OrganizationInvite[]>;
671
+ /**
672
+ * POST /auth/tenants/{organizationId}/invites — invite an address.
673
+ * Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
674
+ * mail it and you deliver the link yourself. The link is valid for 7
675
+ * days, once, and can't be read again later.
676
+ */
677
+ create: (organizationId: string, params: OrganizationInviteInput) => Promise<OrganizationInviteIssued>;
678
+ /**
679
+ * POST /auth/tenants/{organizationId}/invites/{inviteId}/resend — issue
680
+ * a new link (the previous one stops working), mailing it unless
681
+ * `sendEmail` is `false`.
682
+ */
683
+ resend: (organizationId: string, inviteId: string, params?: {
684
+ sendEmail?: boolean;
685
+ }) => Promise<OrganizationInviteIssued>;
686
+ /** DELETE /auth/tenants/{organizationId}/invites/{inviteId} — revoke a pending invite. */
687
+ revoke: (organizationId: string, inviteId: string) => Promise<void>;
688
+ /**
689
+ * POST /auth/tenant-invites/preview — public. Read the `token` query
690
+ * parameter of the invite link and pick the form: one click when
691
+ * `accountExists`, sign-up otherwise.
692
+ */
693
+ preview: (token: string) => Promise<OrganizationInvitePreview>;
694
+ /**
695
+ * POST /auth/tenant-invites/accept — public. Joins the organization; for
696
+ * an address with no account, also creates it (password required) with
697
+ * the e-mail already confirmed. Does not sign the user in.
698
+ */
699
+ accept: (params: AcceptOrganizationInviteInput) => Promise<OrganizationInviteAccepted>;
700
+ };
551
701
  roles: {
552
702
  /** GET /auth/tenants/{organizationId}/roles — roles available in the organization. */
553
703
  list: (organizationId: string) => Promise<Role[]>;
@@ -728,4 +878,4 @@ declare function hasPermissionGroup(source: AuthyonPermissionSource | readonly s
728
878
  /** Converts Authyon's `subject:action` permission strings to authorization rules. */
729
879
  declare function createAuthyonRules(source?: AuthyonPermissionSource, options?: AuthyonAbilityOptions): AbilityRule[];
730
880
 
731
- export { type TwoFactorMethod as $, AuthyonClient as A, type InviteMemberInput as B, type ConfirmApprovalInput as C, type LoginInput as D, type LoginResult as E, FetchHttpAdapter as F, type OrganizationMember as G, type HttpAdapter as H, type IntrospectResult as I, type PaginationOptions as J, type PermissionGroup as K, LoggingHttpAdapter as L, type Role as M, type SessionControllerOptions as N, type Organization as O, type Paged as P, type SessionInfo as Q, type RegisterInput as R, type Session as S, type TokenStorage as T, type SessionSnapshot as U, type SessionSnapshotListener as V, type SessionStatus as W, type SsoProvider as X, type SubjectApprovals as Y, type SubjectSecurity as Z, type TwoFactorChallenge as _, type HttpLoggerOptions as a, type TwoFactorStatus as a0, type User as a1, type ValidateResult as a2, type VerifyTwoFactorInput as a3, type WebAuthnAssertion as a4, type WebAuthnCeremonyStart as a5, type WebAuthnCredential as a6, createAuthyonAbility as a7, createAuthyonRules as a8, createClient as a9, hasPermission as aa, hasPermissionGroup as ab, type AbilityConditions as b, type AbilityEvent as c, type AbilityListener as d, type AbilityRule as e, type AbilitySubject as f, type Activity as g, type Approval as h, type ApprovalAssurance as i, type ApprovalPayload as j, type ApprovalStatus as k, type ApprovalWebAuthnOptions as l, type AuthEvent as m, type AuthState as n, type AuthStateListener as o, type AuthenticatorSetup as p, AuthyonAbility as q, AuthyonAbilityBuilder as r, type AuthyonAbilityOptions as s, type AuthyonClientOptions as t, type AuthyonPermissionSource as u, AuthyonSessionController as v, type CreateOrganizationInput as w, type HttpAdapterRequest as x, type HttpLogEvent as y, type HttpLogger as z };
881
+ export { type SessionInfo as $, AuthyonClient as A, type HttpLogger as B, type ConfirmApprovalInput as C, type InviteMemberInput as D, type LoginInput as E, FetchHttpAdapter as F, type LoginResult as G, type HttpAdapter as H, type IntrospectResult as I, type OrganizationInvite as J, type OrganizationInviteAccepted as K, LoggingHttpAdapter as L, type OrganizationInviteInput as M, type OrganizationInviteIssued as N, type Organization as O, type OrganizationInvitePreview as P, type OrganizationInviteStatus as Q, type OrganizationMember as R, type Paged as S, type TokenStorage as T, type PaginationOptions as U, type PermissionGroup as V, type RegisterInput as W, type Role as X, type SecurityMethods as Y, type Session as Z, type SessionControllerOptions as _, type HttpLoggerOptions as a, type SessionSnapshot as a0, type SessionSnapshotListener as a1, type SessionStatus as a2, type SsoProvider as a3, type SubjectApprovals as a4, type SubjectSecurity as a5, type TwoFactorChallenge as a6, type TwoFactorMethod as a7, type TwoFactorStatus as a8, type User as a9, type ValidateResult as aa, type VerifyTwoFactorInput as ab, type WebAuthnAssertion as ac, type WebAuthnCeremonyStart as ad, type WebAuthnCredential as ae, createAuthyonAbility as af, createAuthyonRules as ag, createClient as ah, hasPermission as ai, hasPermissionGroup as aj, type AbilityConditions as b, type AbilityEvent as c, type AbilityListener as d, type AbilityRule as e, type AbilitySubject as f, type AcceptOrganizationInviteInput as g, type Activity as h, type Approval as i, type ApprovalAssurance as j, type ApprovalPayload as k, type ApprovalStatus as l, type ApprovalWebAuthnOptions as m, type AuthEvent as n, type AuthState as o, type AuthStateListener as p, type AuthenticatorSetup as q, AuthyonAbility as r, AuthyonAbilityBuilder as s, type AuthyonAbilityOptions as t, type AuthyonClientOptions as u, type AuthyonPermissionSource as v, AuthyonSessionController as w, type CreateOrganizationInput as x, type HttpAdapterRequest as y, type HttpLogEvent as z };
package/dist/index.cjs CHANGED
@@ -46,8 +46,22 @@ function path(id, suffix = "") {
46
46
  throw new TypeError("Authyon: an approval id is required.");
47
47
  return `/auth/authorizations/${encodeURIComponent(id)}${suffix}`;
48
48
  }
49
+ var NO_METHODS = {
50
+ password: false,
51
+ authenticator: false,
52
+ emailCode: false,
53
+ passkey: false,
54
+ passkeyCount: 0,
55
+ recoveryCodes: 0,
56
+ sso: [],
57
+ twoFactor: false
58
+ };
49
59
  function subjectSecurity(request) {
50
60
  return {
61
+ methods: async () => {
62
+ const me = await request("/auth/me");
63
+ return me.security ?? NO_METHODS;
64
+ },
51
65
  approvals: {
52
66
  get: (id) => request(path(id)),
53
67
  webauthnOptions: (id) => request(path(id, "/webauthn/options"), { method: "POST" }),
@@ -82,6 +96,7 @@ var ErrorCodes = {
82
96
  UserNotFound: "user_not_found",
83
97
  TemporarilyUnavailable: "temporarily_unavailable",
84
98
  InsufficientScope: "insufficient_scope",
99
+ CredentialThrottled: "credential_throttled",
85
100
  ApprovalNotFound: "authorization_not_found",
86
101
  SessionRevoked: "session_revoked",
87
102
  TwoFactorTooManyFailures: "user.2fa.too_many_failures"
@@ -598,7 +613,11 @@ var AuthyonClient = class {
598
613
  appendQuery(`/auth/tenants/${encodeURIComponent(organizationId)}/members`, params),
599
614
  { bearer: true }
600
615
  ),
601
- /** POST /auth/tenants/{organizationId}/members — invite a member by e-mail. */
616
+ /**
617
+ * POST /auth/tenants/{organizationId}/members — add an existing
618
+ * environment user by e-mail (no e-mail is sent). To invite an address
619
+ * that may not have an account yet, use `organization.invites.create`.
620
+ */
602
621
  invite: (organizationId, params) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/members`, {
603
622
  method: "POST",
604
623
  bearer: true,
@@ -610,6 +629,59 @@ var AuthyonClient = class {
610
629
  { method: "DELETE", bearer: true }
611
630
  )
612
631
  },
632
+ /**
633
+ * Invites by e-mail or by link. Managing them requires the
634
+ * `tenants:members:invite` permission on the organization; `preview` and
635
+ * `accept` are public — the token in the link is the credential.
636
+ */
637
+ invites: {
638
+ /** GET /auth/tenants/{organizationId}/invites — every invite with its status, newest first. */
639
+ list: (organizationId) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/invites`, {
640
+ bearer: true
641
+ }),
642
+ /**
643
+ * POST /auth/tenants/{organizationId}/invites — invite an address.
644
+ * Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
645
+ * mail it and you deliver the link yourself. The link is valid for 7
646
+ * days, once, and can't be read again later.
647
+ */
648
+ create: (organizationId, params) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/invites`, {
649
+ method: "POST",
650
+ bearer: true,
651
+ body: {
652
+ email: params.email,
653
+ roles: params.roles,
654
+ sendEmail: params.sendEmail ?? true,
655
+ redirectUri: params.redirectUri
656
+ }
657
+ }),
658
+ /**
659
+ * POST /auth/tenants/{organizationId}/invites/{inviteId}/resend — issue
660
+ * a new link (the previous one stops working), mailing it unless
661
+ * `sendEmail` is `false`.
662
+ */
663
+ resend: (organizationId, inviteId, params = {}) => this.request(
664
+ `/auth/tenants/${encodeURIComponent(organizationId)}/invites/${encodeURIComponent(inviteId)}/resend`,
665
+ { method: "POST", bearer: true, body: { sendEmail: params.sendEmail ?? true } }
666
+ ),
667
+ /** DELETE /auth/tenants/{organizationId}/invites/{inviteId} — revoke a pending invite. */
668
+ revoke: (organizationId, inviteId) => this.request(
669
+ `/auth/tenants/${encodeURIComponent(organizationId)}/invites/${encodeURIComponent(inviteId)}`,
670
+ { method: "DELETE", bearer: true }
671
+ ),
672
+ /**
673
+ * POST /auth/tenant-invites/preview — public. Read the `token` query
674
+ * parameter of the invite link and pick the form: one click when
675
+ * `accountExists`, sign-up otherwise.
676
+ */
677
+ preview: (token) => this.request("/auth/tenant-invites/preview", { method: "POST", body: { token } }),
678
+ /**
679
+ * POST /auth/tenant-invites/accept — public. Joins the organization; for
680
+ * an address with no account, also creates it (password required) with
681
+ * the e-mail already confirmed. Does not sign the user in.
682
+ */
683
+ accept: (params) => this.request("/auth/tenant-invites/accept", { method: "POST", body: params })
684
+ },
613
685
  roles: {
614
686
  /** GET /auth/tenants/{organizationId}/roles — roles available in the organization. */
615
687
  list: (organizationId) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/roles`, {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TokenStorage, H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonClient } from './ability-5_xXXbDF.cjs';
2
- export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRule, f as AbilitySubject, g as Activity, h as Approval, i as ApprovalAssurance, j as ApprovalPayload, k as ApprovalStatus, l as ApprovalWebAuthnOptions, m as AuthEvent, n as AuthState, o as AuthStateListener, p as AuthenticatorSetup, q as AuthyonAbility, r as AuthyonAbilityBuilder, s as AuthyonAbilityOptions, t as AuthyonClientOptions, u as AuthyonPermissionSource, v as AuthyonSessionController, C as ConfirmApprovalInput, w as CreateOrganizationInput, F as FetchHttpAdapter, x as HttpAdapterRequest, y as HttpLogEvent, z as HttpLogger, I as IntrospectResult, B as InviteMemberInput, L as LoggingHttpAdapter, D as LoginInput, E as LoginResult, O as Organization, G as OrganizationMember, P as Paged, J as PaginationOptions, K as PermissionGroup, R as RegisterInput, M as Role, S as Session, N as SessionControllerOptions, Q as SessionInfo, U as SessionSnapshot, V as SessionSnapshotListener, W as SessionStatus, X as SsoProvider, Y as SubjectApprovals, Z as SubjectSecurity, _ as TwoFactorChallenge, $ as TwoFactorMethod, a0 as TwoFactorStatus, a1 as User, a2 as ValidateResult, a3 as VerifyTwoFactorInput, a4 as WebAuthnAssertion, a5 as WebAuthnCeremonyStart, a6 as WebAuthnCredential, a7 as createAuthyonAbility, a8 as createAuthyonRules, a9 as createClient, aa as hasPermission, ab as hasPermissionGroup } from './ability-5_xXXbDF.cjs';
1
+ import { T as TokenStorage, H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonClient } from './ability-Cp8ir5Gr.cjs';
2
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRule, f as AbilitySubject, g as AcceptOrganizationInviteInput, h as Activity, i as Approval, j as ApprovalAssurance, k as ApprovalPayload, l as ApprovalStatus, m as ApprovalWebAuthnOptions, n as AuthEvent, o as AuthState, p as AuthStateListener, q as AuthenticatorSetup, r as AuthyonAbility, s as AuthyonAbilityBuilder, t as AuthyonAbilityOptions, u as AuthyonClientOptions, v as AuthyonPermissionSource, w as AuthyonSessionController, C as ConfirmApprovalInput, x as CreateOrganizationInput, F as FetchHttpAdapter, y as HttpAdapterRequest, z as HttpLogEvent, B as HttpLogger, I as IntrospectResult, D as InviteMemberInput, L as LoggingHttpAdapter, E as LoginInput, G as LoginResult, O as Organization, J as OrganizationInvite, K as OrganizationInviteAccepted, M as OrganizationInviteInput, N as OrganizationInviteIssued, P as OrganizationInvitePreview, Q as OrganizationInviteStatus, R as OrganizationMember, S as Paged, U as PaginationOptions, V as PermissionGroup, W as RegisterInput, X as Role, Y as SecurityMethods, Z as Session, _ as SessionControllerOptions, $ as SessionInfo, a0 as SessionSnapshot, a1 as SessionSnapshotListener, a2 as SessionStatus, a3 as SsoProvider, a4 as SubjectApprovals, a5 as SubjectSecurity, a6 as TwoFactorChallenge, a7 as TwoFactorMethod, a8 as TwoFactorStatus, a9 as User, aa as ValidateResult, ab as VerifyTwoFactorInput, ac as WebAuthnAssertion, ad as WebAuthnCeremonyStart, ae as WebAuthnCredential, af as createAuthyonAbility, ag as createAuthyonRules, ah as createClient, ai as hasPermission, aj as hasPermissionGroup } from './ability-Cp8ir5Gr.cjs';
3
3
 
4
4
  declare const ErrorCodes: {
5
5
  readonly Unknown: "unknown";
@@ -25,6 +25,7 @@ declare const ErrorCodes: {
25
25
  readonly UserNotFound: "user_not_found";
26
26
  readonly TemporarilyUnavailable: "temporarily_unavailable";
27
27
  readonly InsufficientScope: "insufficient_scope";
28
+ readonly CredentialThrottled: "credential_throttled";
28
29
  readonly ApprovalNotFound: "authorization_not_found";
29
30
  readonly SessionRevoked: "session_revoked";
30
31
  readonly TwoFactorTooManyFailures: "user.2fa.too_many_failures";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TokenStorage, H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonClient } from './ability-5_xXXbDF.js';
2
- export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRule, f as AbilitySubject, g as Activity, h as Approval, i as ApprovalAssurance, j as ApprovalPayload, k as ApprovalStatus, l as ApprovalWebAuthnOptions, m as AuthEvent, n as AuthState, o as AuthStateListener, p as AuthenticatorSetup, q as AuthyonAbility, r as AuthyonAbilityBuilder, s as AuthyonAbilityOptions, t as AuthyonClientOptions, u as AuthyonPermissionSource, v as AuthyonSessionController, C as ConfirmApprovalInput, w as CreateOrganizationInput, F as FetchHttpAdapter, x as HttpAdapterRequest, y as HttpLogEvent, z as HttpLogger, I as IntrospectResult, B as InviteMemberInput, L as LoggingHttpAdapter, D as LoginInput, E as LoginResult, O as Organization, G as OrganizationMember, P as Paged, J as PaginationOptions, K as PermissionGroup, R as RegisterInput, M as Role, S as Session, N as SessionControllerOptions, Q as SessionInfo, U as SessionSnapshot, V as SessionSnapshotListener, W as SessionStatus, X as SsoProvider, Y as SubjectApprovals, Z as SubjectSecurity, _ as TwoFactorChallenge, $ as TwoFactorMethod, a0 as TwoFactorStatus, a1 as User, a2 as ValidateResult, a3 as VerifyTwoFactorInput, a4 as WebAuthnAssertion, a5 as WebAuthnCeremonyStart, a6 as WebAuthnCredential, a7 as createAuthyonAbility, a8 as createAuthyonRules, a9 as createClient, aa as hasPermission, ab as hasPermissionGroup } from './ability-5_xXXbDF.js';
1
+ import { T as TokenStorage, H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonClient } from './ability-Cp8ir5Gr.js';
2
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRule, f as AbilitySubject, g as AcceptOrganizationInviteInput, h as Activity, i as Approval, j as ApprovalAssurance, k as ApprovalPayload, l as ApprovalStatus, m as ApprovalWebAuthnOptions, n as AuthEvent, o as AuthState, p as AuthStateListener, q as AuthenticatorSetup, r as AuthyonAbility, s as AuthyonAbilityBuilder, t as AuthyonAbilityOptions, u as AuthyonClientOptions, v as AuthyonPermissionSource, w as AuthyonSessionController, C as ConfirmApprovalInput, x as CreateOrganizationInput, F as FetchHttpAdapter, y as HttpAdapterRequest, z as HttpLogEvent, B as HttpLogger, I as IntrospectResult, D as InviteMemberInput, L as LoggingHttpAdapter, E as LoginInput, G as LoginResult, O as Organization, J as OrganizationInvite, K as OrganizationInviteAccepted, M as OrganizationInviteInput, N as OrganizationInviteIssued, P as OrganizationInvitePreview, Q as OrganizationInviteStatus, R as OrganizationMember, S as Paged, U as PaginationOptions, V as PermissionGroup, W as RegisterInput, X as Role, Y as SecurityMethods, Z as Session, _ as SessionControllerOptions, $ as SessionInfo, a0 as SessionSnapshot, a1 as SessionSnapshotListener, a2 as SessionStatus, a3 as SsoProvider, a4 as SubjectApprovals, a5 as SubjectSecurity, a6 as TwoFactorChallenge, a7 as TwoFactorMethod, a8 as TwoFactorStatus, a9 as User, aa as ValidateResult, ab as VerifyTwoFactorInput, ac as WebAuthnAssertion, ad as WebAuthnCeremonyStart, ae as WebAuthnCredential, af as createAuthyonAbility, ag as createAuthyonRules, ah as createClient, ai as hasPermission, aj as hasPermissionGroup } from './ability-Cp8ir5Gr.js';
3
3
 
4
4
  declare const ErrorCodes: {
5
5
  readonly Unknown: "unknown";
@@ -25,6 +25,7 @@ declare const ErrorCodes: {
25
25
  readonly UserNotFound: "user_not_found";
26
26
  readonly TemporarilyUnavailable: "temporarily_unavailable";
27
27
  readonly InsufficientScope: "insufficient_scope";
28
+ readonly CredentialThrottled: "credential_throttled";
28
29
  readonly ApprovalNotFound: "authorization_not_found";
29
30
  readonly SessionRevoked: "session_revoked";
30
31
  readonly TwoFactorTooManyFailures: "user.2fa.too_many_failures";
package/dist/index.js CHANGED
@@ -14,8 +14,22 @@ function path(id, suffix = "") {
14
14
  throw new TypeError("Authyon: an approval id is required.");
15
15
  return `/auth/authorizations/${encodeURIComponent(id)}${suffix}`;
16
16
  }
17
+ var NO_METHODS = {
18
+ password: false,
19
+ authenticator: false,
20
+ emailCode: false,
21
+ passkey: false,
22
+ passkeyCount: 0,
23
+ recoveryCodes: 0,
24
+ sso: [],
25
+ twoFactor: false
26
+ };
17
27
  function subjectSecurity(request) {
18
28
  return {
29
+ methods: async () => {
30
+ const me = await request("/auth/me");
31
+ return me.security ?? NO_METHODS;
32
+ },
19
33
  approvals: {
20
34
  get: (id) => request(path(id)),
21
35
  webauthnOptions: (id) => request(path(id, "/webauthn/options"), { method: "POST" }),
@@ -50,6 +64,7 @@ var ErrorCodes = {
50
64
  UserNotFound: "user_not_found",
51
65
  TemporarilyUnavailable: "temporarily_unavailable",
52
66
  InsufficientScope: "insufficient_scope",
67
+ CredentialThrottled: "credential_throttled",
53
68
  ApprovalNotFound: "authorization_not_found",
54
69
  SessionRevoked: "session_revoked",
55
70
  TwoFactorTooManyFailures: "user.2fa.too_many_failures"
@@ -566,7 +581,11 @@ var AuthyonClient = class {
566
581
  appendQuery(`/auth/tenants/${encodeURIComponent(organizationId)}/members`, params),
567
582
  { bearer: true }
568
583
  ),
569
- /** POST /auth/tenants/{organizationId}/members — invite a member by e-mail. */
584
+ /**
585
+ * POST /auth/tenants/{organizationId}/members — add an existing
586
+ * environment user by e-mail (no e-mail is sent). To invite an address
587
+ * that may not have an account yet, use `organization.invites.create`.
588
+ */
570
589
  invite: (organizationId, params) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/members`, {
571
590
  method: "POST",
572
591
  bearer: true,
@@ -578,6 +597,59 @@ var AuthyonClient = class {
578
597
  { method: "DELETE", bearer: true }
579
598
  )
580
599
  },
600
+ /**
601
+ * Invites by e-mail or by link. Managing them requires the
602
+ * `tenants:members:invite` permission on the organization; `preview` and
603
+ * `accept` are public — the token in the link is the credential.
604
+ */
605
+ invites: {
606
+ /** GET /auth/tenants/{organizationId}/invites — every invite with its status, newest first. */
607
+ list: (organizationId) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/invites`, {
608
+ bearer: true
609
+ }),
610
+ /**
611
+ * POST /auth/tenants/{organizationId}/invites — invite an address.
612
+ * Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
613
+ * mail it and you deliver the link yourself. The link is valid for 7
614
+ * days, once, and can't be read again later.
615
+ */
616
+ create: (organizationId, params) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/invites`, {
617
+ method: "POST",
618
+ bearer: true,
619
+ body: {
620
+ email: params.email,
621
+ roles: params.roles,
622
+ sendEmail: params.sendEmail ?? true,
623
+ redirectUri: params.redirectUri
624
+ }
625
+ }),
626
+ /**
627
+ * POST /auth/tenants/{organizationId}/invites/{inviteId}/resend — issue
628
+ * a new link (the previous one stops working), mailing it unless
629
+ * `sendEmail` is `false`.
630
+ */
631
+ resend: (organizationId, inviteId, params = {}) => this.request(
632
+ `/auth/tenants/${encodeURIComponent(organizationId)}/invites/${encodeURIComponent(inviteId)}/resend`,
633
+ { method: "POST", bearer: true, body: { sendEmail: params.sendEmail ?? true } }
634
+ ),
635
+ /** DELETE /auth/tenants/{organizationId}/invites/{inviteId} — revoke a pending invite. */
636
+ revoke: (organizationId, inviteId) => this.request(
637
+ `/auth/tenants/${encodeURIComponent(organizationId)}/invites/${encodeURIComponent(inviteId)}`,
638
+ { method: "DELETE", bearer: true }
639
+ ),
640
+ /**
641
+ * POST /auth/tenant-invites/preview — public. Read the `token` query
642
+ * parameter of the invite link and pick the form: one click when
643
+ * `accountExists`, sign-up otherwise.
644
+ */
645
+ preview: (token) => this.request("/auth/tenant-invites/preview", { method: "POST", body: { token } }),
646
+ /**
647
+ * POST /auth/tenant-invites/accept — public. Joins the organization; for
648
+ * an address with no account, also creates it (password required) with
649
+ * the e-mail already confirmed. Does not sign the user in.
650
+ */
651
+ accept: (params) => this.request("/auth/tenant-invites/accept", { method: "POST", body: params })
652
+ },
581
653
  roles: {
582
654
  /** GET /auth/tenants/{organizationId}/roles — roles available in the organization. */
583
655
  list: (organizationId) => this.request(`/auth/tenants/${encodeURIComponent(organizationId)}/roles`, {
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { a1 as User, N as SessionControllerOptions, A as AuthyonClient, U as SessionSnapshot, S as Session, f as AbilitySubject, s as AuthyonAbilityOptions, q as AuthyonAbility } from '../ability-5_xXXbDF.cjs';
4
- export { v as AuthyonSessionController, V as SessionSnapshotListener, W as SessionStatus } from '../ability-5_xXXbDF.cjs';
3
+ import { a9 as User, _ as SessionControllerOptions, A as AuthyonClient, a0 as SessionSnapshot, Z as Session, f as AbilitySubject, t as AuthyonAbilityOptions, r as AuthyonAbility } from '../ability-Cp8ir5Gr.cjs';
4
+ export { w as AuthyonSessionController, a1 as SessionSnapshotListener, a2 as SessionStatus } from '../ability-Cp8ir5Gr.cjs';
5
5
 
6
6
  interface AuthyonProviderProps<TUser extends User = User> extends SessionControllerOptions {
7
7
  client: AuthyonClient;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { a1 as User, N as SessionControllerOptions, A as AuthyonClient, U as SessionSnapshot, S as Session, f as AbilitySubject, s as AuthyonAbilityOptions, q as AuthyonAbility } from '../ability-5_xXXbDF.js';
4
- export { v as AuthyonSessionController, V as SessionSnapshotListener, W as SessionStatus } from '../ability-5_xXXbDF.js';
3
+ import { a9 as User, _ as SessionControllerOptions, A as AuthyonClient, a0 as SessionSnapshot, Z as Session, f as AbilitySubject, t as AuthyonAbilityOptions, r as AuthyonAbility } from '../ability-Cp8ir5Gr.js';
4
+ export { w as AuthyonSessionController, a1 as SessionSnapshotListener, a2 as SessionStatus } from '../ability-Cp8ir5Gr.js';
5
5
 
6
6
  interface AuthyonProviderProps<TUser extends User = User> extends SessionControllerOptions {
7
7
  client: AuthyonClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authyon/auth",
3
- "version": "0.2.0-beta.15",
3
+ "version": "0.2.0-beta.17",
4
4
  "description": "Authyon SDK for browsers — auth, sessions, multi-tenant and 2FA for vanilla JS/TS.",
5
5
  "license": "MIT",
6
6
  "type": "module",