@techelusive/nest-auth 0.0.0-stage → 0.2.1
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/CHANGELOG.md +71 -0
- package/LICENSE +21 -0
- package/README.md +204 -2
- package/api/openapi.json +4399 -0
- package/api/techelusive-authentication.postman_collection.json +3178 -0
- package/dist/auth-options.d.ts +156 -0
- package/dist/auth-options.js +3 -0
- package/dist/auth-options.js.map +1 -0
- package/dist/auth-options.validation.d.ts +9 -0
- package/dist/auth-options.validation.js +74 -0
- package/dist/auth-options.validation.js.map +1 -0
- package/dist/auth.module.d.ts +38 -0
- package/dist/auth.module.js +173 -0
- package/dist/auth.module.js.map +1 -0
- package/dist/common/auth-error.d.ts +16 -0
- package/dist/common/auth-error.js +23 -0
- package/dist/common/auth-error.js.map +1 -0
- package/dist/common/auth-exception.filter.d.ts +24 -0
- package/dist/common/auth-exception.filter.js +66 -0
- package/dist/common/auth-exception.filter.js.map +1 -0
- package/dist/common/crypto/jwt.d.ts +89 -0
- package/dist/common/crypto/jwt.js +144 -0
- package/dist/common/crypto/jwt.js.map +1 -0
- package/dist/common/crypto/random-secrets.d.ts +78 -0
- package/dist/common/crypto/random-secrets.js +113 -0
- package/dist/common/crypto/random-secrets.js.map +1 -0
- package/dist/common/crypto/remote-public-keys.d.ts +49 -0
- package/dist/common/crypto/remote-public-keys.js +105 -0
- package/dist/common/crypto/remote-public-keys.js.map +1 -0
- package/dist/common/crypto/totp.d.ts +68 -0
- package/dist/common/crypto/totp.js +148 -0
- package/dist/common/crypto/totp.js.map +1 -0
- package/dist/common/encryption.service.d.ts +36 -0
- package/dist/common/encryption.service.js +111 -0
- package/dist/common/encryption.service.js.map +1 -0
- package/dist/common/identifiers.d.ts +48 -0
- package/dist/common/identifiers.js +89 -0
- package/dist/common/identifiers.js.map +1 -0
- package/dist/common/network-safety.d.ts +19 -0
- package/dist/common/network-safety.js +72 -0
- package/dist/common/network-safety.js.map +1 -0
- package/dist/common/rate-limiter.service.d.ts +63 -0
- package/dist/common/rate-limiter.service.js +158 -0
- package/dist/common/rate-limiter.service.js.map +1 -0
- package/dist/common/refresh-token-cookie.d.ts +78 -0
- package/dist/common/refresh-token-cookie.js +185 -0
- package/dist/common/refresh-token-cookie.js.map +1 -0
- package/dist/common/request-context.d.ts +14 -0
- package/dist/common/request-context.js +22 -0
- package/dist/common/request-context.js.map +1 -0
- package/dist/common/strict-validation.pipe.d.ts +8 -0
- package/dist/common/strict-validation.pipe.js +16 -0
- package/dist/common/strict-validation.pipe.js.map +1 -0
- package/dist/common/time.d.ts +15 -0
- package/dist/common/time.js +34 -0
- package/dist/common/time.js.map +1 -0
- package/dist/constants.d.ts +1326 -0
- package/dist/constants.js +1142 -0
- package/dist/constants.js.map +1 -0
- package/dist/database/create-auth-tables.migration.d.ts +26 -0
- package/dist/database/create-auth-tables.migration.js +291 -0
- package/dist/database/create-auth-tables.migration.js.map +1 -0
- package/dist/database/email-change-and-retention.migration.d.ts +25 -0
- package/dist/database/email-change-and-retention.migration.js +54 -0
- package/dist/database/email-change-and-retention.migration.js.map +1 -0
- package/dist/database/entities/api-key.entity.d.ts +17 -0
- package/dist/database/entities/api-key.entity.js +80 -0
- package/dist/database/entities/api-key.entity.js.map +1 -0
- package/dist/database/entities/audit-log.entity.d.ts +13 -0
- package/dist/database/entities/audit-log.entity.js +64 -0
- package/dist/database/entities/audit-log.entity.js.map +1 -0
- package/dist/database/entities/backup-code.entity.d.ts +9 -0
- package/dist/database/entities/backup-code.entity.js +52 -0
- package/dist/database/entities/backup-code.entity.js.map +1 -0
- package/dist/database/entities/index.d.ts +43 -0
- package/dist/database/entities/index.js +82 -0
- package/dist/database/entities/index.js.map +1 -0
- package/dist/database/entities/json-object.d.ts +12 -0
- package/dist/database/entities/json-object.js +3 -0
- package/dist/database/entities/json-object.js.map +1 -0
- package/dist/database/entities/link-token.entity.d.ts +15 -0
- package/dist/database/entities/link-token.entity.js +64 -0
- package/dist/database/entities/link-token.entity.js.map +1 -0
- package/dist/database/entities/one-time-code.entity.d.ts +16 -0
- package/dist/database/entities/one-time-code.entity.js +69 -0
- package/dist/database/entities/one-time-code.entity.js.map +1 -0
- package/dist/database/entities/organization-invitation.entity.d.ts +14 -0
- package/dist/database/entities/organization-invitation.entity.js +73 -0
- package/dist/database/entities/organization-invitation.entity.js.map +1 -0
- package/dist/database/entities/organization-member.entity.d.ts +9 -0
- package/dist/database/entities/organization-member.entity.js +48 -0
- package/dist/database/entities/organization-member.entity.js.map +1 -0
- package/dist/database/entities/organization.entity.d.ts +12 -0
- package/dist/database/entities/organization.entity.js +58 -0
- package/dist/database/entities/organization.entity.js.map +1 -0
- package/dist/database/entities/passkey.entity.d.ts +19 -0
- package/dist/database/entities/passkey.entity.js +78 -0
- package/dist/database/entities/passkey.entity.js.map +1 -0
- package/dist/database/entities/password.entity.d.ts +6 -0
- package/dist/database/entities/password.entity.js +36 -0
- package/dist/database/entities/password.entity.js.map +1 -0
- package/dist/database/entities/refresh-token.entity.d.ts +9 -0
- package/dist/database/entities/refresh-token.entity.js +53 -0
- package/dist/database/entities/refresh-token.entity.js.map +1 -0
- package/dist/database/entities/session.entity.d.ts +20 -0
- package/dist/database/entities/session.entity.js +87 -0
- package/dist/database/entities/session.entity.js.map +1 -0
- package/dist/database/entities/settings.entity.d.ts +7 -0
- package/dist/database/entities/settings.entity.js +41 -0
- package/dist/database/entities/settings.entity.js.map +1 -0
- package/dist/database/entities/sign-in-challenge.entity.d.ts +23 -0
- package/dist/database/entities/sign-in-challenge.entity.js +80 -0
- package/dist/database/entities/sign-in-challenge.entity.js.map +1 -0
- package/dist/database/entities/signing-key.entity.d.ts +11 -0
- package/dist/database/entities/signing-key.entity.js +54 -0
- package/dist/database/entities/signing-key.entity.js.map +1 -0
- package/dist/database/entities/social-account.entity.d.ts +13 -0
- package/dist/database/entities/social-account.entity.js +54 -0
- package/dist/database/entities/social-account.entity.js.map +1 -0
- package/dist/database/entities/two-factor-secret.entity.d.ts +10 -0
- package/dist/database/entities/two-factor-secret.entity.js +48 -0
- package/dist/database/entities/two-factor-secret.entity.js.map +1 -0
- package/dist/database/entities/user.entity.d.ts +34 -0
- package/dist/database/entities/user.entity.js +129 -0
- package/dist/database/entities/user.entity.js.map +1 -0
- package/dist/database/entities/webhook-delivery.entity.d.ts +17 -0
- package/dist/database/entities/webhook-delivery.entity.js +79 -0
- package/dist/database/entities/webhook-delivery.entity.js.map +1 -0
- package/dist/database/entities/webhook.entity.d.ts +12 -0
- package/dist/database/entities/webhook.entity.js +58 -0
- package/dist/database/entities/webhook.entity.js.map +1 -0
- package/dist/database/typeorm-row.d.ts +21 -0
- package/dist/database/typeorm-row.js +29 -0
- package/dist/database/typeorm-row.js.map +1 -0
- package/dist/features/account/account.controller.d.ts +259 -0
- package/dist/features/account/account.controller.js +372 -0
- package/dist/features/account/account.controller.js.map +1 -0
- package/dist/features/account/account.dto.d.ts +16 -0
- package/dist/features/account/account.dto.js +61 -0
- package/dist/features/account/account.dto.js.map +1 -0
- package/dist/features/account/data-export.service.d.ts +85 -0
- package/dist/features/account/data-export.service.js +125 -0
- package/dist/features/account/data-export.service.js.map +1 -0
- package/dist/features/account/health.service.d.ts +30 -0
- package/dist/features/account/health.service.js +59 -0
- package/dist/features/account/health.service.js.map +1 -0
- package/dist/features/admin/admin.controller.d.ts +382 -0
- package/dist/features/admin/admin.controller.js +623 -0
- package/dist/features/admin/admin.controller.js.map +1 -0
- package/dist/features/admin/admin.dto.d.ts +61 -0
- package/dist/features/admin/admin.dto.js +253 -0
- package/dist/features/admin/admin.dto.js.map +1 -0
- package/dist/features/admin/admin.service.d.ts +142 -0
- package/dist/features/admin/admin.service.js +227 -0
- package/dist/features/admin/admin.service.js.map +1 -0
- package/dist/features/api-keys/api-keys.service.d.ts +67 -0
- package/dist/features/api-keys/api-keys.service.js +144 -0
- package/dist/features/api-keys/api-keys.service.js.map +1 -0
- package/dist/features/email-change/email-change.controller.d.ts +38 -0
- package/dist/features/email-change/email-change.controller.js +85 -0
- package/dist/features/email-change/email-change.controller.js.map +1 -0
- package/dist/features/email-change/email-change.dto.d.ts +10 -0
- package/dist/features/email-change/email-change.dto.js +43 -0
- package/dist/features/email-change/email-change.dto.js.map +1 -0
- package/dist/features/email-change/email-change.service.d.ts +74 -0
- package/dist/features/email-change/email-change.service.js +179 -0
- package/dist/features/email-change/email-change.service.js.map +1 -0
- package/dist/features/email-links/email-verification.service.d.ts +46 -0
- package/dist/features/email-links/email-verification.service.js +94 -0
- package/dist/features/email-links/email-verification.service.js.map +1 -0
- package/dist/features/email-links/link-tokens.service.d.ts +44 -0
- package/dist/features/email-links/link-tokens.service.js +122 -0
- package/dist/features/email-links/link-tokens.service.js.map +1 -0
- package/dist/features/events/auth-events.service.d.ts +52 -0
- package/dist/features/events/auth-events.service.js +117 -0
- package/dist/features/events/auth-events.service.js.map +1 -0
- package/dist/features/maintenance/data-retention.service.d.ts +60 -0
- package/dist/features/maintenance/data-retention.service.js +182 -0
- package/dist/features/maintenance/data-retention.service.js.map +1 -0
- package/dist/features/notifications/notifications.service.d.ts +40 -0
- package/dist/features/notifications/notifications.service.js +94 -0
- package/dist/features/notifications/notifications.service.js.map +1 -0
- package/dist/features/one-time-codes/one-time-codes.service.d.ts +40 -0
- package/dist/features/one-time-codes/one-time-codes.service.js +102 -0
- package/dist/features/one-time-codes/one-time-codes.service.js.map +1 -0
- package/dist/features/organizations/organizations.controller.d.ts +220 -0
- package/dist/features/organizations/organizations.controller.js +337 -0
- package/dist/features/organizations/organizations.controller.js.map +1 -0
- package/dist/features/organizations/organizations.dto.d.ts +31 -0
- package/dist/features/organizations/organizations.dto.js +100 -0
- package/dist/features/organizations/organizations.dto.js.map +1 -0
- package/dist/features/organizations/organizations.service.d.ts +274 -0
- package/dist/features/organizations/organizations.service.js +481 -0
- package/dist/features/organizations/organizations.service.js.map +1 -0
- package/dist/features/passkeys/passkeys.controller.d.ts +92 -0
- package/dist/features/passkeys/passkeys.controller.js +183 -0
- package/dist/features/passkeys/passkeys.controller.js.map +1 -0
- package/dist/features/passkeys/passkeys.dto.d.ts +13 -0
- package/dist/features/passkeys/passkeys.dto.js +50 -0
- package/dist/features/passkeys/passkeys.dto.js.map +1 -0
- package/dist/features/passkeys/passkeys.service.d.ts +159 -0
- package/dist/features/passkeys/passkeys.service.js +350 -0
- package/dist/features/passkeys/passkeys.service.js.map +1 -0
- package/dist/features/passwordless/passwordless-auth.service.d.ts +152 -0
- package/dist/features/passwordless/passwordless-auth.service.js +304 -0
- package/dist/features/passwordless/passwordless-auth.service.js.map +1 -0
- package/dist/features/passwordless/passwordless.controller.d.ts +75 -0
- package/dist/features/passwordless/passwordless.controller.js +163 -0
- package/dist/features/passwordless/passwordless.controller.js.map +1 -0
- package/dist/features/passwordless/passwordless.dto.d.ts +29 -0
- package/dist/features/passwordless/passwordless.dto.js +101 -0
- package/dist/features/passwordless/passwordless.dto.js.map +1 -0
- package/dist/features/passwords/password-auth.service.d.ts +154 -0
- package/dist/features/passwords/password-auth.service.js +317 -0
- package/dist/features/passwords/password-auth.service.js.map +1 -0
- package/dist/features/passwords/password-policy.service.d.ts +63 -0
- package/dist/features/passwords/password-policy.service.js +175 -0
- package/dist/features/passwords/password-policy.service.js.map +1 -0
- package/dist/features/passwords/password.controller.d.ts +95 -0
- package/dist/features/passwords/password.controller.js +193 -0
- package/dist/features/passwords/password.controller.js.map +1 -0
- package/dist/features/passwords/password.dto.d.ts +36 -0
- package/dist/features/passwords/password.dto.js +140 -0
- package/dist/features/passwords/password.dto.js.map +1 -0
- package/dist/features/sessions/session.service.d.ts +132 -0
- package/dist/features/sessions/session.service.js +308 -0
- package/dist/features/sessions/session.service.js.map +1 -0
- package/dist/features/sessions/session.types.d.ts +34 -0
- package/dist/features/sessions/session.types.js +3 -0
- package/dist/features/sessions/session.types.js.map +1 -0
- package/dist/features/settings/settings.defaults.d.ts +2 -0
- package/dist/features/settings/settings.defaults.js +7 -0
- package/dist/features/settings/settings.defaults.js.map +1 -0
- package/dist/features/settings/settings.service.d.ts +44 -0
- package/dist/features/settings/settings.service.js +112 -0
- package/dist/features/settings/settings.service.js.map +1 -0
- package/dist/features/settings/settings.types.d.ts +133 -0
- package/dist/features/settings/settings.types.js +3 -0
- package/dist/features/settings/settings.types.js.map +1 -0
- package/dist/features/settings/settings.validation.d.ts +33 -0
- package/dist/features/settings/settings.validation.js +614 -0
- package/dist/features/settings/settings.validation.js.map +1 -0
- package/dist/features/sign-in/sign-in-challenges.service.d.ts +54 -0
- package/dist/features/sign-in/sign-in-challenges.service.js +104 -0
- package/dist/features/sign-in/sign-in-challenges.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.service.d.ts +127 -0
- package/dist/features/sign-in/sign-in.service.js +248 -0
- package/dist/features/sign-in/sign-in.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.types.d.ts +22 -0
- package/dist/features/sign-in/sign-in.types.js +3 -0
- package/dist/features/sign-in/sign-in.types.js.map +1 -0
- package/dist/features/signing-keys/jwks.controller.d.ts +17 -0
- package/dist/features/signing-keys/jwks.controller.js +51 -0
- package/dist/features/signing-keys/jwks.controller.js.map +1 -0
- package/dist/features/signing-keys/signing-keys.service.d.ts +67 -0
- package/dist/features/signing-keys/signing-keys.service.js +142 -0
- package/dist/features/signing-keys/signing-keys.service.js.map +1 -0
- package/dist/features/social/social-auth.service.d.ts +100 -0
- package/dist/features/social/social-auth.service.js +232 -0
- package/dist/features/social/social-auth.service.js.map +1 -0
- package/dist/features/social/social-providers.service.d.ts +97 -0
- package/dist/features/social/social-providers.service.js +214 -0
- package/dist/features/social/social-providers.service.js.map +1 -0
- package/dist/features/social/social.controller.d.ts +54 -0
- package/dist/features/social/social.controller.js +124 -0
- package/dist/features/social/social.controller.js.map +1 -0
- package/dist/features/social/social.dto.d.ts +11 -0
- package/dist/features/social/social.dto.js +38 -0
- package/dist/features/social/social.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.controller.d.ts +84 -0
- package/dist/features/two-factor/two-factor.controller.js +174 -0
- package/dist/features/two-factor/two-factor.controller.js.map +1 -0
- package/dist/features/two-factor/two-factor.dto.d.ts +10 -0
- package/dist/features/two-factor/two-factor.dto.js +37 -0
- package/dist/features/two-factor/two-factor.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.service.d.ts +171 -0
- package/dist/features/two-factor/two-factor.service.js +348 -0
- package/dist/features/two-factor/two-factor.service.js.map +1 -0
- package/dist/features/users/sign-in-methods.service.d.ts +40 -0
- package/dist/features/users/sign-in-methods.service.js +81 -0
- package/dist/features/users/sign-in-methods.service.js.map +1 -0
- package/dist/features/users/sign-up-rules.d.ts +12 -0
- package/dist/features/users/sign-up-rules.js +29 -0
- package/dist/features/users/sign-up-rules.js.map +1 -0
- package/dist/features/users/users.service.d.ts +246 -0
- package/dist/features/users/users.service.js +509 -0
- package/dist/features/users/users.service.js.map +1 -0
- package/dist/features/users/users.types.d.ts +24 -0
- package/dist/features/users/users.types.js +3 -0
- package/dist/features/users/users.types.js.map +1 -0
- package/dist/features/webhooks/webhook-delivery.worker.d.ts +55 -0
- package/dist/features/webhooks/webhook-delivery.worker.js +175 -0
- package/dist/features/webhooks/webhook-delivery.worker.js.map +1 -0
- package/dist/features/webhooks/webhook-signature.d.ts +28 -0
- package/dist/features/webhooks/webhook-signature.js +85 -0
- package/dist/features/webhooks/webhook-signature.js.map +1 -0
- package/dist/features/webhooks/webhooks.service.d.ts +144 -0
- package/dist/features/webhooks/webhooks.service.js +238 -0
- package/dist/features/webhooks/webhooks.service.js.map +1 -0
- package/dist/guards/auth.decorators.d.ts +65 -0
- package/dist/guards/auth.decorators.js +68 -0
- package/dist/guards/auth.decorators.js.map +1 -0
- package/dist/guards/auth.guard.d.ts +47 -0
- package/dist/guards/auth.guard.js +132 -0
- package/dist/guards/auth.guard.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/console-email-sender.d.ts +15 -0
- package/dist/integrations/console-email-sender.js +26 -0
- package/dist/integrations/console-email-sender.js.map +1 -0
- package/dist/integrations/msg91-sms-sender.d.ts +28 -0
- package/dist/integrations/msg91-sms-sender.js +46 -0
- package/dist/integrations/msg91-sms-sender.js.map +1 -0
- package/docs/README.md +39 -0
- package/docs/admin-api-keys-webhooks.md +147 -0
- package/docs/api-reference.md +175 -0
- package/docs/architecture.md +119 -0
- package/docs/client-integration.md +192 -0
- package/docs/code-walkthrough.md +273 -0
- package/docs/configuration.md +229 -0
- package/docs/endpoints/README.md +151 -0
- package/docs/endpoints/account.md +363 -0
- package/docs/endpoints/admin.md +422 -0
- package/docs/endpoints/email-password.md +261 -0
- package/docs/endpoints/organizations.md +192 -0
- package/docs/endpoints/passkeys.md +195 -0
- package/docs/endpoints/passwordless.md +214 -0
- package/docs/endpoints/social.md +116 -0
- package/docs/endpoints/two-factor.md +146 -0
- package/docs/error-codes.md +100 -0
- package/docs/events.md +83 -0
- package/docs/getting-started.md +139 -0
- package/docs/manual-testing.md +215 -0
- package/docs/organizations.md +86 -0
- package/docs/production-checklist.md +60 -0
- package/docs/protecting-routes.md +147 -0
- package/docs/security.md +61 -0
- package/docs/sign-in-flows.md +294 -0
- package/package.json +92 -4
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { RequestContext } from '../../common/request-context.js';
|
|
2
|
+
import { ApiKeysService } from '../api-keys/api-keys.service.js';
|
|
3
|
+
import { DataRetentionService } from '../maintenance/data-retention.service.js';
|
|
4
|
+
import { SessionService } from '../sessions/session.service.js';
|
|
5
|
+
import { SettingsService } from '../settings/settings.service.js';
|
|
6
|
+
import { SettingsChanges } from '../settings/settings.types.js';
|
|
7
|
+
import { SigningKeysService } from '../signing-keys/signing-keys.service.js';
|
|
8
|
+
import { TwoFactorService } from '../two-factor/two-factor.service.js';
|
|
9
|
+
import { UsersService } from '../users/users.service.js';
|
|
10
|
+
import { WebhooksService } from '../webhooks/webhooks.service.js';
|
|
11
|
+
import { AdminUpdateUserInput, CreateApiKeyInput, CreateWebhookInput, PageQuery, SearchAuditLogQuery, SearchUsersQuery, SetRolesInput, SuspendUserInput, UpdateWebhookInput } from './admin.dto';
|
|
12
|
+
import { AdminService } from './admin.service';
|
|
13
|
+
/**
|
|
14
|
+
* Admin API. Every route needs a user with one of settings.admin.adminRoles, and checks the
|
|
15
|
+
* session live, so a demoted or signed-out admin loses access at once.
|
|
16
|
+
*
|
|
17
|
+
* Users
|
|
18
|
+
* GET /auth/admin/users search (?search=&status=&role=&page=&pageSize=)
|
|
19
|
+
* GET /auth/admin/users/:id details, sign-in methods, devices
|
|
20
|
+
* PATCH /auth/admin/users/:id change name / app fields
|
|
21
|
+
* PUT /auth/admin/users/:id/roles replace roles
|
|
22
|
+
* POST /auth/admin/users/:id/suspend suspend with a reason (signs out everywhere)
|
|
23
|
+
* POST /auth/admin/users/:id/unsuspend lift a suspension
|
|
24
|
+
* POST /auth/admin/users/:id/verify-email mark email verified (support case)
|
|
25
|
+
* POST /auth/admin/users/:id/reset-2fa turn off 2FA (lost phone)
|
|
26
|
+
* POST /auth/admin/users/:id/logout-all sign out every device
|
|
27
|
+
* DELETE /auth/admin/users/:id delete account (permanent)
|
|
28
|
+
* Settings
|
|
29
|
+
* GET /auth/admin/settings settings in force
|
|
30
|
+
* PATCH /auth/admin/settings change some settings at runtime
|
|
31
|
+
* DELETE /auth/admin/settings back to the settings in code
|
|
32
|
+
* Security and operations
|
|
33
|
+
* GET /auth/admin/audit-log security history (?userId=&eventName=)
|
|
34
|
+
* GET /auth/admin/stats accounts by status, devices, last 24 hours
|
|
35
|
+
* POST /auth/admin/maintenance/cleanup delete old rows now (also runs hourly)
|
|
36
|
+
* POST /auth/admin/signing-keys/rotate new token signing key
|
|
37
|
+
* API keys and webhooks
|
|
38
|
+
* GET/POST /auth/admin/api-keys, DELETE /auth/admin/api-keys/:id
|
|
39
|
+
* GET/POST /auth/admin/webhooks, PATCH/DELETE /auth/admin/webhooks/:id,
|
|
40
|
+
* POST /auth/admin/webhooks/:id/rotate-secret, POST /auth/admin/webhooks/:id/test,
|
|
41
|
+
* GET /auth/admin/webhooks/:id/deliveries, POST /auth/admin/webhooks/:id/deliveries/:deliveryId/retry
|
|
42
|
+
*/
|
|
43
|
+
export declare class AdminController {
|
|
44
|
+
private readonly admin;
|
|
45
|
+
private readonly settingsService;
|
|
46
|
+
private readonly users;
|
|
47
|
+
private readonly sessions;
|
|
48
|
+
private readonly twoFactor;
|
|
49
|
+
private readonly signingKeys;
|
|
50
|
+
private readonly apiKeys;
|
|
51
|
+
private readonly webhooks;
|
|
52
|
+
private readonly dataRetention;
|
|
53
|
+
constructor(admin: AdminService, settingsService: SettingsService, users: UsersService, sessions: SessionService, twoFactor: TwoFactorService, signingKeys: SigningKeysService, apiKeys: ApiKeysService, webhooks: WebhooksService, dataRetention: DataRetentionService);
|
|
54
|
+
/**
|
|
55
|
+
* GET /auth/admin/users — Searches users.
|
|
56
|
+
*
|
|
57
|
+
* @param query - `?search=&status=&role=&page=&pageSize=`.
|
|
58
|
+
* @returns One page of users.
|
|
59
|
+
*/
|
|
60
|
+
searchUsers(query: SearchUsersQuery): Promise<{
|
|
61
|
+
success: true;
|
|
62
|
+
users: import("../..").PublicUserProfile[];
|
|
63
|
+
total: number;
|
|
64
|
+
page: number;
|
|
65
|
+
pageSize: number;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* GET /auth/admin/users/:id — Details, sign-in methods and devices of one user.
|
|
69
|
+
*
|
|
70
|
+
* @param userId - The user to act on (from the URL).
|
|
71
|
+
* @returns See `AdminService.getUserDetails`.
|
|
72
|
+
*/
|
|
73
|
+
getUser(userId: string): Promise<{
|
|
74
|
+
success: true;
|
|
75
|
+
user: import("../..").PublicUserProfile;
|
|
76
|
+
suspensionReason: string | null;
|
|
77
|
+
statusChangedAt: string | null;
|
|
78
|
+
termsAcceptedAt: string | null;
|
|
79
|
+
privacyPolicyAcceptedAt: string | null;
|
|
80
|
+
signInMethods: import("../users/sign-in-methods.service").UserSignInMethods;
|
|
81
|
+
sessions: {
|
|
82
|
+
id: string;
|
|
83
|
+
signInMethod: string;
|
|
84
|
+
ipAddress: string | null;
|
|
85
|
+
userAgent: string | null;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
lastUsedAt: string;
|
|
88
|
+
}[];
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* PATCH /auth/admin/users/:id — Changes the user's names or app fields.
|
|
92
|
+
*
|
|
93
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
94
|
+
* @param userId - The user to act on (from the URL).
|
|
95
|
+
* @param body - The fields to change.
|
|
96
|
+
* @param request - Who is asking.
|
|
97
|
+
* @returns The user's updated public profile.
|
|
98
|
+
*/
|
|
99
|
+
updateUser(adminUserId: string, userId: string, body: AdminUpdateUserInput, request: RequestContext): Promise<{
|
|
100
|
+
success: boolean;
|
|
101
|
+
user: import("../..").PublicUserProfile;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* PUT /auth/admin/users/:id/roles — Replaces the user's roles.
|
|
105
|
+
*
|
|
106
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
107
|
+
* @param userId - The user to act on (from the URL).
|
|
108
|
+
* @param body - `{ roles }`: the full new list.
|
|
109
|
+
* @param request - Who is asking.
|
|
110
|
+
* @returns The user's updated public profile.
|
|
111
|
+
*/
|
|
112
|
+
setRoles(adminUserId: string, userId: string, body: SetRolesInput, request: RequestContext): Promise<{
|
|
113
|
+
success: boolean;
|
|
114
|
+
user: import("../..").PublicUserProfile;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* POST /auth/admin/users/:id/suspend — Suspends the account and signs the user out everywhere.
|
|
118
|
+
*
|
|
119
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
120
|
+
* @param userId - The user to act on (from the URL).
|
|
121
|
+
* @param body - `{ reason }`.
|
|
122
|
+
* @param request - Who is asking.
|
|
123
|
+
* @returns The user's updated public profile.
|
|
124
|
+
*/
|
|
125
|
+
suspendUser(adminUserId: string, userId: string, body: SuspendUserInput, request: RequestContext): Promise<{
|
|
126
|
+
success: boolean;
|
|
127
|
+
user: import("../..").PublicUserProfile;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* POST /auth/admin/users/:id/unsuspend — Lifts a suspension.
|
|
131
|
+
*
|
|
132
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
133
|
+
* @param userId - The user to act on (from the URL).
|
|
134
|
+
* @param request - Who is asking.
|
|
135
|
+
* @returns The user's updated public profile.
|
|
136
|
+
*/
|
|
137
|
+
unsuspendUser(adminUserId: string, userId: string, request: RequestContext): Promise<{
|
|
138
|
+
success: boolean;
|
|
139
|
+
user: import("../..").PublicUserProfile;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* POST /auth/admin/users/:id/verify-email — Marks the email verified (support case).
|
|
143
|
+
*
|
|
144
|
+
* @param userId - The user to act on (from the URL).
|
|
145
|
+
* @param request - Who is asking.
|
|
146
|
+
* @returns The user's updated public profile.
|
|
147
|
+
*/
|
|
148
|
+
verifyEmail(userId: string, request: RequestContext): Promise<{
|
|
149
|
+
success: boolean;
|
|
150
|
+
user: import("../..").PublicUserProfile;
|
|
151
|
+
}>;
|
|
152
|
+
/**
|
|
153
|
+
* POST /auth/admin/users/:id/reset-2fa — Turns off 2FA for a user who lost their phone.
|
|
154
|
+
*
|
|
155
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
156
|
+
* @param userId - The user to act on (from the URL).
|
|
157
|
+
* @param request - Who is asking.
|
|
158
|
+
* @returns `{ success: true }`.
|
|
159
|
+
*/
|
|
160
|
+
resetTwoFactor(adminUserId: string, userId: string, request: RequestContext): Promise<{
|
|
161
|
+
success: true;
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* POST /auth/admin/users/:id/logout-all — Signs the user out on every device.
|
|
165
|
+
*
|
|
166
|
+
* @param userId - The user to act on (from the URL).
|
|
167
|
+
* @returns How many sessions were ended.
|
|
168
|
+
*/
|
|
169
|
+
signOutUserEverywhere(userId: string): Promise<{
|
|
170
|
+
success: boolean;
|
|
171
|
+
endedSessions: number;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* DELETE /auth/admin/users/:id — Deletes the account. This cannot be undone.
|
|
175
|
+
*
|
|
176
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
177
|
+
* @param userId - The user to act on (from the URL).
|
|
178
|
+
* @param request - Who is asking.
|
|
179
|
+
* @returns `{ success: true }`.
|
|
180
|
+
*/
|
|
181
|
+
deleteUser(adminUserId: string, userId: string, request: RequestContext): Promise<{
|
|
182
|
+
success: boolean;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* GET /auth/admin/settings — The settings in force.
|
|
186
|
+
*
|
|
187
|
+
* @returns The full settings.
|
|
188
|
+
*/
|
|
189
|
+
getSettings(): Promise<{
|
|
190
|
+
success: true;
|
|
191
|
+
settings: import("../settings/settings.types.js").AuthSettings;
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* PATCH /auth/admin/settings — Changes some settings at runtime.
|
|
195
|
+
* The body is checked against the settings rules by SettingsService (unknown fields are refused there).
|
|
196
|
+
*
|
|
197
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
198
|
+
* @param body - Only the sections and fields to change.
|
|
199
|
+
* @param request - Who is asking.
|
|
200
|
+
* @returns The settings now in force.
|
|
201
|
+
*/
|
|
202
|
+
changeSettings(adminUserId: string, body: SettingsChanges, request: RequestContext): Promise<{
|
|
203
|
+
success: true;
|
|
204
|
+
settings: import("../settings/settings.types.js").AuthSettings;
|
|
205
|
+
}>;
|
|
206
|
+
/**
|
|
207
|
+
* DELETE /auth/admin/settings — Discards admin changes, back to the settings in code.
|
|
208
|
+
*
|
|
209
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
210
|
+
* @param request - Who is asking.
|
|
211
|
+
* @returns The settings now in force.
|
|
212
|
+
*/
|
|
213
|
+
resetSettings(adminUserId: string, request: RequestContext): Promise<{
|
|
214
|
+
success: true;
|
|
215
|
+
settings: import("../settings/settings.types.js").AuthSettings;
|
|
216
|
+
}>;
|
|
217
|
+
/**
|
|
218
|
+
* GET /auth/admin/audit-log — Security history, newest first.
|
|
219
|
+
*
|
|
220
|
+
* @param query - `?userId=&eventName=&page=&pageSize=`.
|
|
221
|
+
* @returns One page of entries.
|
|
222
|
+
*/
|
|
223
|
+
searchAuditLog(query: SearchAuditLogQuery): Promise<{
|
|
224
|
+
success: true;
|
|
225
|
+
entries: import("../..").AuditLogEntity[];
|
|
226
|
+
total: number;
|
|
227
|
+
page: number;
|
|
228
|
+
pageSize: number;
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* GET /auth/admin/stats — Accounts by status, signed-in devices, last 24 hours.
|
|
232
|
+
*
|
|
233
|
+
* @returns See `AdminService.getStats`.
|
|
234
|
+
*/
|
|
235
|
+
getStats(): Promise<{
|
|
236
|
+
success: true;
|
|
237
|
+
usersByStatus: {
|
|
238
|
+
[k: string]: number;
|
|
239
|
+
};
|
|
240
|
+
activeSessions: number;
|
|
241
|
+
last24Hours: {
|
|
242
|
+
[k: string]: number;
|
|
243
|
+
};
|
|
244
|
+
pendingWebhookDeliveries: number;
|
|
245
|
+
generatedAt: string;
|
|
246
|
+
}>;
|
|
247
|
+
/**
|
|
248
|
+
* POST /auth/admin/maintenance/cleanup — Runs the data-retention cleanup now
|
|
249
|
+
* (it also runs every hour by itself).
|
|
250
|
+
*
|
|
251
|
+
* @returns How many rows were removed from each table.
|
|
252
|
+
*/
|
|
253
|
+
runCleanup(): Promise<{
|
|
254
|
+
success: boolean;
|
|
255
|
+
removed: import("../maintenance/data-retention.service.js").DataRetentionReport;
|
|
256
|
+
}>;
|
|
257
|
+
/**
|
|
258
|
+
* POST /auth/admin/signing-keys/rotate — Creates a new token signing key.
|
|
259
|
+
* Tokens signed with the old key keep working until they expire.
|
|
260
|
+
*
|
|
261
|
+
* @returns `{ success: true }`.
|
|
262
|
+
*/
|
|
263
|
+
rotateSigningKey(): Promise<{
|
|
264
|
+
success: boolean;
|
|
265
|
+
}>;
|
|
266
|
+
/**
|
|
267
|
+
* GET /auth/admin/api-keys — Lists API keys (never the secret part).
|
|
268
|
+
*
|
|
269
|
+
* @returns The API keys.
|
|
270
|
+
*/
|
|
271
|
+
listApiKeys(): Promise<{
|
|
272
|
+
success: boolean;
|
|
273
|
+
apiKeys: import("../api-keys/api-keys.service.js").ApiKeySummary[];
|
|
274
|
+
}>;
|
|
275
|
+
/**
|
|
276
|
+
* POST /auth/admin/api-keys — Creates an API key. The key itself is shown only in this response.
|
|
277
|
+
*
|
|
278
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
279
|
+
* @param body - Name, scopes and optional expiry date.
|
|
280
|
+
* @param request - Who is asking.
|
|
281
|
+
* @returns The new key's details and the plain key.
|
|
282
|
+
*/
|
|
283
|
+
createApiKey(adminUserId: string, body: CreateApiKeyInput, request: RequestContext): Promise<{
|
|
284
|
+
apiKey: string;
|
|
285
|
+
details: import("../api-keys/api-keys.service.js").ApiKeySummary;
|
|
286
|
+
success: boolean;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* DELETE /auth/admin/api-keys/:id — Revokes an API key; it stops working at once.
|
|
290
|
+
*
|
|
291
|
+
* @param adminUserId - The signed-in admin (for the audit log).
|
|
292
|
+
* @param apiKeyId - The key (from the URL).
|
|
293
|
+
* @param request - Who is asking.
|
|
294
|
+
* @returns `{ success: true }`.
|
|
295
|
+
*/
|
|
296
|
+
revokeApiKey(adminUserId: string, apiKeyId: string, request: RequestContext): Promise<{
|
|
297
|
+
success: boolean;
|
|
298
|
+
}>;
|
|
299
|
+
/**
|
|
300
|
+
* GET /auth/admin/webhooks — Lists webhooks.
|
|
301
|
+
*
|
|
302
|
+
* @returns The webhooks.
|
|
303
|
+
*/
|
|
304
|
+
listWebhooks(): Promise<{
|
|
305
|
+
success: boolean;
|
|
306
|
+
webhooks: import("../webhooks/webhooks.service.js").WebhookSummary[];
|
|
307
|
+
}>;
|
|
308
|
+
/**
|
|
309
|
+
* POST /auth/admin/webhooks — Adds a webhook. The signing secret is shown only in this response.
|
|
310
|
+
*
|
|
311
|
+
* @param body - URL, events, description and whether it is on.
|
|
312
|
+
* @returns The webhook and its signing secret.
|
|
313
|
+
*/
|
|
314
|
+
createWebhook(body: CreateWebhookInput): Promise<{
|
|
315
|
+
success: true;
|
|
316
|
+
webhook: import("../webhooks/webhooks.service.js").WebhookSummary;
|
|
317
|
+
signingSecret: string;
|
|
318
|
+
}>;
|
|
319
|
+
/**
|
|
320
|
+
* PATCH /auth/admin/webhooks/:id — Changes a webhook's URL, events, description or on/off state.
|
|
321
|
+
*
|
|
322
|
+
* @param webhookId - The webhook (from the URL).
|
|
323
|
+
* @param body - The fields to change.
|
|
324
|
+
* @returns The updated webhook.
|
|
325
|
+
*/
|
|
326
|
+
updateWebhook(webhookId: string, body: UpdateWebhookInput): Promise<{
|
|
327
|
+
success: true;
|
|
328
|
+
webhook: import("../webhooks/webhooks.service.js").WebhookSummary;
|
|
329
|
+
}>;
|
|
330
|
+
/**
|
|
331
|
+
* DELETE /auth/admin/webhooks/:id — Deletes a webhook and its delivery history.
|
|
332
|
+
*
|
|
333
|
+
* @param webhookId - The webhook (from the URL).
|
|
334
|
+
* @returns `{ success: true }`.
|
|
335
|
+
*/
|
|
336
|
+
deleteWebhook(webhookId: string): Promise<{
|
|
337
|
+
success: true;
|
|
338
|
+
}>;
|
|
339
|
+
/**
|
|
340
|
+
* POST /auth/admin/webhooks/:id/rotate-secret — Replaces the signing secret.
|
|
341
|
+
*
|
|
342
|
+
* @param webhookId - The webhook (from the URL).
|
|
343
|
+
* @returns The new signing secret (shown only once).
|
|
344
|
+
*/
|
|
345
|
+
rotateWebhookSecret(webhookId: string): Promise<{
|
|
346
|
+
success: true;
|
|
347
|
+
signingSecret: string;
|
|
348
|
+
}>;
|
|
349
|
+
/**
|
|
350
|
+
* POST /auth/admin/webhooks/:id/test — Sends a test event to the webhook.
|
|
351
|
+
*
|
|
352
|
+
* @param webhookId - The webhook (from the URL).
|
|
353
|
+
* @returns `{ success: true }`; the worker sends it within seconds.
|
|
354
|
+
*/
|
|
355
|
+
sendTestDelivery(webhookId: string): Promise<{
|
|
356
|
+
success: true;
|
|
357
|
+
}>;
|
|
358
|
+
/**
|
|
359
|
+
* GET /auth/admin/webhooks/:id/deliveries — Delivery history, newest first.
|
|
360
|
+
*
|
|
361
|
+
* @param webhookId - The webhook (from the URL).
|
|
362
|
+
* @param query - `?page=&pageSize=`.
|
|
363
|
+
* @returns One page of deliveries.
|
|
364
|
+
*/
|
|
365
|
+
listDeliveries(webhookId: string, query: PageQuery): Promise<{
|
|
366
|
+
success: true;
|
|
367
|
+
deliveries: import("../..").WebhookDeliveryEntity[];
|
|
368
|
+
total: number;
|
|
369
|
+
page: number;
|
|
370
|
+
pageSize: number;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* POST /auth/admin/webhooks/:id/deliveries/:deliveryId/retry — Sends a failed delivery again.
|
|
374
|
+
*
|
|
375
|
+
* @param webhookId - The webhook (from the URL).
|
|
376
|
+
* @param deliveryId - The delivery (from the URL).
|
|
377
|
+
* @returns `{ success: true }`; the worker sends it within seconds.
|
|
378
|
+
*/
|
|
379
|
+
retryDelivery(webhookId: string, deliveryId: string): Promise<{
|
|
380
|
+
success: true;
|
|
381
|
+
}>;
|
|
382
|
+
}
|