@authyon/server 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 +49 -2
- package/dist/{authorization-WlwcTBwG.d.ts → authorization-BvjIWPcU.d.ts} +1 -1
- package/dist/{authorization-B82XXf3B.d.cts → authorization-C0Mg5gUv.d.cts} +1 -1
- package/dist/{authyonServerClient-DQzhfaja.d.cts → authyonServerClient-1_1qNRDa.d.cts} +249 -58
- package/dist/{authyonServerClient-DQzhfaja.d.ts → authyonServerClient-1_1qNRDa.d.ts} +249 -58
- package/dist/bff.cjs +18 -0
- package/dist/bff.d.cts +8 -1
- package/dist/bff.d.ts +8 -1
- package/dist/bff.js +18 -1
- package/dist/{chunk-WPPEV5BA.js → chunk-TDJNBD3Z.js} +1 -0
- package/dist/index.cjs +122 -3
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +122 -4
- package/dist/next.d.cts +2 -2
- package/dist/next.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,7 +194,8 @@ await authyon.validate(token, { clientIp: "203.0.113.10" });
|
|
|
194
194
|
## Segurança (`security.*`)
|
|
195
195
|
|
|
196
196
|
OTP e aprovações ficam agrupados em `authyon.security`. Exige uma credencial de ambiente
|
|
197
|
-
com o escopo `authyon:
|
|
197
|
+
com o escopo `authyon:otp:verify` (para `security.otp`) e/ou `authyon:financial:authorize`
|
|
198
|
+
(para `security.approvals`). Guia completo:
|
|
198
199
|
[`docs/security-otp-approvals.md`](../../docs/security-otp-approvals.md).
|
|
199
200
|
|
|
200
201
|
```ts
|
|
@@ -373,12 +374,58 @@ await authyon.environment.tenants.members.remove(tenantId, userId);
|
|
|
373
374
|
// Os métodos tenant(credentials).members.add/remove existentes continuam disponíveis.
|
|
374
375
|
```
|
|
375
376
|
|
|
376
|
-
Configure `envKey` para `user()`.
|
|
377
|
+
Configure `envKey` para `user()`. `members.invite` associa um usuário já
|
|
377
378
|
cadastrado no ambiente pelo e-mail; não cria conta e não envia link por e-mail.
|
|
379
|
+
Para isso, use os convites abaixo.
|
|
378
380
|
A API exige associação/permissões do usuário chamador. No browser, os métodos
|
|
379
381
|
existentes `@authyon/auth` → `organization.members.invite/remove` continuam
|
|
380
382
|
atendendo esse fluxo. Nunca importe `@authyon/server` no browser.
|
|
381
383
|
|
|
384
|
+
## Convites de tenant (e-mail ou link)
|
|
385
|
+
|
|
386
|
+
Convide um e-mail que talvez ainda não tenha conta — aceitar cria a conta, já com o
|
|
387
|
+
e-mail confirmado. A resposta sempre traz o `acceptUrl` completo; `sendEmail: false`
|
|
388
|
+
só gera o link para você enviar pelo seu canal.
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
// Pelo ambiente (escopo authyon:users:write; listar exige authyon:tenants:read).
|
|
392
|
+
const invite = await authyon.environment.tenants.invites.create(tenantId, {
|
|
393
|
+
email: "pessoa@example.com",
|
|
394
|
+
roles: ["reader"],
|
|
395
|
+
sendEmail: false, // padrão: true
|
|
396
|
+
// Opcional: para onde mandar a pessoa depois de aceitar. Precisa estar
|
|
397
|
+
// cadastrado (match exato) nos redirect URIs do ambiente.
|
|
398
|
+
redirectUri: "https://app.example.com/bem-vindo",
|
|
399
|
+
});
|
|
400
|
+
invite.acceptUrl; // só aparece aqui — a API guarda apenas o hash do token
|
|
401
|
+
|
|
402
|
+
await authyon.environment.tenants.invites.list(tenantId);
|
|
403
|
+
await authyon.environment.tenants.invites.resend(tenantId, invite.id, { sendEmail: true });
|
|
404
|
+
await authyon.environment.tenants.invites.revoke(tenantId, invite.id);
|
|
405
|
+
|
|
406
|
+
// Pela credencial do tenant, ou agindo como o usuário (permissão tenants:members:invite).
|
|
407
|
+
await authyon.tenant(credentials).invites.create({ email: "pessoa@example.com" });
|
|
408
|
+
await authyon.user(token).tenants.invites.create(tenantId, { email: "pessoa@example.com" });
|
|
409
|
+
|
|
410
|
+
// Página de aceite no seu backend: públicas, usam só o envKey.
|
|
411
|
+
const preview = await authyon.environment.tenants.invites.preview(token);
|
|
412
|
+
const accepted = await authyon.environment.tenants.invites.accept({
|
|
413
|
+
token,
|
|
414
|
+
password: preview.accountExists ? undefined : password,
|
|
415
|
+
// Opcional. Com metadata, a chamada vai para /env/tenant-invites/accept usando
|
|
416
|
+
// clientId/clientSecret (escopo authyon:users:write) — só o backend pode definir.
|
|
417
|
+
publicMetadata: { plano: "pro" },
|
|
418
|
+
privateMetadata: { crmId: "42" },
|
|
419
|
+
// customFields: { ... } — obsoleto, prefira os metadata acima.
|
|
420
|
+
});
|
|
421
|
+
if (accepted.redirectUri) redirect(accepted.redirectUri); // o redirect fica por sua conta
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
O link vale 7 dias e uma única vez. `resend` gera um link novo e invalida o anterior.
|
|
425
|
+
Por padrão o link aponta para a página do Authyon; configure a _URL do convite para
|
|
426
|
+
tenant_ nas configurações do ambiente para usar a sua (ela recebe `token` e `env`).
|
|
427
|
+
Aceitar não faz login.
|
|
428
|
+
|
|
382
429
|
## Compatibilidade e segurança do transporte
|
|
383
430
|
|
|
384
431
|
As chamadas exigem os endpoints externos atuais da API e a migração
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.js';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.cjs';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -57,6 +57,82 @@ declare class LoggingHttpAdapter implements HttpAdapter {
|
|
|
57
57
|
private log;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Security methods active on the user's account, as returned in the
|
|
62
|
+
* `security` field of `GET /auth/me` and `POST /auth/validate`.
|
|
63
|
+
*/
|
|
64
|
+
interface SecurityMethods {
|
|
65
|
+
/** A password is set (false for accounts created only through SSO or magic link). */
|
|
66
|
+
password: boolean;
|
|
67
|
+
/** Authenticator app (TOTP one-time codes). */
|
|
68
|
+
authenticator: boolean;
|
|
69
|
+
/** One-time codes sent by email. */
|
|
70
|
+
emailCode: boolean;
|
|
71
|
+
/** At least one passkey registered. */
|
|
72
|
+
passkey: boolean;
|
|
73
|
+
passkeyCount: number;
|
|
74
|
+
/** Unused recovery codes left. */
|
|
75
|
+
recoveryCodes: number;
|
|
76
|
+
/** SSO providers linked to the account, e.g. `["google", "github"]`. */
|
|
77
|
+
sso: string[];
|
|
78
|
+
/** Any second factor is active (authenticator, email code or passkey). */
|
|
79
|
+
twoFactor: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Lifecycle of an approval. */
|
|
82
|
+
type ApprovalStatus = "pending" | "approved" | "denied" | "consumed" | "expired";
|
|
83
|
+
/**
|
|
84
|
+
* Free-form JSON object describing what the customer approves (up to 16 KiB).
|
|
85
|
+
* The API stores it, shows it back to the customer and binds its canonical
|
|
86
|
+
* hash (keys sorted) to the approval.
|
|
87
|
+
*/
|
|
88
|
+
type ApprovalPayload = Record<string, unknown>;
|
|
89
|
+
/** Evidence of how the customer proved their identity when approving. */
|
|
90
|
+
interface ApprovalAssurance {
|
|
91
|
+
/** `urn:authyon:loa:3` (passkey) or `urn:authyon:loa:2` (authenticator code). */
|
|
92
|
+
acr: string;
|
|
93
|
+
/** Authentication methods, e.g. `["pwd", "otp"]` or `["pwd", "webauthn"]`. */
|
|
94
|
+
amr: string[];
|
|
95
|
+
/** When the second factor was verified (ISO 8601). */
|
|
96
|
+
authTime: string;
|
|
97
|
+
}
|
|
98
|
+
/** A request for the customer to approve something with a second factor. */
|
|
99
|
+
interface Approval {
|
|
100
|
+
id: string;
|
|
101
|
+
status: ApprovalStatus;
|
|
102
|
+
subjectId: string;
|
|
103
|
+
tenantId?: string | null;
|
|
104
|
+
/** The payload given to `create()`, with keys in canonical order. */
|
|
105
|
+
payload: ApprovalPayload;
|
|
106
|
+
/** SHA-256 (hex) of the canonical payload. */
|
|
107
|
+
payloadHash: string;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
expiresAt: string;
|
|
110
|
+
decidedAt?: string | null;
|
|
111
|
+
consumedAt?: string | null;
|
|
112
|
+
/** Present once approved. */
|
|
113
|
+
assurance?: ApprovalAssurance | null;
|
|
114
|
+
}
|
|
115
|
+
/** Second factor sent with `confirm()`. */
|
|
116
|
+
type ConfirmApprovalInput = {
|
|
117
|
+
method: "authenticator";
|
|
118
|
+
/** Six-digit code from the customer's authenticator app. */
|
|
119
|
+
code: string;
|
|
120
|
+
} | {
|
|
121
|
+
method: "webauthn";
|
|
122
|
+
/** Assertion for the options returned by `webauthnOptions()`. */
|
|
123
|
+
webAuthn: {
|
|
124
|
+
ceremonyToken: string;
|
|
125
|
+
/** JSON-serialized `PublicKeyCredential` from `navigator.credentials.get()`. */
|
|
126
|
+
assertionJson: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/** Passkey assertion options for approving one approval. */
|
|
130
|
+
interface ApprovalWebAuthnOptions {
|
|
131
|
+
ceremonyToken: string;
|
|
132
|
+
/** JSON `PublicKeyCredentialRequestOptions` to pass to `navigator.credentials.get()`. */
|
|
133
|
+
optionsJson: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
60
136
|
interface PaginationOptions {
|
|
61
137
|
skip?: number;
|
|
62
138
|
take?: number;
|
|
@@ -120,6 +196,8 @@ interface User {
|
|
|
120
196
|
/** Environment-level roles from the database-validated user profile. */
|
|
121
197
|
roles?: string[];
|
|
122
198
|
permissions?: string[];
|
|
199
|
+
/** Security methods active on the account (authenticator, email code, passkey, SSO…). */
|
|
200
|
+
security?: SecurityMethods;
|
|
123
201
|
}
|
|
124
202
|
interface RoleGrant {
|
|
125
203
|
role: string;
|
|
@@ -251,8 +329,15 @@ interface UpdateOrganizationInput {
|
|
|
251
329
|
}
|
|
252
330
|
interface CreateUserInput {
|
|
253
331
|
email: string;
|
|
254
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Same contract as `/auth/register`: optional only when the environment's
|
|
334
|
+
* username policy is `AutoFromEmail` (derived from the email). Collisions
|
|
335
|
+
* resolve by that policy.
|
|
336
|
+
*/
|
|
337
|
+
username?: string;
|
|
255
338
|
password: string;
|
|
339
|
+
firstName?: string;
|
|
340
|
+
lastName?: string;
|
|
256
341
|
/** Values for custom user fields configured in the environment. */
|
|
257
342
|
customFields?: Record<string, unknown>;
|
|
258
343
|
emailConfirmed?: boolean;
|
|
@@ -429,6 +514,96 @@ interface TenantMember {
|
|
|
429
514
|
lastLoginAt: string | null;
|
|
430
515
|
}
|
|
431
516
|
type TenantMemberPage = Paged<TenantMember>;
|
|
517
|
+
/**
|
|
518
|
+
* Invite an address to a tenant. The address may not have an account in the
|
|
519
|
+
* environment yet — accepting creates it. `sendEmail` defaults to `true`;
|
|
520
|
+
* `false` only returns the link, for delivery through your own channel.
|
|
521
|
+
*/
|
|
522
|
+
interface TenantInviteInput {
|
|
523
|
+
email: string;
|
|
524
|
+
roles?: string[];
|
|
525
|
+
sendEmail?: boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Where to send the invitee after they accept. Must be registered exactly in
|
|
528
|
+
* the environment's redirect URIs (the same list SSO and magic link use);
|
|
529
|
+
* otherwise the API rejects the invite. Comes back on `preview` and `accept`.
|
|
530
|
+
*/
|
|
531
|
+
redirectUri?: string;
|
|
532
|
+
}
|
|
533
|
+
/** Returned when an invite is created or re-issued. `acceptUrl` is only ever
|
|
534
|
+
* readable here — the API keeps a hash of the token, not the token. */
|
|
535
|
+
interface TenantInviteIssued {
|
|
536
|
+
id: string;
|
|
537
|
+
tenantId: string;
|
|
538
|
+
email: string;
|
|
539
|
+
roles: string[];
|
|
540
|
+
acceptUrl: string;
|
|
541
|
+
expiresAt: string;
|
|
542
|
+
emailSent: boolean;
|
|
543
|
+
redirectUri: string | null;
|
|
544
|
+
}
|
|
545
|
+
type TenantInviteStatus = "pending" | "accepted" | "revoked" | "expired";
|
|
546
|
+
interface TenantInvite {
|
|
547
|
+
id: string;
|
|
548
|
+
tenantId: string;
|
|
549
|
+
email: string;
|
|
550
|
+
roles: string[];
|
|
551
|
+
status: TenantInviteStatus;
|
|
552
|
+
createdAt: string;
|
|
553
|
+
expiresAt: string;
|
|
554
|
+
emailSentAt: string | null;
|
|
555
|
+
acceptedAt: string | null;
|
|
556
|
+
acceptedByUserId: string | null;
|
|
557
|
+
revokedAt: string | null;
|
|
558
|
+
invitedByUserId: string | null;
|
|
559
|
+
redirectUri: string | null;
|
|
560
|
+
}
|
|
561
|
+
/** What an accept page shows before the invitee commits. */
|
|
562
|
+
interface TenantInvitePreview {
|
|
563
|
+
tenantId: string;
|
|
564
|
+
tenantName: string;
|
|
565
|
+
email: string;
|
|
566
|
+
roles: string[];
|
|
567
|
+
expiresAt: string;
|
|
568
|
+
/** True: accepting only needs the token. False: send a password (and a username when `usernameRequired`). */
|
|
569
|
+
accountExists: boolean;
|
|
570
|
+
usernameRequired: boolean;
|
|
571
|
+
/** Where the issuer asked to send the invitee after accepting, or `null`. */
|
|
572
|
+
redirectUri: string | null;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Redeem an invite. For an address that already has an account only `token`
|
|
576
|
+
* and the metadata are used; the rest is for creating the account.
|
|
577
|
+
*/
|
|
578
|
+
interface AcceptTenantInviteInput {
|
|
579
|
+
token: string;
|
|
580
|
+
username?: string;
|
|
581
|
+
password?: string;
|
|
582
|
+
firstName?: string;
|
|
583
|
+
lastName?: string;
|
|
584
|
+
/**
|
|
585
|
+
* @deprecated Use `publicMetadata` / `privateMetadata`. Still sent and
|
|
586
|
+
* validated against the environment's user field schema for now.
|
|
587
|
+
*/
|
|
588
|
+
customFields?: Record<string, unknown>;
|
|
589
|
+
/**
|
|
590
|
+
* Replaces the user's public metadata (readable by the user). Requires the
|
|
591
|
+
* client credentials (`clientId`/`clientSecret`) with `authyon:users:write`:
|
|
592
|
+
* when this or `privateMetadata` is set, `accept` calls
|
|
593
|
+
* `POST /env/tenant-invites/accept` instead of the public route.
|
|
594
|
+
*/
|
|
595
|
+
publicMetadata?: Record<string, unknown>;
|
|
596
|
+
/** Replaces the user's private metadata (server-only). Same requirement as `publicMetadata`. */
|
|
597
|
+
privateMetadata?: Record<string, unknown>;
|
|
598
|
+
}
|
|
599
|
+
interface TenantInviteAccepted {
|
|
600
|
+
tenantId: string;
|
|
601
|
+
tenantName: string;
|
|
602
|
+
userId: string;
|
|
603
|
+
accountCreated: boolean;
|
|
604
|
+
/** Where the issuer asked to send the invitee, or `null`. Redirecting is up to the accept page. */
|
|
605
|
+
redirectUri: string | null;
|
|
606
|
+
}
|
|
432
607
|
|
|
433
608
|
type QueryParams = object;
|
|
434
609
|
|
|
@@ -442,61 +617,6 @@ interface JsonRequestOptions {
|
|
|
442
617
|
|
|
443
618
|
type ManagementRequest = <T>(path: string, options?: JsonRequestOptions) => Promise<T>;
|
|
444
619
|
|
|
445
|
-
/** Lifecycle of an approval. */
|
|
446
|
-
type ApprovalStatus = "pending" | "approved" | "denied" | "consumed" | "expired";
|
|
447
|
-
/**
|
|
448
|
-
* Free-form JSON object describing what the customer approves (up to 16 KiB).
|
|
449
|
-
* The API stores it, shows it back to the customer and binds its canonical
|
|
450
|
-
* hash (keys sorted) to the approval.
|
|
451
|
-
*/
|
|
452
|
-
type ApprovalPayload = Record<string, unknown>;
|
|
453
|
-
/** Evidence of how the customer proved their identity when approving. */
|
|
454
|
-
interface ApprovalAssurance {
|
|
455
|
-
/** `urn:authyon:loa:3` (passkey) or `urn:authyon:loa:2` (authenticator code). */
|
|
456
|
-
acr: string;
|
|
457
|
-
/** Authentication methods, e.g. `["pwd", "otp"]` or `["pwd", "webauthn"]`. */
|
|
458
|
-
amr: string[];
|
|
459
|
-
/** When the second factor was verified (ISO 8601). */
|
|
460
|
-
authTime: string;
|
|
461
|
-
}
|
|
462
|
-
/** A request for the customer to approve something with a second factor. */
|
|
463
|
-
interface Approval {
|
|
464
|
-
id: string;
|
|
465
|
-
status: ApprovalStatus;
|
|
466
|
-
subjectId: string;
|
|
467
|
-
tenantId?: string | null;
|
|
468
|
-
/** The payload given to `create()`, with keys in canonical order. */
|
|
469
|
-
payload: ApprovalPayload;
|
|
470
|
-
/** SHA-256 (hex) of the canonical payload. */
|
|
471
|
-
payloadHash: string;
|
|
472
|
-
createdAt: string;
|
|
473
|
-
expiresAt: string;
|
|
474
|
-
decidedAt?: string | null;
|
|
475
|
-
consumedAt?: string | null;
|
|
476
|
-
/** Present once approved. */
|
|
477
|
-
assurance?: ApprovalAssurance | null;
|
|
478
|
-
}
|
|
479
|
-
/** Second factor sent with `confirm()`. */
|
|
480
|
-
type ConfirmApprovalInput = {
|
|
481
|
-
method: "authenticator";
|
|
482
|
-
/** Six-digit code from the customer's authenticator app. */
|
|
483
|
-
code: string;
|
|
484
|
-
} | {
|
|
485
|
-
method: "webauthn";
|
|
486
|
-
/** Assertion for the options returned by `webauthnOptions()`. */
|
|
487
|
-
webAuthn: {
|
|
488
|
-
ceremonyToken: string;
|
|
489
|
-
/** JSON-serialized `PublicKeyCredential` from `navigator.credentials.get()`. */
|
|
490
|
-
assertionJson: string;
|
|
491
|
-
};
|
|
492
|
-
};
|
|
493
|
-
/** Passkey assertion options for approving one approval. */
|
|
494
|
-
interface ApprovalWebAuthnOptions {
|
|
495
|
-
ceremonyToken: string;
|
|
496
|
-
/** JSON `PublicKeyCredentialRequestOptions` to pass to `navigator.credentials.get()`. */
|
|
497
|
-
optionsJson: string;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
620
|
/** Customer-side operations on an approval (`/auth/authorizations`). */
|
|
501
621
|
interface SubjectApprovals {
|
|
502
622
|
/** GET /auth/authorizations/{id} — the pending payload, to show before asking for the code. */
|
|
@@ -517,6 +637,11 @@ interface SubjectApprovals {
|
|
|
517
637
|
}
|
|
518
638
|
/** The `security` namespace an end-user client exposes. */
|
|
519
639
|
interface SubjectSecurity {
|
|
640
|
+
/**
|
|
641
|
+
* GET /auth/me — which security methods the signed-in user has active
|
|
642
|
+
* (password, authenticator, email code, passkeys, recovery codes, SSO).
|
|
643
|
+
*/
|
|
644
|
+
methods(): Promise<SecurityMethods>;
|
|
520
645
|
/** Approve or reject what your backend asked the customer to confirm. */
|
|
521
646
|
readonly approvals: SubjectApprovals;
|
|
522
647
|
}
|
|
@@ -538,6 +663,20 @@ declare class UserScopedClient {
|
|
|
538
663
|
invite: (tenantId: string, input: InviteTenantMemberInput) => Promise<TenantMember>;
|
|
539
664
|
remove: (tenantId: string, userId: string) => Promise<void>;
|
|
540
665
|
};
|
|
666
|
+
/**
|
|
667
|
+
* Invites by e-mail or by link, acting as the user. Requires the
|
|
668
|
+
* `tenants:members:invite` permission on the tenant.
|
|
669
|
+
*/
|
|
670
|
+
invites: {
|
|
671
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
672
|
+
/** Always returns `acceptUrl`; `sendEmail: false` skips the e-mail. */
|
|
673
|
+
create: (tenantId: string, input: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
674
|
+
/** New link (the previous one stops working), mailed unless `sendEmail` is `false`. */
|
|
675
|
+
resend: (tenantId: string, inviteId: string, input?: {
|
|
676
|
+
sendEmail?: boolean;
|
|
677
|
+
}) => Promise<TenantInviteIssued>;
|
|
678
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
679
|
+
};
|
|
541
680
|
};
|
|
542
681
|
}
|
|
543
682
|
|
|
@@ -797,6 +936,44 @@ declare class AuthyonServerClient {
|
|
|
797
936
|
/** DELETE .../members/{userId}/permissions/{permission} — revoke a permission from a tenant member. */
|
|
798
937
|
revokePermission: (tenantId: string, userId: string, permission: string) => Promise<void>;
|
|
799
938
|
};
|
|
939
|
+
/**
|
|
940
|
+
* Invites by e-mail or by link — for addresses that may not have an
|
|
941
|
+
* account yet; accepting creates it. Managing them needs the
|
|
942
|
+
* credential's `authyon:users:write` scope (listing, `authyon:tenants:read`).
|
|
943
|
+
*/
|
|
944
|
+
invites: {
|
|
945
|
+
/** GET /env/tenants/{tenantId}/invites — every invite with its status, newest first. */
|
|
946
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
947
|
+
/**
|
|
948
|
+
* POST /env/tenants/{tenantId}/invites — invite an address. Always
|
|
949
|
+
* returns `acceptUrl`; with `sendEmail: false` Authyon does not mail
|
|
950
|
+
* it and you deliver the link yourself. Valid 7 days, single use, and
|
|
951
|
+
* not readable again later.
|
|
952
|
+
*/
|
|
953
|
+
create: (tenantId: string, input: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
954
|
+
/** POST .../invites/{inviteId}/resend — new link (the previous one stops working), mailed unless `sendEmail` is `false`. */
|
|
955
|
+
resend: (tenantId: string, inviteId: string, input?: {
|
|
956
|
+
sendEmail?: boolean;
|
|
957
|
+
}) => Promise<TenantInviteIssued>;
|
|
958
|
+
/** DELETE /env/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
|
|
959
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
960
|
+
/**
|
|
961
|
+
* POST /auth/tenant-invites/preview — for a backend hosting the accept
|
|
962
|
+
* page. Public: needs only `envKey`, the token is the credential.
|
|
963
|
+
*/
|
|
964
|
+
preview: (token: string) => Promise<TenantInvitePreview>;
|
|
965
|
+
/**
|
|
966
|
+
* Joins the tenant; for an address with no account, also creates it
|
|
967
|
+
* (password required) with the e-mail already confirmed. Does not
|
|
968
|
+
* sign the user in.
|
|
969
|
+
*
|
|
970
|
+
* Without metadata: POST /auth/tenant-invites/accept — public, needs
|
|
971
|
+
* only `envKey`. With `publicMetadata`/`privateMetadata`: POST
|
|
972
|
+
* /env/tenant-invites/accept with the environment credential
|
|
973
|
+
* (`authyon:users:write`), since only your backend may set them.
|
|
974
|
+
*/
|
|
975
|
+
accept: (input: AcceptTenantInviteInput) => Promise<TenantInviteAccepted>;
|
|
976
|
+
};
|
|
800
977
|
roles: {
|
|
801
978
|
/** GET /env/tenants/{tenantId}/roles — list a tenant's roles. */
|
|
802
979
|
list: (tenantId: string) => Promise<Role[]>;
|
|
@@ -846,7 +1023,8 @@ declare class AuthyonServerClient {
|
|
|
846
1023
|
* app (TOTP) code. A wrong code returns `{ valid: false }` instead of
|
|
847
1024
|
* throwing. Each code is accepted once; 3 wrong codes in a row sign the
|
|
848
1025
|
* user out everywhere (`sessionsRevoked: true`); 5 lock the check for 15
|
|
849
|
-
* minutes (`rate_limited`).
|
|
1026
|
+
* minutes (`rate_limited`). More than 50 wrong codes in 10 minutes from the
|
|
1027
|
+
* same credential pause it (`credential_throttled`). Needs `authyon:otp:verify`.
|
|
850
1028
|
*/
|
|
851
1029
|
check: (userId: string, code: string) => Promise<OtpCheckResult>;
|
|
852
1030
|
};
|
|
@@ -898,6 +1076,19 @@ declare class TenantScopedClient {
|
|
|
898
1076
|
private request;
|
|
899
1077
|
/** POST /tenant/auth/validate — validates this tenant client's current bearer token. */
|
|
900
1078
|
validate(context?: ClientRequestContext): Promise<TenantClientValidationResult>;
|
|
1079
|
+
/** Invites to the token's tenant, by e-mail or by link. */
|
|
1080
|
+
readonly invites: {
|
|
1081
|
+
/** GET /tenant/invites — every invite with its status, newest first. */
|
|
1082
|
+
list: () => Promise<TenantInvite[]>;
|
|
1083
|
+
/** POST /tenant/invites — always returns `acceptUrl`; `sendEmail: false` skips the e-mail. */
|
|
1084
|
+
create: (input: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
1085
|
+
/** POST /tenant/invites/{inviteId}/resend — new link (the previous one stops working), mailed unless `sendEmail` is `false`. */
|
|
1086
|
+
resend: (inviteId: string, input?: {
|
|
1087
|
+
sendEmail?: boolean;
|
|
1088
|
+
}) => Promise<TenantInviteIssued>;
|
|
1089
|
+
/** DELETE /tenant/invites/{inviteId} — revoke a pending invite. */
|
|
1090
|
+
revoke: (inviteId: string) => Promise<void>;
|
|
1091
|
+
};
|
|
901
1092
|
readonly members: {
|
|
902
1093
|
/**
|
|
903
1094
|
* GET /tenant/members — members of the token's tenant.
|
|
@@ -945,4 +1136,4 @@ declare class TenantScopedClient {
|
|
|
945
1136
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
946
1137
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
947
1138
|
|
|
948
|
-
export { type
|
|
1139
|
+
export { type SafeJwtAlgorithm as $, AuthyonServerClient as A, type HttpLogEvent as B, type ClientCredentials as C, type HttpLogger as D, type EnvironmentUser as E, FetchHttpAdapter as F, type InviteTenantMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type JsonWebKeySet as J, JwksTokenVerifier as K, type JwksTokenVerifierOptions as L, LoggingHttpAdapter as M, type LoginActivity as N, type OpenIdConfiguration as O, type Organization as P, type OtpCheckResult as Q, type Paged as R, type PaginationOptions as S, type Permission as T, type PermissionsByRole as U, type ReservedPermissions as V, type Role as W, type RoleGrant as X, type RoleInput as Y, type RoleList as Z, type RolePermissions as _, type HttpLoggerOptions as a, type SecurityMethods as a0, type SubjectApprovals as a1, type SubjectSecurity as a2, type TenantClientValidationResult as a3, type TenantCredentialIssued as a4, type TenantCredentialSummary as a5, type TenantInvite as a6, type TenantInviteAccepted as a7, type TenantInviteInput as a8, type TenantInviteIssued as a9, type TenantInvitePreview as aa, type TenantInviteStatus as ab, type TenantMember as ac, type TenantMemberPage as ad, type TenantMembership as ae, TenantScopedClient as af, type TokenResult as ag, TokenVerificationError as ah, type TokenVerificationErrorCode as ai, type UpdateOrganizationInput as aj, type User as ak, UserScopedClient as al, type ValidateResult as am, type VerifiedAccessToken as an, createClient as ao, normalizeClientIp as ap, type AcceptTenantInviteInput as b, type AccessTokenSource as c, type Approval as d, type ApprovalAssurance as e, type ApprovalPayload as f, type ApprovalStatus as g, type ApprovalWebAuthnOptions as h, type AuditEvent as i, type AuthyonJwksDiscoveryOptions as j, type AuthyonJwtClaims as k, type AuthyonServerClientOptions as l, type ClientRequestContext as m, type ConfirmApprovalInput as n, type ConsumedApproval as o, type CreateApprovalInput as p, type CreateCredentialInput as q, type CreateOrganizationInput as r, type CreatePermissionInput as s, type CreateTenantCredentialInput as t, type CreateUserInput as u, type CredentialCreator as v, type CredentialDetail as w, type CredentialListOptions as x, type CredentialPermissionsInput as y, type HttpAdapterRequest as z };
|