@nauth-toolkit/core 0.1.14 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/database-columns.d.ts +70 -0
- package/dist/adapters/database-columns.d.ts.map +1 -1
- package/dist/adapters/database-columns.js +76 -2
- package/dist/adapters/database-columns.js.map +1 -1
- package/dist/adapters/express.adapter.d.ts +66 -0
- package/dist/adapters/express.adapter.d.ts.map +1 -1
- package/dist/adapters/express.adapter.js +80 -0
- package/dist/adapters/express.adapter.js.map +1 -1
- package/dist/adapters/fastify.adapter.d.ts +42 -0
- package/dist/adapters/fastify.adapter.d.ts.map +1 -1
- package/dist/adapters/fastify.adapter.js +86 -0
- package/dist/adapters/fastify.adapter.js.map +1 -1
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +9 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/storage.factory.d.ts +107 -0
- package/dist/adapters/storage.factory.d.ts.map +1 -1
- package/dist/adapters/storage.factory.js +114 -0
- package/dist/adapters/storage.factory.js.map +1 -1
- package/dist/adapters.d.ts +8 -0
- package/dist/adapters.d.ts.map +1 -1
- package/dist/adapters.js +8 -0
- package/dist/adapters.js.map +1 -1
- package/dist/bootstrap.d.ts +82 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +106 -0
- package/dist/bootstrap.js.map +1 -1
- package/dist/dto/admin-set-password.dto.d.ts +90 -0
- package/dist/dto/admin-set-password.dto.d.ts.map +1 -1
- package/dist/dto/admin-set-password.dto.js +91 -0
- package/dist/dto/admin-set-password.dto.js.map +1 -1
- package/dist/dto/auth-challenge.dto.d.ts +170 -0
- package/dist/dto/auth-challenge.dto.d.ts.map +1 -1
- package/dist/dto/auth-challenge.dto.js +170 -0
- package/dist/dto/auth-challenge.dto.js.map +1 -1
- package/dist/dto/auth-response.dto.d.ts +196 -0
- package/dist/dto/auth-response.dto.d.ts.map +1 -1
- package/dist/dto/auth-response.dto.js +149 -0
- package/dist/dto/auth-response.dto.js.map +1 -1
- package/dist/dto/challenge-response.dto.d.ts +155 -0
- package/dist/dto/challenge-response.dto.d.ts.map +1 -1
- package/dist/dto/challenge-response.dto.js +8 -0
- package/dist/dto/challenge-response.dto.js.map +1 -1
- package/dist/dto/change-password-request.dto.d.ts +35 -0
- package/dist/dto/change-password-request.dto.d.ts.map +1 -1
- package/dist/dto/change-password-request.dto.js +35 -0
- package/dist/dto/change-password-request.dto.js.map +1 -1
- package/dist/dto/change-password-response.dto.d.ts +25 -0
- package/dist/dto/change-password-response.dto.d.ts.map +1 -1
- package/dist/dto/change-password-response.dto.js +25 -0
- package/dist/dto/change-password-response.dto.js.map +1 -1
- package/dist/dto/change-password.dto.d.ts +45 -0
- package/dist/dto/change-password.dto.d.ts.map +1 -1
- package/dist/dto/change-password.dto.js +45 -0
- package/dist/dto/change-password.dto.js.map +1 -1
- package/dist/dto/confirm-forgot-password.dto.d.ts +59 -0
- package/dist/dto/confirm-forgot-password.dto.d.ts.map +1 -1
- package/dist/dto/confirm-forgot-password.dto.js +59 -0
- package/dist/dto/confirm-forgot-password.dto.js.map +1 -1
- package/dist/dto/error-response.dto.d.ts +103 -0
- package/dist/dto/error-response.dto.d.ts.map +1 -1
- package/dist/dto/error-response.dto.js +103 -0
- package/dist/dto/error-response.dto.js.map +1 -1
- package/dist/dto/forgot-password.dto.d.ts +58 -0
- package/dist/dto/forgot-password.dto.d.ts.map +1 -1
- package/dist/dto/forgot-password.dto.js +58 -0
- package/dist/dto/forgot-password.dto.js.map +1 -1
- package/dist/dto/get-available-methods.dto.d.ts +37 -0
- package/dist/dto/get-available-methods.dto.d.ts.map +1 -1
- package/dist/dto/get-available-methods.dto.js +37 -0
- package/dist/dto/get-available-methods.dto.js.map +1 -1
- package/dist/dto/get-challenge-data-response.dto.d.ts +24 -0
- package/dist/dto/get-challenge-data-response.dto.d.ts.map +1 -1
- package/dist/dto/get-challenge-data-response.dto.js +24 -0
- package/dist/dto/get-challenge-data-response.dto.js.map +1 -1
- package/dist/dto/get-challenge-data.dto.d.ts +46 -0
- package/dist/dto/get-challenge-data.dto.d.ts.map +1 -1
- package/dist/dto/get-challenge-data.dto.js +46 -0
- package/dist/dto/get-challenge-data.dto.js.map +1 -1
- package/dist/dto/get-client-info.dto.d.ts +74 -0
- package/dist/dto/get-client-info.dto.d.ts.map +1 -1
- package/dist/dto/get-client-info.dto.js +74 -0
- package/dist/dto/get-client-info.dto.js.map +1 -1
- package/dist/dto/get-device-token-response.dto.d.ts +21 -0
- package/dist/dto/get-device-token-response.dto.d.ts.map +1 -1
- package/dist/dto/get-device-token-response.dto.js +21 -0
- package/dist/dto/get-device-token-response.dto.js.map +1 -1
- package/dist/dto/get-events-by-type.dto.d.ts +50 -0
- package/dist/dto/get-events-by-type.dto.d.ts.map +1 -1
- package/dist/dto/get-events-by-type.dto.js +50 -0
- package/dist/dto/get-events-by-type.dto.js.map +1 -1
- package/dist/dto/get-ip-address-response.dto.d.ts +20 -0
- package/dist/dto/get-ip-address-response.dto.d.ts.map +1 -1
- package/dist/dto/get-ip-address-response.dto.js +20 -0
- package/dist/dto/get-ip-address-response.dto.js.map +1 -1
- package/dist/dto/get-mfa-status.dto.d.ts +59 -0
- package/dist/dto/get-mfa-status.dto.d.ts.map +1 -1
- package/dist/dto/get-mfa-status.dto.js +59 -0
- package/dist/dto/get-mfa-status.dto.js.map +1 -1
- package/dist/dto/get-risk-assessment-history.dto.d.ts +28 -0
- package/dist/dto/get-risk-assessment-history.dto.d.ts.map +1 -1
- package/dist/dto/get-risk-assessment-history.dto.js +28 -0
- package/dist/dto/get-risk-assessment-history.dto.js.map +1 -1
- package/dist/dto/get-session-id-response.dto.d.ts +21 -0
- package/dist/dto/get-session-id-response.dto.d.ts.map +1 -1
- package/dist/dto/get-session-id-response.dto.js +21 -0
- package/dist/dto/get-session-id-response.dto.js.map +1 -1
- package/dist/dto/get-setup-data-response.dto.d.ts +27 -0
- package/dist/dto/get-setup-data-response.dto.d.ts.map +1 -1
- package/dist/dto/get-setup-data-response.dto.js +27 -0
- package/dist/dto/get-setup-data-response.dto.js.map +1 -1
- package/dist/dto/get-setup-data.dto.d.ts +51 -0
- package/dist/dto/get-setup-data.dto.d.ts.map +1 -1
- package/dist/dto/get-setup-data.dto.js +51 -0
- package/dist/dto/get-setup-data.dto.js.map +1 -1
- package/dist/dto/get-suspicious-activity.dto.d.ts +31 -0
- package/dist/dto/get-suspicious-activity.dto.d.ts.map +1 -1
- package/dist/dto/get-suspicious-activity.dto.js +31 -0
- package/dist/dto/get-suspicious-activity.dto.js.map +1 -1
- package/dist/dto/get-user-agent-response.dto.d.ts +19 -0
- package/dist/dto/get-user-agent-response.dto.d.ts.map +1 -1
- package/dist/dto/get-user-agent-response.dto.js +19 -0
- package/dist/dto/get-user-agent-response.dto.js.map +1 -1
- package/dist/dto/get-user-auth-history.dto.d.ts +64 -0
- package/dist/dto/get-user-auth-history.dto.d.ts.map +1 -1
- package/dist/dto/get-user-auth-history.dto.js +64 -0
- package/dist/dto/get-user-auth-history.dto.js.map +1 -1
- package/dist/dto/get-user-by-email.dto.d.ts +42 -0
- package/dist/dto/get-user-by-email.dto.d.ts.map +1 -1
- package/dist/dto/get-user-by-email.dto.js +42 -0
- package/dist/dto/get-user-by-email.dto.js.map +1 -1
- package/dist/dto/get-user-by-id.dto.d.ts +32 -0
- package/dist/dto/get-user-by-id.dto.d.ts.map +1 -1
- package/dist/dto/get-user-by-id.dto.js +32 -0
- package/dist/dto/get-user-by-id.dto.js.map +1 -1
- package/dist/dto/get-user-devices.dto.d.ts +34 -0
- package/dist/dto/get-user-devices.dto.d.ts.map +1 -1
- package/dist/dto/get-user-devices.dto.js +34 -0
- package/dist/dto/get-user-devices.dto.js.map +1 -1
- package/dist/dto/get-user-response.dto.d.ts +14 -0
- package/dist/dto/get-user-response.dto.d.ts.map +1 -1
- package/dist/dto/get-user-response.dto.js +15 -0
- package/dist/dto/get-user-response.dto.js.map +1 -1
- package/dist/dto/has-provider.dto.d.ts +33 -0
- package/dist/dto/has-provider.dto.d.ts.map +1 -1
- package/dist/dto/has-provider.dto.js +33 -0
- package/dist/dto/has-provider.dto.js.map +1 -1
- package/dist/dto/index.js +5 -0
- package/dist/dto/index.js.map +1 -1
- package/dist/dto/is-trusted-device-response.dto.d.ts +28 -0
- package/dist/dto/is-trusted-device-response.dto.d.ts.map +1 -1
- package/dist/dto/is-trusted-device-response.dto.js +28 -0
- package/dist/dto/is-trusted-device-response.dto.js.map +1 -1
- package/dist/dto/list-providers-response.dto.d.ts +19 -0
- package/dist/dto/list-providers-response.dto.d.ts.map +1 -1
- package/dist/dto/list-providers-response.dto.js +19 -0
- package/dist/dto/list-providers-response.dto.js.map +1 -1
- package/dist/dto/login.dto.d.ts +48 -0
- package/dist/dto/login.dto.d.ts.map +1 -1
- package/dist/dto/login.dto.js +50 -1
- package/dist/dto/login.dto.js.map +1 -1
- package/dist/dto/logout-all-response.dto.d.ts +20 -0
- package/dist/dto/logout-all-response.dto.d.ts.map +1 -1
- package/dist/dto/logout-all-response.dto.js +20 -0
- package/dist/dto/logout-all-response.dto.js.map +1 -1
- package/dist/dto/logout-all.dto.d.ts +42 -0
- package/dist/dto/logout-all.dto.d.ts.map +1 -1
- package/dist/dto/logout-all.dto.js +42 -0
- package/dist/dto/logout-all.dto.js.map +1 -1
- package/dist/dto/logout-response.dto.d.ts +21 -0
- package/dist/dto/logout-response.dto.d.ts.map +1 -1
- package/dist/dto/logout-response.dto.js +21 -0
- package/dist/dto/logout-response.dto.js.map +1 -1
- package/dist/dto/logout.dto.d.ts +45 -0
- package/dist/dto/logout.dto.d.ts.map +1 -1
- package/dist/dto/logout.dto.js +45 -0
- package/dist/dto/logout.dto.js.map +1 -1
- package/dist/dto/refresh-token.dto.d.ts +28 -0
- package/dist/dto/refresh-token.dto.d.ts.map +1 -1
- package/dist/dto/refresh-token.dto.js +28 -0
- package/dist/dto/refresh-token.dto.js.map +1 -1
- package/dist/dto/remove-devices.dto.d.ts +51 -0
- package/dist/dto/remove-devices.dto.d.ts.map +1 -1
- package/dist/dto/remove-devices.dto.js +51 -0
- package/dist/dto/remove-devices.dto.js.map +1 -1
- package/dist/dto/resend-code-response.dto.d.ts +28 -0
- package/dist/dto/resend-code-response.dto.d.ts.map +1 -1
- package/dist/dto/resend-code-response.dto.js +28 -0
- package/dist/dto/resend-code-response.dto.js.map +1 -1
- package/dist/dto/resend-code.dto.d.ts +37 -0
- package/dist/dto/resend-code.dto.d.ts.map +1 -1
- package/dist/dto/resend-code.dto.js +37 -0
- package/dist/dto/resend-code.dto.js.map +1 -1
- package/dist/dto/reset-password.dto.d.ts +74 -0
- package/dist/dto/reset-password.dto.d.ts.map +1 -1
- package/dist/dto/reset-password.dto.js +76 -1
- package/dist/dto/reset-password.dto.js.map +1 -1
- package/dist/dto/respond-challenge.dto.d.ts +147 -0
- package/dist/dto/respond-challenge.dto.d.ts.map +1 -1
- package/dist/dto/respond-challenge.dto.js +162 -0
- package/dist/dto/respond-challenge.dto.js.map +1 -1
- package/dist/dto/set-mfa-exemption.dto.d.ts +65 -0
- package/dist/dto/set-mfa-exemption.dto.d.ts.map +1 -1
- package/dist/dto/set-mfa-exemption.dto.js +65 -0
- package/dist/dto/set-mfa-exemption.dto.js.map +1 -1
- package/dist/dto/set-must-change-password-response.dto.d.ts +23 -0
- package/dist/dto/set-must-change-password-response.dto.d.ts.map +1 -1
- package/dist/dto/set-must-change-password-response.dto.js +23 -0
- package/dist/dto/set-must-change-password-response.dto.js.map +1 -1
- package/dist/dto/set-must-change-password.dto.d.ts +32 -0
- package/dist/dto/set-must-change-password.dto.d.ts.map +1 -1
- package/dist/dto/set-must-change-password.dto.js +32 -0
- package/dist/dto/set-must-change-password.dto.js.map +1 -1
- package/dist/dto/set-preferred-method.dto.d.ts +48 -0
- package/dist/dto/set-preferred-method.dto.d.ts.map +1 -1
- package/dist/dto/set-preferred-method.dto.js +48 -0
- package/dist/dto/set-preferred-method.dto.js.map +1 -1
- package/dist/dto/setup-mfa.dto.d.ts +62 -0
- package/dist/dto/setup-mfa.dto.d.ts.map +1 -1
- package/dist/dto/setup-mfa.dto.js +62 -0
- package/dist/dto/setup-mfa.dto.js.map +1 -1
- package/dist/dto/signup.dto.d.ts +92 -0
- package/dist/dto/signup.dto.d.ts.map +1 -1
- package/dist/dto/signup.dto.js +93 -0
- package/dist/dto/signup.dto.js.map +1 -1
- package/dist/dto/social-auth.dto.d.ts +234 -0
- package/dist/dto/social-auth.dto.d.ts.map +1 -1
- package/dist/dto/social-auth.dto.js +234 -0
- package/dist/dto/social-auth.dto.js.map +1 -1
- package/dist/dto/trust-device-response.dto.d.ts +26 -0
- package/dist/dto/trust-device-response.dto.d.ts.map +1 -1
- package/dist/dto/trust-device-response.dto.js +26 -0
- package/dist/dto/trust-device-response.dto.js.map +1 -1
- package/dist/dto/trust-device.dto.d.ts +9 -0
- package/dist/dto/trust-device.dto.d.ts.map +1 -1
- package/dist/dto/trust-device.dto.js +9 -0
- package/dist/dto/trust-device.dto.js.map +1 -1
- package/dist/dto/update-user-attributes-request.dto.d.ts +36 -0
- package/dist/dto/update-user-attributes-request.dto.d.ts.map +1 -1
- package/dist/dto/update-user-attributes-request.dto.js +36 -0
- package/dist/dto/update-user-attributes-request.dto.js.map +1 -1
- package/dist/dto/user-response.dto.d.ts +81 -0
- package/dist/dto/user-response.dto.d.ts.map +1 -1
- package/dist/dto/user-response.dto.js +84 -2
- package/dist/dto/user-response.dto.js.map +1 -1
- package/dist/dto/user-update.dto.d.ts +132 -0
- package/dist/dto/user-update.dto.d.ts.map +1 -1
- package/dist/dto/user-update.dto.js +133 -0
- package/dist/dto/user-update.dto.js.map +1 -1
- package/dist/dto/verify-email.dto.d.ts +171 -0
- package/dist/dto/verify-email.dto.d.ts.map +1 -1
- package/dist/dto/verify-email.dto.js +173 -1
- package/dist/dto/verify-email.dto.js.map +1 -1
- package/dist/dto/verify-mfa-code.dto.d.ts +65 -0
- package/dist/dto/verify-mfa-code.dto.d.ts.map +1 -1
- package/dist/dto/verify-mfa-code.dto.js +65 -0
- package/dist/dto/verify-mfa-code.dto.js.map +1 -1
- package/dist/dto/verify-phone-by-sub.dto.d.ts +49 -0
- package/dist/dto/verify-phone-by-sub.dto.d.ts.map +1 -1
- package/dist/dto/verify-phone-by-sub.dto.js +49 -0
- package/dist/dto/verify-phone-by-sub.dto.js.map +1 -1
- package/dist/dto/verify-phone.dto.d.ts +139 -0
- package/dist/dto/verify-phone.dto.d.ts.map +1 -1
- package/dist/dto/verify-phone.dto.js +142 -1
- package/dist/dto/verify-phone.dto.js.map +1 -1
- package/dist/dto.d.ts +10 -0
- package/dist/dto.d.ts.map +1 -1
- package/dist/dto.js +10 -0
- package/dist/dto.js.map +1 -1
- package/dist/entities/auth-audit.entity.d.ts +159 -0
- package/dist/entities/auth-audit.entity.d.ts.map +1 -1
- package/dist/entities/auth-audit.entity.js +166 -0
- package/dist/entities/auth-audit.entity.js.map +1 -1
- package/dist/entities/challenge-session.entity.d.ts +87 -0
- package/dist/entities/challenge-session.entity.d.ts.map +1 -1
- package/dist/entities/challenge-session.entity.js +87 -0
- package/dist/entities/challenge-session.entity.js.map +1 -1
- package/dist/entities/index.d.ts +18 -0
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +18 -0
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/login-attempt.entity.d.ts +43 -0
- package/dist/entities/login-attempt.entity.d.ts.map +1 -1
- package/dist/entities/login-attempt.entity.js +43 -0
- package/dist/entities/login-attempt.entity.js.map +1 -1
- package/dist/entities/mfa-device.entity.d.ts +112 -0
- package/dist/entities/mfa-device.entity.d.ts.map +1 -1
- package/dist/entities/mfa-device.entity.js +112 -0
- package/dist/entities/mfa-device.entity.js.map +1 -1
- package/dist/entities/rate-limit.entity.d.ts +31 -0
- package/dist/entities/rate-limit.entity.d.ts.map +1 -1
- package/dist/entities/rate-limit.entity.js +31 -0
- package/dist/entities/rate-limit.entity.js.map +1 -1
- package/dist/entities/session.entity.d.ts +121 -0
- package/dist/entities/session.entity.d.ts.map +1 -1
- package/dist/entities/session.entity.js +121 -0
- package/dist/entities/session.entity.js.map +1 -1
- package/dist/entities/social-account.entity.d.ts +75 -0
- package/dist/entities/social-account.entity.d.ts.map +1 -1
- package/dist/entities/social-account.entity.js +75 -0
- package/dist/entities/social-account.entity.js.map +1 -1
- package/dist/entities/storage-lock.entity.d.ts +28 -0
- package/dist/entities/storage-lock.entity.d.ts.map +1 -1
- package/dist/entities/storage-lock.entity.js +28 -0
- package/dist/entities/storage-lock.entity.js.map +1 -1
- package/dist/entities/trusted-device.entity.d.ts +83 -0
- package/dist/entities/trusted-device.entity.d.ts.map +1 -1
- package/dist/entities/trusted-device.entity.js +83 -0
- package/dist/entities/trusted-device.entity.js.map +1 -1
- package/dist/entities/user.entity.d.ts +166 -0
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +166 -0
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/entities/verification-token.entity.d.ts +102 -0
- package/dist/entities/verification-token.entity.d.ts.map +1 -1
- package/dist/entities/verification-token.entity.js +102 -0
- package/dist/entities/verification-token.entity.js.map +1 -1
- package/dist/entities.d.ts +8 -0
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +8 -0
- package/dist/entities.js.map +1 -1
- package/dist/enums/auth-audit-event-type.enum.d.ts +211 -0
- package/dist/enums/auth-audit-event-type.enum.d.ts.map +1 -1
- package/dist/enums/auth-audit-event-type.enum.js +244 -0
- package/dist/enums/auth-audit-event-type.enum.js.map +1 -1
- package/dist/enums/error-codes.enum.d.ts +296 -0
- package/dist/enums/error-codes.enum.d.ts.map +1 -1
- package/dist/enums/error-codes.enum.js +332 -0
- package/dist/enums/error-codes.enum.js.map +1 -1
- package/dist/enums/mfa-method.enum.d.ts +74 -0
- package/dist/enums/mfa-method.enum.d.ts.map +1 -1
- package/dist/enums/mfa-method.enum.js +64 -0
- package/dist/enums/mfa-method.enum.js.map +1 -1
- package/dist/enums/risk-factor.enum.d.ts +91 -0
- package/dist/enums/risk-factor.enum.d.ts.map +1 -1
- package/dist/enums/risk-factor.enum.js +97 -0
- package/dist/enums/risk-factor.enum.js.map +1 -1
- package/dist/exceptions/nauth.exception.d.ts +149 -0
- package/dist/exceptions/nauth.exception.d.ts.map +1 -1
- package/dist/exceptions/nauth.exception.js +159 -0
- package/dist/exceptions/nauth.exception.js.map +1 -1
- package/dist/handlers/auth.handler.d.ts +32 -0
- package/dist/handlers/auth.handler.d.ts.map +1 -1
- package/dist/handlers/auth.handler.js +47 -1
- package/dist/handlers/auth.handler.js.map +1 -1
- package/dist/handlers/client-info.handler.d.ts +25 -0
- package/dist/handlers/client-info.handler.d.ts.map +1 -1
- package/dist/handlers/client-info.handler.js +36 -2
- package/dist/handlers/client-info.handler.js.map +1 -1
- package/dist/handlers/csrf.handler.d.ts +32 -0
- package/dist/handlers/csrf.handler.d.ts.map +1 -1
- package/dist/handlers/csrf.handler.js +49 -1
- package/dist/handlers/csrf.handler.js.map +1 -1
- package/dist/handlers/token-delivery.handler.d.ts +16 -0
- package/dist/handlers/token-delivery.handler.d.ts.map +1 -1
- package/dist/handlers/token-delivery.handler.js +22 -1
- package/dist/handlers/token-delivery.handler.js.map +1 -1
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/client-info.interface.d.ts +58 -0
- package/dist/interfaces/client-info.interface.d.ts.map +1 -1
- package/dist/interfaces/config.interface.d.ts +1780 -0
- package/dist/interfaces/config.interface.d.ts.map +1 -1
- package/dist/interfaces/config.interface.js +16 -0
- package/dist/interfaces/config.interface.js.map +1 -1
- package/dist/interfaces/entities.interface.d.ts +48 -0
- package/dist/interfaces/entities.interface.d.ts.map +1 -1
- package/dist/interfaces/entities.interface.js +8 -0
- package/dist/interfaces/entities.interface.js.map +1 -1
- package/dist/interfaces/index.js +5 -0
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/logger.interface.d.ts +213 -0
- package/dist/interfaces/logger.interface.d.ts.map +1 -1
- package/dist/interfaces/logger.interface.js +35 -0
- package/dist/interfaces/logger.interface.js.map +1 -1
- package/dist/interfaces/mfa-provider.interface.d.ts +134 -0
- package/dist/interfaces/mfa-provider.interface.d.ts.map +1 -1
- package/dist/interfaces/oauth.interface.d.ts +110 -0
- package/dist/interfaces/oauth.interface.d.ts.map +1 -1
- package/dist/interfaces/provider.interface.d.ts +83 -0
- package/dist/interfaces/provider.interface.d.ts.map +1 -1
- package/dist/interfaces/sms-template.interface.d.ts +246 -0
- package/dist/interfaces/sms-template.interface.d.ts.map +1 -1
- package/dist/interfaces/sms-template.interface.js +26 -0
- package/dist/interfaces/sms-template.interface.js.map +1 -1
- package/dist/interfaces/social-auth-provider.interface.d.ts +115 -0
- package/dist/interfaces/social-auth-provider.interface.d.ts.map +1 -1
- package/dist/interfaces/storage-adapter.interface.d.ts +37 -0
- package/dist/interfaces/storage-adapter.interface.d.ts.map +1 -1
- package/dist/interfaces/template.interface.d.ts +351 -0
- package/dist/interfaces/template.interface.d.ts.map +1 -1
- package/dist/interfaces/template.interface.js +13 -0
- package/dist/interfaces/template.interface.js.map +1 -1
- package/dist/interfaces/token-verifier.interface.d.ts +101 -0
- package/dist/interfaces/token-verifier.interface.d.ts.map +1 -1
- package/dist/interfaces.d.ts +8 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js +8 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/internal.d.ts +120 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +138 -0
- package/dist/internal.js.map +1 -1
- package/dist/platform/interfaces.d.ts +187 -0
- package/dist/platform/interfaces.d.ts.map +1 -1
- package/dist/platform/interfaces.js +11 -0
- package/dist/platform/interfaces.js.map +1 -1
- package/dist/schemas/auth-config.schema.d.ts +62 -0
- package/dist/schemas/auth-config.schema.d.ts.map +1 -1
- package/dist/schemas/auth-config.schema.js +189 -9
- package/dist/schemas/auth-config.schema.js.map +1 -1
- package/dist/services/adaptive-mfa-decision.service.d.ts +144 -0
- package/dist/services/adaptive-mfa-decision.service.d.ts.map +1 -1
- package/dist/services/adaptive-mfa-decision.service.js +151 -5
- package/dist/services/adaptive-mfa-decision.service.js.map +1 -1
- package/dist/services/auth-audit.service.d.ts +195 -0
- package/dist/services/auth-audit.service.d.ts.map +1 -1
- package/dist/services/auth-audit.service.js +228 -1
- package/dist/services/auth-audit.service.js.map +1 -1
- package/dist/services/auth-challenge-helper.service.d.ts +144 -1
- package/dist/services/auth-challenge-helper.service.d.ts.map +1 -1
- package/dist/services/auth-challenge-helper.service.js +295 -16
- package/dist/services/auth-challenge-helper.service.js.map +1 -1
- package/dist/services/auth-flow-context-builder.service.d.ts +120 -1
- package/dist/services/auth-flow-context-builder.service.d.ts.map +1 -1
- package/dist/services/auth-flow-context-builder.service.js +184 -5
- package/dist/services/auth-flow-context-builder.service.js.map +1 -1
- package/dist/services/auth-flow-rules.d.ts +136 -0
- package/dist/services/auth-flow-rules.d.ts.map +1 -1
- package/dist/services/auth-flow-rules.js +137 -0
- package/dist/services/auth-flow-rules.js.map +1 -1
- package/dist/services/auth-flow-state-definitions.d.ts +40 -0
- package/dist/services/auth-flow-state-definitions.d.ts.map +1 -1
- package/dist/services/auth-flow-state-definitions.js +98 -0
- package/dist/services/auth-flow-state-definitions.js.map +1 -1
- package/dist/services/auth-flow-state-machine.service.d.ts +91 -0
- package/dist/services/auth-flow-state-machine.service.d.ts.map +1 -1
- package/dist/services/auth-flow-state-machine.service.js +102 -0
- package/dist/services/auth-flow-state-machine.service.js.map +1 -1
- package/dist/services/auth-flow-state-machine.types.d.ts +221 -0
- package/dist/services/auth-flow-state-machine.types.d.ts.map +1 -1
- package/dist/services/auth-flow-state-machine.types.js +47 -0
- package/dist/services/auth-flow-state-machine.types.js.map +1 -1
- package/dist/services/auth.service.d.ts +397 -1
- package/dist/services/auth.service.d.ts.map +1 -1
- package/dist/services/auth.service.js +943 -27
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/challenge.service.d.ts +255 -1
- package/dist/services/challenge.service.d.ts.map +1 -1
- package/dist/services/challenge.service.js +327 -3
- package/dist/services/challenge.service.js.map +1 -1
- package/dist/services/client-info.service.d.ts +143 -0
- package/dist/services/client-info.service.d.ts.map +1 -1
- package/dist/services/client-info.service.js +161 -0
- package/dist/services/client-info.service.js.map +1 -1
- package/dist/services/csrf.service.d.ts +15 -0
- package/dist/services/csrf.service.d.ts.map +1 -1
- package/dist/services/csrf.service.js +16 -0
- package/dist/services/csrf.service.js.map +1 -1
- package/dist/services/email-verification.service.d.ts +52 -0
- package/dist/services/email-verification.service.d.ts.map +1 -1
- package/dist/services/email-verification.service.js +152 -12
- package/dist/services/email-verification.service.js.map +1 -1
- package/dist/services/geo-location.service.d.ts +105 -0
- package/dist/services/geo-location.service.d.ts.map +1 -1
- package/dist/services/geo-location.service.js +188 -2
- package/dist/services/geo-location.service.js.map +1 -1
- package/dist/services/jwt.service.d.ts +257 -0
- package/dist/services/jwt.service.d.ts.map +1 -1
- package/dist/services/jwt.service.js +284 -1
- package/dist/services/jwt.service.js.map +1 -1
- package/dist/services/mfa-base.service.d.ts +179 -1
- package/dist/services/mfa-base.service.d.ts.map +1 -1
- package/dist/services/mfa-base.service.js +256 -2
- package/dist/services/mfa-base.service.js.map +1 -1
- package/dist/services/mfa.service.d.ts +304 -0
- package/dist/services/mfa.service.d.ts.map +1 -1
- package/dist/services/mfa.service.js +380 -0
- package/dist/services/mfa.service.js.map +1 -1
- package/dist/services/password-reset.service.d.ts +46 -0
- package/dist/services/password-reset.service.d.ts.map +1 -1
- package/dist/services/password-reset.service.js +79 -0
- package/dist/services/password-reset.service.js.map +1 -1
- package/dist/services/password.service.d.ts +139 -0
- package/dist/services/password.service.d.ts.map +1 -1
- package/dist/services/password.service.js +167 -9
- package/dist/services/password.service.js.map +1 -1
- package/dist/services/phone-verification.service.d.ts +75 -0
- package/dist/services/phone-verification.service.d.ts.map +1 -1
- package/dist/services/phone-verification.service.js +188 -6
- package/dist/services/phone-verification.service.js.map +1 -1
- package/dist/services/risk-detection.service.d.ts +198 -0
- package/dist/services/risk-detection.service.d.ts.map +1 -1
- package/dist/services/risk-detection.service.js +358 -11
- package/dist/services/risk-detection.service.js.map +1 -1
- package/dist/services/risk-scoring.service.d.ts +84 -0
- package/dist/services/risk-scoring.service.d.ts.map +1 -1
- package/dist/services/risk-scoring.service.js +87 -0
- package/dist/services/risk-scoring.service.js.map +1 -1
- package/dist/services/session.service.d.ts +204 -0
- package/dist/services/session.service.d.ts.map +1 -1
- package/dist/services/session.service.js +289 -4
- package/dist/services/session.service.js.map +1 -1
- package/dist/services/social-auth-base.service.d.ts +123 -1
- package/dist/services/social-auth-base.service.d.ts.map +1 -1
- package/dist/services/social-auth-base.service.js +155 -2
- package/dist/services/social-auth-base.service.js.map +1 -1
- package/dist/services/social-auth.service.d.ts +191 -0
- package/dist/services/social-auth.service.d.ts.map +1 -1
- package/dist/services/social-auth.service.js +215 -2
- package/dist/services/social-auth.service.js.map +1 -1
- package/dist/services/social-provider-registry.service.d.ts +86 -0
- package/dist/services/social-provider-registry.service.d.ts.map +1 -1
- package/dist/services/social-provider-registry.service.js +86 -0
- package/dist/services/social-provider-registry.service.js.map +1 -1
- package/dist/services/trusted-device.service.d.ts +105 -0
- package/dist/services/trusted-device.service.d.ts.map +1 -1
- package/dist/services/trusted-device.service.js +133 -4
- package/dist/services/trusted-device.service.js.map +1 -1
- package/dist/storage/account-lockout-storage.service.d.ts +35 -0
- package/dist/storage/account-lockout-storage.service.d.ts.map +1 -1
- package/dist/storage/account-lockout-storage.service.js +35 -0
- package/dist/storage/account-lockout-storage.service.js.map +1 -1
- package/dist/storage/memory-storage.adapter.d.ts +148 -0
- package/dist/storage/memory-storage.adapter.d.ts.map +1 -1
- package/dist/storage/memory-storage.adapter.js +201 -6
- package/dist/storage/memory-storage.adapter.js.map +1 -1
- package/dist/storage/rate-limit-storage.service.d.ts +3 -0
- package/dist/storage/rate-limit-storage.service.d.ts.map +1 -1
- package/dist/storage/rate-limit-storage.service.js +4 -0
- package/dist/storage/rate-limit-storage.service.js.map +1 -1
- package/dist/storage.d.ts +8 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -0
- package/dist/storage.js.map +1 -1
- package/dist/templates/html-template.engine.d.ts +110 -0
- package/dist/templates/html-template.engine.d.ts.map +1 -1
- package/dist/templates/html-template.engine.js +147 -0
- package/dist/templates/html-template.engine.js.map +1 -1
- package/dist/templates/index.d.ts +5 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +5 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/sms-template.engine.d.ts +151 -0
- package/dist/templates/sms-template.engine.d.ts.map +1 -1
- package/dist/templates/sms-template.engine.js +171 -0
- package/dist/templates/sms-template.engine.js.map +1 -1
- package/dist/templates.d.ts +8 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +8 -0
- package/dist/templates.js.map +1 -1
- package/dist/utils/common-passwords.d.ts +42 -0
- package/dist/utils/common-passwords.d.ts.map +1 -1
- package/dist/utils/common-passwords.js +88 -0
- package/dist/utils/common-passwords.js.map +1 -1
- package/dist/utils/context-storage.d.ts +129 -0
- package/dist/utils/context-storage.d.ts.map +1 -1
- package/dist/utils/context-storage.js +129 -0
- package/dist/utils/context-storage.js.map +1 -1
- package/dist/utils/cookie-names.util.d.ts +35 -0
- package/dist/utils/cookie-names.util.d.ts.map +1 -1
- package/dist/utils/cookie-names.util.js +37 -0
- package/dist/utils/cookie-names.util.js.map +1 -1
- package/dist/utils/cookies.util.d.ts +19 -0
- package/dist/utils/cookies.util.d.ts.map +1 -1
- package/dist/utils/cookies.util.js +30 -3
- package/dist/utils/cookies.util.js.map +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/ip-extractor.d.ts +88 -0
- package/dist/utils/ip-extractor.d.ts.map +1 -1
- package/dist/utils/ip-extractor.js +109 -16
- package/dist/utils/ip-extractor.js.map +1 -1
- package/dist/utils/nauth-logger.d.ts +70 -0
- package/dist/utils/nauth-logger.d.ts.map +1 -1
- package/dist/utils/nauth-logger.js +82 -4
- package/dist/utils/nauth-logger.js.map +1 -1
- package/dist/utils/pii-redactor.d.ts +70 -0
- package/dist/utils/pii-redactor.d.ts.map +1 -1
- package/dist/utils/pii-redactor.js +102 -0
- package/dist/utils/pii-redactor.js.map +1 -1
- package/dist/utils/setup/get-repositories.d.ts +16 -0
- package/dist/utils/setup/get-repositories.d.ts.map +1 -1
- package/dist/utils/setup/get-repositories.js +21 -0
- package/dist/utils/setup/get-repositories.js.map +1 -1
- package/dist/utils/setup/init-services.d.ts +40 -1
- package/dist/utils/setup/init-services.d.ts.map +1 -1
- package/dist/utils/setup/init-services.js +98 -0
- package/dist/utils/setup/init-services.js.map +1 -1
- package/dist/utils/setup/init-social.d.ts +27 -0
- package/dist/utils/setup/init-social.d.ts.map +1 -1
- package/dist/utils/setup/init-social.js +49 -0
- package/dist/utils/setup/init-social.js.map +1 -1
- package/dist/utils/setup/init-storage.d.ts +22 -0
- package/dist/utils/setup/init-storage.d.ts.map +1 -1
- package/dist/utils/setup/init-storage.js +36 -0
- package/dist/utils/setup/init-storage.js.map +1 -1
- package/dist/utils/setup/register-mfa.d.ts +22 -0
- package/dist/utils/setup/register-mfa.d.ts.map +1 -1
- package/dist/utils/setup/register-mfa.js +41 -0
- package/dist/utils/setup/register-mfa.js.map +1 -1
- package/dist/utils/setup/run-nauth-migrations.d.ts +7 -0
- package/dist/utils/setup/run-nauth-migrations.d.ts.map +1 -1
- package/dist/utils/setup/run-nauth-migrations.js +8 -0
- package/dist/utils/setup/run-nauth-migrations.js.map +1 -1
- package/dist/utils/token-delivery-policy.d.ts +17 -0
- package/dist/utils/token-delivery-policy.d.ts.map +1 -1
- package/dist/utils/token-delivery-policy.js +17 -0
- package/dist/utils/token-delivery-policy.js.map +1 -1
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -0
- package/dist/utils.js.map +1 -1
- package/dist/validators/template.validator.d.ts +80 -0
- package/dist/validators/template.validator.d.ts.map +1 -1
- package/dist/validators/template.validator.js +94 -0
- package/dist/validators/template.validator.js.map +1 -1
- package/package.json +7 -2
|
@@ -1,35 +1,156 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseSession = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base Session Entity
|
|
6
|
+
*
|
|
7
|
+
* JWT session tracking with device information and security features.
|
|
8
|
+
* Database adapters extend this class and add ORM-specific decorators.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This class is database-agnostic. TypeORM, Prisma, or other ORMs
|
|
12
|
+
* extend this class in their respective packages.
|
|
13
|
+
*/
|
|
4
14
|
class BaseSession {
|
|
15
|
+
/**
|
|
16
|
+
* Internal session ID (auto-increment integer)
|
|
17
|
+
*/
|
|
5
18
|
id;
|
|
19
|
+
/**
|
|
20
|
+
* Version for optimistic locking
|
|
21
|
+
* Automatically incremented on each update by the ORM
|
|
22
|
+
* Used to detect race conditions and concurrent modifications
|
|
23
|
+
*
|
|
24
|
+
* SECURITY CRITICAL: Prevents TOCTOU vulnerabilities
|
|
25
|
+
*/
|
|
6
26
|
version;
|
|
27
|
+
/**
|
|
28
|
+
* Internal user ID (foreign key to users table)
|
|
29
|
+
* Uses integer for optimal performance in joins and lookups
|
|
30
|
+
*/
|
|
7
31
|
userId;
|
|
32
|
+
/**
|
|
33
|
+
* Access token hash (SHA-256)
|
|
34
|
+
* Used for token revocation and session tracking
|
|
35
|
+
*/
|
|
8
36
|
accessTokenHash;
|
|
37
|
+
/**
|
|
38
|
+
* Refresh token hash (SHA-256)
|
|
39
|
+
* Used for token rotation and reuse detection
|
|
40
|
+
*/
|
|
9
41
|
refreshTokenHash;
|
|
42
|
+
/**
|
|
43
|
+
* Token family identifier
|
|
44
|
+
* Used for refresh token rotation and reuse detection
|
|
45
|
+
*/
|
|
10
46
|
tokenFamily;
|
|
47
|
+
/**
|
|
48
|
+
* Device identifier (UUID)
|
|
49
|
+
* Unique identifier for the device/browser
|
|
50
|
+
*/
|
|
11
51
|
deviceId;
|
|
52
|
+
/**
|
|
53
|
+
* User-friendly device name
|
|
54
|
+
* Examples: "iPhone 15 Pro", "Chrome on MacBook"
|
|
55
|
+
*/
|
|
12
56
|
deviceName;
|
|
57
|
+
/**
|
|
58
|
+
* Device type
|
|
59
|
+
* Examples: "mobile", "desktop", "tablet"
|
|
60
|
+
*/
|
|
13
61
|
deviceType;
|
|
62
|
+
/**
|
|
63
|
+
* Device fingerprint hash
|
|
64
|
+
* Combination of device characteristics for additional security
|
|
65
|
+
*/
|
|
14
66
|
deviceFingerprint;
|
|
67
|
+
/**
|
|
68
|
+
* IP address when session was created
|
|
69
|
+
*/
|
|
15
70
|
ipAddress;
|
|
71
|
+
/**
|
|
72
|
+
* Country from IP geolocation (optional)
|
|
73
|
+
*/
|
|
16
74
|
ipCountry;
|
|
75
|
+
/**
|
|
76
|
+
* City from IP geolocation (optional)
|
|
77
|
+
*/
|
|
17
78
|
ipCity;
|
|
79
|
+
/**
|
|
80
|
+
* Latitude from IP geolocation (optional)
|
|
81
|
+
* Used for impossible travel detection
|
|
82
|
+
*/
|
|
18
83
|
ipLatitude;
|
|
84
|
+
/**
|
|
85
|
+
* Longitude from IP geolocation (optional)
|
|
86
|
+
* Used for impossible travel detection
|
|
87
|
+
*/
|
|
19
88
|
ipLongitude;
|
|
89
|
+
/**
|
|
90
|
+
* ISP from IP geolocation (optional)
|
|
91
|
+
*/
|
|
20
92
|
ipIsp;
|
|
93
|
+
/**
|
|
94
|
+
* User agent string
|
|
95
|
+
*/
|
|
21
96
|
userAgent;
|
|
97
|
+
/**
|
|
98
|
+
* Platform extracted from user agent
|
|
99
|
+
* Examples: "iOS", "Android", "Windows", "macOS"
|
|
100
|
+
*/
|
|
22
101
|
platform;
|
|
102
|
+
/**
|
|
103
|
+
* Browser extracted from user agent
|
|
104
|
+
* Examples: "Chrome", "Safari", "Firefox"
|
|
105
|
+
*/
|
|
23
106
|
browser;
|
|
107
|
+
/**
|
|
108
|
+
* Authentication method used to create this session
|
|
109
|
+
* Examples: "password", "google", "facebook", "github", "apple"
|
|
110
|
+
* null for legacy sessions
|
|
111
|
+
*/
|
|
24
112
|
authMethod;
|
|
113
|
+
/**
|
|
114
|
+
* "Remember me" flag
|
|
115
|
+
* Longer expiration for remembered sessions
|
|
116
|
+
*/
|
|
25
117
|
isRemembered;
|
|
118
|
+
/**
|
|
119
|
+
* Trusted device flag
|
|
120
|
+
* Trusted devices may skip MFA
|
|
121
|
+
*/
|
|
26
122
|
isTrustedDevice;
|
|
123
|
+
/**
|
|
124
|
+
* Session expiration timestamp
|
|
125
|
+
* After this time, session is invalid
|
|
126
|
+
*/
|
|
27
127
|
expiresAt;
|
|
128
|
+
/**
|
|
129
|
+
* Last activity timestamp
|
|
130
|
+
* Updated on each API request
|
|
131
|
+
*/
|
|
28
132
|
lastActivityAt;
|
|
133
|
+
/**
|
|
134
|
+
* Session revocation status
|
|
135
|
+
* Revoked sessions cannot be used
|
|
136
|
+
*/
|
|
29
137
|
isRevoked;
|
|
138
|
+
/**
|
|
139
|
+
* When session was revoked
|
|
140
|
+
*/
|
|
30
141
|
revokedAt;
|
|
142
|
+
/**
|
|
143
|
+
* Reason for session revocation
|
|
144
|
+
* Examples: "user_logout", "token_reuse_detected", "admin_revoked"
|
|
145
|
+
*/
|
|
31
146
|
revokeReason;
|
|
147
|
+
/**
|
|
148
|
+
* Additional session metadata (JSON)
|
|
149
|
+
*/
|
|
32
150
|
metadata;
|
|
151
|
+
/**
|
|
152
|
+
* Session creation timestamp
|
|
153
|
+
*/
|
|
33
154
|
createdAt;
|
|
34
155
|
}
|
|
35
156
|
exports.BaseSession = BaseSession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.entity.js","sourceRoot":"","sources":["../../src/entities/session.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"session.entity.js","sourceRoot":"","sources":["../../src/entities/session.entity.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,MAAa,WAAW;IACtB;;OAEG;IACH,EAAE,CAAU;IAEZ;;;;;;OAMG;IACH,OAAO,CAAU;IAEjB;;;OAGG;IACH,MAAM,CAAU;IAEhB;;;OAGG;IACH,eAAe,CAAU;IAEzB;;;OAGG;IACH,gBAAgB,CAAU;IAE1B;;;OAGG;IACH,WAAW,CAAiB;IAE5B;;;OAGG;IACH,QAAQ,CAAiB;IAEzB;;;OAGG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,iBAAiB,CAAiB;IAElC;;OAEG;IACH,SAAS,CAAiB;IAE1B;;OAEG;IACH,SAAS,CAAiB;IAE1B;;OAEG;IACH,MAAM,CAAiB;IAEvB;;;OAGG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,WAAW,CAAiB;IAE5B;;OAEG;IACH,KAAK,CAAiB;IAEtB;;OAEG;IACH,SAAS,CAAiB;IAE1B;;;OAGG;IACH,QAAQ,CAAiB;IAEzB;;;OAGG;IACH,OAAO,CAAiB;IAExB;;;;OAIG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,YAAY,CAAW;IAEvB;;;OAGG;IACH,eAAe,CAAW;IAE1B;;;OAGG;IACH,SAAS,CAAQ;IAEjB;;;OAGG;IACH,cAAc,CAAe;IAE7B;;;OAGG;IACH,SAAS,CAAW;IAEpB;;OAEG;IACH,SAAS,CAAe;IAExB;;;OAGG;IACH,YAAY,CAAiB;IAE7B;;OAEG;IACH,QAAQ,CAAkC;IAE1C;;OAEG;IACH,SAAS,CAAQ;CAClB;AAzKD,kCAyKC"}
|
|
@@ -1,13 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Social Account Entity
|
|
3
|
+
*
|
|
4
|
+
* Stores OAuth provider linkage (no token storage, one-time attribute import).
|
|
5
|
+
* Each record represents a user's account linked to a specific social provider.
|
|
6
|
+
* Database adapters extend this class and add ORM-specific decorators.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This class is database-agnostic. TypeORM, Prisma, or other ORMs
|
|
10
|
+
* extend this class in their respective packages.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // User has Google and Apple accounts linked
|
|
15
|
+
* const socialAccounts = [
|
|
16
|
+
* { provider: 'google', providerId: 'google_123', providerEmail: 'user@gmail.com' },
|
|
17
|
+
* { provider: 'apple', providerId: 'apple_456', providerEmail: 'user@icloud.com' }
|
|
18
|
+
* ];
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
1
21
|
export declare class BaseSocialAccount {
|
|
22
|
+
/**
|
|
23
|
+
* Internal database ID (auto-increment integer)
|
|
24
|
+
* Used for foreign key relationships and internal queries
|
|
25
|
+
* NOT exposed externally
|
|
26
|
+
*/
|
|
2
27
|
id: number;
|
|
28
|
+
/**
|
|
29
|
+
* Foreign key to users table
|
|
30
|
+
* References the user who owns this social account
|
|
31
|
+
*/
|
|
3
32
|
userId: number;
|
|
33
|
+
/**
|
|
34
|
+
* Social provider name
|
|
35
|
+
* Examples: 'google', 'apple', 'facebook'
|
|
36
|
+
*/
|
|
4
37
|
provider: string;
|
|
38
|
+
/**
|
|
39
|
+
* Provider's unique identifier for this user
|
|
40
|
+
* This is the ID that the OAuth provider uses to identify the user
|
|
41
|
+
* Examples: Google sub, Apple user ID, Facebook ID
|
|
42
|
+
*/
|
|
5
43
|
providerId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Email address from the provider (for audit/debugging)
|
|
46
|
+
* May be different from user's primary email if they have multiple emails
|
|
47
|
+
* Used for account linking by email verification
|
|
48
|
+
*/
|
|
6
49
|
providerEmail?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* When this social account was linked to the user
|
|
52
|
+
* Used for audit trails and account management
|
|
53
|
+
*/
|
|
7
54
|
linkedAt: Date;
|
|
55
|
+
/**
|
|
56
|
+
* When this social account was last used for authentication
|
|
57
|
+
* Updated on each successful social login
|
|
58
|
+
* Used for analytics and account cleanup
|
|
59
|
+
*/
|
|
8
60
|
lastUsedAt?: Date | null;
|
|
61
|
+
/**
|
|
62
|
+
* Raw OAuth profile data from provider (for debugging)
|
|
63
|
+
* Contains the full response from the OAuth provider
|
|
64
|
+
* Useful for troubleshooting and attribute mapping
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```json
|
|
68
|
+
* {
|
|
69
|
+
* "sub": "google_123",
|
|
70
|
+
* "email": "user@gmail.com",
|
|
71
|
+
* "given_name": "John",
|
|
72
|
+
* "family_name": "Doe",
|
|
73
|
+
* "picture": "https://...",
|
|
74
|
+
* "locale": "en"
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
9
78
|
metadata?: Record<string, unknown> | null;
|
|
79
|
+
/**
|
|
80
|
+
* Account creation timestamp
|
|
81
|
+
*/
|
|
10
82
|
createdAt: Date;
|
|
83
|
+
/**
|
|
84
|
+
* Last account update timestamp
|
|
85
|
+
*/
|
|
11
86
|
updatedAt: Date;
|
|
12
87
|
}
|
|
13
88
|
//# sourceMappingURL=social-account.entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-account.entity.d.ts","sourceRoot":"","sources":["../../src/entities/social-account.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"social-account.entity.d.ts","sourceRoot":"","sources":["../../src/entities/social-account.entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,iBAAiB;IAC5B;;;;OAIG;IACH,EAAE,EAAG,MAAM,CAAC;IAEZ;;;OAGG;IACH,MAAM,EAAG,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,EAAG,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,EAAG,MAAM,CAAC;IAEpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,QAAQ,EAAG,IAAI,CAAC;IAEhB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,SAAS,EAAG,IAAI,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -1,16 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseSocialAccount = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base Social Account Entity
|
|
6
|
+
*
|
|
7
|
+
* Stores OAuth provider linkage (no token storage, one-time attribute import).
|
|
8
|
+
* Each record represents a user's account linked to a specific social provider.
|
|
9
|
+
* Database adapters extend this class and add ORM-specific decorators.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This class is database-agnostic. TypeORM, Prisma, or other ORMs
|
|
13
|
+
* extend this class in their respective packages.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // User has Google and Apple accounts linked
|
|
18
|
+
* const socialAccounts = [
|
|
19
|
+
* { provider: 'google', providerId: 'google_123', providerEmail: 'user@gmail.com' },
|
|
20
|
+
* { provider: 'apple', providerId: 'apple_456', providerEmail: 'user@icloud.com' }
|
|
21
|
+
* ];
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
4
24
|
class BaseSocialAccount {
|
|
25
|
+
/**
|
|
26
|
+
* Internal database ID (auto-increment integer)
|
|
27
|
+
* Used for foreign key relationships and internal queries
|
|
28
|
+
* NOT exposed externally
|
|
29
|
+
*/
|
|
5
30
|
id;
|
|
31
|
+
/**
|
|
32
|
+
* Foreign key to users table
|
|
33
|
+
* References the user who owns this social account
|
|
34
|
+
*/
|
|
6
35
|
userId;
|
|
36
|
+
/**
|
|
37
|
+
* Social provider name
|
|
38
|
+
* Examples: 'google', 'apple', 'facebook'
|
|
39
|
+
*/
|
|
7
40
|
provider;
|
|
41
|
+
/**
|
|
42
|
+
* Provider's unique identifier for this user
|
|
43
|
+
* This is the ID that the OAuth provider uses to identify the user
|
|
44
|
+
* Examples: Google sub, Apple user ID, Facebook ID
|
|
45
|
+
*/
|
|
8
46
|
providerId;
|
|
47
|
+
/**
|
|
48
|
+
* Email address from the provider (for audit/debugging)
|
|
49
|
+
* May be different from user's primary email if they have multiple emails
|
|
50
|
+
* Used for account linking by email verification
|
|
51
|
+
*/
|
|
9
52
|
providerEmail;
|
|
53
|
+
/**
|
|
54
|
+
* When this social account was linked to the user
|
|
55
|
+
* Used for audit trails and account management
|
|
56
|
+
*/
|
|
10
57
|
linkedAt;
|
|
58
|
+
/**
|
|
59
|
+
* When this social account was last used for authentication
|
|
60
|
+
* Updated on each successful social login
|
|
61
|
+
* Used for analytics and account cleanup
|
|
62
|
+
*/
|
|
11
63
|
lastUsedAt;
|
|
64
|
+
/**
|
|
65
|
+
* Raw OAuth profile data from provider (for debugging)
|
|
66
|
+
* Contains the full response from the OAuth provider
|
|
67
|
+
* Useful for troubleshooting and attribute mapping
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```json
|
|
71
|
+
* {
|
|
72
|
+
* "sub": "google_123",
|
|
73
|
+
* "email": "user@gmail.com",
|
|
74
|
+
* "given_name": "John",
|
|
75
|
+
* "family_name": "Doe",
|
|
76
|
+
* "picture": "https://...",
|
|
77
|
+
* "locale": "en"
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
12
81
|
metadata;
|
|
82
|
+
/**
|
|
83
|
+
* Account creation timestamp
|
|
84
|
+
*/
|
|
13
85
|
createdAt;
|
|
86
|
+
/**
|
|
87
|
+
* Last account update timestamp
|
|
88
|
+
*/
|
|
14
89
|
updatedAt;
|
|
15
90
|
}
|
|
16
91
|
exports.BaseSocialAccount = BaseSocialAccount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-account.entity.js","sourceRoot":"","sources":["../../src/entities/social-account.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"social-account.entity.js","sourceRoot":"","sources":["../../src/entities/social-account.entity.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,iBAAiB;IAC5B;;;;OAIG;IACH,EAAE,CAAU;IAEZ;;;OAGG;IACH,MAAM,CAAU;IAEhB;;;OAGG;IACH,QAAQ,CAAU;IAElB;;;;OAIG;IACH,UAAU,CAAU;IAEpB;;;;OAIG;IACH,aAAa,CAAiB;IAE9B;;;OAGG;IACH,QAAQ,CAAQ;IAEhB;;;;OAIG;IACH,UAAU,CAAe;IAEzB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAkC;IAE1C;;OAEG;IACH,SAAS,CAAQ;IAEjB;;OAEG;IACH,SAAS,CAAQ;CAClB;AA3ED,8CA2EC"}
|
|
@@ -1,8 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Storage Lock Entity
|
|
3
|
+
*
|
|
4
|
+
* Stores distributed locks for transient state management.
|
|
5
|
+
* Used by DatabaseStorageAdapter for token refresh locks and other distributed operations.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This class is database-agnostic. TypeORM, Prisma, or other ORMs
|
|
9
|
+
* extend this class in their respective packages.
|
|
10
|
+
*/
|
|
1
11
|
export declare class BaseStorageLock {
|
|
12
|
+
/**
|
|
13
|
+
* Internal lock record ID (auto-increment integer)
|
|
14
|
+
*/
|
|
2
15
|
id: number;
|
|
16
|
+
/**
|
|
17
|
+
* Unique key identifier for the lock
|
|
18
|
+
* Format: <lock-type>:<identifier> (e.g., "refresh-lock:token-hash-123")
|
|
19
|
+
*/
|
|
3
20
|
key: string;
|
|
21
|
+
/**
|
|
22
|
+
* Lock value (stored as string, typically timestamp or lock holder identifier)
|
|
23
|
+
*/
|
|
4
24
|
value: string;
|
|
25
|
+
/**
|
|
26
|
+
* Lock expiration timestamp
|
|
27
|
+
* Used for TTL-based cleanup and automatic lock release
|
|
28
|
+
* Can be null for locks that don't expire
|
|
29
|
+
*/
|
|
5
30
|
expiresAt: Date | null;
|
|
31
|
+
/**
|
|
32
|
+
* Lock creation timestamp
|
|
33
|
+
*/
|
|
6
34
|
createdAt: Date;
|
|
7
35
|
}
|
|
8
36
|
//# sourceMappingURL=storage-lock.entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-lock.entity.d.ts","sourceRoot":"","sources":["../../src/entities/storage-lock.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-lock.entity.d.ts","sourceRoot":"","sources":["../../src/entities/storage-lock.entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,EAAE,EAAG,MAAM,CAAC;IAEZ;;;OAGG;IACH,GAAG,EAAG,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAG,MAAM,CAAC;IAEf;;;;OAIG;IACH,SAAS,EAAG,IAAI,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseStorageLock = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base Storage Lock Entity
|
|
6
|
+
*
|
|
7
|
+
* Stores distributed locks for transient state management.
|
|
8
|
+
* Used by DatabaseStorageAdapter for token refresh locks and other distributed operations.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This class is database-agnostic. TypeORM, Prisma, or other ORMs
|
|
12
|
+
* extend this class in their respective packages.
|
|
13
|
+
*/
|
|
4
14
|
class BaseStorageLock {
|
|
15
|
+
/**
|
|
16
|
+
* Internal lock record ID (auto-increment integer)
|
|
17
|
+
*/
|
|
5
18
|
id;
|
|
19
|
+
/**
|
|
20
|
+
* Unique key identifier for the lock
|
|
21
|
+
* Format: <lock-type>:<identifier> (e.g., "refresh-lock:token-hash-123")
|
|
22
|
+
*/
|
|
6
23
|
key;
|
|
24
|
+
/**
|
|
25
|
+
* Lock value (stored as string, typically timestamp or lock holder identifier)
|
|
26
|
+
*/
|
|
7
27
|
value;
|
|
28
|
+
/**
|
|
29
|
+
* Lock expiration timestamp
|
|
30
|
+
* Used for TTL-based cleanup and automatic lock release
|
|
31
|
+
* Can be null for locks that don't expire
|
|
32
|
+
*/
|
|
8
33
|
expiresAt;
|
|
34
|
+
/**
|
|
35
|
+
* Lock creation timestamp
|
|
36
|
+
*/
|
|
9
37
|
createdAt;
|
|
10
38
|
}
|
|
11
39
|
exports.BaseStorageLock = BaseStorageLock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-lock.entity.js","sourceRoot":"","sources":["../../src/entities/storage-lock.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"storage-lock.entity.js","sourceRoot":"","sources":["../../src/entities/storage-lock.entity.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,MAAa,eAAe;IAC1B;;OAEG;IACH,EAAE,CAAU;IAEZ;;;OAGG;IACH,GAAG,CAAU;IAEb;;OAEG;IACH,KAAK,CAAU;IAEf;;;;OAIG;IACH,SAAS,CAAe;IAExB;;OAEG;IACH,SAAS,CAAQ;CAClB;AA5BD,0CA4BC"}
|
|
@@ -1,17 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Trusted Device Entity
|
|
3
|
+
*
|
|
4
|
+
* Stores trusted device information for MFA "remember device" feature.
|
|
5
|
+
* Devices marked as trusted can skip MFA verification for a configured period.
|
|
6
|
+
* Uses HttpOnly cookies for secure device token storage.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Each user can have multiple trusted devices. Each record represents one device
|
|
10
|
+
* that has been marked as trusted after successful MFA verification.
|
|
11
|
+
* Trust persists across logouts and session expiration.
|
|
12
|
+
*
|
|
13
|
+
* Database adapters extend this class and add ORM-specific decorators.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Trust a device after MFA verification
|
|
18
|
+
* const trustedDevice = new TrustedDevice();
|
|
19
|
+
* trustedDevice.userId = user.id;
|
|
20
|
+
* trustedDevice.deviceTokenHash = hashToken(deviceToken);
|
|
21
|
+
* trustedDevice.trustedUntil = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000); // 30 days
|
|
22
|
+
* trustedDevice.deviceName = 'iPhone 15 Pro';
|
|
23
|
+
* trustedDevice.deviceType = 'mobile';
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
1
26
|
export declare class BaseTrustedDevice {
|
|
27
|
+
/**
|
|
28
|
+
* Internal device ID (auto-increment integer)
|
|
29
|
+
*/
|
|
2
30
|
id: number;
|
|
31
|
+
/**
|
|
32
|
+
* Internal user ID (foreign key to users table)
|
|
33
|
+
* References the user who trusted this device
|
|
34
|
+
*/
|
|
3
35
|
userId: number;
|
|
36
|
+
/**
|
|
37
|
+
* Hashed device token (SHA-256)
|
|
38
|
+
* The actual token is stored in HttpOnly cookie, only hash stored in DB
|
|
39
|
+
* Used for validation and lookup
|
|
40
|
+
*
|
|
41
|
+
* SECURITY: Never store the actual token, only the hash
|
|
42
|
+
*/
|
|
4
43
|
deviceTokenHash: string;
|
|
44
|
+
/**
|
|
45
|
+
* Device identifier (UUID from client or generated)
|
|
46
|
+
* Used for additional validation and device management
|
|
47
|
+
* Can be used to identify the same device across different tokens
|
|
48
|
+
*/
|
|
5
49
|
deviceId?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* User-friendly device name
|
|
52
|
+
* Examples: "iPhone 15 Pro", "Chrome on MacBook", "Firefox on Windows"
|
|
53
|
+
*/
|
|
6
54
|
deviceName?: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Device type
|
|
57
|
+
* Examples: "mobile", "desktop", "tablet"
|
|
58
|
+
*/
|
|
7
59
|
deviceType?: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* IP address when device was trusted
|
|
62
|
+
* Used for audit and security monitoring
|
|
63
|
+
*/
|
|
8
64
|
ipAddress?: string | null;
|
|
65
|
+
/**
|
|
66
|
+
* User agent string when device was trusted
|
|
67
|
+
* Used for audit and device identification
|
|
68
|
+
*/
|
|
9
69
|
userAgent?: string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Platform extracted from user agent
|
|
72
|
+
* Examples: "iOS", "Android", "Windows", "macOS"
|
|
73
|
+
*/
|
|
10
74
|
platform?: string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Browser extracted from user agent
|
|
77
|
+
* Examples: "Chrome", "Safari", "Firefox"
|
|
78
|
+
*/
|
|
11
79
|
browser?: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* When trust expires
|
|
82
|
+
* After this date, device is no longer trusted and MFA is required
|
|
83
|
+
* Calculated as: createdAt + rememberDeviceDays
|
|
84
|
+
*/
|
|
12
85
|
trustedUntil: Date;
|
|
86
|
+
/**
|
|
87
|
+
* When this device was last used for login
|
|
88
|
+
* Updated on each successful login from this trusted device
|
|
89
|
+
*/
|
|
13
90
|
lastUsedAt?: Date | null;
|
|
91
|
+
/**
|
|
92
|
+
* Device creation timestamp
|
|
93
|
+
*/
|
|
14
94
|
createdAt: Date;
|
|
95
|
+
/**
|
|
96
|
+
* Last update timestamp
|
|
97
|
+
*/
|
|
15
98
|
updatedAt: Date;
|
|
16
99
|
}
|
|
17
100
|
//# sourceMappingURL=trusted-device.entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted-device.entity.d.ts","sourceRoot":"","sources":["../../src/entities/trusted-device.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trusted-device.entity.d.ts","sourceRoot":"","sources":["../../src/entities/trusted-device.entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,EAAE,EAAG,MAAM,CAAC;IAEZ;;;OAGG;IACH,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,eAAe,EAAG,MAAM,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;;OAIG;IACH,YAAY,EAAG,IAAI,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAG,IAAI,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAG,IAAI,CAAC;CAClB"}
|
|
@@ -1,20 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseTrustedDevice = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base Trusted Device Entity
|
|
6
|
+
*
|
|
7
|
+
* Stores trusted device information for MFA "remember device" feature.
|
|
8
|
+
* Devices marked as trusted can skip MFA verification for a configured period.
|
|
9
|
+
* Uses HttpOnly cookies for secure device token storage.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Each user can have multiple trusted devices. Each record represents one device
|
|
13
|
+
* that has been marked as trusted after successful MFA verification.
|
|
14
|
+
* Trust persists across logouts and session expiration.
|
|
15
|
+
*
|
|
16
|
+
* Database adapters extend this class and add ORM-specific decorators.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Trust a device after MFA verification
|
|
21
|
+
* const trustedDevice = new TrustedDevice();
|
|
22
|
+
* trustedDevice.userId = user.id;
|
|
23
|
+
* trustedDevice.deviceTokenHash = hashToken(deviceToken);
|
|
24
|
+
* trustedDevice.trustedUntil = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000); // 30 days
|
|
25
|
+
* trustedDevice.deviceName = 'iPhone 15 Pro';
|
|
26
|
+
* trustedDevice.deviceType = 'mobile';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
4
29
|
class BaseTrustedDevice {
|
|
30
|
+
/**
|
|
31
|
+
* Internal device ID (auto-increment integer)
|
|
32
|
+
*/
|
|
5
33
|
id;
|
|
34
|
+
/**
|
|
35
|
+
* Internal user ID (foreign key to users table)
|
|
36
|
+
* References the user who trusted this device
|
|
37
|
+
*/
|
|
6
38
|
userId;
|
|
39
|
+
/**
|
|
40
|
+
* Hashed device token (SHA-256)
|
|
41
|
+
* The actual token is stored in HttpOnly cookie, only hash stored in DB
|
|
42
|
+
* Used for validation and lookup
|
|
43
|
+
*
|
|
44
|
+
* SECURITY: Never store the actual token, only the hash
|
|
45
|
+
*/
|
|
7
46
|
deviceTokenHash;
|
|
47
|
+
/**
|
|
48
|
+
* Device identifier (UUID from client or generated)
|
|
49
|
+
* Used for additional validation and device management
|
|
50
|
+
* Can be used to identify the same device across different tokens
|
|
51
|
+
*/
|
|
8
52
|
deviceId;
|
|
53
|
+
/**
|
|
54
|
+
* User-friendly device name
|
|
55
|
+
* Examples: "iPhone 15 Pro", "Chrome on MacBook", "Firefox on Windows"
|
|
56
|
+
*/
|
|
9
57
|
deviceName;
|
|
58
|
+
/**
|
|
59
|
+
* Device type
|
|
60
|
+
* Examples: "mobile", "desktop", "tablet"
|
|
61
|
+
*/
|
|
10
62
|
deviceType;
|
|
63
|
+
/**
|
|
64
|
+
* IP address when device was trusted
|
|
65
|
+
* Used for audit and security monitoring
|
|
66
|
+
*/
|
|
11
67
|
ipAddress;
|
|
68
|
+
/**
|
|
69
|
+
* User agent string when device was trusted
|
|
70
|
+
* Used for audit and device identification
|
|
71
|
+
*/
|
|
12
72
|
userAgent;
|
|
73
|
+
/**
|
|
74
|
+
* Platform extracted from user agent
|
|
75
|
+
* Examples: "iOS", "Android", "Windows", "macOS"
|
|
76
|
+
*/
|
|
13
77
|
platform;
|
|
78
|
+
/**
|
|
79
|
+
* Browser extracted from user agent
|
|
80
|
+
* Examples: "Chrome", "Safari", "Firefox"
|
|
81
|
+
*/
|
|
14
82
|
browser;
|
|
83
|
+
/**
|
|
84
|
+
* When trust expires
|
|
85
|
+
* After this date, device is no longer trusted and MFA is required
|
|
86
|
+
* Calculated as: createdAt + rememberDeviceDays
|
|
87
|
+
*/
|
|
15
88
|
trustedUntil;
|
|
89
|
+
/**
|
|
90
|
+
* When this device was last used for login
|
|
91
|
+
* Updated on each successful login from this trusted device
|
|
92
|
+
*/
|
|
16
93
|
lastUsedAt;
|
|
94
|
+
/**
|
|
95
|
+
* Device creation timestamp
|
|
96
|
+
*/
|
|
17
97
|
createdAt;
|
|
98
|
+
/**
|
|
99
|
+
* Last update timestamp
|
|
100
|
+
*/
|
|
18
101
|
updatedAt;
|
|
19
102
|
}
|
|
20
103
|
exports.BaseTrustedDevice = BaseTrustedDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted-device.entity.js","sourceRoot":"","sources":["../../src/entities/trusted-device.entity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"trusted-device.entity.js","sourceRoot":"","sources":["../../src/entities/trusted-device.entity.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,iBAAiB;IAC5B;;OAEG;IACH,EAAE,CAAU;IAEZ;;;OAGG;IACH,MAAM,CAAU;IAEhB;;;;;;OAMG;IACH,eAAe,CAAU;IAEzB;;;;OAIG;IACH,QAAQ,CAAiB;IAEzB;;;OAGG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,UAAU,CAAiB;IAE3B;;;OAGG;IACH,SAAS,CAAiB;IAE1B;;;OAGG;IACH,SAAS,CAAiB;IAE1B;;;OAGG;IACH,QAAQ,CAAiB;IAEzB;;;OAGG;IACH,OAAO,CAAiB;IAExB;;;;OAIG;IACH,YAAY,CAAQ;IAEpB;;;OAGG;IACH,UAAU,CAAe;IAEzB;;OAEG;IACH,SAAS,CAAQ;IAEjB;;OAEG;IACH,SAAS,CAAQ;CAClB;AAtFD,8CAsFC"}
|