@techelusive/nest-auth 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -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,259 @@
|
|
|
1
|
+
import { AuthOptions } from '../../auth-options.js';
|
|
2
|
+
import { RequestContext } from '../../common/request-context.js';
|
|
3
|
+
import { RateLimiterService } from '../../common/rate-limiter.service.js';
|
|
4
|
+
import { AccessTokenClaims } from '../sessions/session.types.js';
|
|
5
|
+
import { SessionService } from '../sessions/session.service.js';
|
|
6
|
+
import { SettingsService } from '../settings/settings.service.js';
|
|
7
|
+
import { SignInService } from '../sign-in/sign-in.service.js';
|
|
8
|
+
import { SignInMethodsService } from '../users/sign-in-methods.service.js';
|
|
9
|
+
import { UsersService } from '../users/users.service.js';
|
|
10
|
+
import { ReactivateAccountInput, RefreshTokenInput, UpdateMyProfileInput } from './account.dto';
|
|
11
|
+
import { DataExportService } from './data-export.service';
|
|
12
|
+
import { HealthService } from './health.service';
|
|
13
|
+
/** The parts of the raw HTTP request read by the cookie refresh. */
|
|
14
|
+
type HttpRequestWithHeaders = {
|
|
15
|
+
headers: Record<string, string | string[] | undefined>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The signed-in user's own account: tokens, profile, devices, deactivate / delete.
|
|
19
|
+
*
|
|
20
|
+
* POST /auth/refresh new tokens from a refresh token
|
|
21
|
+
* POST /auth/logout sign out this device
|
|
22
|
+
* POST /auth/logout-all sign out every device
|
|
23
|
+
* GET /auth/me profile
|
|
24
|
+
* PATCH /auth/me change name / app fields
|
|
25
|
+
* GET /auth/sign-in-methods password? Google? passkeys?
|
|
26
|
+
* GET /auth/sessions signed-in devices
|
|
27
|
+
* DELETE /auth/sessions/:id sign out one device
|
|
28
|
+
* POST /auth/deactivate switch account off (reversible)
|
|
29
|
+
* POST /auth/reactivate switch it back on
|
|
30
|
+
* DELETE /auth/me delete account (permanent)
|
|
31
|
+
* GET /auth/me/export download my data (JSON)
|
|
32
|
+
* GET /auth/health database / Redis reachable (public)
|
|
33
|
+
*/
|
|
34
|
+
export declare class AccountController {
|
|
35
|
+
private readonly settingsService;
|
|
36
|
+
private readonly users;
|
|
37
|
+
private readonly sessions;
|
|
38
|
+
private readonly signIn;
|
|
39
|
+
private readonly signInMethods;
|
|
40
|
+
private readonly rateLimiter;
|
|
41
|
+
private readonly dataExport;
|
|
42
|
+
private readonly healthService;
|
|
43
|
+
private readonly options;
|
|
44
|
+
constructor(settingsService: SettingsService, users: UsersService, sessions: SessionService, signIn: SignInService, signInMethods: SignInMethodsService, rateLimiter: RateLimiterService, dataExport: DataExportService, healthService: HealthService, options: AuthOptions);
|
|
45
|
+
/**
|
|
46
|
+
* POST /auth/refresh — Swaps a refresh token for new tokens. Public.
|
|
47
|
+
*
|
|
48
|
+
* The refresh token comes from the body or, with AuthOptions.refreshTokenCookie, from the
|
|
49
|
+
* HttpOnly cookie (then the request must come from one of the allowed origins).
|
|
50
|
+
*
|
|
51
|
+
* @param body - `{ refreshToken }`, or empty when the cookie is used.
|
|
52
|
+
* @param request - Who is asking (for rate limits).
|
|
53
|
+
* @param httpRequest - The raw request, to read the cookie and Origin header.
|
|
54
|
+
* @returns A new access token and refresh token.
|
|
55
|
+
*/
|
|
56
|
+
refresh(body: RefreshTokenInput, request: RequestContext, httpRequest: HttpRequestWithHeaders): Promise<{
|
|
57
|
+
accessToken: string;
|
|
58
|
+
expiresIn: number;
|
|
59
|
+
refreshToken: string;
|
|
60
|
+
refreshTokenExpiresAt: string;
|
|
61
|
+
sessionId: string;
|
|
62
|
+
success: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* POST /auth/logout — Signs out this device and clears the refresh token cookie.
|
|
66
|
+
*
|
|
67
|
+
* @param user - The access token's claims (user id and session id).
|
|
68
|
+
* @param request - Who is asking.
|
|
69
|
+
* @returns A success message.
|
|
70
|
+
*/
|
|
71
|
+
logout(user: AccessTokenClaims, request: RequestContext): Promise<{
|
|
72
|
+
success: boolean;
|
|
73
|
+
message: "You have been signed out.";
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* POST /auth/logout-all — Signs out every device, this one included.
|
|
77
|
+
*
|
|
78
|
+
* @param user - The access token's claims.
|
|
79
|
+
* @param request - Who is asking.
|
|
80
|
+
* @returns A success message and how many sessions were ended.
|
|
81
|
+
*/
|
|
82
|
+
logoutEverywhere(user: AccessTokenClaims, request: RequestContext): Promise<{
|
|
83
|
+
success: boolean;
|
|
84
|
+
message: "You have been signed out on all devices.";
|
|
85
|
+
endedSessions: number;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* GET /auth/me — The signed-in user's profile.
|
|
89
|
+
*
|
|
90
|
+
* @param userId - From the access token.
|
|
91
|
+
* @returns The public profile.
|
|
92
|
+
*/
|
|
93
|
+
getMe(userId: string): Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
user: import("../..").PublicUserProfile;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* PATCH /auth/me — Changes the signed-in user's names or metadata.
|
|
99
|
+
*
|
|
100
|
+
* @param userId - From the access token.
|
|
101
|
+
* @param body - The fields to change.
|
|
102
|
+
* @param request - Who is asking.
|
|
103
|
+
* @returns The updated public profile.
|
|
104
|
+
*/
|
|
105
|
+
updateMe(userId: string, body: UpdateMyProfileInput, request: RequestContext): Promise<{
|
|
106
|
+
success: boolean;
|
|
107
|
+
user: import("../..").PublicUserProfile;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* GET /auth/sign-in-methods — Every way the user can currently sign in.
|
|
111
|
+
*
|
|
112
|
+
* @param userId - From the access token.
|
|
113
|
+
* @returns Password, codes, social accounts and passkey count.
|
|
114
|
+
*/
|
|
115
|
+
getSignInMethods(userId: string): Promise<{
|
|
116
|
+
success: boolean;
|
|
117
|
+
signInMethods: import("../users/sign-in-methods.service.js").UserSignInMethods;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* GET /auth/sessions — The user's signed-in devices, with this one marked `isCurrentDevice`.
|
|
121
|
+
*
|
|
122
|
+
* @param user - The access token's claims (user id and session id).
|
|
123
|
+
* @returns The devices, most recently used first.
|
|
124
|
+
*/
|
|
125
|
+
listSessions(user: AccessTokenClaims): Promise<{
|
|
126
|
+
success: boolean;
|
|
127
|
+
sessions: {
|
|
128
|
+
id: string;
|
|
129
|
+
isCurrentDevice: boolean;
|
|
130
|
+
signInMethod: string;
|
|
131
|
+
ipAddress: string | null;
|
|
132
|
+
userAgent: string | null;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
lastUsedAt: string;
|
|
135
|
+
}[];
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* DELETE /auth/sessions/:sessionId — Signs out one of the user's devices.
|
|
139
|
+
*
|
|
140
|
+
* @param userId - From the access token.
|
|
141
|
+
* @param sessionId - From the URL.
|
|
142
|
+
* @returns `{ success: true }`.
|
|
143
|
+
* @throws AuthError NOT_FOUND when the session isn't the user's or has already ended.
|
|
144
|
+
*/
|
|
145
|
+
revokeSession(userId: string, sessionId: string): Promise<{
|
|
146
|
+
success: boolean;
|
|
147
|
+
}>;
|
|
148
|
+
/**
|
|
149
|
+
* POST /auth/deactivate — Switches the account off and signs out everywhere.
|
|
150
|
+
* Signing in again offers to reactivate it.
|
|
151
|
+
*
|
|
152
|
+
* @param userId - From the access token.
|
|
153
|
+
* @param request - Who is asking.
|
|
154
|
+
* @returns A success message.
|
|
155
|
+
*/
|
|
156
|
+
deactivate(userId: string, request: RequestContext): Promise<{
|
|
157
|
+
success: boolean;
|
|
158
|
+
message: "Your account has been deactivated. Sign in again at any time to reactivate it.";
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* POST /auth/reactivate — Switches a deactivated account back on and signs in. Public.
|
|
162
|
+
*
|
|
163
|
+
* @param body - `{ reactivationToken }` from the ACCOUNT_DEACTIVATED error.
|
|
164
|
+
* @param request - Who is asking.
|
|
165
|
+
* @returns Tokens, or a 2FA challenge.
|
|
166
|
+
*/
|
|
167
|
+
reactivate(body: ReactivateAccountInput, request: RequestContext): Promise<import("../..").SignInResult>;
|
|
168
|
+
/**
|
|
169
|
+
* GET /auth/me/export — Everything stored about the signed-in user, as JSON ("download my data").
|
|
170
|
+
*
|
|
171
|
+
* @param userId - From the access token.
|
|
172
|
+
* @returns See `DataExportService.exportUserData`.
|
|
173
|
+
*/
|
|
174
|
+
exportMyData(userId: string): Promise<{
|
|
175
|
+
success: true;
|
|
176
|
+
exportedAt: string;
|
|
177
|
+
profile: {
|
|
178
|
+
termsAcceptedAt: string | null;
|
|
179
|
+
privacyPolicyAcceptedAt: string | null;
|
|
180
|
+
onboardingCompletedAt: string | null;
|
|
181
|
+
updatedAt: string;
|
|
182
|
+
id: string;
|
|
183
|
+
email: string | null;
|
|
184
|
+
isEmailVerified: boolean;
|
|
185
|
+
phoneNumber: string | null;
|
|
186
|
+
isPhoneVerified: boolean;
|
|
187
|
+
firstName: string | null;
|
|
188
|
+
lastName: string | null;
|
|
189
|
+
roles: string[];
|
|
190
|
+
status: import("../../constants.js").AccountStatus;
|
|
191
|
+
pendingVerifications: import("../../constants.js").PendingVerification[];
|
|
192
|
+
onboardingCompleted: boolean;
|
|
193
|
+
isTwoFactorEnabled: boolean;
|
|
194
|
+
metadata: import("../..").JsonObject;
|
|
195
|
+
lastSignedInAt: string | null;
|
|
196
|
+
createdAt: string;
|
|
197
|
+
};
|
|
198
|
+
signInMethods: import("../users/sign-in-methods.service.js").UserSignInMethods;
|
|
199
|
+
linkedAccounts: {
|
|
200
|
+
provider: import("../../constants.js").SocialProvider;
|
|
201
|
+
email: string | null;
|
|
202
|
+
linkedAt: string;
|
|
203
|
+
}[];
|
|
204
|
+
passkeys: {
|
|
205
|
+
name: string;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
lastUsedAt: string | null;
|
|
208
|
+
}[];
|
|
209
|
+
devices: {
|
|
210
|
+
signInMethod: string;
|
|
211
|
+
ipAddress: string | null;
|
|
212
|
+
userAgent: string | null;
|
|
213
|
+
signedInAt: string;
|
|
214
|
+
lastUsedAt: string;
|
|
215
|
+
endedAt: string | null;
|
|
216
|
+
}[];
|
|
217
|
+
organizations: {
|
|
218
|
+
name: string | null;
|
|
219
|
+
role: import("../../constants.js").OrganizationRole;
|
|
220
|
+
joinedAt: string;
|
|
221
|
+
}[];
|
|
222
|
+
securityHistory: {
|
|
223
|
+
event: string;
|
|
224
|
+
ipAddress: string | null;
|
|
225
|
+
userAgent: string | null;
|
|
226
|
+
details: import("../..").JsonObject;
|
|
227
|
+
at: string;
|
|
228
|
+
}[];
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* GET /auth/health — For load balancers and uptime checks: 200 when the database (and Redis, if
|
|
232
|
+
* used) answer, 503 otherwise. Says nothing about users. Public.
|
|
233
|
+
*
|
|
234
|
+
* @param response - Used only to set the 503 status.
|
|
235
|
+
* @returns The overall status and each check's result.
|
|
236
|
+
*/
|
|
237
|
+
health(response: {
|
|
238
|
+
status: (code: number) => unknown;
|
|
239
|
+
}): Promise<{
|
|
240
|
+
success: boolean;
|
|
241
|
+
status: "error" | "ok";
|
|
242
|
+
checks: {
|
|
243
|
+
database: import("../../constants.js").HealthStatus;
|
|
244
|
+
redis: import("../../constants.js").HealthStatus;
|
|
245
|
+
};
|
|
246
|
+
}>;
|
|
247
|
+
/**
|
|
248
|
+
* DELETE /auth/me — Deletes the signed-in user's account. This cannot be undone.
|
|
249
|
+
*
|
|
250
|
+
* @param userId - From the access token.
|
|
251
|
+
* @param request - Who is asking.
|
|
252
|
+
* @returns A success message.
|
|
253
|
+
*/
|
|
254
|
+
deleteMe(userId: string, request: RequestContext): Promise<{
|
|
255
|
+
success: boolean;
|
|
256
|
+
message: "Your account has been deleted.";
|
|
257
|
+
}>;
|
|
258
|
+
}
|
|
259
|
+
export {};
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AccountController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const auth_error_1 = require("../../common/auth-error.js");
|
|
18
|
+
const strict_validation_pipe_1 = require("../../common/strict-validation.pipe.js");
|
|
19
|
+
const request_context_1 = require("../../common/request-context.js");
|
|
20
|
+
const constants_1 = require("../../constants.js");
|
|
21
|
+
const rate_limiter_service_1 = require("../../common/rate-limiter.service.js");
|
|
22
|
+
const auth_decorators_1 = require("../../guards/auth.decorators.js");
|
|
23
|
+
const session_service_1 = require("../sessions/session.service.js");
|
|
24
|
+
const settings_service_1 = require("../settings/settings.service.js");
|
|
25
|
+
const sign_in_service_1 = require("../sign-in/sign-in.service.js");
|
|
26
|
+
const sign_in_methods_service_1 = require("../users/sign-in-methods.service.js");
|
|
27
|
+
const users_service_1 = require("../users/users.service.js");
|
|
28
|
+
const account_dto_1 = require("./account.dto");
|
|
29
|
+
const data_export_service_1 = require("./data-export.service");
|
|
30
|
+
const health_service_1 = require("./health.service");
|
|
31
|
+
const refresh_token_cookie_1 = require("../../common/refresh-token-cookie.js");
|
|
32
|
+
/**
|
|
33
|
+
* The signed-in user's own account: tokens, profile, devices, deactivate / delete.
|
|
34
|
+
*
|
|
35
|
+
* POST /auth/refresh new tokens from a refresh token
|
|
36
|
+
* POST /auth/logout sign out this device
|
|
37
|
+
* POST /auth/logout-all sign out every device
|
|
38
|
+
* GET /auth/me profile
|
|
39
|
+
* PATCH /auth/me change name / app fields
|
|
40
|
+
* GET /auth/sign-in-methods password? Google? passkeys?
|
|
41
|
+
* GET /auth/sessions signed-in devices
|
|
42
|
+
* DELETE /auth/sessions/:id sign out one device
|
|
43
|
+
* POST /auth/deactivate switch account off (reversible)
|
|
44
|
+
* POST /auth/reactivate switch it back on
|
|
45
|
+
* DELETE /auth/me delete account (permanent)
|
|
46
|
+
* GET /auth/me/export download my data (JSON)
|
|
47
|
+
* GET /auth/health database / Redis reachable (public)
|
|
48
|
+
*/
|
|
49
|
+
let AccountController = class AccountController {
|
|
50
|
+
settingsService;
|
|
51
|
+
users;
|
|
52
|
+
sessions;
|
|
53
|
+
signIn;
|
|
54
|
+
signInMethods;
|
|
55
|
+
rateLimiter;
|
|
56
|
+
dataExport;
|
|
57
|
+
healthService;
|
|
58
|
+
options;
|
|
59
|
+
constructor(settingsService, users, sessions, signIn, signInMethods, rateLimiter, dataExport, healthService, options) {
|
|
60
|
+
this.settingsService = settingsService;
|
|
61
|
+
this.users = users;
|
|
62
|
+
this.sessions = sessions;
|
|
63
|
+
this.signIn = signIn;
|
|
64
|
+
this.signInMethods = signInMethods;
|
|
65
|
+
this.rateLimiter = rateLimiter;
|
|
66
|
+
this.dataExport = dataExport;
|
|
67
|
+
this.healthService = healthService;
|
|
68
|
+
this.options = options;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* POST /auth/refresh — Swaps a refresh token for new tokens. Public.
|
|
72
|
+
*
|
|
73
|
+
* The refresh token comes from the body or, with AuthOptions.refreshTokenCookie, from the
|
|
74
|
+
* HttpOnly cookie (then the request must come from one of the allowed origins).
|
|
75
|
+
*
|
|
76
|
+
* @param body - `{ refreshToken }`, or empty when the cookie is used.
|
|
77
|
+
* @param request - Who is asking (for rate limits).
|
|
78
|
+
* @param httpRequest - The raw request, to read the cookie and Origin header.
|
|
79
|
+
* @returns A new access token and refresh token.
|
|
80
|
+
*/
|
|
81
|
+
async refresh(body, request, httpRequest) {
|
|
82
|
+
await this.rateLimiter.consume(constants_1.RATE_LIMIT_KEY.refreshPerIp(request.ipAddress), constants_1.RATE_LIMITS.refreshPerIp);
|
|
83
|
+
let refreshToken = body.refreshToken;
|
|
84
|
+
const cookieOptions = this.options.refreshTokenCookie;
|
|
85
|
+
if (refreshToken === undefined && cookieOptions) {
|
|
86
|
+
(0, refresh_token_cookie_1.assertAllowedOrigin)(cookieOptions, httpRequest);
|
|
87
|
+
refreshToken = (0, refresh_token_cookie_1.readRefreshCookie)(cookieOptions, httpRequest);
|
|
88
|
+
}
|
|
89
|
+
const tokens = await this.sessions.refreshSession(refreshToken, request, await this.settingsService.getSettings());
|
|
90
|
+
return { success: true, ...tokens };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* POST /auth/logout — Signs out this device and clears the refresh token cookie.
|
|
94
|
+
*
|
|
95
|
+
* @param user - The access token's claims (user id and session id).
|
|
96
|
+
* @param request - Who is asking.
|
|
97
|
+
* @returns A success message.
|
|
98
|
+
*/
|
|
99
|
+
async logout(user, request) {
|
|
100
|
+
await this.signIn.signOut(user.sub, user.sid, request);
|
|
101
|
+
return { success: true, message: constants_1.SUCCESS_MESSAGES.signedOut };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* POST /auth/logout-all — Signs out every device, this one included.
|
|
105
|
+
*
|
|
106
|
+
* @param user - The access token's claims.
|
|
107
|
+
* @param request - Who is asking.
|
|
108
|
+
* @returns A success message and how many sessions were ended.
|
|
109
|
+
*/
|
|
110
|
+
async logoutEverywhere(user, request) {
|
|
111
|
+
const endedSessions = await this.signIn.signOutEverywhere(user.sub, request);
|
|
112
|
+
return { success: true, message: constants_1.SUCCESS_MESSAGES.signedOutEverywhere, endedSessions };
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* GET /auth/me — The signed-in user's profile.
|
|
116
|
+
*
|
|
117
|
+
* @param userId - From the access token.
|
|
118
|
+
* @returns The public profile.
|
|
119
|
+
*/
|
|
120
|
+
async getMe(userId) {
|
|
121
|
+
const settings = await this.settingsService.getSettings();
|
|
122
|
+
return { success: true, user: this.users.toPublicProfile(await this.users.getUserOrThrow(userId), settings) };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* PATCH /auth/me — Changes the signed-in user's names or metadata.
|
|
126
|
+
*
|
|
127
|
+
* @param userId - From the access token.
|
|
128
|
+
* @param body - The fields to change.
|
|
129
|
+
* @param request - Who is asking.
|
|
130
|
+
* @returns The updated public profile.
|
|
131
|
+
*/
|
|
132
|
+
async updateMe(userId, body, request) {
|
|
133
|
+
const settings = await this.settingsService.getSettings();
|
|
134
|
+
const user = await this.users.updateProfile(userId, body, null, request);
|
|
135
|
+
return { success: true, user: this.users.toPublicProfile(user, settings) };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* GET /auth/sign-in-methods — Every way the user can currently sign in.
|
|
139
|
+
*
|
|
140
|
+
* @param userId - From the access token.
|
|
141
|
+
* @returns Password, codes, social accounts and passkey count.
|
|
142
|
+
*/
|
|
143
|
+
async getSignInMethods(userId) {
|
|
144
|
+
const settings = await this.settingsService.getSettings();
|
|
145
|
+
const user = await this.users.getUserOrThrow(userId);
|
|
146
|
+
return { success: true, signInMethods: await this.signInMethods.listSignInMethods(user, settings) };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* GET /auth/sessions — The user's signed-in devices, with this one marked `isCurrentDevice`.
|
|
150
|
+
*
|
|
151
|
+
* @param user - The access token's claims (user id and session id).
|
|
152
|
+
* @returns The devices, most recently used first.
|
|
153
|
+
*/
|
|
154
|
+
async listSessions(user) {
|
|
155
|
+
const sessions = await this.sessions.listActiveSessions(user.sub);
|
|
156
|
+
return {
|
|
157
|
+
success: true,
|
|
158
|
+
sessions: sessions.map((session) => ({
|
|
159
|
+
id: session.id,
|
|
160
|
+
isCurrentDevice: session.id === user.sid,
|
|
161
|
+
signInMethod: session.signInMethod,
|
|
162
|
+
ipAddress: session.ipAddress,
|
|
163
|
+
userAgent: session.userAgent,
|
|
164
|
+
createdAt: session.createdAt.toISOString(),
|
|
165
|
+
lastUsedAt: session.lastUsedAt.toISOString(),
|
|
166
|
+
})),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* DELETE /auth/sessions/:sessionId — Signs out one of the user's devices.
|
|
171
|
+
*
|
|
172
|
+
* @param userId - From the access token.
|
|
173
|
+
* @param sessionId - From the URL.
|
|
174
|
+
* @returns `{ success: true }`.
|
|
175
|
+
* @throws AuthError NOT_FOUND when the session isn't the user's or has already ended.
|
|
176
|
+
*/
|
|
177
|
+
async revokeSession(userId, sessionId) {
|
|
178
|
+
const wasRevoked = await this.sessions.revokeSession(sessionId, constants_1.SESSION_END_REASON.signedOutByUser, userId);
|
|
179
|
+
if (!wasRevoked)
|
|
180
|
+
throw new auth_error_1.AuthError(constants_1.AUTH_ERRORS.notFound);
|
|
181
|
+
return { success: true };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* POST /auth/deactivate — Switches the account off and signs out everywhere.
|
|
185
|
+
* Signing in again offers to reactivate it.
|
|
186
|
+
*
|
|
187
|
+
* @param userId - From the access token.
|
|
188
|
+
* @param request - Who is asking.
|
|
189
|
+
* @returns A success message.
|
|
190
|
+
*/
|
|
191
|
+
async deactivate(userId, request) {
|
|
192
|
+
await this.users.deactivateAccount(userId, request);
|
|
193
|
+
return { success: true, message: constants_1.SUCCESS_MESSAGES.accountDeactivated };
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* POST /auth/reactivate — Switches a deactivated account back on and signs in. Public.
|
|
197
|
+
*
|
|
198
|
+
* @param body - `{ reactivationToken }` from the ACCOUNT_DEACTIVATED error.
|
|
199
|
+
* @param request - Who is asking.
|
|
200
|
+
* @returns Tokens, or a 2FA challenge.
|
|
201
|
+
*/
|
|
202
|
+
async reactivate(body, request) {
|
|
203
|
+
return this.signIn.reactivateAndSignIn(body.reactivationToken, request, await this.settingsService.getSettings());
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* GET /auth/me/export — Everything stored about the signed-in user, as JSON ("download my data").
|
|
207
|
+
*
|
|
208
|
+
* @param userId - From the access token.
|
|
209
|
+
* @returns See `DataExportService.exportUserData`.
|
|
210
|
+
*/
|
|
211
|
+
exportMyData(userId) {
|
|
212
|
+
return this.dataExport.exportUserData(userId);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* GET /auth/health — For load balancers and uptime checks: 200 when the database (and Redis, if
|
|
216
|
+
* used) answer, 503 otherwise. Says nothing about users. Public.
|
|
217
|
+
*
|
|
218
|
+
* @param response - Used only to set the 503 status.
|
|
219
|
+
* @returns The overall status and each check's result.
|
|
220
|
+
*/
|
|
221
|
+
async health(response) {
|
|
222
|
+
const report = await this.healthService.check();
|
|
223
|
+
if (!report.isHealthy)
|
|
224
|
+
response.status(constants_1.HEALTH_SERVICE_UNAVAILABLE_STATUS);
|
|
225
|
+
return { success: report.isHealthy, status: report.isHealthy ? constants_1.HEALTH_STATUS.ok : constants_1.HEALTH_STATUS.error, checks: report.checks };
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* DELETE /auth/me — Deletes the signed-in user's account. This cannot be undone.
|
|
229
|
+
*
|
|
230
|
+
* @param userId - From the access token.
|
|
231
|
+
* @param request - Who is asking.
|
|
232
|
+
* @returns A success message.
|
|
233
|
+
*/
|
|
234
|
+
async deleteMe(userId, request) {
|
|
235
|
+
await this.users.deleteUser(userId, null, request);
|
|
236
|
+
return { success: true, message: constants_1.SUCCESS_MESSAGES.accountDeleted };
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
exports.AccountController = AccountController;
|
|
240
|
+
__decorate([
|
|
241
|
+
(0, common_1.Post)(constants_1.ROUTES.auth.refresh),
|
|
242
|
+
(0, auth_decorators_1.Public)(),
|
|
243
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
244
|
+
__param(0, (0, common_1.Body)()),
|
|
245
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
246
|
+
__param(2, (0, common_1.Req)()),
|
|
247
|
+
__metadata("design:type", Function),
|
|
248
|
+
__metadata("design:paramtypes", [account_dto_1.RefreshTokenInput, Object, Object]),
|
|
249
|
+
__metadata("design:returntype", Promise)
|
|
250
|
+
], AccountController.prototype, "refresh", null);
|
|
251
|
+
__decorate([
|
|
252
|
+
(0, common_1.Post)(constants_1.ROUTES.auth.logout),
|
|
253
|
+
(0, refresh_token_cookie_1.ClearsRefreshTokenCookie)(),
|
|
254
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
255
|
+
__param(0, (0, auth_decorators_1.CurrentUser)()),
|
|
256
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
257
|
+
__metadata("design:type", Function),
|
|
258
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
259
|
+
__metadata("design:returntype", Promise)
|
|
260
|
+
], AccountController.prototype, "logout", null);
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, common_1.Post)(constants_1.ROUTES.auth.logoutAll),
|
|
263
|
+
(0, refresh_token_cookie_1.ClearsRefreshTokenCookie)(),
|
|
264
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
265
|
+
__param(0, (0, auth_decorators_1.CurrentUser)()),
|
|
266
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
267
|
+
__metadata("design:type", Function),
|
|
268
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
269
|
+
__metadata("design:returntype", Promise)
|
|
270
|
+
], AccountController.prototype, "logoutEverywhere", null);
|
|
271
|
+
__decorate([
|
|
272
|
+
(0, common_1.Get)(constants_1.ROUTES.auth.me),
|
|
273
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
274
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
275
|
+
__metadata("design:type", Function),
|
|
276
|
+
__metadata("design:paramtypes", [String]),
|
|
277
|
+
__metadata("design:returntype", Promise)
|
|
278
|
+
], AccountController.prototype, "getMe", null);
|
|
279
|
+
__decorate([
|
|
280
|
+
(0, common_1.Patch)(constants_1.ROUTES.auth.me),
|
|
281
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
282
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
283
|
+
__param(1, (0, common_1.Body)()),
|
|
284
|
+
__param(2, (0, request_context_1.CurrentRequest)()),
|
|
285
|
+
__metadata("design:type", Function),
|
|
286
|
+
__metadata("design:paramtypes", [String, account_dto_1.UpdateMyProfileInput, Object]),
|
|
287
|
+
__metadata("design:returntype", Promise)
|
|
288
|
+
], AccountController.prototype, "updateMe", null);
|
|
289
|
+
__decorate([
|
|
290
|
+
(0, common_1.Get)(constants_1.ROUTES.auth.signInMethods),
|
|
291
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
292
|
+
__metadata("design:type", Function),
|
|
293
|
+
__metadata("design:paramtypes", [String]),
|
|
294
|
+
__metadata("design:returntype", Promise)
|
|
295
|
+
], AccountController.prototype, "getSignInMethods", null);
|
|
296
|
+
__decorate([
|
|
297
|
+
(0, common_1.Get)(constants_1.ROUTES.auth.sessions),
|
|
298
|
+
__param(0, (0, auth_decorators_1.CurrentUser)()),
|
|
299
|
+
__metadata("design:type", Function),
|
|
300
|
+
__metadata("design:paramtypes", [Object]),
|
|
301
|
+
__metadata("design:returntype", Promise)
|
|
302
|
+
], AccountController.prototype, "listSessions", null);
|
|
303
|
+
__decorate([
|
|
304
|
+
(0, common_1.Delete)(constants_1.ROUTES.auth.session),
|
|
305
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
306
|
+
__param(1, (0, common_1.Param)(constants_1.ROUTE_PARAM.sessionId, new common_1.ParseUUIDPipe())),
|
|
307
|
+
__metadata("design:type", Function),
|
|
308
|
+
__metadata("design:paramtypes", [String, String]),
|
|
309
|
+
__metadata("design:returntype", Promise)
|
|
310
|
+
], AccountController.prototype, "revokeSession", null);
|
|
311
|
+
__decorate([
|
|
312
|
+
(0, common_1.Post)(constants_1.ROUTES.auth.deactivate),
|
|
313
|
+
(0, refresh_token_cookie_1.ClearsRefreshTokenCookie)(),
|
|
314
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
315
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
316
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
317
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
318
|
+
__metadata("design:type", Function),
|
|
319
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
320
|
+
__metadata("design:returntype", Promise)
|
|
321
|
+
], AccountController.prototype, "deactivate", null);
|
|
322
|
+
__decorate([
|
|
323
|
+
(0, common_1.Post)(constants_1.ROUTES.auth.reactivate),
|
|
324
|
+
(0, auth_decorators_1.Public)(),
|
|
325
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
326
|
+
__param(0, (0, common_1.Body)()),
|
|
327
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
328
|
+
__metadata("design:type", Function),
|
|
329
|
+
__metadata("design:paramtypes", [account_dto_1.ReactivateAccountInput, Object]),
|
|
330
|
+
__metadata("design:returntype", Promise)
|
|
331
|
+
], AccountController.prototype, "reactivate", null);
|
|
332
|
+
__decorate([
|
|
333
|
+
(0, common_1.Get)(constants_1.ROUTES.auth.exportMyData),
|
|
334
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
335
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
336
|
+
__metadata("design:type", Function),
|
|
337
|
+
__metadata("design:paramtypes", [String]),
|
|
338
|
+
__metadata("design:returntype", void 0)
|
|
339
|
+
], AccountController.prototype, "exportMyData", null);
|
|
340
|
+
__decorate([
|
|
341
|
+
(0, common_1.Get)(constants_1.ROUTES.auth.health),
|
|
342
|
+
(0, auth_decorators_1.Public)(),
|
|
343
|
+
__param(0, (0, common_1.Res)({ passthrough: true })),
|
|
344
|
+
__metadata("design:type", Function),
|
|
345
|
+
__metadata("design:paramtypes", [Object]),
|
|
346
|
+
__metadata("design:returntype", Promise)
|
|
347
|
+
], AccountController.prototype, "health", null);
|
|
348
|
+
__decorate([
|
|
349
|
+
(0, common_1.Delete)(constants_1.ROUTES.auth.me),
|
|
350
|
+
(0, refresh_token_cookie_1.ClearsRefreshTokenCookie)(),
|
|
351
|
+
(0, auth_decorators_1.CheckSession)(),
|
|
352
|
+
__param(0, (0, auth_decorators_1.CurrentUserId)()),
|
|
353
|
+
__param(1, (0, request_context_1.CurrentRequest)()),
|
|
354
|
+
__metadata("design:type", Function),
|
|
355
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
356
|
+
__metadata("design:returntype", Promise)
|
|
357
|
+
], AccountController.prototype, "deleteMe", null);
|
|
358
|
+
exports.AccountController = AccountController = __decorate([
|
|
359
|
+
(0, common_1.Controller)(constants_1.ROUTES.auth.prefix),
|
|
360
|
+
(0, refresh_token_cookie_1.LibraryController)(),
|
|
361
|
+
(0, common_1.UsePipes)(strict_validation_pipe_1.strictValidationPipe),
|
|
362
|
+
__param(8, (0, common_1.Inject)(constants_1.AUTH_OPTIONS_TOKEN)),
|
|
363
|
+
__metadata("design:paramtypes", [settings_service_1.SettingsService,
|
|
364
|
+
users_service_1.UsersService,
|
|
365
|
+
session_service_1.SessionService,
|
|
366
|
+
sign_in_service_1.SignInService,
|
|
367
|
+
sign_in_methods_service_1.SignInMethodsService,
|
|
368
|
+
rate_limiter_service_1.RateLimiterService,
|
|
369
|
+
data_export_service_1.DataExportService,
|
|
370
|
+
health_service_1.HealthService, Object])
|
|
371
|
+
], AccountController);
|
|
372
|
+
//# sourceMappingURL=account.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.controller.js","sourceRoot":"","sources":["../../../src/features/account/account.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoJ;AAEpJ,oDAAgD;AAChD,4EAAuE;AACvE,8DAA0E;AAC1E,2CAWqB;AACrB,wEAAmE;AACnE,8DAA4F;AAE5F,yEAAqE;AACrE,2EAAuE;AACvE,wEAAmE;AACnE,sFAAgF;AAChF,kEAA8D;AAC9D,+CAAgG;AAChG,+DAA0D;AAC1D,qDAAiD;AACjD,wEAKuC;AAKvC;;;;;;;;;;;;;;;;GAgBG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAET;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAC4B;IAT/C,YACmB,e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A;;;;qDAE5B;AAWK;IAFL,IAAA,YAAG,EAAC,kBAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IACvB,IAAA,wBAAM,GAAE;IACK,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;;;+CAIvC;AAYK;IAHL,IAAA,eAAM,EAAC,kBAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IACtB,IAAA,+CAAwB,GAAE;IAC1B,IAAA,8BAAY,GAAE;IACC,WAAA,IAAA,+BAAa,GAAE,CAAA;IAAkB,WAAA,IAAA,gCAAc,GAAE,CAAA;;;;iDAGhE;4BA5NU,iBAAiB;IAH7B,IAAA,mBAAU,EAAC,kBAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IAC9B,IAAA,wCAAiB,GAAE;IACnB,IAAA,iBAAQ,EAAC,6CAAoB,CAAC;IAW1B,WAAA,IAAA,eAAM,EAAC,8BAAkB,CAAC,CAAA;qCARO,kCAAe;QACzB,4BAAY;QACT,gCAAc;QAChB,+BAAa;QACN,8CAAoB;QACtB,yCAAkB;QACnB,uCAAiB;QACd,8BAAa;GATpC,iBAAiB,CA6N7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JsonObject } from '../../database/entities/json-object.js';
|
|
2
|
+
/** POST /auth/refresh. Leave refreshToken out when it lives in the cookie (AuthOptions.refreshTokenCookie). */
|
|
3
|
+
export declare class RefreshTokenInput {
|
|
4
|
+
refreshToken?: string;
|
|
5
|
+
}
|
|
6
|
+
/** POST /auth/reactivate */
|
|
7
|
+
export declare class ReactivateAccountInput {
|
|
8
|
+
/** The reactivationToken from the ACCOUNT_DEACTIVATED sign-in response. */
|
|
9
|
+
reactivationToken: string;
|
|
10
|
+
}
|
|
11
|
+
/** PATCH /auth/me. Users may change their name and app fields, never their roles or status. */
|
|
12
|
+
export declare class UpdateMyProfileInput {
|
|
13
|
+
firstName?: string;
|
|
14
|
+
lastName?: string;
|
|
15
|
+
metadata?: JsonObject;
|
|
16
|
+
}
|