@authyon/server 0.2.0-beta.14 → 0.2.0-beta.16

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/index.cjs CHANGED
@@ -168,29 +168,34 @@ async function allCredentials(request, path2) {
168
168
  throw new Error("Authyon: use listPage for more than 1000 credential pages.");
169
169
  }
170
170
 
171
- // ../../internal/core/financial/subjectFinancialAuthorizations.ts
171
+ // ../../internal/core/security/approvals.ts
172
172
  function path(id, suffix = "") {
173
173
  if (typeof id !== "string" || !id.trim())
174
- throw new TypeError("Authyon: a financial authorization id is required.");
174
+ throw new TypeError("Authyon: an approval id is required.");
175
175
  return `/auth/authorizations/${encodeURIComponent(id)}${suffix}`;
176
176
  }
177
- function subjectFinancialAuthorizations(request) {
177
+ var NO_METHODS = {
178
+ password: false,
179
+ authenticator: false,
180
+ emailCode: false,
181
+ passkey: false,
182
+ passkeyCount: 0,
183
+ recoveryCodes: 0,
184
+ sso: [],
185
+ twoFactor: false
186
+ };
187
+ function subjectSecurity(request) {
178
188
  return {
179
- /** GET /auth/authorizations/{id} — the pending transaction, to show before asking for the code. */
180
- get: (id) => request(path(id)),
181
- /** POST /auth/authorizations/{id}/webauthn/options — passkey options for approving this authorization. */
182
- webauthnOptions: (id) => request(path(id, "/webauthn/options"), { method: "POST" }),
183
- /**
184
- * POST /auth/authorizations/{id}/confirm — approves the transaction.
185
- *
186
- * Pass the authenticator code or passkey assertion to verify the second
187
- * factor inline (recommended). Without `input`, the session itself must
188
- * have used a passkey or authenticator code within the last 5 minutes,
189
- * otherwise the API answers `step_up_required`.
190
- */
191
- confirm: (id, input) => request(path(id, "/confirm"), { method: "POST", body: input }),
192
- /** POST /auth/authorizations/{id}/reject — the customer declines the transaction. */
193
- reject: (id) => request(path(id, "/reject"), { method: "POST" })
189
+ methods: async () => {
190
+ const me = await request("/auth/me");
191
+ return me.security ?? NO_METHODS;
192
+ },
193
+ approvals: {
194
+ get: (id) => request(path(id)),
195
+ webauthnOptions: (id) => request(path(id, "/webauthn/options"), { method: "POST" }),
196
+ confirm: (id, input) => request(path(id, "/confirm"), { method: "POST", body: input }),
197
+ reject: (id) => request(path(id, "/reject"), { method: "POST" })
198
+ }
194
199
  };
195
200
  }
196
201
 
@@ -222,10 +227,35 @@ var UserScopedClient = class {
222
227
  remove: (tenantId, userId) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/members/${segment(userId)}`, {
223
228
  method: "DELETE"
224
229
  })
230
+ },
231
+ /**
232
+ * Invites by e-mail or by link, acting as the user. Requires the
233
+ * `tenants:members:invite` permission on the tenant.
234
+ */
235
+ invites: {
236
+ list: (tenantId) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/invites`),
237
+ /** Always returns `acceptUrl`; `sendEmail: false` skips the e-mail. */
238
+ create: (tenantId, input) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/invites`, {
239
+ method: "POST",
240
+ body: {
241
+ email: input.email,
242
+ roles: input.roles,
243
+ sendEmail: input.sendEmail ?? true,
244
+ redirectUri: input.redirectUri
245
+ }
246
+ }),
247
+ /** New link (the previous one stops working), mailed unless `sendEmail` is `false`. */
248
+ resend: (tenantId, inviteId, input = {}) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/invites/${segment(inviteId)}/resend`, {
249
+ method: "POST",
250
+ body: { sendEmail: input.sendEmail ?? true }
251
+ }),
252
+ revoke: (tenantId, inviteId) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/invites/${segment(inviteId)}`, {
253
+ method: "DELETE"
254
+ })
225
255
  }
226
256
  };
227
257
  __privateSet(this, _request, scopedRequest(request, token));
228
- this.financialAuthorizations = subjectFinancialAuthorizations(__privateGet(this, _request));
258
+ this.security = subjectSecurity(__privateGet(this, _request));
229
259
  }
230
260
  };
231
261
  _request = new WeakMap();
@@ -280,10 +310,18 @@ var ErrorCodes = {
280
310
  InvalidSecondFactorCode: "invalid_code",
281
311
  VerificationAttemptsExhausted: "verification_attempts_exhausted",
282
312
  MethodNotEnrolled: "method_not_enrolled",
283
- InvalidAuthorizationState: "invalid_authorization_state",
284
- TransactionMismatch: "transaction_mismatch",
285
- AuthorizationNotConsumable: "authorization_not_consumable",
286
- IdempotencyConflict: "idempotency_conflict"
313
+ InvalidApprovalState: "invalid_authorization_state",
314
+ PayloadMismatch: "payload_mismatch",
315
+ ApprovalNotConsumable: "authorization_not_consumable",
316
+ IdempotencyConflict: "idempotency_conflict",
317
+ UserDisabled: "user_disabled",
318
+ UserNotFound: "user_not_found",
319
+ TemporarilyUnavailable: "temporarily_unavailable",
320
+ InsufficientScope: "insufficient_scope",
321
+ CredentialThrottled: "credential_throttled",
322
+ ApprovalNotFound: "authorization_not_found",
323
+ SessionRevoked: "session_revoked",
324
+ TwoFactorTooManyFailures: "user.2fa.too_many_failures"
287
325
  };
288
326
  var STANDARD_ERROR_FIELDS = /* @__PURE__ */ new Set([
289
327
  "type",
@@ -1008,6 +1046,61 @@ var AuthyonServerClient = class {
1008
1046
  { method: "DELETE", envBearer: true }
1009
1047
  )
1010
1048
  },
1049
+ /**
1050
+ * Invites by e-mail or by link — for addresses that may not have an
1051
+ * account yet; accepting creates it. Managing them needs the
1052
+ * credential's `authyon:users:write` scope (listing, `authyon:tenants:read`).
1053
+ */
1054
+ invites: {
1055
+ /** GET /env/tenants/{tenantId}/invites — every invite with its status, newest first. */
1056
+ list: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/invites`, { envBearer: true }),
1057
+ /**
1058
+ * POST /env/tenants/{tenantId}/invites — invite an address. Always
1059
+ * returns `acceptUrl`; with `sendEmail: false` Authyon does not mail
1060
+ * it and you deliver the link yourself. Valid 7 days, single use, and
1061
+ * not readable again later.
1062
+ */
1063
+ create: (tenantId, input) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/invites`, {
1064
+ method: "POST",
1065
+ envBearer: true,
1066
+ body: {
1067
+ email: input.email,
1068
+ roles: input.roles,
1069
+ sendEmail: input.sendEmail ?? true,
1070
+ redirectUri: input.redirectUri
1071
+ }
1072
+ }),
1073
+ /** POST .../invites/{inviteId}/resend — new link (the previous one stops working), mailed unless `sendEmail` is `false`. */
1074
+ resend: (tenantId, inviteId, input = {}) => this.request(
1075
+ `/env/tenants/${encodeURIComponent(tenantId)}/invites/${encodeURIComponent(inviteId)}/resend`,
1076
+ { method: "POST", envBearer: true, body: { sendEmail: input.sendEmail ?? true } }
1077
+ ),
1078
+ /** DELETE /env/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
1079
+ revoke: (tenantId, inviteId) => this.request(
1080
+ `/env/tenants/${encodeURIComponent(tenantId)}/invites/${encodeURIComponent(inviteId)}`,
1081
+ { method: "DELETE", envBearer: true }
1082
+ ),
1083
+ /**
1084
+ * POST /auth/tenant-invites/preview — for a backend hosting the accept
1085
+ * page. Public: needs only `envKey`, the token is the credential.
1086
+ */
1087
+ preview: (token) => this.request("/auth/tenant-invites/preview", { method: "POST", body: { token } }),
1088
+ /**
1089
+ * Joins the tenant; for an address with no account, also creates it
1090
+ * (password required) with the e-mail already confirmed. Does not
1091
+ * sign the user in.
1092
+ *
1093
+ * Without metadata: POST /auth/tenant-invites/accept — public, needs
1094
+ * only `envKey`. With `publicMetadata`/`privateMetadata`: POST
1095
+ * /env/tenant-invites/accept with the environment credential
1096
+ * (`authyon:users:write`), since only your backend may set them.
1097
+ */
1098
+ accept: (input) => input.publicMetadata !== void 0 || input.privateMetadata !== void 0 ? this.request("/env/tenant-invites/accept", {
1099
+ method: "POST",
1100
+ envBearer: true,
1101
+ body: input
1102
+ }) : this.request("/auth/tenant-invites/accept", { method: "POST", body: input })
1103
+ },
1011
1104
  roles: {
1012
1105
  /** GET /env/tenants/{tenantId}/roles — list a tenant's roles. */
1013
1106
  list: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/roles`, { envBearer: true }),
