@colveor/core 1.1.0 → 1.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 +17 -0
- package/README.md +6 -0
- package/dist/bootstrap/bootstrap-colveor-app.d.ts.map +1 -1
- package/dist/bootstrap/bootstrap-colveor-app.js +22 -3
- package/dist/bootstrap/bootstrap-colveor-app.js.map +1 -1
- package/dist/common/decorators/index.d.ts +6 -0
- package/dist/common/decorators/index.d.ts.map +1 -1
- package/dist/common/decorators/index.js +8 -1
- package/dist/common/decorators/index.js.map +1 -1
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts +9 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts.map +1 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js +12 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js.map +1 -0
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -6
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/login-ip-rate-limit.guard.js +65 -21
- package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +3 -2
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.js +17 -15
- package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/permissions.guard.d.ts.map +1 -1
- package/dist/common/guards/permissions.guard.js +12 -2
- package/dist/common/guards/permissions.guard.js.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.js +5 -1
- package/dist/common/interceptors/timeout.interceptor.js.map +1 -1
- package/dist/common/interfaces/request-user.d.ts +4 -3
- package/dist/common/interfaces/request-user.d.ts.map +1 -1
- package/dist/common/utils/cache-version.util.d.ts +12 -0
- package/dist/common/utils/cache-version.util.d.ts.map +1 -0
- package/dist/common/utils/cache-version.util.js +34 -0
- package/dist/common/utils/cache-version.util.js.map +1 -0
- package/dist/common/utils/postgres-error.util.d.ts +5 -0
- package/dist/common/utils/postgres-error.util.d.ts.map +1 -0
- package/dist/common/utils/postgres-error.util.js +13 -0
- package/dist/common/utils/postgres-error.util.js.map +1 -0
- package/dist/common/utils/singleflight.util.d.ts +6 -0
- package/dist/common/utils/singleflight.util.d.ts.map +1 -0
- package/dist/common/utils/singleflight.util.js +21 -0
- package/dist/common/utils/singleflight.util.js.map +1 -0
- package/dist/common/validators/is-exclusive-auth-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-auth-params.validator.js.map +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js.map +1 -1
- package/dist/config/app.config.d.ts +38 -0
- package/dist/config/app.config.d.ts.map +1 -1
- package/dist/config/app.config.js +24 -0
- package/dist/config/app.config.js.map +1 -1
- package/dist/config/database.config.d.ts +6 -0
- package/dist/config/database.config.d.ts.map +1 -1
- package/dist/config/database.config.js +3 -0
- package/dist/config/database.config.js.map +1 -1
- package/dist/config/env-flags.util.d.ts +4 -0
- package/dist/config/env-flags.util.d.ts.map +1 -1
- package/dist/config/env-flags.util.js +7 -0
- package/dist/config/env-flags.util.js.map +1 -1
- package/dist/config/env.validation.d.ts +24 -1
- package/dist/config/env.validation.d.ts.map +1 -1
- package/dist/config/env.validation.js +92 -2
- package/dist/config/env.validation.js.map +1 -1
- package/dist/config/in-memory-redis.client.d.ts +23 -4
- package/dist/config/in-memory-redis.client.d.ts.map +1 -1
- package/dist/config/in-memory-redis.client.js +148 -4
- package/dist/config/in-memory-redis.client.js.map +1 -1
- package/dist/config/redis.module.d.ts.map +1 -1
- package/dist/config/redis.module.js +5 -0
- package/dist/config/redis.module.js.map +1 -1
- package/dist/core.module.d.ts +5 -0
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +5 -0
- package/dist/core.module.js.map +1 -1
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts +7 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts.map +1 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js +24 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts +7 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js +16 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts +7 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js +14 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts +13 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js +35 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts +11 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js +60 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts +14 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js +39 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts +13 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js +69 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts +11 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js +51 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts +12 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js +37 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts +12 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js +74 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts +12 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js +52 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts +11 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js +36 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js +39 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js +39 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts +13 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js +72 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts +10 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.js +60 -0
- package/dist/database/migrations/1785006199386-audit-events.js.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts +10 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js +25 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts +11 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js +157 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts +10 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js +38 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts +14 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js +345 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts +10 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js +39 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts +11 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js +33 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts +11 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js +33 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts +11 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js +24 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts +10 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js +35 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts +11 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js +23 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js.map +1 -0
- package/dist/database/seeds/roles.seed.d.ts +6 -0
- package/dist/database/seeds/roles.seed.d.ts.map +1 -1
- package/dist/database/seeds/roles.seed.js +22 -5
- package/dist/database/seeds/roles.seed.js.map +1 -1
- package/dist/database/seeds/settings.seed.d.ts +5 -0
- package/dist/database/seeds/settings.seed.d.ts.map +1 -1
- package/dist/database/seeds/settings.seed.js +500 -25
- package/dist/database/seeds/settings.seed.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.d.ts +1 -0
- package/dist/database/seeds/templates/html-template.reader.d.ts.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.js +3 -1
- package/dist/database/seeds/templates/html-template.reader.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.ts +5 -1
- package/dist/database/typeorm.util.d.ts.map +1 -1
- package/dist/database/typeorm.util.js +6 -0
- package/dist/database/typeorm.util.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.d.ts +15 -7
- package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.js +74 -17
- package/dist/modules/admin/controllers/admin.controller.js.map +1 -1
- package/dist/modules/admin/services/admin-log.service.d.ts +14 -7
- package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -1
- package/dist/modules/admin/services/admin-log.service.js +41 -38
- package/dist/modules/admin/services/admin-log.service.js.map +1 -1
- package/dist/modules/audit/audit.manifest.d.ts +8 -0
- package/dist/modules/audit/audit.manifest.d.ts.map +1 -0
- package/dist/modules/audit/audit.manifest.js +31 -0
- package/dist/modules/audit/audit.manifest.js.map +1 -0
- package/dist/modules/audit/audit.module.d.ts +8 -0
- package/dist/modules/audit/audit.module.d.ts.map +1 -0
- package/dist/modules/audit/audit.module.js +57 -0
- package/dist/modules/audit/audit.module.js.map +1 -0
- package/dist/modules/audit/constants/audit-actions.d.ts +79 -0
- package/dist/modules/audit/constants/audit-actions.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-actions.js +89 -0
- package/dist/modules/audit/constants/audit-actions.js.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts +10 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.js +13 -0
- package/dist/modules/audit/constants/audit-mutation.js.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts +13 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.js +149 -0
- package/dist/modules/audit/controllers/audit.controller.js.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts +27 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.js +18 -0
- package/dist/modules/audit/decorators/audit.decorator.js.map +1 -0
- package/dist/modules/audit/dto/audit.dto.d.ts +54 -0
- package/dist/modules/audit/dto/audit.dto.d.ts.map +1 -0
- package/dist/modules/audit/dto/audit.dto.js +129 -0
- package/dist/modules/audit/dto/audit.dto.js.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts +33 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.js +125 -0
- package/dist/modules/audit/entities/audit-event.entity.js.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts +16 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js +65 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js.map +1 -0
- package/dist/modules/audit/index.d.ts +13 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +23 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts +11 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js +75 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts +31 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js +338 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.js +132 -0
- package/dist/modules/audit/services/audit-archive.service.js.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts +22 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js +79 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.js +99 -0
- package/dist/modules/audit/services/audit-leader.service.js.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts +29 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.js +144 -0
- package/dist/modules/audit/services/audit-outbox.worker.js.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts +18 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.js +70 -0
- package/dist/modules/audit/services/audit-partition.service.js.map +1 -0
- package/dist/modules/audit/services/audit-write.service.d.ts +60 -0
- package/dist/modules/audit/services/audit-write.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-write.service.js +463 -0
- package/dist/modules/audit/services/audit-write.service.js.map +1 -0
- package/dist/modules/audit/services/audit.service.d.ts +60 -0
- package/dist/modules/audit/services/audit.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit.service.js +373 -0
- package/dist/modules/audit/services/audit.service.js.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts +20 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.js +44 -0
- package/dist/modules/audit/utils/audit-hash.util.js.map +1 -0
- package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/auth-core.module.js +16 -4
- package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -1
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts +22 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js +25 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts +19 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js +110 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +7 -8
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +34 -34
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -1
- package/dist/modules/auth/auth.manifest.d.ts +6 -0
- package/dist/modules/auth/auth.manifest.d.ts.map +1 -1
- package/dist/modules/auth/auth.manifest.js +38 -2
- package/dist/modules/auth/auth.manifest.js.map +1 -1
- package/dist/modules/auth/auth.module.d.ts.map +1 -1
- package/dist/modules/auth/auth.module.js +39 -4
- package/dist/modules/auth/auth.module.js.map +1 -1
- package/dist/modules/auth/controllers/account.controller.d.ts +15 -1
- package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/account.controller.js +65 -7
- package/dist/modules/auth/controllers/account.controller.js.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.d.ts +7 -3
- package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.js +76 -16
- package/dist/modules/auth/controllers/auth.controller.js.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts +4 -2
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.js +32 -11
- package/dist/modules/auth/controllers/forgot-password.controller.js.map +1 -1
- package/dist/modules/auth/controllers/mfa.controller.d.ts +18 -0
- package/dist/modules/auth/controllers/mfa.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/mfa.controller.js +192 -0
- package/dist/modules/auth/controllers/mfa.controller.js.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts +22 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.js +192 -0
- package/dist/modules/auth/controllers/oauth.controller.js.map +1 -0
- package/dist/modules/auth/controllers/otp.controller.d.ts +6 -3
- package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/otp.controller.js +32 -33
- package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.js +10 -2
- package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
- package/dist/modules/auth/controllers/session.controller.d.ts +12 -4
- package/dist/modules/auth/controllers/session.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/session.controller.js +130 -31
- package/dist/modules/auth/controllers/session.controller.js.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.d.ts +11 -2
- package/dist/modules/auth/dto/auth-config.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.js +78 -3
- package/dist/modules/auth/dto/auth-config.dto.js.map +1 -1
- package/dist/modules/auth/dto/index.d.ts +2 -0
- package/dist/modules/auth/dto/index.d.ts.map +1 -1
- package/dist/modules/auth/dto/index.js +2 -0
- package/dist/modules/auth/dto/index.js.map +1 -1
- package/dist/modules/auth/dto/login.dto.d.ts +8 -1
- package/dist/modules/auth/dto/login.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/login.dto.js +48 -3
- package/dist/modules/auth/dto/login.dto.js.map +1 -1
- package/dist/modules/auth/dto/mfa.dto.d.ts +61 -0
- package/dist/modules/auth/dto/mfa.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/mfa.dto.js +326 -0
- package/dist/modules/auth/dto/mfa.dto.js.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts +45 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.js +249 -0
- package/dist/modules/auth/dto/oauth.dto.js.map +1 -0
- package/dist/modules/auth/dto/otp.dto.d.ts +3 -1
- package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/otp.dto.js +19 -0
- package/dist/modules/auth/dto/otp.dto.js.map +1 -1
- package/dist/modules/auth/dto/password.dto.d.ts +28 -0
- package/dist/modules/auth/dto/password.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/password.dto.js +191 -5
- package/dist/modules/auth/dto/password.dto.js.map +1 -1
- package/dist/modules/auth/dto/register.dto.d.ts +1 -0
- package/dist/modules/auth/dto/register.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/register.dto.js +1 -0
- package/dist/modules/auth/dto/register.dto.js.map +1 -1
- package/dist/modules/auth/dto/session.dto.d.ts +20 -0
- package/dist/modules/auth/dto/session.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/session.dto.js +98 -0
- package/dist/modules/auth/dto/session.dto.js.map +1 -0
- package/dist/modules/auth/dto/token.dto.d.ts +38 -1
- package/dist/modules/auth/dto/token.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/token.dto.js +21 -1
- package/dist/modules/auth/dto/token.dto.js.map +1 -1
- package/dist/modules/auth/entities/index.d.ts +2 -0
- package/dist/modules/auth/entities/index.d.ts.map +1 -1
- package/dist/modules/auth/entities/index.js +2 -0
- package/dist/modules/auth/entities/index.js.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts +2 -0
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.js +6 -0
- package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -1
- package/dist/modules/auth/entities/user-mfa.entity.d.ts +19 -0
- package/dist/modules/auth/entities/user-mfa.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-mfa.entity.js +73 -0
- package/dist/modules/auth/entities/user-mfa.entity.js.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts +24 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js +84 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js.map +1 -0
- package/dist/modules/auth/events/auth.events.d.ts +84 -19
- package/dist/modules/auth/events/auth.events.d.ts.map +1 -1
- package/dist/modules/auth/events/auth.events.js +17 -9
- package/dist/modules/auth/events/auth.events.js.map +1 -1
- package/dist/modules/auth/services/account.service.d.ts +74 -14
- package/dist/modules/auth/services/account.service.d.ts.map +1 -1
- package/dist/modules/auth/services/account.service.js +247 -31
- package/dist/modules/auth/services/account.service.js.map +1 -1
- package/dist/modules/auth/services/dpop.service.d.ts +41 -0
- package/dist/modules/auth/services/dpop.service.d.ts.map +1 -0
- package/dist/modules/auth/services/dpop.service.js +159 -0
- package/dist/modules/auth/services/dpop.service.js.map +1 -0
- package/dist/modules/auth/services/index.d.ts +2 -0
- package/dist/modules/auth/services/index.d.ts.map +1 -1
- package/dist/modules/auth/services/index.js +2 -0
- package/dist/modules/auth/services/index.js.map +1 -1
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts +28 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts.map +1 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js +163 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js.map +1 -0
- package/dist/modules/auth/services/login.service.d.ts +29 -34
- package/dist/modules/auth/services/login.service.d.ts.map +1 -1
- package/dist/modules/auth/services/login.service.js +173 -61
- package/dist/modules/auth/services/login.service.js.map +1 -1
- package/dist/modules/auth/services/mfa.service.d.ts +111 -0
- package/dist/modules/auth/services/mfa.service.d.ts.map +1 -0
- package/dist/modules/auth/services/mfa.service.js +662 -0
- package/dist/modules/auth/services/mfa.service.js.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js +56 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts +12 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js +64 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js +76 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts +16 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js +92 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts +9 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js +3 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js.map +1 -0
- package/dist/modules/auth/services/oauth.service.d.ts +83 -0
- package/dist/modules/auth/services/oauth.service.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth.service.js +471 -0
- package/dist/modules/auth/services/oauth.service.js.map +1 -0
- package/dist/modules/auth/services/otp-auth.service.d.ts +13 -3
- package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/otp-auth.service.js +41 -7
- package/dist/modules/auth/services/otp-auth.service.js.map +1 -1
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts +22 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts.map +1 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js +117 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js.map +1 -0
- package/dist/modules/auth/services/password.service.d.ts +25 -5
- package/dist/modules/auth/services/password.service.d.ts.map +1 -1
- package/dist/modules/auth/services/password.service.js +154 -20
- package/dist/modules/auth/services/password.service.js.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.d.ts +10 -3
- package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.js +110 -13
- package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
- package/dist/modules/auth/services/registration.service.d.ts +10 -2
- package/dist/modules/auth/services/registration.service.d.ts.map +1 -1
- package/dist/modules/auth/services/registration.service.js +113 -25
- package/dist/modules/auth/services/registration.service.js.map +1 -1
- package/dist/modules/auth/services/turnstile.service.d.ts +17 -0
- package/dist/modules/auth/services/turnstile.service.d.ts.map +1 -0
- package/dist/modules/auth/services/turnstile.service.js +94 -0
- package/dist/modules/auth/services/turnstile.service.js.map +1 -0
- package/dist/modules/auth/utils/auth-params.util.d.ts +13 -6
- package/dist/modules/auth/utils/auth-params.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-params.util.js +27 -4
- package/dist/modules/auth/utils/auth-params.util.js.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts +12 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.js +36 -4
- package/dist/modules/auth/utils/auth-supported.util.js.map +1 -1
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts +10 -0
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js +31 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts +5 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.js +22 -0
- package/dist/modules/auth/utils/backup-codes.util.js.map +1 -0
- package/dist/modules/auth/utils/dpop.util.d.ts +22 -0
- package/dist/modules/auth/utils/dpop.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/dpop.util.js +73 -0
- package/dist/modules/auth/utils/dpop.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts +22 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.js +59 -0
- package/dist/modules/auth/utils/mfa-secret.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts +26 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js +49 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts +5 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js +18 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js.map +1 -0
- package/dist/modules/auth/utils/totp.util.d.ts +16 -0
- package/dist/modules/auth/utils/totp.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/totp.util.js +88 -0
- package/dist/modules/auth/utils/totp.util.js.map +1 -0
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts +28 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts.map +1 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.js +48 -2
- package/dist/modules/delivery/composers/otp-delivery.composer.js.map +1 -1
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts +29 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts.map +1 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js +51 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js.map +1 -0
- package/dist/modules/delivery/delivery.module.d.ts.map +1 -1
- package/dist/modules/delivery/delivery.module.js +1 -15
- package/dist/modules/delivery/delivery.module.js.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.d.ts.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js +3 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts +12 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.js +121 -40
- package/dist/modules/delivery/notification-delivery.service.js.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts +22 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.js +144 -42
- package/dist/modules/delivery/processors/delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/delivery.processor.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts +11 -0
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js +90 -16
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts +7 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.js +11 -2
- package/dist/modules/delivery/queues/sync-jobs.queue.js.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts +7 -3
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.js +33 -10
- package/dist/modules/delivery/services/delivery-audit-retention.service.js.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.d.ts +7 -4
- package/dist/modules/delivery/services/notification-audit.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.js +83 -26
- package/dist/modules/delivery/services/notification-audit.service.js.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts +2 -0
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.js +22 -3
- package/dist/modules/delivery/utils/payload-snapshot.util.js.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts +7 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.js +5 -7
- package/dist/modules/file-upload/controllers/file-upload.controller.js.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts +2 -0
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.js +20 -0
- package/dist/modules/file-upload/dto/file-upload.dto.js.map +1 -1
- package/dist/modules/file-upload/file-upload.module.d.ts.map +1 -1
- package/dist/modules/file-upload/file-upload.module.js +12 -2
- package/dist/modules/file-upload/file-upload.module.js.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.d.ts +24 -6
- package/dist/modules/file-upload/services/file-upload.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.js +164 -36
- package/dist/modules/file-upload/services/file-upload.service.js.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts +4 -2
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js +30 -5
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.d.ts.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js +7 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js.map +1 -1
- package/dist/modules/health/health.controller.d.ts +5 -1
- package/dist/modules/health/health.controller.d.ts.map +1 -1
- package/dist/modules/health/health.controller.js +57 -3
- package/dist/modules/health/health.controller.js.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.d.ts +19 -4
- package/dist/modules/invitations/controllers/invitations.controller.d.ts.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.js +19 -10
- package/dist/modules/invitations/controllers/invitations.controller.js.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.d.ts +13 -0
- package/dist/modules/invitations/dto/invitation.dto.d.ts.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.js +69 -2
- package/dist/modules/invitations/dto/invitation.dto.js.map +1 -1
- package/dist/modules/invitations/services/invitations.service.d.ts +24 -6
- package/dist/modules/invitations/services/invitations.service.d.ts.map +1 -1
- package/dist/modules/invitations/services/invitations.service.js +96 -20
- package/dist/modules/invitations/services/invitations.service.js.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.d.ts +7 -2
- package/dist/modules/jobs/queues/jobs.queue.d.ts.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.js +25 -10
- package/dist/modules/jobs/queues/jobs.queue.js.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts +3 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.js +25 -2
- package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.js +1 -0
- package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.js +3 -1
- package/dist/modules/notifications/entities/device-token.entity.js.map +1 -1
- package/dist/modules/notifications/services/fcm.service.d.ts +2 -0
- package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/fcm.service.js +28 -7
- package/dist/modules/notifications/services/fcm.service.js.map +1 -1
- package/dist/modules/notifications/services/notifications.service.d.ts +16 -3
- package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/notifications.service.js +95 -24
- package/dist/modules/notifications/services/notifications.service.js.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.d.ts +2 -0
- package/dist/modules/observability/metrics/metrics.service.d.ts.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.js +11 -0
- package/dist/modules/observability/metrics/metrics.service.js.map +1 -1
- package/dist/modules/otp/constants/otp.constants.d.ts +7 -5
- package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -1
- package/dist/modules/otp/constants/otp.constants.js +11 -8
- package/dist/modules/otp/constants/otp.constants.js.map +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.d.ts +10 -2
- package/dist/modules/otp/otp.service.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.js +48 -4
- package/dist/modules/otp/otp.service.js.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.d.ts +2 -0
- package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.js +19 -0
- package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -1
- package/dist/modules/otp/services/otp.session.store.d.ts +9 -3
- package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.session.store.js +34 -42
- package/dist/modules/otp/services/otp.session.store.js.map +1 -1
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts +11 -0
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts.map +1 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js +68 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js.map +1 -0
- package/dist/modules/profile/controllers/profile.controller.d.ts +9 -3
- package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -1
- package/dist/modules/profile/controllers/profile.controller.js +140 -8
- package/dist/modules/profile/controllers/profile.controller.js.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts +10 -0
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js +43 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js.map +1 -1
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts +24 -0
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js +115 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js.map +1 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/user-profile-response.dto.js +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.js.map +1 -1
- package/dist/modules/profile/dto/username-available.dto.d.ts +6 -0
- package/dist/modules/profile/dto/username-available.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/username-available.dto.js +31 -0
- package/dist/modules/profile/dto/username-available.dto.js.map +1 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts +10 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts.map +1 -1
- package/dist/modules/profile/entities/user-profiles.entity.js +29 -1
- package/dist/modules/profile/entities/user-profiles.entity.js.map +1 -1
- package/dist/modules/profile/index.d.ts +1 -0
- package/dist/modules/profile/index.d.ts.map +1 -1
- package/dist/modules/profile/index.js +1 -0
- package/dist/modules/profile/index.js.map +1 -1
- package/dist/modules/profile/profile.manifest.d.ts +2 -2
- package/dist/modules/profile/profile.manifest.js +2 -2
- package/dist/modules/profile/profile.manifest.js.map +1 -1
- package/dist/modules/profile/profile.module.d.ts.map +1 -1
- package/dist/modules/profile/profile.module.js +7 -2
- package/dist/modules/profile/profile.module.js.map +1 -1
- package/dist/modules/profile/services/profile.service.d.ts +56 -4
- package/dist/modules/profile/services/profile.service.d.ts.map +1 -1
- package/dist/modules/profile/services/profile.service.js +247 -20
- package/dist/modules/profile/services/profile.service.js.map +1 -1
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts +26 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts.map +1 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js +124 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts +36 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.js +42 -0
- package/dist/modules/realtime/constants/realtime.constants.js.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts +21 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.js +113 -0
- package/dist/modules/realtime/controllers/realtime.controller.js.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts +42 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js +289 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js.map +1 -0
- package/dist/modules/realtime/index.d.ts +12 -0
- package/dist/modules/realtime/index.d.ts.map +1 -0
- package/dist/modules/realtime/index.js +35 -0
- package/dist/modules/realtime/index.js.map +1 -0
- package/dist/modules/realtime/realtime.manifest.d.ts +8 -0
- package/dist/modules/realtime/realtime.manifest.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.manifest.js +31 -0
- package/dist/modules/realtime/realtime.manifest.js.map +1 -0
- package/dist/modules/realtime/realtime.module.d.ts +14 -0
- package/dist/modules/realtime/realtime.module.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.module.js +126 -0
- package/dist/modules/realtime/realtime.module.js.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts +16 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js +55 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts +15 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.js +86 -0
- package/dist/modules/realtime/services/realtime-presence.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts +12 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js +63 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime.service.d.ts +88 -0
- package/dist/modules/realtime/services/realtime.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime.service.js +343 -0
- package/dist/modules/realtime/services/realtime.service.js.map +1 -0
- package/dist/modules/realtime/types/realtime.types.d.ts +50 -0
- package/dist/modules/realtime/types/realtime.types.d.ts.map +1 -0
- package/dist/modules/realtime/types/realtime.types.js +14 -0
- package/dist/modules/realtime/types/realtime.types.js.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts +5 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.js +45 -0
- package/dist/modules/realtime/utils/handshake-error.util.js.map +1 -0
- package/dist/modules/roles/controllers/modules.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/modules.controller.js +21 -10
- package/dist/modules/roles/controllers/modules.controller.js.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.js +21 -10
- package/dist/modules/roles/controllers/permissions.controller.js.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.d.ts +5 -4
- package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.js +26 -13
- package/dist/modules/roles/controllers/roles.controller.js.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.d.ts +3 -2
- package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.js +14 -6
- package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -1
- package/dist/modules/roles/services/modules.service.d.ts +8 -5
- package/dist/modules/roles/services/modules.service.d.ts.map +1 -1
- package/dist/modules/roles/services/modules.service.js +58 -12
- package/dist/modules/roles/services/modules.service.js.map +1 -1
- package/dist/modules/roles/services/permissions.service.d.ts +8 -5
- package/dist/modules/roles/services/permissions.service.d.ts.map +1 -1
- package/dist/modules/roles/services/permissions.service.js +61 -12
- package/dist/modules/roles/services/permissions.service.js.map +1 -1
- package/dist/modules/roles/services/roles.service.d.ts +19 -9
- package/dist/modules/roles/services/roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/roles.service.js +137 -47
- package/dist/modules/roles/services/roles.service.js.map +1 -1
- package/dist/modules/roles/services/user-roles.service.d.ts +12 -4
- package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/user-roles.service.js +58 -26
- package/dist/modules/roles/services/user-roles.service.js.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts +7 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.js +10 -0
- package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -1
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts +12 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts.map +1 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js +46 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts +20 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js +97 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js.map +1 -0
- package/dist/modules/sessions/services/token.service.d.ts +150 -16
- package/dist/modules/sessions/services/token.service.d.ts.map +1 -1
- package/dist/modules/sessions/services/token.service.js +505 -74
- package/dist/modules/sessions/services/token.service.js.map +1 -1
- package/dist/modules/sessions/sessions.module.d.ts.map +1 -1
- package/dist/modules/sessions/sessions.module.js +4 -2
- package/dist/modules/sessions/sessions.module.js.map +1 -1
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts +13 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts.map +1 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js +37 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js.map +1 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts +57 -3
- package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.defaults.js +58 -3
- package/dist/modules/settings/constants/settings.defaults.js.map +1 -1
- package/dist/modules/settings/constants/settings.keys.d.ts +138 -2
- package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.keys.js +140 -2
- package/dist/modules/settings/constants/settings.keys.js.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts +5 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.js +134 -5
- package/dist/modules/settings/controllers/settings.controller.js.map +1 -1
- package/dist/modules/settings/services/settings.service.d.ts +17 -7
- package/dist/modules/settings/services/settings.service.d.ts.map +1 -1
- package/dist/modules/settings/services/settings.service.js +80 -14
- package/dist/modules/settings/services/settings.service.js.map +1 -1
- package/dist/modules/settings/utils/settings-secret.util.d.ts +13 -0
- package/dist/modules/settings/utils/settings-secret.util.d.ts.map +1 -0
- package/dist/modules/settings/utils/settings-secret.util.js +80 -0
- package/dist/modules/settings/utils/settings-secret.util.js.map +1 -0
- package/dist/modules/users/controllers/users.controller.d.ts +4 -2
- package/dist/modules/users/controllers/users.controller.d.ts.map +1 -1
- package/dist/modules/users/controllers/users.controller.js +89 -10
- package/dist/modules/users/controllers/users.controller.js.map +1 -1
- package/dist/modules/users/dto/user.dto.d.ts +3 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
- package/dist/modules/users/dto/user.dto.js +27 -4
- package/dist/modules/users/dto/user.dto.js.map +1 -1
- package/dist/modules/users/entities/user.entity.d.ts +7 -1
- package/dist/modules/users/entities/user.entity.d.ts.map +1 -1
- package/dist/modules/users/entities/user.entity.js +10 -0
- package/dist/modules/users/entities/user.entity.js.map +1 -1
- package/dist/modules/users/services/users.service.d.ts +15 -2
- package/dist/modules/users/services/users.service.d.ts.map +1 -1
- package/dist/modules/users/services/users.service.js +152 -37
- package/dist/modules/users/services/users.service.js.map +1 -1
- package/dist/modules/users/users.module.d.ts.map +1 -1
- package/dist/modules/users/users.module.js +1 -2
- package/dist/modules/users/users.module.js.map +1 -1
- package/package.json +19 -7
- package/dist/modules/admin/entities/admin-log.entity.d.ts +0 -20
- package/dist/modules/admin/entities/admin-log.entity.d.ts.map +0 -1
- package/dist/modules/admin/entities/admin-log.entity.js +0 -65
- package/dist/modules/admin/entities/admin-log.entity.js.map +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
/** Minimum digits for OTP codes (generation and verification). */
|
|
1
|
+
/** Minimum digits for OTP codes (generation and verification) in non-production. */
|
|
2
2
|
export declare const OTP_MIN_LENGTH = 4;
|
|
3
|
+
/** Production floor — 4-digit OTPs are too weak for fintech. */
|
|
4
|
+
export declare const OTP_PROD_MIN_LENGTH = 6;
|
|
3
5
|
/** Maximum digits for OTP codes (generation and verification). */
|
|
4
6
|
export declare const OTP_MAX_LENGTH = 6;
|
|
5
7
|
/** Clamps a configured otp.code_length value to the allowed range. */
|
|
6
|
-
export declare function clampOtpCodeLength(length: number): number;
|
|
8
|
+
export declare function clampOtpCodeLength(length: number, minLength?: number): number;
|
|
7
9
|
/** Returns true for numeric OTP strings within the allowed length range. */
|
|
8
10
|
export declare function isValidOtpCode(value: string): boolean;
|
|
9
11
|
/**
|
|
10
12
|
* How long the Redis correlation key lives (seconds).
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
+
* Must cover delivery lockDuration (120s) plus stall/retry budget so a reclaimed
|
|
14
|
+
* send can still peek the code. Internal — not exposed as a DB setting.
|
|
13
15
|
*/
|
|
14
|
-
export declare const OTP_CORRELATION_TTL_SECONDS =
|
|
16
|
+
export declare const OTP_CORRELATION_TTL_SECONDS = 300;
|
|
15
17
|
//# sourceMappingURL=otp.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.constants.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"otp.constants.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":"AAIA,oFAAoF;AACpF,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,kEAAkE;AAClE,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAuB,GAAG,MAAM,CAK7F;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC"}
|
|
@@ -3,18 +3,21 @@
|
|
|
3
3
|
// These are implementation details, not admin-configurable settings.
|
|
4
4
|
// OTP code length and other runtime values live in settings.defaults.ts.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.OTP_CORRELATION_TTL_SECONDS = exports.OTP_MAX_LENGTH = exports.OTP_MIN_LENGTH = void 0;
|
|
6
|
+
exports.OTP_CORRELATION_TTL_SECONDS = exports.OTP_MAX_LENGTH = exports.OTP_PROD_MIN_LENGTH = exports.OTP_MIN_LENGTH = void 0;
|
|
7
7
|
exports.clampOtpCodeLength = clampOtpCodeLength;
|
|
8
8
|
exports.isValidOtpCode = isValidOtpCode;
|
|
9
|
-
/** Minimum digits for OTP codes (generation and verification). */
|
|
9
|
+
/** Minimum digits for OTP codes (generation and verification) in non-production. */
|
|
10
10
|
exports.OTP_MIN_LENGTH = 4;
|
|
11
|
+
/** Production floor — 4-digit OTPs are too weak for fintech. */
|
|
12
|
+
exports.OTP_PROD_MIN_LENGTH = 6;
|
|
11
13
|
/** Maximum digits for OTP codes (generation and verification). */
|
|
12
14
|
exports.OTP_MAX_LENGTH = 6;
|
|
13
15
|
/** Clamps a configured otp.code_length value to the allowed range. */
|
|
14
|
-
function clampOtpCodeLength(length) {
|
|
16
|
+
function clampOtpCodeLength(length, minLength = exports.OTP_MIN_LENGTH) {
|
|
17
|
+
const min = Math.min(Math.max(minLength, exports.OTP_MIN_LENGTH), exports.OTP_MAX_LENGTH);
|
|
15
18
|
const n = Math.trunc(Number(length));
|
|
16
|
-
if (!Number.isFinite(n) || n <
|
|
17
|
-
return
|
|
19
|
+
if (!Number.isFinite(n) || n < min)
|
|
20
|
+
return min;
|
|
18
21
|
return Math.min(n, exports.OTP_MAX_LENGTH);
|
|
19
22
|
}
|
|
20
23
|
/** Returns true for numeric OTP strings within the allowed length range. */
|
|
@@ -23,8 +26,8 @@ function isValidOtpCode(value) {
|
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* How long the Redis correlation key lives (seconds).
|
|
26
|
-
*
|
|
27
|
-
*
|
|
29
|
+
* Must cover delivery lockDuration (120s) plus stall/retry budget so a reclaimed
|
|
30
|
+
* send can still peek the code. Internal — not exposed as a DB setting.
|
|
28
31
|
*/
|
|
29
|
-
exports.OTP_CORRELATION_TTL_SECONDS =
|
|
32
|
+
exports.OTP_CORRELATION_TTL_SECONDS = 300;
|
|
30
33
|
//# sourceMappingURL=otp.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.constants.js","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":";AAAA,kFAAkF;AAClF,qEAAqE;AACrE,yEAAyE;;;
|
|
1
|
+
{"version":3,"file":"otp.constants.js","sourceRoot":"","sources":["../../../../src/modules/otp/constants/otp.constants.ts"],"names":[],"mappings":";AAAA,kFAAkF;AAClF,qEAAqE;AACrE,yEAAyE;;;AAYzE,gDAKC;AAGD,wCAEC;AApBD,oFAAoF;AACvE,QAAA,cAAc,GAAG,CAAC,CAAC;AAEhC,gEAAgE;AACnD,QAAA,mBAAmB,GAAG,CAAC,CAAC;AAErC,kEAAkE;AACrD,QAAA,cAAc,GAAG,CAAC,CAAC;AAEhC,sEAAsE;AACtE,SAAgB,kBAAkB,CAAC,MAAc,EAAE,YAAoB,sBAAc;IACpF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,sBAAc,CAAC,EAAE,sBAAc,CAAC,CAAC;IAC1E,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG;QAAE,OAAO,GAAG,CAAC;IAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAc,CAAC,CAAC;AACpC,CAAC;AAED,4EAA4E;AAC5E,SAAgB,cAAc,CAAC,KAAa;IAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,sBAAc,IAAI,KAAK,CAAC,MAAM,IAAI,sBAAc,CAAC;AAChG,CAAC;AAED;;;;GAIG;AACU,QAAA,2BAA2B,GAAG,GAAG,CAAC"}
|
|
@@ -58,7 +58,7 @@ export interface OtpVerifyResult {
|
|
|
58
58
|
/**
|
|
59
59
|
* Primary auth method when hasAccount is true. Set by auth module after user lookup.
|
|
60
60
|
*/
|
|
61
|
-
authMethod?: 'phone' | 'email';
|
|
61
|
+
authMethod?: 'phone' | 'email' | 'oauth';
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
export declare abstract class IOtpService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.service.interface.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/interfaces/otp.service.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE;QACL;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;CACF;AAED,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE;QACL;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC;QACzB;;WAEG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"otp.service.interface.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/interfaces/otp.service.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE;QACL;;WAEG;QACH,cAAc,EAAE,MAAM,CAAC;QACvB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;CACF;AAED,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE;QACL;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC;QACzB;;WAEG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;KACzC,CAAC;CACF;AAED,8BAAsB,WAAW;IAChC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAE9F;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAEjF;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAEtE;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;CAC/F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
3
|
import { type RedisBackend } from '../../config/redis.module';
|
|
4
|
+
import { AuditService } from '../audit/services/audit.service';
|
|
4
5
|
import { NotificationDeliveryService } from '../delivery';
|
|
5
6
|
import { StructuredLoggerService } from '../observability/logging/structured-logger.service';
|
|
6
7
|
import { SettingsService } from '../settings/services/settings.service';
|
|
@@ -15,7 +16,8 @@ export declare class OtpService extends IOtpService implements OnApplicationBoot
|
|
|
15
16
|
private readonly configService;
|
|
16
17
|
private readonly settingsService;
|
|
17
18
|
private readonly logger;
|
|
18
|
-
|
|
19
|
+
private readonly audit;
|
|
20
|
+
constructor(notificationDelivery: NotificationDeliveryService | null, redisBackend: RedisBackend, sessionStore: OtpSessionStore, rateLimiter: OtpRateLimiter, configService: ConfigService, settingsService: SettingsService, logger: StructuredLoggerService, audit: AuditService);
|
|
19
21
|
onApplicationBootstrap(): void;
|
|
20
22
|
generateOtp(identifier: string, channel: 'sms' | 'email'): Promise<OtpGenerateResult>;
|
|
21
23
|
verifyOtp(sessionToken: string, code: string): Promise<OtpVerifyResult>;
|
|
@@ -34,7 +36,13 @@ export declare class OtpService extends IOtpService implements OnApplicationBoot
|
|
|
34
36
|
private findTestOtpEntry;
|
|
35
37
|
/** Best-effort normalisation for settings rows; invalid rows are skipped. */
|
|
36
38
|
private normalizeTestSettingIdentifier;
|
|
37
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Structured log for all OTP lifecycle events.
|
|
41
|
+
* Compliance audit only for security-significant outcomes (verify / fail / lockout) —
|
|
42
|
+
* not generate/resend — so high-QPS send paths do not amplify the serial seal outbox.
|
|
43
|
+
*/
|
|
38
44
|
private auditLog;
|
|
45
|
+
private toComplianceAction;
|
|
46
|
+
private isFailureEvent;
|
|
39
47
|
}
|
|
40
48
|
//# sourceMappingURL=otp.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.service.d.ts","sourceRoot":"","sources":["../../../src/modules/otp/otp.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,sBAAsB,EAItB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAiB,KAAK,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AE,YAAY;IAKrC,sBAAsB,IAAI,IAAI;IAcxB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBrF,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA+CvE,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6CjE;;OAEG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAgBtF,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;IAQvB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAqCxB,6EAA6E;IAC7E,OAAO,CAAC,8BAA8B;IAUtC;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;CAKtB"}
|
|
@@ -17,6 +17,8 @@ const common_1 = require("@nestjs/common");
|
|
|
17
17
|
const config_1 = require("@nestjs/config");
|
|
18
18
|
const node_env_util_1 = require("../../config/node-env.util");
|
|
19
19
|
const redis_module_1 = require("../../config/redis.module");
|
|
20
|
+
const audit_actions_1 = require("../audit/constants/audit-actions");
|
|
21
|
+
const audit_service_1 = require("../audit/services/audit.service");
|
|
20
22
|
const structured_logger_service_1 = require("../observability/logging/structured-logger.service");
|
|
21
23
|
const settings_keys_1 = require("../settings/constants/settings.keys");
|
|
22
24
|
const settings_service_1 = require("../settings/services/settings.service");
|
|
@@ -33,7 +35,8 @@ let OtpService = class OtpService extends otp_service_interface_1.IOtpService {
|
|
|
33
35
|
configService;
|
|
34
36
|
settingsService;
|
|
35
37
|
logger;
|
|
36
|
-
|
|
38
|
+
audit;
|
|
39
|
+
constructor(notificationDelivery, redisBackend, sessionStore, rateLimiter, configService, settingsService, logger, audit) {
|
|
37
40
|
super();
|
|
38
41
|
this.notificationDelivery = notificationDelivery;
|
|
39
42
|
this.redisBackend = redisBackend;
|
|
@@ -42,6 +45,7 @@ let OtpService = class OtpService extends otp_service_interface_1.IOtpService {
|
|
|
42
45
|
this.configService = configService;
|
|
43
46
|
this.settingsService = settingsService;
|
|
44
47
|
this.logger = logger;
|
|
48
|
+
this.audit = audit;
|
|
45
49
|
}
|
|
46
50
|
onApplicationBootstrap() {
|
|
47
51
|
if (!this.sessionStore.isEnabled()) {
|
|
@@ -74,7 +78,7 @@ let OtpService = class OtpService extends otp_service_interface_1.IOtpService {
|
|
|
74
78
|
this.assertEnabled();
|
|
75
79
|
this.assertValidUuid(sessionToken);
|
|
76
80
|
const session = await this.sessionStore.loadSession(sessionToken);
|
|
77
|
-
const { isValid, newAttempts, lockedOut, identifier, channel } = await this.sessionStore.verifyCodeAndTrackAttempts(sessionToken, code, session);
|
|
81
|
+
const { isValid, newAttempts, lockedOut, identifier, channel, alreadyConsumed } = await this.sessionStore.verifyCodeAndTrackAttempts(sessionToken, code, session);
|
|
78
82
|
if (lockedOut) {
|
|
79
83
|
this.auditLog('otp.locked_out', {
|
|
80
84
|
identifier: (0, otp_utils_1.maskIdentifier)(identifier, channel),
|
|
@@ -83,6 +87,12 @@ let OtpService = class OtpService extends otp_service_interface_1.IOtpService {
|
|
|
83
87
|
throw new common_1.BadRequestException('Maximum verification attempts exceeded. Please request a new OTP.');
|
|
84
88
|
}
|
|
85
89
|
if (!isValid) {
|
|
90
|
+
if (alreadyConsumed) {
|
|
91
|
+
this.auditLog('otp.already_consumed', {
|
|
92
|
+
identifier: (0, otp_utils_1.maskIdentifier)(identifier, channel),
|
|
93
|
+
});
|
|
94
|
+
throw new common_1.BadRequestException('OTP already used. Please request a new code if you need another verification.');
|
|
95
|
+
}
|
|
86
96
|
this.auditLog('otp.failed', {
|
|
87
97
|
identifier: (0, otp_utils_1.maskIdentifier)(identifier, channel),
|
|
88
98
|
attempts: newAttempts,
|
|
@@ -196,12 +206,45 @@ let OtpService = class OtpService extends otp_service_interface_1.IOtpService {
|
|
|
196
206
|
}
|
|
197
207
|
}
|
|
198
208
|
// ─── Audit Logging ───────────────────────────────────────────────────────────
|
|
199
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Structured log for all OTP lifecycle events.
|
|
211
|
+
* Compliance audit only for security-significant outcomes (verify / fail / lockout) —
|
|
212
|
+
* not generate/resend — so high-QPS send paths do not amplify the serial seal outbox.
|
|
213
|
+
*/
|
|
200
214
|
auditLog(event, meta) {
|
|
201
215
|
this.logger.info('OTP lifecycle event', {
|
|
202
216
|
event,
|
|
203
217
|
metadata: meta,
|
|
204
218
|
});
|
|
219
|
+
const action = this.toComplianceAction(event);
|
|
220
|
+
if (!action)
|
|
221
|
+
return;
|
|
222
|
+
const status = this.isFailureEvent(event) ? 'FAILURE' : 'SUCCESS';
|
|
223
|
+
this.audit.record({
|
|
224
|
+
action,
|
|
225
|
+
actorType: 'SYSTEM',
|
|
226
|
+
actorId: null,
|
|
227
|
+
resourceType: 'otp',
|
|
228
|
+
status,
|
|
229
|
+
metadata: meta,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
toComplianceAction(event) {
|
|
233
|
+
switch (event) {
|
|
234
|
+
case 'otp.verified':
|
|
235
|
+
return audit_actions_1.AUDIT_ACTIONS.OTP_VERIFIED;
|
|
236
|
+
case 'otp.failed':
|
|
237
|
+
case 'otp.already_consumed':
|
|
238
|
+
return audit_actions_1.AUDIT_ACTIONS.OTP_FAILED;
|
|
239
|
+
case 'otp.locked_out':
|
|
240
|
+
return audit_actions_1.AUDIT_ACTIONS.OTP_LOCKED_OUT;
|
|
241
|
+
default:
|
|
242
|
+
// generated / resent / *.test → structured logs only
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
isFailureEvent(event) {
|
|
247
|
+
return (event === 'otp.failed' || event === 'otp.locked_out' || event === 'otp.already_consumed');
|
|
205
248
|
}
|
|
206
249
|
};
|
|
207
250
|
exports.OtpService = OtpService;
|
|
@@ -213,6 +256,7 @@ exports.OtpService = OtpService = __decorate([
|
|
|
213
256
|
otp_rate_limiter_1.OtpRateLimiter,
|
|
214
257
|
config_1.ConfigService,
|
|
215
258
|
settings_service_1.SettingsService,
|
|
216
|
-
structured_logger_service_1.StructuredLoggerService
|
|
259
|
+
structured_logger_service_1.StructuredLoggerService,
|
|
260
|
+
audit_service_1.AuditService])
|
|
217
261
|
], OtpService);
|
|
218
262
|
//# sourceMappingURL=otp.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.service.js","sourceRoot":"","sources":["../../../src/modules/otp/otp.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAWwB;AACxB,2CAA+C;AAE/C,8DAAiE;AACjE,4DAA6E;
|
|
1
|
+
{"version":3,"file":"otp.service.js","sourceRoot":"","sources":["../../../src/modules/otp/otp.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAWwB;AACxB,2CAA+C;AAE/C,8DAAiE;AACjE,4DAA6E;AAC7E,oEAAiE;AAEjE,mEAA+D;AAE/D,kGAA6F;AAE7F,uEAAmE;AACnE,4EAAwE;AACxE,6DAA2D;AAC3D,8EAI4C;AAC5C,kEAA6D;AAC7D,oEAA+D;AAC/D,iDAA4F;AAGrF,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,mCAAW;IAGxB;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IAVlB,YAEkB,oBAAwD,EAExD,YAA0B,EAC1B,YAA6B,EAC7B,WAA2B,EAC3B,aAA4B,EAC5B,eAAgC,EAChC,MAA+B,EAC/B,KAAmB;QAEpC,KAAK,EAAE,CAAC;QAVS,yBAAoB,GAApB,oBAAoB,CAAoC;QAExD,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAiB;QAC7B,gBAAW,GAAX,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I;YACb,YAAY,EAAE,KAAK;YACnB,MAAM;YACN,QAAQ,EAAE,IAAI;SACd,CAAC,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,KAAa;QACvC,QAAQ,KAAK,EAAE,CAAC;YACf,KAAK,cAAc;gBAClB,OAAO,6BAAa,CAAC,YAAY,CAAC;YACnC,KAAK,YAAY,CAAC;YAClB,KAAK,sBAAsB;gBAC1B,OAAO,6BAAa,CAAC,UAAU,CAAC;YACjC,KAAK,gBAAgB;gBACpB,OAAO,6BAAa,CAAC,cAAc,CAAC;YACrC;gBACC,qDAAqD;gBACrD,OAAO,IAAI,CAAC;QACd,CAAC;IACF,CAAC;IAEO,cAAc,CAAC,KAAa;QACnC,OAAO,CACN,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,gBAAgB,IAAI,KAAK,KAAK,sBAAsB,CACxF,CAAC;IACH,CAAC;CACD,CAAA;AAtRY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAEV,WAAA,IAAA,eAAM,EAAC,4BAAa,CAAC,CAAA;qDAES,mCAAe;QAChB,iCAAc;QACZ,sBAAa;QACX,kCAAe;QACxB,mDAAuB;QACxB,4BAAY;GAXzB,UAAU,CAsRtB"}
|
|
@@ -16,6 +16,8 @@ export declare class OtpRateLimiter {
|
|
|
16
16
|
* otp:rate:email:<identifier>
|
|
17
17
|
*/
|
|
18
18
|
assertSendRateLimit(identifier: string, channel: 'sms' | 'email'): Promise<void>;
|
|
19
|
+
/** Soft global OTP budget (SMS drain / botnet). 0 disables. */
|
|
20
|
+
private assertGlobalDailySendLimit;
|
|
19
21
|
/**
|
|
20
22
|
* Resend attempts share the same per-identifier rate-limit key so that
|
|
21
23
|
* an attacker cannot bypass the send-otp quota by pivoting to resend-otp.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.rate-limiter.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.rate-limiter.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,qBACa,cAAc;IAGzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,uBAAuB;IAGjD;;;;;;;;OAQG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"otp.rate-limiter.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.rate-limiter.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,qBACa,cAAc;IAGzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,uBAAuB;IAGjD;;;;;;;;OAQG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtF,+DAA+D;YACjD,0BAA0B;IAqBxC;;;OAGG;IACG,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YAI1E,eAAe;IA4B7B,wEAAwE;YAC1D,aAAa;IAW3B,OAAO,CAAC,OAAO;CAGf"}
|
|
@@ -41,8 +41,27 @@ let OtpRateLimiter = class OtpRateLimiter {
|
|
|
41
41
|
* otp:rate:email:<identifier>
|
|
42
42
|
*/
|
|
43
43
|
async assertSendRateLimit(identifier, channel) {
|
|
44
|
+
await this.assertGlobalDailySendLimit();
|
|
44
45
|
await this.assertRateLimit(identifier, channel, 'otp.rate_limit.exceeded');
|
|
45
46
|
}
|
|
47
|
+
/** Soft global OTP budget (SMS drain / botnet). 0 disables. */
|
|
48
|
+
async assertGlobalDailySendLimit() {
|
|
49
|
+
const max = this.settingsService.get(settings_keys_1.SETTING_KEYS.OTP_GLOBAL_DAILY_SEND_LIMIT);
|
|
50
|
+
if (!max || max <= 0)
|
|
51
|
+
return;
|
|
52
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
53
|
+
const key = `otp:global-daily:${day}`;
|
|
54
|
+
const count = await this.evalRateLimit(key, 86_400);
|
|
55
|
+
if (count > max) {
|
|
56
|
+
this.logger.warn('OTP global daily send limit exceeded', {
|
|
57
|
+
event: 'otp.global_daily_limit.exceeded',
|
|
58
|
+
metadata: { max, day },
|
|
59
|
+
});
|
|
60
|
+
throw new common_1.HttpException({
|
|
61
|
+
message: 'OTP service is temporarily unavailable. Please try again later.',
|
|
62
|
+
}, common_1.HttpStatus.TOO_MANY_REQUESTS);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
46
65
|
/**
|
|
47
66
|
* Resend attempts share the same per-identifier rate-limit key so that
|
|
48
67
|
* an attacker cannot bypass the send-otp quota by pivoting to resend-otp.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.rate-limiter.js","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.rate-limiter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA+E;AAC/E,sDAA8B;AAE9B,+DAA4D;AAC5D,qGAAgG;AAChG,0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tC,CAAC,CAAC;YACH,MAAM,IAAI,sBAAa,CACtB;gBACC,OAAO,EAAE,8CAA8C,GAAG,IAAI;gBAC9D,UAAU,EAAE,GAAG;aACf,EACD,mBAAU,CAAC,iBAAiB,EAC5B,EAAE,WAAW,EAAE,gBAAgB,GAAG,EAAE,EAAE,CACtC,CAAC;QACH,CAAC;IACF,CAAC;IAED,wEAAwE;IAChE,KAAK,CAAC,aAAa,CAAC,GAAW,EAAE,aAAqB;QAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAC5B;;aAEU,EACV,CAAC,EACD,GAAG,EACH,MAAM,CAAC,aAAa,CAAC,CACrB,CAAW,CAAC;IACd,CAAC;IAEO,OAAO,CAAC,UAAkB,EAAE,OAAwB;QAC3D,OAAO,YAAY,OAAO,IAAI,UAAU,EAAE,CAAC;IAC5C,CAAC;CACD,CAAA;
|
|
1
|
+
{"version":3,"file":"otp.rate-limiter.js","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.rate-limiter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA+E;AAC/E,sDAA8B;AAE9B,+DAA4D;AAC5D,qGAAgG;AAChG,0EAAsE;AACtE,+EAA2E;AAGpE,IAAM,cAAc,GAApB,MAAM,cAAc;IAGR;IACA;IACA;IAJlB,YAEkB,KAAc,EACd,eAAgC,EAChC,MAA+B;QAF/B,UAAK,GAAL,KAAK,CAAS;QACd,oBAAe,GAAf,eAAe,CAAiB;QAChC,WAAM,GAAN,MAAM,CAAyB;IAC9C,CAAC;IAEJ;;;;;;;;OAQG;IACH,KAAK,CAAC,mBAAmB,CAAC,UAAkB,EAAE,OAAwB;QACrE,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACxC,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,OAAO,EAAE,yBAAyB,CAAC,CAAC;IAC5E,CAAC;IAED,+DAA+D;IACvD,KAAK,CAAC,0BAA0B;QACvC,MAAM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I,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEpD,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;YACjB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;gBAC3C,KAAK;gBACL,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE;aACtC,CAAC,CAAC;YACH,MAAM,IAAI,sBAAa,CACtB;gBACC,OAAO,EAAE,8CAA8C,GAAG,IAAI;gBAC9D,UAAU,EAAE,GAAG;aACf,EACD,mBAAU,CAAC,iBAAiB,EAC5B,EAAE,WAAW,EAAE,gBAAgB,GAAG,EAAE,EAAE,CACtC,CAAC;QACH,CAAC;IACF,CAAC;IAED,wEAAwE;IAChE,KAAK,CAAC,aAAa,CAAC,GAAW,EAAE,aAAqB;QAC7D,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAC5B;;aAEU,EACV,CAAC,EACD,GAAG,EACH,MAAM,CAAC,aAAa,CAAC,CACrB,CAAW,CAAC;IACd,CAAC;IAEO,OAAO,CAAC,UAAkB,EAAE,OAAwB;QAC3D,OAAO,YAAY,OAAO,IAAI,UAAU,EAAE,CAAC;IAC5C,CAAC;CACD,CAAA;AA/FY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;qCACG,iBAAO;QACG,kCAAe;QACxB,mDAAuB;GALrC,cAAc,CA+F1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConfigService } from '@nestjs/config';
|
|
1
2
|
import { ModuleRef } from '@nestjs/core';
|
|
2
3
|
import IORedis from 'ioredis';
|
|
3
4
|
import { StructuredLoggerService } from '../../observability/logging/structured-logger.service';
|
|
@@ -10,17 +11,20 @@ export interface VerifyCodeResult {
|
|
|
10
11
|
lockedOut: boolean;
|
|
11
12
|
identifier: string;
|
|
12
13
|
channel: 'sms' | 'email';
|
|
14
|
+
/** True when the code was correct but another concurrent verify already claimed the session. */
|
|
15
|
+
alreadyConsumed?: boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare class OtpSessionStore {
|
|
15
18
|
private readonly redis;
|
|
16
19
|
private readonly moduleRef;
|
|
17
20
|
private readonly settingsService;
|
|
21
|
+
private readonly configService;
|
|
18
22
|
private readonly logger;
|
|
19
|
-
constructor(redis: IORedis, moduleRef: ModuleRef, settingsService: SettingsService, logger: StructuredLoggerService);
|
|
23
|
+
constructor(redis: IORedis, moduleRef: ModuleRef, settingsService: SettingsService, configService: ConfigService, logger: StructuredLoggerService);
|
|
20
24
|
isEnabled(): boolean;
|
|
21
25
|
private delivery;
|
|
22
26
|
/**
|
|
23
|
-
* Creates a Redis session, hashes the code
|
|
27
|
+
* Creates a Redis session, hashes the code (HMAC), and enqueues the delivery job.
|
|
24
28
|
*
|
|
25
29
|
* The plaintext OTP code is NEVER stored in the BullMQ job payload.
|
|
26
30
|
* Instead, a short-lived correlation key is written to Redis with a TTL.
|
|
@@ -40,7 +44,7 @@ export declare class OtpSessionStore {
|
|
|
40
44
|
* Two-step flow — hash verification must happen in Node (no Lua crypto),
|
|
41
45
|
* but the attempt counter is managed atomically to prevent race conditions:
|
|
42
46
|
*
|
|
43
|
-
* Step A (Node):
|
|
47
|
+
* Step A (Node): verify HMAC (or legacy Argon2) against the submitted code.
|
|
44
48
|
* Step B (Lua): INCR attempts; if ≥ MAX → DEL session (lockout).
|
|
45
49
|
*
|
|
46
50
|
* The MAX check lives inside the Lua script so two concurrent wrong-code
|
|
@@ -49,6 +53,8 @@ export declare class OtpSessionStore {
|
|
|
49
53
|
verifyCodeAndTrackAttempts(sessionToken: string, code: string, session: OtpSessionData): Promise<VerifyCodeResult>;
|
|
50
54
|
private sessionKey;
|
|
51
55
|
private correlationKey;
|
|
56
|
+
/** Prefer ENCRYPTION_KEY; fall back to a stable non-empty string for local/dev. */
|
|
57
|
+
private otpHashSecret;
|
|
52
58
|
private get client();
|
|
53
59
|
}
|
|
54
60
|
//# sourceMappingURL=otp.session.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.session.store.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.session.store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"otp.session.store.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.session.store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,OAAO,MAAM,SAAS,CAAC;AAK9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAM3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAGN,cAAc,EAEd,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC;IACzB,gGAAgG;IAChG,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,qBACa,eAAe;IAG1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJN,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,uBAAuB;IAGjD,SAAS,IAAI,OAAO;IAIpB,OAAO,CAAC,QAAQ;IAIhB;;;;;;;;;;;OAWG;IACG,aAAa,CAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,KAAK,GAAG,OAAO,EACxB,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,CAAC;IA4GvB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6B1D,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD;;;;;;;;;;;OAWG;IACG,0BAA0B,CAC/B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,gBAAgB,CAAC;IAyE5B,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAItB,mFAAmF;IACnF,OAAO,CAAC,aAAa;IAMrB,OAAO,KAAK,MAAM,GAEjB;CACD"}
|
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
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;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
10
|
};
|
|
@@ -50,10 +17,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
18
|
exports.OtpSessionStore = void 0;
|
|
52
19
|
const common_1 = require("@nestjs/common");
|
|
20
|
+
const config_1 = require("@nestjs/config");
|
|
53
21
|
const core_1 = require("@nestjs/core");
|
|
54
|
-
const argon2 = __importStar(require("argon2"));
|
|
55
22
|
const crypto_1 = require("crypto");
|
|
56
23
|
const ioredis_1 = __importDefault(require("ioredis"));
|
|
24
|
+
const node_env_util_1 = require("../../../config/node-env.util");
|
|
57
25
|
const redis_module_1 = require("../../../config/redis.module");
|
|
58
26
|
const delivery_1 = require("../../delivery");
|
|
59
27
|
const structured_logger_service_1 = require("../../observability/logging/structured-logger.service");
|
|
@@ -61,15 +29,18 @@ const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
|
61
29
|
const settings_service_1 = require("../../settings/services/settings.service");
|
|
62
30
|
const otp_constants_1 = require("../constants/otp.constants");
|
|
63
31
|
const otp_utils_1 = require("../utils/otp.utils");
|
|
32
|
+
const otp_code_hash_util_1 = require("../utils/otp-code-hash.util");
|
|
64
33
|
let OtpSessionStore = class OtpSessionStore {
|
|
65
34
|
redis;
|
|
66
35
|
moduleRef;
|
|
67
36
|
settingsService;
|
|
37
|
+
configService;
|
|
68
38
|
logger;
|
|
69
|
-
constructor(redis, moduleRef, settingsService, logger) {
|
|
39
|
+
constructor(redis, moduleRef, settingsService, configService, logger) {
|
|
70
40
|
this.redis = redis;
|
|
71
41
|
this.moduleRef = moduleRef;
|
|
72
42
|
this.settingsService = settingsService;
|
|
43
|
+
this.configService = configService;
|
|
73
44
|
this.logger = logger;
|
|
74
45
|
}
|
|
75
46
|
isEnabled() {
|
|
@@ -79,7 +50,7 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
79
50
|
return this.moduleRef.get(delivery_1.NotificationDeliveryService, { strict: false });
|
|
80
51
|
}
|
|
81
52
|
/**
|
|
82
|
-
* Creates a Redis session, hashes the code
|
|
53
|
+
* Creates a Redis session, hashes the code (HMAC), and enqueues the delivery job.
|
|
83
54
|
*
|
|
84
55
|
* The plaintext OTP code is NEVER stored in the BullMQ job payload.
|
|
85
56
|
* Instead, a short-lived correlation key is written to Redis with a TTL.
|
|
@@ -93,11 +64,14 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
93
64
|
async createSession(identifier, channel, fixedCode) {
|
|
94
65
|
const ttl = this.settingsService.get(settings_keys_1.SETTING_KEYS.OTP_TTL_SECONDS);
|
|
95
66
|
const resendIn = this.settingsService.get(settings_keys_1.SETTING_KEYS.OTP_RESEND_COOLDOWN_SECONDS);
|
|
96
|
-
const
|
|
67
|
+
const minLength = (0, node_env_util_1.isProductionNodeEnv)(this.configService.get('app.nodeEnv'))
|
|
68
|
+
? otp_constants_1.OTP_PROD_MIN_LENGTH
|
|
69
|
+
: undefined;
|
|
70
|
+
const codeLength = (0, otp_constants_1.clampOtpCodeLength)(this.settingsService.get(settings_keys_1.SETTING_KEYS.OTP_CODE_LENGTH), minLength);
|
|
97
71
|
const code = (0, otp_utils_1.resolveSessionOtpCode)(codeLength, fixedCode);
|
|
98
72
|
(0, otp_utils_1.assertValidOtpCodeOrThrow)(code, !!fixedCode);
|
|
99
73
|
const sessionToken = (0, crypto_1.randomUUID)();
|
|
100
|
-
const otpCodeHash =
|
|
74
|
+
const otpCodeHash = (0, otp_code_hash_util_1.hashOtpCode)(code, this.otpHashSecret());
|
|
101
75
|
const now = Date.now();
|
|
102
76
|
const sessionData = {
|
|
103
77
|
identifier,
|
|
@@ -212,7 +186,7 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
212
186
|
* Two-step flow — hash verification must happen in Node (no Lua crypto),
|
|
213
187
|
* but the attempt counter is managed atomically to prevent race conditions:
|
|
214
188
|
*
|
|
215
|
-
* Step A (Node):
|
|
189
|
+
* Step A (Node): verify HMAC (or legacy Argon2) against the submitted code.
|
|
216
190
|
* Step B (Lua): INCR attempts; if ≥ MAX → DEL session (lockout).
|
|
217
191
|
*
|
|
218
192
|
* The MAX check lives inside the Lua script so two concurrent wrong-code
|
|
@@ -232,7 +206,7 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
232
206
|
channel: session.channel,
|
|
233
207
|
};
|
|
234
208
|
}
|
|
235
|
-
const isValid = await
|
|
209
|
+
const isValid = await (0, otp_code_hash_util_1.verifyOtpCode)(session.otpCodeHash, code, this.otpHashSecret());
|
|
236
210
|
if (!isValid) {
|
|
237
211
|
const [newAttempts, lockedOut] = (await this.client.eval(`local raw = redis.call('GET', KEYS[1])
|
|
238
212
|
if not raw then return {0, 0} end
|
|
@@ -259,8 +233,18 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
259
233
|
channel: session.channel,
|
|
260
234
|
};
|
|
261
235
|
}
|
|
262
|
-
//
|
|
263
|
-
await this.client.
|
|
236
|
+
// Atomic single-use claim: only one concurrent correct verify wins.
|
|
237
|
+
const claimed = await this.client.getdel(key);
|
|
238
|
+
if (!claimed) {
|
|
239
|
+
return {
|
|
240
|
+
isValid: false,
|
|
241
|
+
alreadyConsumed: true,
|
|
242
|
+
newAttempts: session.attempts,
|
|
243
|
+
lockedOut: false,
|
|
244
|
+
identifier: session.identifier,
|
|
245
|
+
channel: session.channel,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
264
248
|
return {
|
|
265
249
|
isValid: true,
|
|
266
250
|
newAttempts: session.attempts,
|
|
@@ -275,6 +259,13 @@ let OtpSessionStore = class OtpSessionStore {
|
|
|
275
259
|
correlationKey(correlationId) {
|
|
276
260
|
return `otp:code:${correlationId}`;
|
|
277
261
|
}
|
|
262
|
+
/** Prefer ENCRYPTION_KEY; fall back to a stable non-empty string for local/dev. */
|
|
263
|
+
otpHashSecret() {
|
|
264
|
+
const key = this.configService.get('app.encryptionKey')?.trim();
|
|
265
|
+
if (key)
|
|
266
|
+
return key;
|
|
267
|
+
return 'colveor-otp-dev-secret';
|
|
268
|
+
}
|
|
278
269
|
get client() {
|
|
279
270
|
return this.redis;
|
|
280
271
|
}
|
|
@@ -286,6 +277,7 @@ exports.OtpSessionStore = OtpSessionStore = __decorate([
|
|
|
286
277
|
__metadata("design:paramtypes", [ioredis_1.default,
|
|
287
278
|
core_1.ModuleRef,
|
|
288
279
|
settings_service_1.SettingsService,
|
|
280
|
+
config_1.ConfigService,
|
|
289
281
|
structured_logger_service_1.StructuredLoggerService])
|
|
290
282
|
], OtpSessionStore);
|
|
291
283
|
//# sourceMappingURL=otp.session.store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.session.store.js","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.session.store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"otp.session.store.js","sourceRoot":"","sources":["../../../../src/modules/otp/services/otp.session.store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,2CAA+C;AAC/C,uCAAyC;AACzC,mCAAoC;AACpC,sDAA8B;AAE9B,iEAAoE;AACpE,+DAA4D;AAC5D,6CAA6D;AAC7D,qGAAgG;AAChG,0EAAsE;AACtE,+EAA2E;AAC3E,8DAIoC;AAEpC,kDAK4B;AAC5B,oEAAyE;AAalE,IAAM,eAAe,GAArB,MAAM,eAAe;IAGT;IACA;IACA;IACA;IACA;IANlB,YAEkB,KAAc,EACd,SAAoB,EACpB,eAAgC,EAChC,aAA4B,EAC5B,MAA+B;QAJ/B,UAAK,GAAL,KAAK,CAAS;QACd,cAAS,GAAT,SAAS,CAAW;QACpB,oBAAe,GAAf,eAAe,CAAiB;QAChC,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAyB;IAC9C,CAAC;IAEJ,SAAS;QACR,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,KAAK,CAAC;IAC9C,CAAC;IAEO,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,sCAA2B,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,aAAa,CAClB,U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A0R3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast keyed hash for short-lived OTP codes (not password hashing).
|
|
3
|
+
* Prefer HMAC over Argon2 so generate/verify stay off the request-path CPU budget.
|
|
4
|
+
*/
|
|
5
|
+
export declare function hashOtpCode(code: string, secret: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Verifies an OTP against a stored hash.
|
|
8
|
+
* Supports legacy Argon2 hashes (pre-HMAC) for in-flight Redis sessions.
|
|
9
|
+
*/
|
|
10
|
+
export declare function verifyOtpCode(storedHash: string, code: string, secret: string): Promise<boolean>;
|
|
11
|
+
//# sourceMappingURL=otp-code-hash.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-code-hash.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/otp/utils/otp-code-hash.util.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC,CAalB"}
|