@colveor/core 1.0.1 → 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 +23 -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 +5 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
- package/dist/modules/users/dto/user.dto.js +46 -5
- 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
|
@@ -2,17 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseSupportedAuthMethods = parseSupportedAuthMethods;
|
|
4
4
|
exports.assertSupportedAuthMethod = assertSupportedAuthMethod;
|
|
5
|
+
exports.parseOAuthProviders = parseOAuthProviders;
|
|
6
|
+
exports.parseMfaRequiredMethods = parseMfaRequiredMethods;
|
|
7
|
+
exports.isKnownOAuthProvider = isKnownOAuthProvider;
|
|
8
|
+
exports.allSupportedAuthMethods = allSupportedAuthMethods;
|
|
5
9
|
const common_1 = require("@nestjs/common");
|
|
6
|
-
const
|
|
10
|
+
const user_oauth_identity_entity_1 = require("../entities/user-oauth-identity.entity");
|
|
11
|
+
const ALL_METHODS = ['phone', 'email', 'oauth'];
|
|
12
|
+
const ALL_OAUTH_PROVIDERS = [
|
|
13
|
+
user_oauth_identity_entity_1.OAuthProvider.GOOGLE,
|
|
14
|
+
user_oauth_identity_entity_1.OAuthProvider.APPLE,
|
|
15
|
+
user_oauth_identity_entity_1.OAuthProvider.MICROSOFT,
|
|
16
|
+
];
|
|
7
17
|
function parseSupportedAuthMethods(raw) {
|
|
8
18
|
if (!Array.isArray(raw))
|
|
9
|
-
return
|
|
10
|
-
const parsed = raw.filter((entry) => entry === 'phone' || entry === 'email');
|
|
11
|
-
return parsed.length > 0 ? parsed :
|
|
19
|
+
return ['phone', 'email'];
|
|
20
|
+
const parsed = raw.filter((entry) => entry === 'phone' || entry === 'email' || entry === 'oauth');
|
|
21
|
+
return parsed.length > 0 ? parsed : ['phone', 'email'];
|
|
12
22
|
}
|
|
13
23
|
function assertSupportedAuthMethod(method, supported, action) {
|
|
14
24
|
if (supported.includes(method))
|
|
15
25
|
return;
|
|
16
26
|
throw new common_1.ForbiddenException(`${method} ${action} is not enabled on this server. Supported: ${supported.join(', ')}.`);
|
|
17
27
|
}
|
|
28
|
+
/** Parse OAuth provider allow-list from settings (known providers only). */
|
|
29
|
+
function parseOAuthProviders(raw) {
|
|
30
|
+
if (!Array.isArray(raw))
|
|
31
|
+
return [];
|
|
32
|
+
return raw.filter((entry) => ALL_OAUTH_PROVIDERS.includes(entry));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parse MFA required-for methods. Unlike {@link parseSupportedAuthMethods}, an empty
|
|
36
|
+
* array means "never require MFA" and is preserved.
|
|
37
|
+
*/
|
|
38
|
+
function parseMfaRequiredMethods(raw) {
|
|
39
|
+
if (!Array.isArray(raw))
|
|
40
|
+
return ['phone', 'email', 'oauth'];
|
|
41
|
+
return raw.filter((entry) => entry === 'phone' || entry === 'email' || entry === 'oauth');
|
|
42
|
+
}
|
|
43
|
+
function isKnownOAuthProvider(value) {
|
|
44
|
+
return ALL_OAUTH_PROVIDERS.includes(value);
|
|
45
|
+
}
|
|
46
|
+
/** @internal — for tests / docs */
|
|
47
|
+
function allSupportedAuthMethods() {
|
|
48
|
+
return [...ALL_METHODS];
|
|
49
|
+
}
|
|
18
50
|
//# sourceMappingURL=auth-supported.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-supported.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/auth-supported.util.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"auth-supported.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/auth-supported.util.ts"],"names":[],"mappings":";;AAcA,8DAOC;AAED,8DAUC;AAGD,kDAKC;AAMD,0DAMC;AAED,oDAEC;AAGD,0DAEC;AA9DD,2CAAoD;AAEpD,uFAAuE;AAIvE,MAAM,WAAW,GAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEvE,MAAM,mBAAmB,GAAoB;IAC5C,0CAAa,CAAC,MAAM;IACpB,0CAAa,CAAC,KAAK;IACnB,0CAAa,CAAC,SAAS;CACvB,CAAC;AAEF,SAAgB,yBAAyB,CAAC,GAAY;IACrD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CACxB,CAAC,KAAK,EAAgC,EAAE,CACvC,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,CAC5D,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,yBAAyB,CACxC,MAA2B,EAC3B,SAAgC,EAChC,MAA4B;IAE5B,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO;IAEvC,MAAM,IAAI,2BAAkB,CAC3B,GAAG,MAAM,IAAI,MAAM,8CAA8C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACxF,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,SAAgB,mBAAmB,CAAC,GAAY;IAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,EAA0B,EAAE,CACnD,mBAAmB,CAAC,QAAQ,CAAC,KAAsB,CAAC,CACpD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,GAAY;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,GAAG,CAAC,MAAM,CAChB,CAAC,KAAK,EAAgC,EAAE,CACvC,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,CAC5D,CAAC;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IACjD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAsB,CAAC,CAAC;AAC7D,CAAC;AAED,mCAAmC;AACnC,SAAgB,uBAAuB;IACtC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Stored format for HMAC-hashed MFA backup codes. */
|
|
2
|
+
export declare const BACKUP_CODE_HASH_PREFIX = "hmac-sha256:";
|
|
3
|
+
export declare function hashBackupCode(normalizedCode: string, pepper: string): string;
|
|
4
|
+
export declare function verifyHmacBackupCode(stored: string, normalizedCode: string, pepper: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Verify a stored backup-code hash (HMAC-SHA256 only).
|
|
7
|
+
* Legacy Argon2 hashes are stripped at boot by {@link LegacyHashCleanupService}.
|
|
8
|
+
*/
|
|
9
|
+
export declare function verifyBackupCodeHash(stored: string, normalizedCode: string, pepper: string): boolean;
|
|
10
|
+
//# sourceMappingURL=backup-code-hash.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-code-hash.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/backup-code-hash.util.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAG7E;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACZ,OAAO,CAOT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACZ,OAAO,CAET"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BACKUP_CODE_HASH_PREFIX = void 0;
|
|
4
|
+
exports.hashBackupCode = hashBackupCode;
|
|
5
|
+
exports.verifyHmacBackupCode = verifyHmacBackupCode;
|
|
6
|
+
exports.verifyBackupCodeHash = verifyBackupCodeHash;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
/** Stored format for HMAC-hashed MFA backup codes. */
|
|
9
|
+
exports.BACKUP_CODE_HASH_PREFIX = 'hmac-sha256:';
|
|
10
|
+
function hashBackupCode(normalizedCode, pepper) {
|
|
11
|
+
const digest = (0, crypto_1.createHmac)('sha256', pepper).update(normalizedCode, 'utf8').digest('hex');
|
|
12
|
+
return `${exports.BACKUP_CODE_HASH_PREFIX}${digest}`;
|
|
13
|
+
}
|
|
14
|
+
function verifyHmacBackupCode(stored, normalizedCode, pepper) {
|
|
15
|
+
if (!stored.startsWith(exports.BACKUP_CODE_HASH_PREFIX))
|
|
16
|
+
return false;
|
|
17
|
+
const expected = hashBackupCode(normalizedCode, pepper);
|
|
18
|
+
const a = Buffer.from(stored);
|
|
19
|
+
const b = Buffer.from(expected);
|
|
20
|
+
if (a.length !== b.length)
|
|
21
|
+
return false;
|
|
22
|
+
return (0, crypto_1.timingSafeEqual)(a, b);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Verify a stored backup-code hash (HMAC-SHA256 only).
|
|
26
|
+
* Legacy Argon2 hashes are stripped at boot by {@link LegacyHashCleanupService}.
|
|
27
|
+
*/
|
|
28
|
+
function verifyBackupCodeHash(stored, normalizedCode, pepper) {
|
|
29
|
+
return verifyHmacBackupCode(stored, normalizedCode, pepper);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=backup-code-hash.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-code-hash.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/backup-code-hash.util.ts"],"names":[],"mappings":";;;AAKA,wCAGC;AAED,oDAWC;AAMD,oDAMC;AAjCD,mCAAqD;AAErD,sDAAsD;AACzC,QAAA,uBAAuB,GAAG,cAAc,CAAC;AAEtD,SAAgB,cAAc,CAAC,cAAsB,EAAE,MAAc;IACpE,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzF,OAAO,GAAG,+BAAuB,GAAG,MAAM,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,oBAAoB,CACnC,MAAc,EACd,cAAsB,EACtB,MAAc;IAEd,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,+BAAuB,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,QAAQ,GAAG,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,IAAA,wBAAe,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,MAAc,EACd,cAAsB,EACtB,MAAc;IAEd,OAAO,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Generate human-readable backup codes: `xxxx-xxxx-xxxx` (hex groups). */
|
|
2
|
+
export declare function generateBackupCodes(count: number): string[];
|
|
3
|
+
/** Normalize user-entered backup code for comparison (strips separators). */
|
|
4
|
+
export declare function normalizeBackupCode(code: string): string;
|
|
5
|
+
//# sourceMappingURL=backup-codes.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-codes.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/backup-codes.util.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAO3D;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateBackupCodes = generateBackupCodes;
|
|
4
|
+
exports.normalizeBackupCode = normalizeBackupCode;
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
/** Generate human-readable backup codes: `xxxx-xxxx-xxxx` (hex groups). */
|
|
7
|
+
function generateBackupCodes(count) {
|
|
8
|
+
const codes = [];
|
|
9
|
+
for (let i = 0; i < count; i++) {
|
|
10
|
+
const raw = (0, crypto_1.randomBytes)(6).toString('hex'); // 12 hex chars
|
|
11
|
+
codes.push(`${raw.slice(0, 4)}-${raw.slice(4, 8)}-${raw.slice(8, 12)}`);
|
|
12
|
+
}
|
|
13
|
+
return codes;
|
|
14
|
+
}
|
|
15
|
+
/** Normalize user-entered backup code for comparison (strips separators). */
|
|
16
|
+
function normalizeBackupCode(code) {
|
|
17
|
+
return code
|
|
18
|
+
.trim()
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.replace(/[\s_-]/g, '');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=backup-codes.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-codes.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/backup-codes.util.ts"],"names":[],"mappings":";;AAGA,kDAOC;AAGD,kDAKC;AAlBD,mCAAqC;AAErC,2EAA2E;AAC3E,SAAgB,mBAAmB,CAAC,KAAa;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe;QAC3D,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,6EAA6E;AAC7E,SAAgB,mBAAmB,CAAC,IAAY;IAC/C,OAAO,IAAI;SACT,IAAI,EAAE;SACN,WAAW,EAAE;SACb,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type JWK, type JWTPayload } from 'jose';
|
|
2
|
+
export type DpopMode = 'off' | 'optional' | 'required';
|
|
3
|
+
export declare function parseDpopMode(raw: unknown): DpopMode;
|
|
4
|
+
/** RFC 7638 JWK thumbprint (SHA-256) → base64url. */
|
|
5
|
+
export declare function computeJwkThumbprint(jwk: JWK): Promise<string>;
|
|
6
|
+
export declare function accessTokenHash(accessToken: string): string;
|
|
7
|
+
export interface VerifiedDpopProof {
|
|
8
|
+
jkt: string;
|
|
9
|
+
jti: string;
|
|
10
|
+
payload: JWTPayload;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Verify a DPoP proof JWT (RFC 9449 subset: ES256/RS256, htm/htu/iat/jti, optional ath).
|
|
14
|
+
*/
|
|
15
|
+
export declare function verifyDpopProof(args: {
|
|
16
|
+
proof: string;
|
|
17
|
+
method: string;
|
|
18
|
+
uri: string;
|
|
19
|
+
accessToken?: string;
|
|
20
|
+
maxAgeSeconds?: number;
|
|
21
|
+
}): Promise<VerifiedDpopProof>;
|
|
22
|
+
//# sourceMappingURL=dpop.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dpop.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/dpop.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,KAAK,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEnG,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAGpD;AAED,qDAAqD;AACrD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,UAAU,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoC7B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDpopMode = parseDpopMode;
|
|
4
|
+
exports.computeJwkThumbprint = computeJwkThumbprint;
|
|
5
|
+
exports.accessTokenHash = accessTokenHash;
|
|
6
|
+
exports.verifyDpopProof = verifyDpopProof;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const jose_1 = require("jose");
|
|
9
|
+
function parseDpopMode(raw) {
|
|
10
|
+
if (raw === 'required' || raw === 'optional' || raw === 'off')
|
|
11
|
+
return raw;
|
|
12
|
+
return 'optional';
|
|
13
|
+
}
|
|
14
|
+
/** RFC 7638 JWK thumbprint (SHA-256) → base64url. */
|
|
15
|
+
async function computeJwkThumbprint(jwk) {
|
|
16
|
+
return (0, jose_1.calculateJwkThumbprint)(jwk, 'sha256');
|
|
17
|
+
}
|
|
18
|
+
function accessTokenHash(accessToken) {
|
|
19
|
+
return (0, crypto_1.createHash)('sha256').update(accessToken, 'utf8').digest('base64url');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Verify a DPoP proof JWT (RFC 9449 subset: ES256/RS256, htm/htu/iat/jti, optional ath).
|
|
23
|
+
*/
|
|
24
|
+
async function verifyDpopProof(args) {
|
|
25
|
+
const { proof, method, uri, accessToken, maxAgeSeconds = 60 } = args;
|
|
26
|
+
const headerB64 = proof.split('.')[0];
|
|
27
|
+
if (!headerB64)
|
|
28
|
+
throw new Error('Invalid DPoP proof');
|
|
29
|
+
const header = JSON.parse(Buffer.from(headerB64, 'base64url').toString('utf8'));
|
|
30
|
+
if (header.typ !== 'dpop+jwt')
|
|
31
|
+
throw new Error('DPoP typ must be dpop+jwt');
|
|
32
|
+
if (!header.jwk || typeof header.jwk !== 'object')
|
|
33
|
+
throw new Error('DPoP header missing jwk');
|
|
34
|
+
if (header.jwk.d)
|
|
35
|
+
throw new Error('DPoP jwk must be a public key');
|
|
36
|
+
const key = await (0, jose_1.importJWK)(header.jwk, header.alg);
|
|
37
|
+
const { payload } = await (0, jose_1.compactVerify)(proof, key);
|
|
38
|
+
const claims = JSON.parse(new TextDecoder().decode(payload));
|
|
39
|
+
if (typeof claims.htm !== 'string' || claims.htm.toUpperCase() !== method.toUpperCase()) {
|
|
40
|
+
throw new Error('DPoP htm mismatch');
|
|
41
|
+
}
|
|
42
|
+
if (typeof claims.htu !== 'string' || !htuMatches(claims.htu, uri)) {
|
|
43
|
+
throw new Error('DPoP htu mismatch');
|
|
44
|
+
}
|
|
45
|
+
if (typeof claims.iat !== 'number')
|
|
46
|
+
throw new Error('DPoP iat required');
|
|
47
|
+
const age = Math.abs(Math.floor(Date.now() / 1000) - claims.iat);
|
|
48
|
+
if (age > maxAgeSeconds)
|
|
49
|
+
throw new Error('DPoP proof expired');
|
|
50
|
+
if (typeof claims.jti !== 'string' || !claims.jti)
|
|
51
|
+
throw new Error('DPoP jti required');
|
|
52
|
+
if (accessToken) {
|
|
53
|
+
const expectedAth = accessTokenHash(accessToken);
|
|
54
|
+
if (claims.ath !== expectedAth)
|
|
55
|
+
throw new Error('DPoP ath mismatch');
|
|
56
|
+
}
|
|
57
|
+
const jkt = await computeJwkThumbprint(header.jwk);
|
|
58
|
+
return { jkt, jti: claims.jti, payload: claims };
|
|
59
|
+
}
|
|
60
|
+
/** Compare htu ignoring trailing slash and query/hash differences on the request side. */
|
|
61
|
+
function htuMatches(claimHtu, requestUri) {
|
|
62
|
+
try {
|
|
63
|
+
const a = new URL(claimHtu);
|
|
64
|
+
const b = new URL(requestUri);
|
|
65
|
+
const pathA = a.pathname.replace(/\/$/, '') || '/';
|
|
66
|
+
const pathB = b.pathname.replace(/\/$/, '') || '/';
|
|
67
|
+
return a.origin === b.origin && pathA === pathB;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return claimHtu === requestUri;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=dpop.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dpop.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/dpop.util.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { decrypt, encrypt, tryDecrypt } from '../../../config/encryption.util';
|
|
2
|
+
/** Prefixed ciphertext for versioned MFA TOTP secrets. */
|
|
3
|
+
export declare const MFA_SECRET_PREFIX = "enc:v1:";
|
|
4
|
+
/**
|
|
5
|
+
* Seal a TOTP secret for Redis/DB storage.
|
|
6
|
+
* Format: `enc:v1:<iv>:<tag>:<ciphertext>` (AES-256-GCM via ENCRYPTION_KEY / MFA_ENCRYPTION_KEY).
|
|
7
|
+
*/
|
|
8
|
+
export declare function sealMfaSecret(plaintext: string, encryptionKey: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Open a stored MFA secret. Supports:
|
|
11
|
+
* - `enc:v1:...` (current format)
|
|
12
|
+
* - legacy unprefixed `iv:tag:ct` (pre-versioning)
|
|
13
|
+
*
|
|
14
|
+
* Tries `currentKey`, then optional `previousKey` for zero-downtime rotation.
|
|
15
|
+
*/
|
|
16
|
+
export declare function openMfaSecret(stored: string, currentKey: string, previousKey?: string): string | null;
|
|
17
|
+
/** Strict decrypt (throws) for cases that must fail closed. */
|
|
18
|
+
export declare function decryptMfaSecret(stored: string, currentKey: string, previousKey?: string): string;
|
|
19
|
+
/** Re-encrypt legacy/unprefixed ciphertext to `enc:v1:` under the current key. */
|
|
20
|
+
export declare function resealMfaSecretIfNeeded(stored: string, currentKey: string, previousKey?: string): string | null;
|
|
21
|
+
export { decrypt, encrypt, tryDecrypt };
|
|
22
|
+
//# sourceMappingURL=mfa-secret.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa-secret.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/mfa-secret.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE/E,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAYf;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAMjG;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAUf;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryDecrypt = exports.encrypt = exports.decrypt = exports.MFA_SECRET_PREFIX = void 0;
|
|
4
|
+
exports.sealMfaSecret = sealMfaSecret;
|
|
5
|
+
exports.openMfaSecret = openMfaSecret;
|
|
6
|
+
exports.decryptMfaSecret = decryptMfaSecret;
|
|
7
|
+
exports.resealMfaSecretIfNeeded = resealMfaSecretIfNeeded;
|
|
8
|
+
const encryption_util_1 = require("../../../config/encryption.util");
|
|
9
|
+
Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return encryption_util_1.decrypt; } });
|
|
10
|
+
Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return encryption_util_1.encrypt; } });
|
|
11
|
+
Object.defineProperty(exports, "tryDecrypt", { enumerable: true, get: function () { return encryption_util_1.tryDecrypt; } });
|
|
12
|
+
/** Prefixed ciphertext for versioned MFA TOTP secrets. */
|
|
13
|
+
exports.MFA_SECRET_PREFIX = 'enc:v1:';
|
|
14
|
+
/**
|
|
15
|
+
* Seal a TOTP secret for Redis/DB storage.
|
|
16
|
+
* Format: `enc:v1:<iv>:<tag>:<ciphertext>` (AES-256-GCM via ENCRYPTION_KEY / MFA_ENCRYPTION_KEY).
|
|
17
|
+
*/
|
|
18
|
+
function sealMfaSecret(plaintext, encryptionKey) {
|
|
19
|
+
return `${exports.MFA_SECRET_PREFIX}${(0, encryption_util_1.encrypt)(plaintext, encryptionKey)}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Open a stored MFA secret. Supports:
|
|
23
|
+
* - `enc:v1:...` (current format)
|
|
24
|
+
* - legacy unprefixed `iv:tag:ct` (pre-versioning)
|
|
25
|
+
*
|
|
26
|
+
* Tries `currentKey`, then optional `previousKey` for zero-downtime rotation.
|
|
27
|
+
*/
|
|
28
|
+
function openMfaSecret(stored, currentKey, previousKey) {
|
|
29
|
+
const payload = stored.startsWith(exports.MFA_SECRET_PREFIX)
|
|
30
|
+
? stored.slice(exports.MFA_SECRET_PREFIX.length)
|
|
31
|
+
: stored;
|
|
32
|
+
const fromCurrent = (0, encryption_util_1.tryDecrypt)(payload, currentKey);
|
|
33
|
+
if (fromCurrent != null)
|
|
34
|
+
return fromCurrent;
|
|
35
|
+
if (previousKey) {
|
|
36
|
+
return (0, encryption_util_1.tryDecrypt)(payload, previousKey);
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
/** Strict decrypt (throws) for cases that must fail closed. */
|
|
41
|
+
function decryptMfaSecret(stored, currentKey, previousKey) {
|
|
42
|
+
const opened = openMfaSecret(stored, currentKey, previousKey);
|
|
43
|
+
if (opened == null) {
|
|
44
|
+
throw new Error('Unable to decrypt MFA secret with configured keys');
|
|
45
|
+
}
|
|
46
|
+
return opened;
|
|
47
|
+
}
|
|
48
|
+
/** Re-encrypt legacy/unprefixed ciphertext to `enc:v1:` under the current key. */
|
|
49
|
+
function resealMfaSecretIfNeeded(stored, currentKey, previousKey) {
|
|
50
|
+
const plaintext = openMfaSecret(stored, currentKey, previousKey);
|
|
51
|
+
if (plaintext == null)
|
|
52
|
+
return null;
|
|
53
|
+
if (stored.startsWith(exports.MFA_SECRET_PREFIX) &&
|
|
54
|
+
(0, encryption_util_1.tryDecrypt)(stored.slice(exports.MFA_SECRET_PREFIX.length), currentKey) != null) {
|
|
55
|
+
return stored; // already current version + current key
|
|
56
|
+
}
|
|
57
|
+
return sealMfaSecret(plaintext, currentKey);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=mfa-secret.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa-secret.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/mfa-secret.util.ts"],"names":[],"mappings":";;;AASA,sCAEC;AASD,sCAgBC;AAGD,4CAMC;AAGD,0DAcC;AA9DD,qEAA+E;AAgEtE,wFAhEA,yBAAO,OAgEA;AAAE,wFAhEA,yBAAO,OAgEA;AAAE,2FAhEA,4BAAU,OAgEA;AA9DrC,0DAA0D;AAC7C,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C;;;GAGG;AACH,SAAgB,aAAa,CAAC,SAAiB,EAAE,aAAqB;IACrE,OAAO,GAAG,yBAAiB,GAAG,IAAA,yBAAO,EAAC,SAAS,EAAE,aAAa,CAAC,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAC5B,MAAc,EACd,UAAkB,EAClB,WAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,yBAAiB,CAAC;QACnD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAiB,CAAC,MAAM,CAAC;QACxC,CAAC,CAAC,MAAM,CAAC;IAEV,MAAM,WAAW,GAAG,IAAA,4BAAU,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,WAAW,IAAI,IAAI;QAAE,OAAO,WAAW,CAAC;IAE5C,IAAI,WAAW,EAAE,CAAC;QACjB,OAAO,IAAA,4BAAU,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,+DAA+D;AAC/D,SAAgB,gBAAgB,CAAC,MAAc,EAAE,UAAkB,EAAE,WAAoB;IACxF,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAC9D,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,kFAAkF;AAClF,SAAgB,uBAAuB,CACtC,MAAc,EACd,UAAkB,EAClB,WAAoB;IAEpB,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACjE,IAAI,SAAS,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,IACC,MAAM,CAAC,UAAU,CAAC,yBAAiB,CAAC;QACpC,IAAA,4BAAU,EAAC,MAAM,CAAC,KAAK,CAAC,yBAAiB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,IAAI,IAAI,EACrE,CAAC;QACF,OAAO,MAAM,CAAC,CAAC,wCAAwC;IACxD,CAAC;IACD,OAAO,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** MFA verify body: TOTP vs backup code (exclusive). */
|
|
2
|
+
export interface MfaVerifyParams {
|
|
3
|
+
mfaToken?: string;
|
|
4
|
+
totp?: string;
|
|
5
|
+
backupCode?: string;
|
|
6
|
+
}
|
|
7
|
+
export type MfaVerifyMode = 'totp' | 'backup_code' | 'ambiguous' | 'missing';
|
|
8
|
+
export declare function resolveMfaVerifyMode(dto: MfaVerifyParams): MfaVerifyMode;
|
|
9
|
+
export declare const MFA_VERIFY_PARAMS_ERROR = "Provide { mfaToken, totp } or { mfaToken, backupCode } \u2014 not both and not neither.";
|
|
10
|
+
/** Step-up body: TOTP vs backup code (exclusive). */
|
|
11
|
+
export interface MfaStepUpParams {
|
|
12
|
+
totp?: string;
|
|
13
|
+
backupCode?: string;
|
|
14
|
+
}
|
|
15
|
+
export type MfaStepUpMode = 'totp' | 'backup_code' | 'ambiguous' | 'missing';
|
|
16
|
+
export declare function resolveMfaStepUpMode(dto: MfaStepUpParams): MfaStepUpMode;
|
|
17
|
+
export declare const MFA_STEP_UP_PARAMS_ERROR = "Provide either { totp } or { backupCode } \u2014 not both and not neither.";
|
|
18
|
+
/** Disable / regenerate confirmation: TOTP `code` vs backup code (exclusive). */
|
|
19
|
+
export interface MfaDisableParams {
|
|
20
|
+
code?: string;
|
|
21
|
+
backupCode?: string;
|
|
22
|
+
}
|
|
23
|
+
export type MfaDisableMode = 'totp' | 'backup_code' | 'ambiguous' | 'missing';
|
|
24
|
+
export declare function resolveMfaDisableMode(dto: MfaDisableParams): MfaDisableMode;
|
|
25
|
+
export declare const MFA_DISABLE_PARAMS_ERROR = "Provide either { code } (TOTP) or { backupCode } \u2014 not both and not neither.";
|
|
26
|
+
//# sourceMappingURL=mfa-verify-params.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa-verify-params.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/mfa-verify-params.util.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,CAaxE;AAED,eAAO,MAAM,uBAAuB,4FACiD,CAAC;AAEtF,qDAAqD;AACrD,MAAM,WAAW,eAAe;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,CASxE;AAED,eAAO,MAAM,wBAAwB,+EACmC,CAAC;AAEzE,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;AAE9E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,cAAc,CAS3E;AAED,eAAO,MAAM,wBAAwB,sFAC0C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MFA_DISABLE_PARAMS_ERROR = exports.MFA_STEP_UP_PARAMS_ERROR = exports.MFA_VERIFY_PARAMS_ERROR = void 0;
|
|
4
|
+
exports.resolveMfaVerifyMode = resolveMfaVerifyMode;
|
|
5
|
+
exports.resolveMfaStepUpMode = resolveMfaStepUpMode;
|
|
6
|
+
exports.resolveMfaDisableMode = resolveMfaDisableMode;
|
|
7
|
+
function resolveMfaVerifyMode(dto) {
|
|
8
|
+
const hasToken = typeof dto.mfaToken === 'string' && dto.mfaToken.trim().length > 0;
|
|
9
|
+
if (!hasToken)
|
|
10
|
+
return 'missing';
|
|
11
|
+
const totp = typeof dto.totp === 'string' && /^\d{6}$/.test(dto.totp.trim());
|
|
12
|
+
const backup = typeof dto.backupCode === 'string' &&
|
|
13
|
+
dto.backupCode.trim().replace(/[\s_-]/g, '').length >= 8;
|
|
14
|
+
if (totp && backup)
|
|
15
|
+
return 'ambiguous';
|
|
16
|
+
if (totp)
|
|
17
|
+
return 'totp';
|
|
18
|
+
if (backup)
|
|
19
|
+
return 'backup_code';
|
|
20
|
+
return 'missing';
|
|
21
|
+
}
|
|
22
|
+
exports.MFA_VERIFY_PARAMS_ERROR = 'Provide { mfaToken, totp } or { mfaToken, backupCode } — not both and not neither.';
|
|
23
|
+
function resolveMfaStepUpMode(dto) {
|
|
24
|
+
const totp = typeof dto.totp === 'string' && /^\d{6}$/.test(dto.totp.trim());
|
|
25
|
+
const backup = typeof dto.backupCode === 'string' &&
|
|
26
|
+
dto.backupCode.trim().replace(/[\s_-]/g, '').length >= 8;
|
|
27
|
+
if (totp && backup)
|
|
28
|
+
return 'ambiguous';
|
|
29
|
+
if (totp)
|
|
30
|
+
return 'totp';
|
|
31
|
+
if (backup)
|
|
32
|
+
return 'backup_code';
|
|
33
|
+
return 'missing';
|
|
34
|
+
}
|
|
35
|
+
exports.MFA_STEP_UP_PARAMS_ERROR = 'Provide either { totp } or { backupCode } — not both and not neither.';
|
|
36
|
+
function resolveMfaDisableMode(dto) {
|
|
37
|
+
const totp = typeof dto.code === 'string' && /^\d{6}$/.test(dto.code.trim());
|
|
38
|
+
const backup = typeof dto.backupCode === 'string' &&
|
|
39
|
+
dto.backupCode.trim().replace(/[\s_-]/g, '').length >= 8;
|
|
40
|
+
if (totp && backup)
|
|
41
|
+
return 'ambiguous';
|
|
42
|
+
if (totp)
|
|
43
|
+
return 'totp';
|
|
44
|
+
if (backup)
|
|
45
|
+
return 'backup_code';
|
|
46
|
+
return 'missing';
|
|
47
|
+
}
|
|
48
|
+
exports.MFA_DISABLE_PARAMS_ERROR = 'Provide either { code } (TOTP) or { backupCode } — not both and not neither.';
|
|
49
|
+
//# sourceMappingURL=mfa-verify-params.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfa-verify-params.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/mfa-verify-params.util.ts"],"names":[],"mappings":";;;AASA,oDAaC;AAaD,oDASC;AAaD,sDASC;AAzDD,SAAgB,oBAAoB,CAAC,GAAoB;IACxD,MAAM,QAAQ,GAAG,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IACpF,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,GACX,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;QAClC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IAE1D,IAAI,IAAI,IAAI,MAAM;QAAE,OAAO,WAAW,CAAC;IACvC,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC;IACxB,IAAI,MAAM;QAAE,OAAO,aAAa,CAAC;IACjC,OAAO,SAAS,CAAC;AAClB,CAAC;AAEY,QAAA,uBAAuB,GACnC,oFAAoF,CAAC;AAUtF,SAAgB,oBAAoB,CAAC,GAAoB;IACxD,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,GACX,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;QAClC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1D,IAAI,IAAI,IAAI,MAAM;QAAE,OAAO,WAAW,CAAC;IACvC,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC;IACxB,IAAI,MAAM;QAAE,OAAO,aAAa,CAAC;IACjC,OAAO,SAAS,CAAC;AAClB,CAAC;AAEY,QAAA,wBAAwB,GACpC,uEAAuE,CAAC;AAUzE,SAAgB,qBAAqB,CAAC,GAAqB;IAC1D,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,GACX,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;QAClC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1D,IAAI,IAAI,IAAI,MAAM;QAAE,OAAO,WAAW,CAAC;IACvC,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC;IACxB,IAAI,MAAM;QAAE,OAAO,aAAa,CAAC;IACjC,OAAO,SAAS,CAAC;AAClB,CAAC;AAEY,QAAA,wBAAwB,GACpC,8EAA8E,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Action scope for MFA step-up tokens (mint + consume must match). */
|
|
2
|
+
export declare const STEP_UP_PURPOSES: readonly ["change_email", "change_phone", "change_password", "set_password", "oauth_link", "oauth_unlink", "account_delete"];
|
|
3
|
+
export type StepUpPurpose = (typeof STEP_UP_PURPOSES)[number];
|
|
4
|
+
export declare function isStepUpPurpose(value: unknown): value is StepUpPurpose;
|
|
5
|
+
//# sourceMappingURL=step-up-purpose.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-up-purpose.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/step-up-purpose.util.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,8HAQnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STEP_UP_PURPOSES = void 0;
|
|
4
|
+
exports.isStepUpPurpose = isStepUpPurpose;
|
|
5
|
+
/** Action scope for MFA step-up tokens (mint + consume must match). */
|
|
6
|
+
exports.STEP_UP_PURPOSES = [
|
|
7
|
+
'change_email',
|
|
8
|
+
'change_phone',
|
|
9
|
+
'change_password',
|
|
10
|
+
'set_password',
|
|
11
|
+
'oauth_link',
|
|
12
|
+
'oauth_unlink',
|
|
13
|
+
'account_delete',
|
|
14
|
+
];
|
|
15
|
+
function isStepUpPurpose(value) {
|
|
16
|
+
return typeof value === 'string' && exports.STEP_UP_PURPOSES.includes(value);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=step-up-purpose.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-up-purpose.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/step-up-purpose.util.ts"],"names":[],"mappings":";;;AAaA,0CAEC;AAfD,uEAAuE;AAC1D,QAAA,gBAAgB,GAAG;IAC/B,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,cAAc;IACd,YAAY;IACZ,cAAc;IACd,gBAAgB;CACP,CAAC;AAIX,SAAgB,eAAe,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,wBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Generate a 20-byte random secret encoded as base32 (Authenticator-compatible). */
|
|
2
|
+
export declare function generateTotpSecret(bytes?: number): string;
|
|
3
|
+
/** Build an `otpauth://` URI for QR provisioning. */
|
|
4
|
+
export declare function buildOtpAuthUri(args: {
|
|
5
|
+
secret: string;
|
|
6
|
+
accountName: string;
|
|
7
|
+
issuer: string;
|
|
8
|
+
}): string;
|
|
9
|
+
/**
|
|
10
|
+
* Verify a 6-digit TOTP code against a base32 secret.
|
|
11
|
+
* Allows ±`window` time steps (default 1 → 30s skew tolerance).
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyTotp(secretBase32: string, token: string, window?: number): boolean;
|
|
14
|
+
/** Current time-step index (for replay-protection keys). */
|
|
15
|
+
export declare function currentTotpTimestep(): number;
|
|
16
|
+
//# sourceMappingURL=totp.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/utils/totp.util.ts"],"names":[],"mappings":"AAIA,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,KAAK,SAAK,GAAG,MAAM,CAErD;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,CAIT;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAWnF;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTotpSecret = generateTotpSecret;
|
|
4
|
+
exports.buildOtpAuthUri = buildOtpAuthUri;
|
|
5
|
+
exports.verifyTotp = verifyTotp;
|
|
6
|
+
exports.currentTotpTimestep = currentTotpTimestep;
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
9
|
+
/** Generate a 20-byte random secret encoded as base32 (Authenticator-compatible). */
|
|
10
|
+
function generateTotpSecret(bytes = 20) {
|
|
11
|
+
return base32Encode((0, crypto_1.randomBytes)(bytes));
|
|
12
|
+
}
|
|
13
|
+
/** Build an `otpauth://` URI for QR provisioning. */
|
|
14
|
+
function buildOtpAuthUri(args) {
|
|
15
|
+
const label = encodeURIComponent(`${args.issuer}:${args.accountName}`);
|
|
16
|
+
const issuer = encodeURIComponent(args.issuer);
|
|
17
|
+
return `otpauth://totp/${label}?secret=${args.secret}&issuer=${issuer}&algorithm=SHA1&digits=6&period=30`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Verify a 6-digit TOTP code against a base32 secret.
|
|
21
|
+
* Allows ±`window` time steps (default 1 → 30s skew tolerance).
|
|
22
|
+
*/
|
|
23
|
+
function verifyTotp(secretBase32, token, window = 1) {
|
|
24
|
+
const normalized = token.replace(/\s/g, '');
|
|
25
|
+
if (!/^\d{6}$/.test(normalized))
|
|
26
|
+
return false;
|
|
27
|
+
const secret = base32Decode(secretBase32);
|
|
28
|
+
const timestep = Math.floor(Date.now() / 1000 / 30);
|
|
29
|
+
for (let i = -window; i <= window; i++) {
|
|
30
|
+
if (hotp(secret, timestep + i) === normalized)
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
/** Current time-step index (for replay-protection keys). */
|
|
36
|
+
function currentTotpTimestep() {
|
|
37
|
+
return Math.floor(Date.now() / 1000 / 30);
|
|
38
|
+
}
|
|
39
|
+
function hotp(secret, counter) {
|
|
40
|
+
const buf = Buffer.alloc(8);
|
|
41
|
+
buf.writeBigUInt64BE(BigInt(counter));
|
|
42
|
+
const hmac = (0, crypto_1.createHmac)('sha1', secret).update(buf).digest();
|
|
43
|
+
const offset = hmac[hmac.length - 1] & 0x0f;
|
|
44
|
+
const code = ((hmac[offset] & 0x7f) << 24) |
|
|
45
|
+
((hmac[offset + 1] & 0xff) << 16) |
|
|
46
|
+
((hmac[offset + 2] & 0xff) << 8) |
|
|
47
|
+
(hmac[offset + 3] & 0xff);
|
|
48
|
+
return String(code % 1_000_000).padStart(6, '0');
|
|
49
|
+
}
|
|
50
|
+
function base32Encode(data) {
|
|
51
|
+
let bits = 0;
|
|
52
|
+
let value = 0;
|
|
53
|
+
let output = '';
|
|
54
|
+
for (const byte of data) {
|
|
55
|
+
value = (value << 8) | byte;
|
|
56
|
+
bits += 8;
|
|
57
|
+
while (bits >= 5) {
|
|
58
|
+
output += BASE32_ALPHABET[(value >>> (bits - 5)) & 31];
|
|
59
|
+
bits -= 5;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (bits > 0) {
|
|
63
|
+
output += BASE32_ALPHABET[(value << (5 - bits)) & 31];
|
|
64
|
+
}
|
|
65
|
+
return output;
|
|
66
|
+
}
|
|
67
|
+
function base32Decode(input) {
|
|
68
|
+
const cleaned = input
|
|
69
|
+
.replace(/=+$/, '')
|
|
70
|
+
.toUpperCase()
|
|
71
|
+
.replace(/[^A-Z2-7]/g, '');
|
|
72
|
+
let bits = 0;
|
|
73
|
+
let value = 0;
|
|
74
|
+
const bytes = [];
|
|
75
|
+
for (const char of cleaned) {
|
|
76
|
+
const idx = BASE32_ALPHABET.indexOf(char);
|
|
77
|
+
if (idx === -1)
|
|
78
|
+
throw new Error('Invalid base32 secret');
|
|
79
|
+
value = (value << 5) | idx;
|
|
80
|
+
bits += 5;
|
|
81
|
+
if (bits >= 8) {
|
|
82
|
+
bytes.push((value >>> (bits - 8)) & 0xff);
|
|
83
|
+
bits -= 8;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return Buffer.from(bytes);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=totp.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp.util.js","sourceRoot":"","sources":["../../../../src/modules/auth/utils/totp.util.ts"],"names":[],"mappings":"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"}
|