ldap-passwords
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -5,2 +5,5 @@ import { md5, verifyMD5 } from 'ldap-md5'; | ||
export { md5, verifyMD5, ssha, verifySSHA, sha512Crypt, verifySha512 }; | ||
export function ldapVerifyAll(textPassword, hashedPassword) { | ||
return verifyMD5(textPassword, hashedPassword) || verifySSHA(textPassword, hashedPassword) || verifySha512(textPassword, hashedPassword); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ldap-passwords", | ||
"type": "module", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "ldap-passwords offers secure password hashing and verification using LDAP password algorithms.", | ||
@@ -28,2 +28,3 @@ "author": { | ||
"build": "tsc", | ||
"test": "tsc && vitest run", | ||
"lint": "eslint .", | ||
@@ -42,8 +43,9 @@ "lint:fix": "eslint . --fix", | ||
"@antfu/eslint-config": "^2.6.3", | ||
"@types/node": "^20.11.5", | ||
"@types/node": "^20.11.6", | ||
"@vercel/analytics": "^1.1.2", | ||
"eslint": "^8.56.0", | ||
"typescript": "^5.3.3", | ||
"vitepress": "1.0.0-rc.39" | ||
"vitepress": "1.0.0-rc.40", | ||
"vitest": "^1.2.1" | ||
} | ||
} |
@@ -1,91 +0,18 @@ | ||
/** | ||
* @function | ||
* Encrypt a plain text password with the Ldap MD5 algorithm. | ||
* Keep in mind that MD5 is not considered a secure hashing algorithm for storing passwords, as it is vulnerable to various attacks. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @returns {string} - Encrypted password with the Ldap MD5 algorithm. | ||
* | ||
* | ||
* @example | ||
* const encryptedPassword = md5('mySuperSecretPassword') | ||
* // return {MD5}aTVgaG9NWR2N1eNABkQgYQ== | ||
* | ||
*/ | ||
export declare function md5(textPassword: string): string | ||
import type { md5, verifyMD5 } from 'ldap-md5/types/index' | ||
import type { ssha, verifySSHA } from 'ldap-sha/types/index' | ||
import type { sha512Crypt, verifySha512 } from 'ldap-sha512/types/index' | ||
/** | ||
* @function | ||
* Verify passwords encrypted with MD5. | ||
* Keep in mind that MD5 is not considered a secure hashing algorithm for storing passwords, as it is vulnerable to various attacks. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @param {string | string[]} md5Password - String or Array of strings to be compared to the plain text password. | ||
* | ||
* @example | ||
* const isValid = verifyMD5('mySuperSecretPassword', arrayOfMD5Passwords) | ||
* // return true or false | ||
*/ | ||
export declare function verifyMD5(textPassword: string, md5Password: string | string[]): boolean | ||
export { md5, verifyMD5, ssha, verifySSHA, sha512Crypt, verifySha512 } | ||
/** | ||
* @function | ||
* Encrypt a plain text password with the Ldap SSHA algorithm. | ||
* Verify passwords encrypted with MD5, SSHA or SHA512 CRYPT. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @returns {string} - Encrypted password with the Ldap SSHA algorithm. | ||
* @param {string | string[]} hashedPassword - String or Array of strings to be compared to the plain text password. | ||
* | ||
* | ||
* @example | ||
* const encryptedPassword = ssha('mySuperSecretPassword') | ||
* // return {SSHA}sTIysPunEI4boe6OwgQO+/tRZao2OWJIbDMvY0g2UlM= | ||
* | ||
*/ | ||
export declare function ssha(textPassword: string): string | ||
/** | ||
* @function | ||
* Verify passwords encrypted with SSHA. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @param {string | string[]} sshaPassword - String or Array of strings to be compared to the plain text password. | ||
* | ||
* @example | ||
* const isValid = verifySSHA('mySuperSecretPassword', arrayOfSSHAPasswords) | ||
* const isValid = ldapVerifyAll('mySuperSecretPassword', arrayOfHashedPasswords) | ||
* // return true or false | ||
*/ | ||
export declare function verifySSHA(textPassword: string, sshaPassword: string | string[]): boolean | ||
/** | ||
* @function | ||
* Encrypt a plain text password with the Ldap sha512crypt algorithm. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @param {string} salt - Salt used to hash the password (it can't be greater than 16 characters). | ||
* @returns {string} - Encrypted password with the Ldap sha512crypt algorithm. | ||
* | ||
* @throws {Error} If salt length is greater than 16. | ||
* | ||
* @example | ||
* const encryptedPassword = sha512Crypt('mySuperSecretPassword') | ||
* // return {CRYPT}$6$NQgPVC0up/oNVCb4$Aduz92Zfo/PFDE/XhvA3QmSqHquqdNiCdZvc9N5/UTpEUepMdd/6Mq/TeoM07wvyxHpg8ELGVzTWZt2e7Z9LY/ | ||
* | ||
* // OR | ||
* | ||
* const encryptedPassword = sha512Crypt('mySuperSecretPassword', 'myDopeCustomSalt') | ||
* // return {CRYPT}$6$myDopeCustomSalt$4ENRn.vwcs09z0fjr6Jt3NMOFVkn.p9v7ilDcK/CwRnQm48Y5HawkiGivh4gBTLwSY4SQNfCAe05E1nCTpZ0u. | ||
*/ | ||
export declare function sha512Crypt(textPassword: string, salt?: string): string | ||
/** | ||
* @function | ||
* Verify passwords encrypted with sha512. | ||
* | ||
* @param {string} textPassword - Plain text password. | ||
* @param {string | string[]} sha512Password - String or Array of strings to be compared to the plain text password. | ||
* | ||
* @example | ||
* const isValid = verifySha512('mySuperSecretPassword', arrayOfSha512Passwords) | ||
* // return true or false | ||
*/ | ||
export declare function verifySha512(textPassword: string, sha512Password: string | string[]): boolean | ||
export declare function ldapVerifyAll(textPassword: string, hashedPassword: string | string[]): boolean |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
275746
7
240