@@ -1070,46 +1163,65 @@ var AuthyonServerClient = class {
1070
1163
  /** GET /permissions/reserved — reserved permission names you can't redefine. */
1071
1164
  reserved: () => this.request("/permissions/reserved", { envBearer: true })
1072
1165
  },
1166
+ audit: {
1167
+ /** GET /env/audit — paginated list of the environment's audit events. */
1168
+ list: (params = {}) => this.request("/env/audit", { envBearer: true, query: params }),
1169
+ /** GET /env/audit/login-activity — paginated login activity in the environment. */
1170
+ loginActivity: (params = {}) => this.request("/env/audit/login-activity", { envBearer: true, query: params })
1171
+ }
1172
+ };
1173
+ // ── Security: one-time codes and approvals ───────────────────────────────
1174
+ //
1175
+ // Everything here runs with the environment credential: `otp` needs the
1176
+ // `authyon:otp:verify` scope, `approvals` needs `authyon:financial:authorize`.
1177
+ // Keep those credentials on the server.
1178
+ this.security = {
1179
+ otp: {
1180
+ /**
1181
+ * POST /env/users/{userId}/otp/verify — checks the user's authenticator
1182
+ * app (TOTP) code. A wrong code returns `{ valid: false }` instead of
1183
+ * throwing. Each code is accepted once; 3 wrong codes in a row sign the
1184
+ * user out everywhere (`sessionsRevoked: true`); 5 lock the check for 15
1185
+ * minutes (`rate_limited`). More than 50 wrong codes in 10 minutes from the
1186
+ * same credential pause it (`credential_throttled`). Needs `authyon:otp:verify`.
1187
+ */
1188
+ check: (userId, code) => this.request(`/env/users/${segment(userId)}/otp/verify`, {
1189
+ method: "POST",
1190
+ envBearer: true,
1191
+ body: { code }
1192
+ })
1193
+ },
1073
1194
  /**
1074
- * Transaction-bound step-up for financial operations. The environment
1075
- * credential needs the `authyon:financial:authorize` scope.
1195
+ * The customer approves a payload with their authenticator code or
1196
+ * passkey, once.
1076
1197
  *
1077
- * 1. `create()` the authorization for the transaction and the customer.
1078
- * 2. The customer approves it with their authenticator code or passkey
1079
- * (`@authyon/auth` → `financialAuthorizations.confirm`).
1080
- * 3. `consume()` it with the same transaction right before executing it.
1198
+ * 1. `create()` the approval with the payload and the customer.
1199
+ * 2. The customer confirms it (`@authyon/auth` → `security.approvals.confirm`).
1200
+ * 3. `consume()` it right before executing, and execute the returned payload.
1081
1201
  */
1082
- financialAuthorizations: {
1083
- /** POST /env/authorizations — registers a transaction awaiting the customer's approval. */
1202
+ approvals: {
1203
+ /** POST /env/authorizations — registers a payload awaiting the customer's approval. */
1084
1204
  create: (input) => {
1085
1205
  const { idempotencyKey, ...body } = input;
1086
- if (typeof idempotencyKey !== "string" || !idempotencyKey.trim())
1087
- throw new TypeError("Authyon: `idempotencyKey` is required.");
1088
1206
  return this.request("/env/authorizations", {
1089
1207
  method: "POST",
1090
1208
  envBearer: true,
1091
- headers: { "Idempotency-Key": idempotencyKey },
1209
+ headers: idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0,
1092
1210
  body
1093
1211
  });
1094
1212
  },
1095
1213
  /** GET /env/authorizations/{id} — current status and, once approved, the assurance evidence. */
1096
1214
  get: (id) => this.request(`/env/authorizations/${segment(id)}`, { envBearer: true }),
1097
1215
  /**
1098
- * POST /env/authorizations/{id}/consume — redeems an approved
1099
- * authorization exactly once. Resend the same transaction given to
1100
- * `create()`; any difference fails with `transaction_mismatch`.
1216
+ * POST /env/authorizations/{id}/consume — redeems an approved approval
1217
+ * exactly once and returns the approved payload. Pass `payload` to have
1218
+ * the API check it matches (`payload_mismatch` otherwise).
1101
1219
  */
1102
- consume: (id, transaction) => this.request(`/env/authorizations/${segment(id)}/consume`, {
1220
+ consume: (id, payload) => this.request(`/env/authorizations/${segment(id)}/consume`, {
1103
1221
  method: "POST",
1104
1222
  envBearer: true,
1105
- body: transaction
1223
+ body: payload === void 0 ? void 0 : { payload }
1106
1224
  })
1107
- },
1108
- audit: {
1109
- /** GET /env/audit — paginated list of the environment's audit events. */
1110
- list: (params = {}) => this.request("/env/audit", { envBearer: true, query: params }),
1111
- /** GET /env/audit/login-activity — paginated login activity in the environment. */
1112
- loginActivity: (params = {}) => this.request("/env/audit/login-activity", { envBearer: true, query: params })
1113
1225
  }
1114
1226
  };
1115
1227
  // ── Generic permission grants ─────────────────────────────────────────────
@@ -1235,6 +1347,28 @@ var AuthyonServerClient = class {
1235
1347
  _clientSecret = new WeakMap();
1236
1348
  var TenantScopedClient = class {
1237
1349
  constructor(server, credentials) {
1350
+ /** Invites to the token's tenant, by e-mail or by link. */
1351
+ this.invites = {
1352
+ /** GET /tenant/invites — every invite with its status, newest first. */
1353
+ list: () => this.request("/tenant/invites"),
1354
+ /** POST /tenant/invites — always returns `acceptUrl`; `sendEmail: false` skips the e-mail. */
1355
+ create: (input) => this.request("/tenant/invites", {
1356
+ method: "POST",
1357
+ body: {
1358
+ email: input.email,
1359
+ roles: input.roles,
1360
+ sendEmail: input.sendEmail ?? true,
1361
+ redirectUri: input.redirectUri
1362
+ }
1363
+ }),
1364
+ /** POST /tenant/invites/{inviteId}/resend — new link (the previous one stops working), mailed unless `sendEmail` is `false`. */
1365
+ resend: (inviteId, input = {}) => this.request(`/tenant/invites/${encodeURIComponent(inviteId)}/resend`, {
1366
+ method: "POST",
1367
+ body: { sendEmail: input.sendEmail ?? true }
1368
+ }),
1369
+ /** DELETE /tenant/invites/{inviteId} — revoke a pending invite. */
1370
+ revoke: (inviteId) => this.request(`/tenant/invites/${encodeURIComponent(inviteId)}`, { method: "DELETE" })
1371
+ };
1238
1372
  this.members = {
1239
1373
  /**
1240
1374
  * GET /tenant/members — members of the token's tenant.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-DmNnjw4z.cjs';
2
- export { b as AccessTokenSource, c as AuditEvent, d as AuthyonJwksDiscoveryOptions, e as AuthyonJwtClaims, f as AuthyonServerClientOptions, C as ClientCredentials, g as ClientRequestContext, h as ConfirmFinancialAuthorizationInput, i as ConsumedFinancialAuthorization, j as CreateCredentialInput, k as CreateFinancialAuthorizationInput, l as CreateOrganizationInput, m as CreatePermissionInput, n as CreateTenantCredentialInput, o as CreateUserInput, p as CredentialCreator, q as CredentialDetail, r as CredentialListOptions, s as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, t as FinancialAssurance, u as FinancialAuthorization, v as FinancialAuthorizationStatus, w as FinancialTransaction, x as FinancialWebAuthnOptions, y as HttpAdapterRequest, z as HttpLogEvent, B as HttpLogger, I as IntrospectResult, D as InviteTenantMemberInput, J as JsonWebKeySet, G as JwksTokenVerifier, K as JwksTokenVerifierOptions, L as LoggingHttpAdapter, M as LoginActivity, O as OpenIdConfiguration, N as Organization, P as Paged, Q as PaginationOptions, R as Permission, S as PermissionsByRole, T as ReservedPermissions, U as Role, V as RoleGrant, W as RoleInput, X as RoleList, Y as RolePermissions, Z as SafeJwtAlgorithm, _ as TenantClientValidationResult, $ as TenantCredentialIssued, a0 as TenantCredentialSummary, a1 as TenantMember, a2 as TenantMemberPage, a3 as TenantMembership, a4 as TenantScopedClient, a5 as TokenResult, a6 as TokenVerificationError, a7 as TokenVerificationErrorCode, a8 as UpdateOrganizationInput, a9 as User, aa as UserScopedClient, ab as ValidateResult, ac as VerifiedAccessToken, ad as createClient, ae as normalizeClientIp } from './authyonServerClient-DmNnjw4z.cjs';
3
- export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-B7ynKAud.cjs';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.cjs';
2
+ export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as JsonWebKeySet, K as JwksTokenVerifier, L as JwksTokenVerifierOptions, M as LoggingHttpAdapter, N as LoginActivity, O as OpenIdConfiguration, P as Organization, Q as OtpCheckResult, R as Paged, S as PaginationOptions, T as Permission, U as PermissionsByRole, V as ReservedPermissions, W as Role, X as RoleGrant, Y as RoleInput, Z as RoleList, _ as RolePermissions, $ as SafeJwtAlgorithm, a0 as SecurityMethods, a1 as SubjectApprovals, a2 as SubjectSecurity, a3 as TenantClientValidationResult, a4 as TenantCredentialIssued, a5 as TenantCredentialSummary, a6 as TenantInvite, a7 as TenantInviteAccepted, a8 as TenantInviteInput, a9 as TenantInviteIssued, aa as TenantInvitePreview, ab as TenantInviteStatus, ac as TenantMember, ad as TenantMemberPage, ae as TenantMembership, af as TenantScopedClient, ag as TokenResult, ah as TokenVerificationError, ai as TokenVerificationErrorCode, aj as UpdateOrganizationInput, ak as User, al as UserScopedClient, am as ValidateResult, an as VerifiedAccessToken, ao as createClient, ap as normalizeClientIp } from './authyonServerClient-1_1qNRDa.cjs';
3
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-C0Mg5gUv.cjs';
4
4
  import 'jose';
5
5
 
6
6
  declare const ErrorCodes: {
@@ -19,10 +19,18 @@ declare const ErrorCodes: {
19
19
  readonly InvalidSecondFactorCode: "invalid_code";
20
20
  readonly VerificationAttemptsExhausted: "verification_attempts_exhausted";
21
21
  readonly MethodNotEnrolled: "method_not_enrolled";
22
- readonly InvalidAuthorizationState: "invalid_authorization_state";
23
- readonly TransactionMismatch: "transaction_mismatch";
24
- readonly AuthorizationNotConsumable: "authorization_not_consumable";
22
+ readonly InvalidApprovalState: "invalid_authorization_state";
23
+ readonly PayloadMismatch: "payload_mismatch";
24
+ readonly ApprovalNotConsumable: "authorization_not_consumable";
25
25
  readonly IdempotencyConflict: "idempotency_conflict";
26
+ readonly UserDisabled: "user_disabled";
27
+ readonly UserNotFound: "user_not_found";
28
+ readonly TemporarilyUnavailable: "temporarily_unavailable";
29
+ readonly InsufficientScope: "insufficient_scope";
30
+ readonly CredentialThrottled: "credential_throttled";
31
+ readonly ApprovalNotFound: "authorization_not_found";
32
+ readonly SessionRevoked: "session_revoked";
33
+ readonly TwoFactorTooManyFailures: "user.2fa.too_many_failures";
26
34
  };
27
35
  type KnownErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
28
36
  type AuthyonErrorCategory = "network" | "timeout" | "authentication" | "authorization" | "validation" | "not_found" | "conflict" | "rate_limit" | "server" | "unknown";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-DmNnjw4z.js';
2
- export { b as AccessTokenSource, c as AuditEvent, d as AuthyonJwksDiscoveryOptions, e as AuthyonJwtClaims, f as AuthyonServerClientOptions, C as ClientCredentials, g as ClientRequestContext, h as ConfirmFinancialAuthorizationInput, i as ConsumedFinancialAuthorization, j as CreateCredentialInput, k as CreateFinancialAuthorizationInput, l as CreateOrganizationInput, m as CreatePermissionInput, n as CreateTenantCredentialInput, o as CreateUserInput, p as CredentialCreator, q as CredentialDetail, r as CredentialListOptions, s as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, t as FinancialAssurance, u as FinancialAuthorization, v as FinancialAuthorizationStatus, w as FinancialTransaction, x as FinancialWebAuthnOptions, y as HttpAdapterRequest, z as HttpLogEvent, B as HttpLogger, I as IntrospectResult, D as InviteTenantMemberInput, J as JsonWebKeySet, G as JwksTokenVerifier, K as JwksTokenVerifierOptions, L as LoggingHttpAdapter, M as LoginActivity, O as OpenIdConfiguration, N as Organization, P as Paged, Q as PaginationOptions, R as Permission, S as PermissionsByRole, T as ReservedPermissions, U as Role, V as RoleGrant, W as RoleInput, X as RoleList, Y as RolePermissions, Z as SafeJwtAlgorithm, _ as TenantClientValidationResult, $ as TenantCredentialIssued, a0 as TenantCredentialSummary, a1 as TenantMember, a2 as TenantMemberPage, a3 as TenantMembership, a4 as TenantScopedClient, a5 as TokenResult, a6 as TokenVerificationError, a7 as TokenVerificationErrorCode, a8 as UpdateOrganizationInput, a9 as User, aa as UserScopedClient, ab as ValidateResult, ac as VerifiedAccessToken, ad as createClient, ae as normalizeClientIp } from './authyonServerClient-DmNnjw4z.js';
3
- export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-BF015NDJ.js';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.js';
2
+ export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as JsonWebKeySet, K as JwksTokenVerifier, L as JwksTokenVerifierOptions, M as LoggingHttpAdapter, N as LoginActivity, O as OpenIdConfiguration, P as Organization, Q as OtpCheckResult, R as Paged, S as PaginationOptions, T as Permission, U as PermissionsByRole, V as ReservedPermissions, W as Role, X as RoleGrant, Y as RoleInput, Z as RoleList, _ as RolePermissions, $ as SafeJwtAlgorithm, a0 as SecurityMethods, a1 as SubjectApprovals, a2 as SubjectSecurity, a3 as TenantClientValidationResult, a4 as TenantCredentialIssued, a5 as TenantCredentialSummary, a6 as TenantInvite, a7 as TenantInviteAccepted, a8 as TenantInviteInput, a9 as TenantInviteIssued, aa as TenantInvitePreview, ab as TenantInviteStatus, ac as TenantMember, ad as TenantMemberPage, ae as TenantMembership, af as TenantScopedClient, ag as TokenResult, ah as TokenVerificationError, ai as TokenVerificationErrorCode, aj as UpdateOrganizationInput, ak as User, al as UserScopedClient, am as ValidateResult, an as VerifiedAccessToken, ao as createClient, ap as normalizeClientIp } from './authyonServerClient-1_1qNRDa.js';
3
+ export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-BvjIWPcU.js';
4
4
  import 'jose';
5
5
 
6
6
  declare const ErrorCodes: {
@@ -19,10 +19,18 @@ declare const ErrorCodes: {
19
19
  readonly InvalidSecondFactorCode: "invalid_code";
20
20
  readonly VerificationAttemptsExhausted: "verification_attempts_exhausted";
21
21
  readonly MethodNotEnrolled: "method_not_enrolled";
22
- readonly InvalidAuthorizationState: "invalid_authorization_state";
23
- readonly TransactionMismatch: "transaction_mismatch";
24
- readonly AuthorizationNotConsumable: "authorization_not_consumable";
22
+ readonly InvalidApprovalState: "invalid_authorization_state";
23
+ readonly PayloadMismatch: "payload_mismatch";
24
+ readonly ApprovalNotConsumable: "authorization_not_consumable";
25
25
  readonly IdempotencyConflict: "idempotency_conflict";
26
+ readonly UserDisabled: "user_disabled";
27
+ readonly UserNotFound: "user_not_found";
28
+ readonly TemporarilyUnavailable: "temporarily_unavailable";
29
+ readonly InsufficientScope: "insufficient_scope";
30
+ readonly CredentialThrottled: "credential_throttled";
31
+ readonly ApprovalNotFound: "authorization_not_found";
32
+ readonly SessionRevoked: "session_revoked";
33
+ readonly TwoFactorTooManyFailures: "user.2fa.too_many_failures";
26
34
  };
27
35
  type KnownErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
28
36
  type AuthyonErrorCategory = "network" | "timeout" | "authentication" | "authorization" | "validation" | "not_found" | "conflict" | "rate_limit" | "server" | "unknown";