Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadnasriya committed Oct 1, 2024
1 parent 63a80c3 commit 7671821
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nasriya/authcrypto",
"version": "1.1.1",
"version": "1.1.2",
"description": "AuthCrypto is a versatile cryptographic toolkit for handling JSON Web Tokens (JWT), password hashing, and secure token generation and verification. It provides robust methods for creating and managing JWTs, hashing and verifying passwords with secure algorithms, and generating cryptographically strong random values for various use cases.",
"main": "./dist/cjs/manager.js",
"module": "./dist/esm/manager.js",
Expand Down
6 changes: 3 additions & 3 deletions src/assets/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class ConfigManager {
set maxPasswordLength(max: number) {
if (!Number.isInteger(max)) { throw new TypeError('The max password length must be a valid number and cannot be greater than 32') }
if (max < 8) { throw new RangeError('The max password length cannot be less than 8') }
if (this.minPasswordLength && max > this.minPasswordLength) { throw new RangeError('The max password length cannot be greater than the min password length') }
if (this.minPasswordLength && max < this.minPasswordLength) { throw new RangeError('The max password length cannot be less than the min password length') }
process.env.AuthCrypto_PASSWORDS_MAX = max.toString();
}

Expand Down Expand Up @@ -135,9 +135,9 @@ class ConfigManager {
if (typeof secret !== 'string') { throw new TypeError('The JWT secret must be a string') }

const keyBytes = Buffer.byteLength(secret, 'utf8');
if (keyBytes < 64) { throw new Error(`The "AuthCrypto_JWT_SECRET" key must be at least 64 bytes long for HS512. Found: ${keyBytes} bytes.`); }
if (keyBytes < 64) { throw new Error(`The "AuthCrypto_SECRET" key must be at least 64 bytes long for HS512. Found: ${keyBytes} bytes.`); }

process.env.AuthCrypto_JWT_SECRET = secret;
process.env.AuthCrypto_SECRET = secret;
}

/**
Expand Down

0 comments on commit 7671821

Please sign in to comment.