@jmlq/auth 0.0.1-alpha.1 → 0.0.1-alpha.3
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/README.md +259 -306
- package/dist/application/dtos/index.d.ts +3 -0
- package/dist/application/dtos/index.js +19 -0
- package/dist/application/dtos/request/index.d.ts +4 -0
- package/dist/{src/application/dtos → application/dtos/request}/index.js +4 -4
- package/dist/{src/application/dtos/login.dto.d.ts → application/dtos/request/login.request.d.ts} +0 -4
- package/dist/application/dtos/request/logout.request.d.ts +3 -0
- package/dist/application/dtos/request/refresh-token.request.d.ts +3 -0
- package/dist/application/dtos/request/register-user.request.d.ts +6 -0
- package/dist/application/dtos/response/index.d.ts +4 -0
- package/dist/application/dtos/response/index.js +20 -0
- package/dist/application/dtos/response/login.response.d.ts +4 -0
- package/dist/{src/application/dtos/logout.dto.d.ts → application/dtos/response/logout.response.d.ts} +0 -3
- package/dist/{src/application/dtos/refresh-token.dto.d.ts → application/dtos/response/refresh-token.response.d.ts} +0 -3
- package/dist/application/dtos/response/register-user.response.d.ts +7 -0
- package/dist/application/dtos/type/index.d.ts +1 -0
- package/dist/{src/shared/constants → application/dtos/type}/index.js +1 -1
- package/dist/application/dtos/type/user-role.type.d.ts +4 -0
- package/dist/application/factories/auth-service.factory.d.ts +11 -0
- package/dist/application/factories/auth-service.factory.js +40 -0
- package/dist/{src/application → application}/index.d.ts +1 -0
- package/dist/{src/application → application}/index.js +1 -0
- package/dist/application/types/auth-service-factory-options.type.d.ts +5 -0
- package/dist/application/types/index.d.ts +1 -0
- package/dist/{src/infrastructure/jwt/factory → application/types}/index.js +1 -1
- package/dist/{src/application → application}/use-cases/login-with-password.use-case.d.ts +2 -2
- package/dist/{src/application → application}/use-cases/login-with-password.use-case.js +6 -5
- package/dist/{src/application → application}/use-cases/logout.use-case.d.ts +2 -2
- package/dist/{src/application → application}/use-cases/logout.use-case.js +2 -2
- package/dist/{src/application → application}/use-cases/refresh-token.use-case.d.ts +2 -2
- package/dist/{src/application → application}/use-cases/refresh-token.use-case.js +2 -2
- package/dist/application/use-cases/register-user.use-case.d.ts +12 -0
- package/dist/{src/application → application}/use-cases/register-user.use-case.js +27 -1
- package/dist/{src/domain → domain}/errors/auth.errors.d.ts +1 -14
- package/dist/{src/domain → domain}/errors/auth.errors.js +1 -15
- package/dist/{src/domain → domain}/index.d.ts +0 -1
- package/dist/{src/domain → domain}/index.js +0 -1
- package/dist/domain/ports/auth/index.d.ts +2 -0
- package/dist/domain/ports/auth/index.js +18 -0
- package/dist/{src/domain/ports/auth/password-hasher.d.ts → domain/ports/auth/password-hasher.port.d.ts} +1 -1
- package/dist/{src/domain → domain}/ports/auth/password-policy.port.d.ts +1 -1
- package/dist/domain/ports/index.d.ts +4 -0
- package/dist/{src/infrastructure/jwt → domain/ports}/index.js +3 -2
- package/dist/domain/ports/jwt/index.d.ts +1 -0
- package/dist/{src/shared/types → domain/ports/jwt}/index.js +1 -1
- package/dist/domain/ports/jwt/payload/index.d.ts +1 -0
- package/dist/domain/ports/jwt/payload/index.js +17 -0
- package/dist/{src/domain → domain}/ports/repository/credential.repository.d.ts +1 -1
- package/dist/{src/domain → domain}/ports/repository/index.d.ts +1 -1
- package/dist/{src/domain → domain}/ports/repository/index.js +1 -1
- package/dist/{src/domain/ports/repository/user.repository.d.ts → domain/ports/repository/user-repository.port.d.ts} +1 -1
- package/dist/domain/ports/token/index.d.ts +2 -0
- package/dist/domain/ports/token/index.js +18 -0
- package/dist/{src/domain → domain}/ports/token/token-session.port.d.ts +2 -2
- package/dist/{src/domain → domain}/ports/token/token.service.port.d.ts +2 -2
- package/dist/{src/domain → domain}/props/jwt/generate-access-token.props.d.ts +0 -2
- package/dist/{src/domain → domain}/props/jwt/generate-refresh-token.props.d.ts +0 -2
- package/dist/{src/domain/props/services → domain/props/jwt}/index.d.ts +1 -0
- package/dist/{src/domain/props/services → domain/props/jwt}/index.js +1 -0
- package/dist/{src/domain → domain}/services/password-policy.service.d.ts +2 -2
- package/dist/{src/infrastructure/repositories/test → in-memory}/in-memory-credential.repository.d.ts +2 -2
- package/dist/{src/infrastructure/repositories/test → in-memory}/in-memory-credential.repository.js +12 -2
- package/dist/{src/infrastructure/repositories/test → in-memory}/in-memory-user.repository.d.ts +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +13 -1
- package/dist/infrastructure/index.js +1 -0
- package/dist/{src/infrastructure → infrastructure}/security/bcrypt-password-hasher.d.ts +7 -2
- package/dist/{src/infrastructure → infrastructure}/security/bcrypt-password-hasher.js +7 -2
- package/dist/{src/infrastructure → infrastructure}/services/index.d.ts +0 -1
- package/dist/{src/infrastructure → infrastructure}/services/index.js +0 -1
- package/dist/infrastructure/services/token-session.service.d.ts +22 -0
- package/dist/{src/infrastructure/services/default-token-session.service.js → infrastructure/services/token-session.service.js} +30 -31
- package/dist/infrastructure/types/auth-service-container.d.ts +14 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/{src/infrastructure/repositories → shared}/index.js +1 -1
- package/package.json +5 -8
- package/dist/examples/bcrypt-password-hasher.example.d.ts +0 -3
- package/dist/examples/bcrypt-password-hasher.example.js +0 -78
- package/dist/examples/entity-object.example.d.ts +0 -39
- package/dist/examples/entity-object.example.js +0 -411
- package/dist/examples/factory-auth-service-example.d.ts +0 -3
- package/dist/examples/factory-auth-service-example.js +0 -84
- package/dist/examples/index.example.d.ts +0 -12
- package/dist/examples/index.example.js +0 -171
- package/dist/examples/jwt-algoritm.example.d.ts +0 -47
- package/dist/examples/jwt-algoritm.example.js +0 -447
- package/dist/examples/jwt-token-generator.example.d.ts +0 -6
- package/dist/examples/jwt-token-generator.example.js +0 -49
- package/dist/examples/jwt-verifier.example.d.ts +0 -3
- package/dist/examples/jwt-verifier.example.js +0 -80
- package/dist/examples/password-policy.example.d.ts +0 -7
- package/dist/examples/password-policy.example.js +0 -57
- package/dist/examples/service-jwt-token.example.d.ts +0 -3
- package/dist/examples/service-jwt-token.example.js +0 -154
- package/dist/examples/service-token-session.example.d.ts +0 -3
- package/dist/examples/service-token-session.example.js +0 -139
- package/dist/examples/use-case-login-with-password.example.d.ts +0 -6
- package/dist/examples/use-case-login-with-password.example.js +0 -105
- package/dist/examples/use-case-logout.example.d.ts +0 -7
- package/dist/examples/use-case-logout.example.js +0 -134
- package/dist/examples/use-case-refresh-token.example.d.ts +0 -11
- package/dist/examples/use-case-refresh-token.example.js +0 -164
- package/dist/examples/use-case-register-user.example.d.ts +0 -9
- package/dist/examples/use-case-register-user.example.js +0 -110
- package/dist/src/application/dtos/index.d.ts +0 -4
- package/dist/src/application/dtos/register-user.dto.d.ts +0 -16
- package/dist/src/application/factories/auth-service.factory.d.ts +0 -5
- package/dist/src/application/factories/auth-service.factory.js +0 -51
- package/dist/src/application/use-cases/register-user.use-case.d.ts +0 -10
- package/dist/src/domain/errors/auth-domain-error.d.ts +0 -82
- package/dist/src/domain/errors/auth-domain-error.js +0 -112
- package/dist/src/domain/ports/auth/password-policy-config.port.js +0 -10
- package/dist/src/domain/ports/config/auth-config.port.d.ts +0 -19
- package/dist/src/domain/ports/config/auth-config.port.js +0 -3
- package/dist/src/domain/ports/index.d.ts +0 -9
- package/dist/src/domain/ports/index.js +0 -25
- package/dist/src/domain/ports/jwt/factory/signature-strategy-factory.port.d.ts +0 -14
- package/dist/src/domain/ports/jwt/signature-strategy-factory.port.d.ts +0 -14
- package/dist/src/domain/ports/jwt/signature-strategy.d.ts +0 -30
- package/dist/src/domain/ports/jwt/signature-strategy.js +0 -4
- package/dist/src/domain/ports/jwt/signature-strategy.port.d.ts +0 -31
- package/dist/src/domain/ports/jwt/signature-strategy.port.js +0 -4
- package/dist/src/domain/ports/jwt/strategy/signature-strategy.port.d.ts +0 -31
- package/dist/src/domain/ports/jwt/strategy/signature-strategy.port.js +0 -4
- package/dist/src/domain/props/create-payload-props.port.d.ts +0 -0
- package/dist/src/domain/props/create-payload-props.port.js +0 -8
- package/dist/src/domain/props/jwt/create-payload.props.d.ts +0 -9
- package/dist/src/domain/props/jwt/generate-token.props.d.ts +0 -10
- package/dist/src/domain/props/jwt/generate-token.props.js +0 -2
- package/dist/src/domain/props/jwt/index.d.ts +0 -5
- package/dist/src/domain/props/jwt/index.js +0 -21
- package/dist/src/domain/props/jwt/jwt-subject.d.ts +0 -7
- package/dist/src/domain/props/jwt/jwt-subject.js +0 -2
- package/dist/src/domain/props/services/generate-access-token.props.d.ts +0 -8
- package/dist/src/domain/props/services/generate-refresh-token.props.d.ts +0 -8
- package/dist/src/domain/services/token.service.port.d.ts +0 -9
- package/dist/src/index.d.ts +0 -78
- package/dist/src/index.js +0 -94
- package/dist/src/infrastructure/index.d.ts +0 -5
- package/dist/src/infrastructure/index.js +0 -21
- package/dist/src/infrastructure/jwt/factory/index.d.ts +0 -1
- package/dist/src/infrastructure/jwt/factory/signature-strategy.factory.d.ts +0 -21
- package/dist/src/infrastructure/jwt/factory/signature-strategy.factory.js +0 -61
- package/dist/src/infrastructure/jwt/index.d.ts +0 -3
- package/dist/src/infrastructure/jwt/signature-strategy.factory.d.ts +0 -21
- package/dist/src/infrastructure/jwt/signature-strategy.factory.js +0 -61
- package/dist/src/infrastructure/jwt/strategies/ecdsa-signature-strategy.d.ts +0 -47
- package/dist/src/infrastructure/jwt/strategies/ecdsa-signature-strategy.js +0 -124
- package/dist/src/infrastructure/jwt/strategies/ecdsa-signature.strategy.d.ts +0 -47
- package/dist/src/infrastructure/jwt/strategies/ecdsa-signature.strategy.js +0 -124
- package/dist/src/infrastructure/jwt/strategies/hmac-signature-strategy.d.ts +0 -54
- package/dist/src/infrastructure/jwt/strategies/hmac-signature-strategy.js +0 -129
- package/dist/src/infrastructure/jwt/strategies/hmac-signature.strategy.d.ts +0 -54
- package/dist/src/infrastructure/jwt/strategies/hmac-signature.strategy.js +0 -129
- package/dist/src/infrastructure/jwt/strategies/index.d.ts +0 -3
- package/dist/src/infrastructure/jwt/strategies/index.js +0 -19
- package/dist/src/infrastructure/jwt/strategies/rsa-signature-strategy.d.ts +0 -47
- package/dist/src/infrastructure/jwt/strategies/rsa-signature-strategy.js +0 -124
- package/dist/src/infrastructure/jwt/strategies/rsa-signature.strategy.d.ts +0 -47
- package/dist/src/infrastructure/jwt/strategies/rsa-signature.strategy.js +0 -124
- package/dist/src/infrastructure/jwt/token/actions/jwt-token-generator.d.ts +0 -57
- package/dist/src/infrastructure/jwt/token/actions/jwt-token-generator.js +0 -123
- package/dist/src/infrastructure/jwt/token/actions/jwt-token-verifier.d.ts +0 -59
- package/dist/src/infrastructure/jwt/token/actions/jwt-token-verifier.js +0 -100
- package/dist/src/infrastructure/jwt/token/index.d.ts +0 -5
- package/dist/src/infrastructure/jwt/token/index.js +0 -21
- package/dist/src/infrastructure/jwt/token/jwt-signer.d.ts +0 -33
- package/dist/src/infrastructure/jwt/token/jwt-signer.js +0 -46
- package/dist/src/infrastructure/jwt/token/jwt-token-parser.d.ts +0 -29
- package/dist/src/infrastructure/jwt/token/jwt-token-parser.js +0 -57
- package/dist/src/infrastructure/jwt/token/jwt-token-validator.d.ts +0 -32
- package/dist/src/infrastructure/jwt/token/jwt-token-validator.js +0 -77
- package/dist/src/infrastructure/jwt/token/tools/jwt-signer.d.ts +0 -33
- package/dist/src/infrastructure/jwt/token/tools/jwt-signer.js +0 -46
- package/dist/src/infrastructure/jwt/token/tools/jwt-token-parser.d.ts +0 -30
- package/dist/src/infrastructure/jwt/token/tools/jwt-token-parser.js +0 -57
- package/dist/src/infrastructure/jwt/token/tools/jwt-token-validator.d.ts +0 -32
- package/dist/src/infrastructure/jwt/token/tools/jwt-token-validator.js +0 -77
- package/dist/src/infrastructure/repositories/index.d.ts +0 -1
- package/dist/src/infrastructure/repositories/test/in-memory-token-session.repository.d.ts +0 -67
- package/dist/src/infrastructure/repositories/test/in-memory-token-session.repository.js +0 -128
- package/dist/src/infrastructure/services/default-token-session.service.d.ts +0 -18
- package/dist/src/infrastructure/services/jwt-token.service.d.ts +0 -15
- package/dist/src/infrastructure/services/jwt-token.service.js +0 -44
- package/dist/src/infrastructure/services/simple-jwt-token.service.d.ts +0 -15
- package/dist/src/infrastructure/services/simple-jwt-token.service.js +0 -46
- package/dist/src/infrastructure/services/token-session.service.d.ts +0 -24
- package/dist/src/infrastructure/services/token-session.service.js +0 -131
- package/dist/src/infrastructure/types/auth-service-container.d.ts +0 -14
- package/dist/src/shared/constants/index.d.ts +0 -1
- package/dist/src/shared/constants/jwt-algorithms.d.ts +0 -17
- package/dist/src/shared/constants/jwt-algorithms.js +0 -23
- package/dist/src/shared/encoders/base64-url-encoder.d.ts +0 -29
- package/dist/src/shared/encoders/base64-url-encoder.js +0 -45
- package/dist/src/shared/encoders/index.d.ts +0 -1
- package/dist/src/shared/encoders/index.js +0 -17
- package/dist/src/shared/index.d.ts +0 -4
- package/dist/src/shared/index.js +0 -20
- package/dist/src/shared/types/index.d.ts +0 -1
- package/dist/src/shared/types/jwt.d.ts +0 -25
- package/dist/src/shared/types/jwt.js +0 -2
- package/dist/src/shared/types/jwt.types.d.ts +0 -39
- package/dist/src/shared/types/jwt.types.js +0 -2
- package/dist/tests/application/factory/auth-service-factory.spec.d.ts +0 -1
- package/dist/tests/application/factory/auth-service-factory.spec.js +0 -97
- package/dist/tests/application/use-cases/login-with-password.integration.spec.d.ts +0 -1
- package/dist/tests/application/use-cases/login-with-password.integration.spec.js +0 -140
- package/dist/tests/application/use-cases/logout-use-case.spec.d.ts +0 -1
- package/dist/tests/application/use-cases/logout-use-case.spec.js +0 -40
- package/dist/tests/application/use-cases/refresh-token-use-case.spec.d.ts +0 -1
- package/dist/tests/application/use-cases/refresh-token-use-case.spec.js +0 -116
- package/dist/tests/application/use-cases/register-user.usecase.spec.d.ts +0 -1
- package/dist/tests/application/use-cases/register-user.usecase.spec.js +0 -151
- package/dist/tests/domain/entities/credential.spec.d.ts +0 -1
- package/dist/tests/domain/entities/credential.spec.js +0 -93
- package/dist/tests/domain/entities/user.spec.d.ts +0 -1
- package/dist/tests/domain/entities/user.spec.js +0 -93
- package/dist/tests/domain/object-values/email.spec.d.ts +0 -1
- package/dist/tests/domain/object-values/email.spec.js +0 -77
- package/dist/tests/domain/object-values/hashed-password.spec.d.ts +0 -1
- package/dist/tests/domain/object-values/hashed-password.spec.js +0 -54
- package/dist/tests/domain/object-values/id.spec.d.ts +0 -1
- package/dist/tests/domain/object-values/id.spec.js +0 -48
- package/dist/tests/domain/object-values/permission.spec.d.ts +0 -1
- package/dist/tests/domain/object-values/permission.spec.js +0 -75
- package/dist/tests/domain/object-values/role.spec.d.ts +0 -1
- package/dist/tests/domain/object-values/role.spec.js +0 -139
- package/dist/tests/domain/services/default-password-policy.spec.d.ts +0 -1
- package/dist/tests/domain/services/default-password-policy.spec.js +0 -69
- package/dist/tests/doman/entities/credential.spec.d.ts +0 -1
- package/dist/tests/doman/entities/credential.spec.js +0 -93
- package/dist/tests/doman/entities/user.spec.d.ts +0 -1
- package/dist/tests/doman/entities/user.spec.js +0 -93
- package/dist/tests/doman/object-values/email.spec.d.ts +0 -1
- package/dist/tests/doman/object-values/email.spec.js +0 -77
- package/dist/tests/doman/object-values/hashed-password.spec.d.ts +0 -1
- package/dist/tests/doman/object-values/hashed-password.spec.js +0 -54
- package/dist/tests/doman/object-values/id.spec.d.ts +0 -1
- package/dist/tests/doman/object-values/id.spec.js +0 -48
- package/dist/tests/doman/object-values/permission.spec.d.ts +0 -1
- package/dist/tests/doman/object-values/permission.spec.js +0 -75
- package/dist/tests/doman/object-values/role.spec.d.ts +0 -1
- package/dist/tests/doman/object-values/role.spec.js +0 -139
- package/dist/tests/helpers/make-jwt-subject.d.ts +0 -7
- package/dist/tests/helpers/make-jwt-subject.js +0 -16
- package/dist/tests/helpers/make-jwt-user.d.ts +0 -7
- package/dist/tests/helpers/make-jwt-user.js +0 -16
- package/dist/tests/helpers/make-user.d.ts +0 -2
- package/dist/tests/helpers/make-user.js +0 -15
- package/dist/tests/infrastructure/jwt/signature-strategy-factory.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/signature-strategy-factory.spec.js +0 -127
- package/dist/tests/infrastructure/jwt/strategies/ecdsa-signature-strategy.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/strategies/ecdsa-signature-strategy.spec.js +0 -157
- package/dist/tests/infrastructure/jwt/strategies/hmac-signature-strategy.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/strategies/hmac-signature-strategy.spec.js +0 -150
- package/dist/tests/infrastructure/jwt/strategies/rsa-signature-strategy..spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/strategies/rsa-signature-strategy..spec.js +0 -156
- package/dist/tests/infrastructure/jwt/token/actions/jwt-token-generator.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/actions/jwt-token-generator.spec.js +0 -179
- package/dist/tests/infrastructure/jwt/token/actions/jwt-token-verifier.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/actions/jwt-token-verifier.spec.js +0 -142
- package/dist/tests/infrastructure/jwt/token/jwt-signer.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/jwt-signer.spec.js +0 -125
- package/dist/tests/infrastructure/jwt/token/jwt-token-parser.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/jwt-token-parser.spec.js +0 -116
- package/dist/tests/infrastructure/jwt/token/jwt-token-validator.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/jwt-token-validator.spec.js +0 -88
- package/dist/tests/infrastructure/jwt/token/tools/jwt-signer.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/tools/jwt-signer.spec.js +0 -126
- package/dist/tests/infrastructure/jwt/token/tools/jwt-token-parser.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/tools/jwt-token-parser.spec.js +0 -116
- package/dist/tests/infrastructure/jwt/token/tools/jwt-token-validator.spec.d.ts +0 -1
- package/dist/tests/infrastructure/jwt/token/tools/jwt-token-validator.spec.js +0 -88
- package/dist/tests/infrastructure/security/security/bcrypt-password-hasher.spec.d.ts +0 -1
- package/dist/tests/infrastructure/security/security/bcrypt-password-hasher.spec.js +0 -37
- package/dist/tests/infrastructure/services/jwt-token-service.spec.d.ts +0 -1
- package/dist/tests/infrastructure/services/jwt-token-service.spec.js +0 -145
- package/dist/tests/infrastructure/services/token-session.service.spec.d.ts +0 -1
- package/dist/tests/infrastructure/services/token-session.service.spec.js +0 -269
- package/dist/tests/shared/constants/jwt-algorithms.spec.d.ts +0 -1
- package/dist/tests/shared/constants/jwt-algorithms.spec.js +0 -27
- package/dist/tests/shared/encoders/base64-url-encoder.spec.d.ts +0 -1
- package/dist/tests/shared/encoders/base64-url-encoder.spec.js +0 -70
- package/dist/tests/shared/utils/time-parser.spec.d.ts +0 -1
- package/dist/tests/shared/utils/time-parser.spec.js +0 -80
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -17
- package/dist/utils/time-parser.d.ts +0 -28
- package/dist/utils/time-parser.js +0 -76
- /package/dist/{src/application/dtos/login.dto.js → application/dtos/request/login.request.js} +0 -0
- /package/dist/{src/application/dtos/logout.dto.js → application/dtos/request/logout.request.js} +0 -0
- /package/dist/{src/application/dtos/refresh-token.dto.js → application/dtos/request/refresh-token.request.js} +0 -0
- /package/dist/{src/application/dtos/register-user.dto.js → application/dtos/request/register-user.request.js} +0 -0
- /package/dist/{src/domain/ports/auth/password-hasher.js → application/dtos/response/login.response.js} +0 -0
- /package/dist/{src/domain/ports/auth/password-policy.port.js → application/dtos/response/logout.response.js} +0 -0
- /package/dist/{src/domain/ports/jwt/factory/signature-strategy-factory.port.js → application/dtos/response/refresh-token.response.js} +0 -0
- /package/dist/{src/domain/ports/jwt/payload/jwt-payload.port.js → application/dtos/response/register-user.response.js} +0 -0
- /package/dist/{src/domain/ports/jwt/signature-strategy-factory.port.js → application/dtos/type/user-role.type.js} +0 -0
- /package/dist/{src/application → application}/factories/index.d.ts +0 -0
- /package/dist/{src/application → application}/factories/index.js +0 -0
- /package/dist/{src/domain/ports/repository/credential.repository.js → application/types/auth-service-factory-options.type.js} +0 -0
- /package/dist/{src/application → application}/use-cases/index.d.ts +0 -0
- /package/dist/{src/application → application}/use-cases/index.js +0 -0
- /package/dist/{src/domain → domain}/entities/credential.entity.d.ts +0 -0
- /package/dist/{src/domain → domain}/entities/credential.entity.js +0 -0
- /package/dist/{src/domain → domain}/entities/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/entities/index.js +0 -0
- /package/dist/{src/domain → domain}/entities/user.entity.d.ts +0 -0
- /package/dist/{src/domain → domain}/entities/user.entity.js +0 -0
- /package/dist/{src/domain → domain}/errors/identity.errors.d.ts +0 -0
- /package/dist/{src/domain → domain}/errors/identity.errors.js +0 -0
- /package/dist/{src/domain → domain}/errors/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/errors/index.js +0 -0
- /package/dist/{src/domain → domain}/object-values/email.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/email.js +0 -0
- /package/dist/{src/domain → domain}/object-values/hashed-password.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/hashed-password.js +0 -0
- /package/dist/{src/domain → domain}/object-values/id.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/id.js +0 -0
- /package/dist/{src/domain → domain}/object-values/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/index.js +0 -0
- /package/dist/{src/domain → domain}/object-values/permission.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/permission.js +0 -0
- /package/dist/{src/domain → domain}/object-values/role.d.ts +0 -0
- /package/dist/{src/domain → domain}/object-values/role.js +0 -0
- /package/dist/{src/domain/ports/repository/user.repository.js → domain/ports/auth/password-hasher.port.js} +0 -0
- /package/dist/{src/domain/ports/token/token-session.port.js → domain/ports/auth/password-policy.port.js} +0 -0
- /package/dist/{src/domain → domain}/ports/jwt/payload/jwt-payload.port.d.ts +0 -0
- /package/dist/{src/domain/ports/token/token.service.port.js → domain/ports/jwt/payload/jwt-payload.port.js} +0 -0
- /package/dist/{src/domain/props/entities/credential.props.js → domain/ports/repository/credential.repository.js} +0 -0
- /package/dist/{src/domain/props/entities/user.props.js → domain/ports/repository/user-repository.port.js} +0 -0
- /package/dist/{src/domain/props/jwt/create-payload.props.js → domain/ports/token/token-session.port.js} +0 -0
- /package/dist/{src/domain/services → domain/ports/token}/token.service.port.js +0 -0
- /package/dist/{src/domain → domain}/props/entities/credential.props.d.ts +0 -0
- /package/dist/{src/domain/props/jwt/generate-access-token.props.js → domain/props/entities/credential.props.js} +0 -0
- /package/dist/{src/domain → domain}/props/entities/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/props/entities/index.js +0 -0
- /package/dist/{src/domain → domain}/props/entities/user.props.d.ts +0 -0
- /package/dist/{src/domain/props/jwt/generate-refresh-token.props.js → domain/props/entities/user.props.js} +0 -0
- /package/dist/{src/domain → domain}/props/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/props/index.js +0 -0
- /package/dist/{src/domain/props/services → domain/props/jwt}/generate-access-token.props.js +0 -0
- /package/dist/{src/domain/props/services → domain/props/jwt}/generate-refresh-token.props.js +0 -0
- /package/dist/{src/domain → domain}/props/jwt/jwt-user.d.ts +0 -0
- /package/dist/{src/domain → domain}/props/jwt/jwt-user.js +0 -0
- /package/dist/{src/domain → domain}/services/index.d.ts +0 -0
- /package/dist/{src/domain → domain}/services/index.js +0 -0
- /package/dist/{src/domain → domain}/services/password-policy.service.js +0 -0
- /package/dist/{src/infrastructure/repositories/test → in-memory}/in-memory-user.repository.js +0 -0
- /package/dist/{src/infrastructure/repositories/test → in-memory}/index.d.ts +0 -0
- /package/dist/{src/infrastructure/repositories/test → in-memory}/index.js +0 -0
- /package/dist/{src/domain/ports/auth/password-policy-config.port.d.ts → infrastructure/index.d.ts} +0 -0
- /package/dist/{src/infrastructure → infrastructure}/security/index.d.ts +0 -0
- /package/dist/{src/infrastructure → infrastructure}/security/index.js +0 -0
- /package/dist/{src/infrastructure → infrastructure}/types/auth-service-container.js +0 -0
- /package/dist/{src/infrastructure → infrastructure}/types/index.d.ts +0 -0
- /package/dist/{src/infrastructure → infrastructure}/types/index.js +0 -0
- /package/dist/{src/shared → shared}/utils/index.d.ts +0 -0
- /package/dist/{src/shared → shared}/utils/index.js +0 -0
- /package/dist/{src/shared → shared}/utils/time-parser.d.ts +0 -0
- /package/dist/{src/shared → shared}/utils/time-parser.js +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// src/domain/errors/auth.errors.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.InvalidTokenError = exports.AuthenticationError = exports.ClaimsValidationError = exports.ClockSkewError = exports.TokenRevokedError = exports.KeyMismatchError = exports.KeyNotFoundError = exports.UnsupportedAlgorithmError = exports.InvalidSignatureError = exports.InvalidTokenFormatError = exports.TokenNotYetValidError = exports.TokenExpiredError = exports.AuthDomainError = void 0;
|
|
5
|
-
class AuthDomainError extends Error {
|
|
6
|
-
constructor(message, code, details) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.code = code;
|
|
9
|
-
this.details = details;
|
|
10
|
-
this.name = new.target.name;
|
|
11
|
-
// Compatible con V8; ignora silenciosamente en otros engines
|
|
12
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
13
|
-
Error.captureStackTrace(this, new.target);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
toJSON() {
|
|
17
|
-
return {
|
|
18
|
-
name: this.name,
|
|
19
|
-
message: this.message,
|
|
20
|
-
code: this.code,
|
|
21
|
-
details: this.details,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
static isAuthError(e) {
|
|
25
|
-
return e instanceof AuthDomainError;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.AuthDomainError = AuthDomainError;
|
|
29
|
-
/** El token ya no es válido por exp (exp < now) */
|
|
30
|
-
class TokenExpiredError extends AuthDomainError {
|
|
31
|
-
constructor(message = "Token has expired", details) {
|
|
32
|
-
super(message, "TOKEN_EXPIRED", details);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.TokenExpiredError = TokenExpiredError;
|
|
36
|
-
/** El token aún no debe usarse (nbf > now) */
|
|
37
|
-
class TokenNotYetValidError extends AuthDomainError {
|
|
38
|
-
constructor(message = "Token is not yet valid", details) {
|
|
39
|
-
super(message, "TOKEN_NOT_YET_VALID", details);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.TokenNotYetValidError = TokenNotYetValidError;
|
|
43
|
-
/** Formato inválido (no tiene 3 partes, base64url inválido, JSON inválido) */
|
|
44
|
-
class InvalidTokenFormatError extends AuthDomainError {
|
|
45
|
-
constructor(message = "Invalid token format", details) {
|
|
46
|
-
super(message, "TOKEN_MALFORMED", details);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.InvalidTokenFormatError = InvalidTokenFormatError;
|
|
50
|
-
/** Firma inválida (no coincide con datos/clave) */
|
|
51
|
-
class InvalidSignatureError extends AuthDomainError {
|
|
52
|
-
constructor(message = "Invalid token signature", details) {
|
|
53
|
-
super(message, "SIGNATURE_INVALID", details);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.InvalidSignatureError = InvalidSignatureError;
|
|
57
|
-
/** Algoritmo no soportado por la librería/política */
|
|
58
|
-
class UnsupportedAlgorithmError extends AuthDomainError {
|
|
59
|
-
constructor(message = "Unsupported algorithm", details) {
|
|
60
|
-
super(message, "ALGORITHM_UNSUPPORTED", details);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.UnsupportedAlgorithmError = UnsupportedAlgorithmError;
|
|
64
|
-
/** No se pudo resolver/obtener la clave necesaria (kid, store…) */
|
|
65
|
-
class KeyNotFoundError extends AuthDomainError {
|
|
66
|
-
constructor(message = "Signing/verification key not found", details) {
|
|
67
|
-
super(message, "KEY_NOT_FOUND", details);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.KeyNotFoundError = KeyNotFoundError;
|
|
71
|
-
/** La clave encontrada no corresponde (key-id/alg desalineado, par incorrecto) */
|
|
72
|
-
class KeyMismatchError extends AuthDomainError {
|
|
73
|
-
constructor(message = "Key does not match token/algorithm", details) {
|
|
74
|
-
super(message, "KEY_MISMATCH", details);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.KeyMismatchError = KeyMismatchError;
|
|
78
|
-
/** Token revocado en listas de deny/blacklist */
|
|
79
|
-
class TokenRevokedError extends AuthDomainError {
|
|
80
|
-
constructor(message = "Token has been revoked", details) {
|
|
81
|
-
super(message, "TOKEN_REVOKED", details);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.TokenRevokedError = TokenRevokedError;
|
|
85
|
-
/** Desfase de reloj detectado (leeway insuficiente) */
|
|
86
|
-
class ClockSkewError extends AuthDomainError {
|
|
87
|
-
constructor(message = "Clock skew detected", details) {
|
|
88
|
-
super(message, "CLOCK_SKEW", details);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.ClockSkewError = ClockSkewError;
|
|
92
|
-
/** Claims inválidas a nivel semántico (aud, iss, scope, custom…) */
|
|
93
|
-
class ClaimsValidationError extends AuthDomainError {
|
|
94
|
-
constructor(issues, message = "Invalid token claims") {
|
|
95
|
-
super(message, "CLAIMS_VALIDATION_ERROR", { issues });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.ClaimsValidationError = ClaimsValidationError;
|
|
99
|
-
/** Falla general de autenticación (catch-all) */
|
|
100
|
-
class AuthenticationError extends AuthDomainError {
|
|
101
|
-
constructor(message = "Authentication failed", details) {
|
|
102
|
-
super(message, "AUTHENTICATION_FAILED", details);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.AuthenticationError = AuthenticationError;
|
|
106
|
-
/** Alias histórico si lo usabas antes */
|
|
107
|
-
class InvalidTokenError extends AuthenticationError {
|
|
108
|
-
constructor(message = "Invalid token", details) {
|
|
109
|
-
super(message, details);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
exports.InvalidTokenError = InvalidTokenError;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// // Impone reglas para las contraseñas
|
|
3
|
-
// export interface IPasswordPolicyConfig {
|
|
4
|
-
// minLength: number;
|
|
5
|
-
// maxLength: number;
|
|
6
|
-
// requireUppercase: boolean;
|
|
7
|
-
// requireLowercase: boolean;
|
|
8
|
-
// requireNumbers: boolean;
|
|
9
|
-
// requireSpecialChars: boolean;
|
|
10
|
-
// }
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AnyAlgorithm } from "src/shared";
|
|
2
|
-
export interface IAuthConfig {
|
|
3
|
-
jwt: {
|
|
4
|
-
accessTokenSecret: string;
|
|
5
|
-
refreshTokenSecret: string;
|
|
6
|
-
accessTokenExpirationMs: number;
|
|
7
|
-
refreshTokenExpirationMs: number;
|
|
8
|
-
accessTokenExpiration?: string;
|
|
9
|
-
refreshTokenExpiration?: string;
|
|
10
|
-
};
|
|
11
|
-
bcrypt: {
|
|
12
|
-
saltRounds: number;
|
|
13
|
-
};
|
|
14
|
-
info: {
|
|
15
|
-
audience?: string;
|
|
16
|
-
issuer?: string;
|
|
17
|
-
};
|
|
18
|
-
algorithm: AnyAlgorithm;
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from "./auth/password-hasher";
|
|
2
|
-
export * from "./auth/password-policy.port";
|
|
3
|
-
export * from "./config/auth-config.port";
|
|
4
|
-
export * from "./jwt/factory/signature-strategy-factory.port";
|
|
5
|
-
export * from "./jwt/payload/jwt-payload.port";
|
|
6
|
-
export * from "./jwt/strategy/signature-strategy.port";
|
|
7
|
-
export * from "./repository";
|
|
8
|
-
export * from "./token/token-session.port";
|
|
9
|
-
export * from "./token/token.service.port";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./auth/password-hasher"), exports);
|
|
18
|
-
__exportStar(require("./auth/password-policy.port"), exports);
|
|
19
|
-
__exportStar(require("./config/auth-config.port"), exports);
|
|
20
|
-
__exportStar(require("./jwt/factory/signature-strategy-factory.port"), exports);
|
|
21
|
-
__exportStar(require("./jwt/payload/jwt-payload.port"), exports);
|
|
22
|
-
__exportStar(require("./jwt/strategy/signature-strategy.port"), exports);
|
|
23
|
-
__exportStar(require("./repository"), exports);
|
|
24
|
-
__exportStar(require("./token/token-session.port"), exports);
|
|
25
|
-
__exportStar(require("./token/token.service.port"), exports);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ISignatureStrategy } from "../..";
|
|
2
|
-
import { AlgorithmName } from "../../../../shared";
|
|
3
|
-
export interface ISignatureStrategyFactory {
|
|
4
|
-
/**
|
|
5
|
-
* Devuelve una estrategia capaz de firmar/verificar con el algoritmo dado.
|
|
6
|
-
* Debe lanzar si el algoritmo no es soportado.
|
|
7
|
-
*/
|
|
8
|
-
create(alg: AlgorithmName): ISignatureStrategy;
|
|
9
|
-
/**
|
|
10
|
-
* (Opcional, útil para validaciones/feature flags)
|
|
11
|
-
* Lista de algoritmos soportados por la implementación.
|
|
12
|
-
*/
|
|
13
|
-
supported(): ReadonlyArray<AlgorithmName>;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ISignatureStrategy } from "..";
|
|
2
|
-
import { AlgorithmName } from "../../../shared";
|
|
3
|
-
export interface ISignatureStrategyFactory {
|
|
4
|
-
/**
|
|
5
|
-
* Devuelve una estrategia capaz de firmar/verificar con el algoritmo dado.
|
|
6
|
-
* Debe lanzar si el algoritmo no es soportado.
|
|
7
|
-
*/
|
|
8
|
-
create(alg: AlgorithmName): ISignatureStrategy;
|
|
9
|
-
/**
|
|
10
|
-
* (Opcional, útil para validaciones/feature flags)
|
|
11
|
-
* Lista de algoritmos soportados por la implementación.
|
|
12
|
-
*/
|
|
13
|
-
supported(): ReadonlyArray<AlgorithmName>;
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*Esta interfaz implementa el patrón Strategy para el manejo de firmas digitales en JWT.
|
|
3
|
-
*Define un contrato común para todas las estrategias de firma digital, permitiendo que diferentes
|
|
4
|
-
*algoritmos de firma (HMAC, RSA, ECDSA) sean intercambiables de manera transparente.
|
|
5
|
-
*/
|
|
6
|
-
export interface SignatureStrategy {
|
|
7
|
-
/**
|
|
8
|
-
*Firma digitalmente los datos usando la clave proporcionada
|
|
9
|
-
*Retorna la firma digital como string codificado
|
|
10
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
11
|
-
* @param key La clave para firmar (secreta para HMAC, privada para RSA/ECDSA)
|
|
12
|
-
* @returns La firma digital como string codificado
|
|
13
|
-
*/
|
|
14
|
-
sign(data: string, key: string): string;
|
|
15
|
-
/**
|
|
16
|
-
*Verifica si una firma es válida para los datos dados
|
|
17
|
-
*Retorna true si la firma es válida, false si no
|
|
18
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
19
|
-
* @param signature La firma digital a verificar
|
|
20
|
-
* @param key La clave para verificar (secreta para HMAC, pública para RSA/ECDSA)
|
|
21
|
-
* @returns true si la firma es válida, false si no
|
|
22
|
-
*/
|
|
23
|
-
verify(data: string, signature: string, key: string): boolean;
|
|
24
|
-
/**
|
|
25
|
-
*Identifica qué algoritmo soporta esta estrategia específica
|
|
26
|
-
*El nombre del algoritmo (ej: 'HS256', 'RS256', 'ES256')
|
|
27
|
-
* @returns El nombre del algoritmo soportado
|
|
28
|
-
*/
|
|
29
|
-
getSupportedAlgorithm(): string;
|
|
30
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { AlgorithmName } from "../../../shared";
|
|
2
|
-
/**
|
|
3
|
-
*Esta interfaz implementa el patrón Strategy para el manejo de firmas digitales en JWT.
|
|
4
|
-
*Define un contrato común para todas las estrategias de firma digital, permitiendo que diferentes
|
|
5
|
-
*algoritmos de firma (HMAC, RSA, ECDSA) sean intercambiables de manera transparente.
|
|
6
|
-
*/
|
|
7
|
-
export interface ISignatureStrategy {
|
|
8
|
-
/**
|
|
9
|
-
*Firma digitalmente los datos usando la clave proporcionada
|
|
10
|
-
*Retorna la firma digital como string codificado
|
|
11
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
12
|
-
* @param key La clave para firmar (secreta para HMAC, privada para RSA/ECDSA)
|
|
13
|
-
* @returns La firma digital como string codificado
|
|
14
|
-
*/
|
|
15
|
-
sign(data: string, key: string): string;
|
|
16
|
-
/**
|
|
17
|
-
*Verifica si una firma es válida para los datos dados
|
|
18
|
-
*Retorna true si la firma es válida, false si no
|
|
19
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
20
|
-
* @param signature La firma digital a verificar
|
|
21
|
-
* @param key La clave para verificar (secreta para HMAC, pública para RSA/ECDSA)
|
|
22
|
-
* @returns true si la firma es válida, false si no
|
|
23
|
-
*/
|
|
24
|
-
verify(data: string, signature: string, key: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
*Identifica qué algoritmo soporta esta estrategia específica
|
|
27
|
-
*El nombre del algoritmo (ej: 'HS256', 'RS256', 'ES256')
|
|
28
|
-
* @returns El nombre del algoritmo soportado
|
|
29
|
-
*/
|
|
30
|
-
getSupportedAlgorithm(): AlgorithmName;
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { AlgorithmName } from "../../../../shared";
|
|
2
|
-
/**
|
|
3
|
-
*Esta interfaz implementa el patrón Strategy para el manejo de firmas digitales en JWT.
|
|
4
|
-
*Define un contrato común para todas las estrategias de firma digital, permitiendo que diferentes
|
|
5
|
-
*algoritmos de firma (HMAC, RSA, ECDSA) sean intercambiables de manera transparente.
|
|
6
|
-
*/
|
|
7
|
-
export interface ISignatureStrategy {
|
|
8
|
-
/**
|
|
9
|
-
*Firma digitalmente los datos usando la clave proporcionada
|
|
10
|
-
*Retorna la firma digital como string codificado
|
|
11
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
12
|
-
* @param key La clave para firmar (secreta para HMAC, privada para RSA/ECDSA)
|
|
13
|
-
* @returns La firma digital como string codificado
|
|
14
|
-
*/
|
|
15
|
-
sign(data: string, key: string): string;
|
|
16
|
-
/**
|
|
17
|
-
*Verifica si una firma es válida para los datos dados
|
|
18
|
-
*Retorna true si la firma es válida, false si no
|
|
19
|
-
* @param data Los datos a firmar (normalmente el header + payload del JWT)
|
|
20
|
-
* @param signature La firma digital a verificar
|
|
21
|
-
* @param key La clave para verificar (secreta para HMAC, pública para RSA/ECDSA)
|
|
22
|
-
* @returns true si la firma es válida, false si no
|
|
23
|
-
*/
|
|
24
|
-
verify(data: string, signature: string, key: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
*Identifica qué algoritmo soporta esta estrategia específica
|
|
27
|
-
*El nombre del algoritmo (ej: 'HS256', 'RS256', 'ES256')
|
|
28
|
-
* @returns El nombre del algoritmo soportado
|
|
29
|
-
*/
|
|
30
|
-
getSupportedAlgorithm(): AlgorithmName;
|
|
31
|
-
}
|
|
File without changes
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JwtUser } from ".";
|
|
2
|
-
import { JwtTokenServiceConfig } from "../../../shared";
|
|
3
|
-
export interface ICreatePayloadProps {
|
|
4
|
-
user: JwtUser;
|
|
5
|
-
expiresIn: string | undefined;
|
|
6
|
-
defaultExpirationMs: number;
|
|
7
|
-
customClaims?: Record<string, any>;
|
|
8
|
-
config: JwtTokenServiceConfig;
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { JwtUser } from ".";
|
|
2
|
-
import { JwtTokenServiceConfig } from "../../../shared";
|
|
3
|
-
export interface IGenerateTokenProps {
|
|
4
|
-
user: JwtUser;
|
|
5
|
-
expiresIn: string | undefined;
|
|
6
|
-
defaultExpirationMs: number;
|
|
7
|
-
secret: string;
|
|
8
|
-
config: JwtTokenServiceConfig;
|
|
9
|
-
customClaims?: Record<string, any>;
|
|
10
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./create-payload.props"), exports);
|
|
18
|
-
__exportStar(require("./generate-access-token.props"), exports);
|
|
19
|
-
__exportStar(require("./generate-refresh-token.props"), exports);
|
|
20
|
-
__exportStar(require("./generate-token.props"), exports);
|
|
21
|
-
__exportStar(require("./jwt-user"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IJWTPayload } from "../ports";
|
|
2
|
-
import { IGenerateAccessTokenProps, IGenerateRefreshTokenProps } from "../props";
|
|
3
|
-
export interface ITokenService {
|
|
4
|
-
generateAccessToken(props: IGenerateAccessTokenProps): Promise<string>;
|
|
5
|
-
generateRefreshToken(props: IGenerateRefreshTokenProps): Promise<string>;
|
|
6
|
-
verifyAccessToken(token: string): Promise<IJWTPayload>;
|
|
7
|
-
verifyRefreshToken(token: string): Promise<IJWTPayload>;
|
|
8
|
-
getTokenExpiration(token: string): Promise<Date>;
|
|
9
|
-
}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
export * from "./application";
|
|
2
|
-
export * from "./domain";
|
|
3
|
-
export * from "./infrastructure";
|
|
4
|
-
export * from "./shared";
|
|
5
|
-
/**
|
|
6
|
-
* Quick Start Example:
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import {
|
|
10
|
-
* AuthServiceFactory,
|
|
11
|
-
* IAuthConfig,
|
|
12
|
-
* InMemoryUserRepository,
|
|
13
|
-
* InMemoryCredentialRepository
|
|
14
|
-
* } from '@ml-dev-core/jwt.auth';
|
|
15
|
-
*
|
|
16
|
-
* const config: IAuthConfig = {
|
|
17
|
-
* jwt: {
|
|
18
|
-
* accessTokenSecret: 'your-secret',
|
|
19
|
-
* refreshTokenSecret: 'your-refresh-secret',
|
|
20
|
-
* accessTokenExpirationMs: 15 * 60 * 1000,
|
|
21
|
-
* refreshTokenExpirationMs: 7 * 24 * 60 * 60 * 1000,
|
|
22
|
-
* accessTokenExpiration: '15m',
|
|
23
|
-
* refreshTokenExpiration: '7d'
|
|
24
|
-
* },
|
|
25
|
-
* bcrypt: { saltRounds: 12 },
|
|
26
|
-
* algorithm: 'HS256',
|
|
27
|
-
* info: {
|
|
28
|
-
* issuer: 'your-app',
|
|
29
|
-
* audience: 'your-client'
|
|
30
|
-
* }
|
|
31
|
-
* };
|
|
32
|
-
*
|
|
33
|
-
* const authServices = AuthServiceFactory.create(
|
|
34
|
-
* config,
|
|
35
|
-
* new InMemoryUserRepository(),
|
|
36
|
-
* new InMemoryCredentialRepository()
|
|
37
|
-
* );
|
|
38
|
-
*
|
|
39
|
-
* // Use authServices.registerUserUseCase, loginWithPasswordUseCase, etc.
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* Quick Start Example:
|
|
44
|
-
*
|
|
45
|
-
* ```typescript
|
|
46
|
-
* import {
|
|
47
|
-
* AuthServiceFactory,
|
|
48
|
-
* IAuthConfig,
|
|
49
|
-
* InMemoryUserRepository,
|
|
50
|
-
* InMemoryCredentialRepository
|
|
51
|
-
* } from '@ml-dev-core/jwt.auth';
|
|
52
|
-
*
|
|
53
|
-
* const config: IAuthConfig = {
|
|
54
|
-
* jwt: {
|
|
55
|
-
* accessTokenSecret: 'your-secret',
|
|
56
|
-
* refreshTokenSecret: 'your-refresh-secret',
|
|
57
|
-
* accessTokenExpirationMs: 15 * 60 * 1000,
|
|
58
|
-
* refreshTokenExpirationMs: 7 * 24 * 60 * 60 * 1000,
|
|
59
|
-
* accessTokenExpiration: '15m',
|
|
60
|
-
* refreshTokenExpiration: '7d'
|
|
61
|
-
* },
|
|
62
|
-
* bcrypt: { saltRounds: 12 },
|
|
63
|
-
* algorithm: 'HS256',
|
|
64
|
-
* info: {
|
|
65
|
-
* issuer: 'your-app',
|
|
66
|
-
* audience: 'your-client'
|
|
67
|
-
* }
|
|
68
|
-
* };
|
|
69
|
-
*
|
|
70
|
-
* const authServices = AuthServiceFactory.create(
|
|
71
|
-
* config,
|
|
72
|
-
* new InMemoryUserRepository(),
|
|
73
|
-
* new InMemoryCredentialRepository()
|
|
74
|
-
* );
|
|
75
|
-
*
|
|
76
|
-
* // Use authServices.registerUserUseCase, loginWithPasswordUseCase, etc.
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
package/dist/src/index.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./application"), exports);
|
|
18
|
-
__exportStar(require("./domain"), exports);
|
|
19
|
-
__exportStar(require("./infrastructure"), exports);
|
|
20
|
-
__exportStar(require("./shared"), exports);
|
|
21
|
-
/**
|
|
22
|
-
* Quick Start Example:
|
|
23
|
-
*
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import {
|
|
26
|
-
* AuthServiceFactory,
|
|
27
|
-
* IAuthConfig,
|
|
28
|
-
* InMemoryUserRepository,
|
|
29
|
-
* InMemoryCredentialRepository
|
|
30
|
-
* } from '@ml-dev-core/jwt.auth';
|
|
31
|
-
*
|
|
32
|
-
* const config: IAuthConfig = {
|
|
33
|
-
* jwt: {
|
|
34
|
-
* accessTokenSecret: 'your-secret',
|
|
35
|
-
* refreshTokenSecret: 'your-refresh-secret',
|
|
36
|
-
* accessTokenExpirationMs: 15 * 60 * 1000,
|
|
37
|
-
* refreshTokenExpirationMs: 7 * 24 * 60 * 60 * 1000,
|
|
38
|
-
* accessTokenExpiration: '15m',
|
|
39
|
-
* refreshTokenExpiration: '7d'
|
|
40
|
-
* },
|
|
41
|
-
* bcrypt: { saltRounds: 12 },
|
|
42
|
-
* algorithm: 'HS256',
|
|
43
|
-
* info: {
|
|
44
|
-
* issuer: 'your-app',
|
|
45
|
-
* audience: 'your-client'
|
|
46
|
-
* }
|
|
47
|
-
* };
|
|
48
|
-
*
|
|
49
|
-
* const authServices = AuthServiceFactory.create(
|
|
50
|
-
* config,
|
|
51
|
-
* new InMemoryUserRepository(),
|
|
52
|
-
* new InMemoryCredentialRepository()
|
|
53
|
-
* );
|
|
54
|
-
*
|
|
55
|
-
* // Use authServices.registerUserUseCase, loginWithPasswordUseCase, etc.
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
/**
|
|
59
|
-
* Quick Start Example:
|
|
60
|
-
*
|
|
61
|
-
* ```typescript
|
|
62
|
-
* import {
|
|
63
|
-
* AuthServiceFactory,
|
|
64
|
-
* IAuthConfig,
|
|
65
|
-
* InMemoryUserRepository,
|
|
66
|
-
* InMemoryCredentialRepository
|
|
67
|
-
* } from '@ml-dev-core/jwt.auth';
|
|
68
|
-
*
|
|
69
|
-
* const config: IAuthConfig = {
|
|
70
|
-
* jwt: {
|
|
71
|
-
* accessTokenSecret: 'your-secret',
|
|
72
|
-
* refreshTokenSecret: 'your-refresh-secret',
|
|
73
|
-
* accessTokenExpirationMs: 15 * 60 * 1000,
|
|
74
|
-
* refreshTokenExpirationMs: 7 * 24 * 60 * 60 * 1000,
|
|
75
|
-
* accessTokenExpiration: '15m',
|
|
76
|
-
* refreshTokenExpiration: '7d'
|
|
77
|
-
* },
|
|
78
|
-
* bcrypt: { saltRounds: 12 },
|
|
79
|
-
* algorithm: 'HS256',
|
|
80
|
-
* info: {
|
|
81
|
-
* issuer: 'your-app',
|
|
82
|
-
* audience: 'your-client'
|
|
83
|
-
* }
|
|
84
|
-
* };
|
|
85
|
-
*
|
|
86
|
-
* const authServices = AuthServiceFactory.create(
|
|
87
|
-
* config,
|
|
88
|
-
* new InMemoryUserRepository(),
|
|
89
|
-
* new InMemoryCredentialRepository()
|
|
90
|
-
* );
|
|
91
|
-
*
|
|
92
|
-
* // Use authServices.registerUserUseCase, loginWithPasswordUseCase, etc.
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./jwt"), exports);
|
|
18
|
-
__exportStar(require("./repositories"), exports);
|
|
19
|
-
__exportStar(require("./security"), exports);
|
|
20
|
-
__exportStar(require("./services"), exports);
|
|
21
|
-
__exportStar(require("./types"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./signature-strategy.factory";
|