@casual-simulation/crypto
Advanced tools
Comparing version 3.2.7 to 3.3.8-alpha.10146812598
@@ -33,2 +33,4 @@ /// <reference types="node" /> | ||
* Hashes the given password using the given salt and returns the resulting base64 encoded hash. | ||
* Should only be used for low-entropy passwords like 5-digit codes or passwords that were generated by a user themselves. | ||
* For high-entropy passwords, use hashHighEntropyPasswordWithSalt(). | ||
* | ||
@@ -39,7 +41,7 @@ * Returns a V1 hash that indicates that scrypt was used for the hashing process. | ||
*/ | ||
export declare function hashPasswordWithSalt(password: string, salt: string): string; | ||
export declare function hashLowEntropyPasswordWithSalt(password: string, salt: string): string; | ||
/** | ||
* Hashes the given password with the given salt using HMAC-SHA-256 and returns the resulting base64 encoded hash. | ||
* This function is designed for high-entropy passwords (at least 128 bits of unguessable information) and is not designed | ||
* for regular passwords. Use hashPasswordWithSalt() for regular low-entropy passwords. | ||
* for regular passwords. Use hashLowEntropyPasswordWithSalt() for regular low-entropy passwords. | ||
* | ||
@@ -55,5 +57,5 @@ * Returns a V2 hash that indicates that HMAC-SHA-256 was used for the hashing process. | ||
* @param salt The base64 encoded salt to use for the password. | ||
* @param hashes The hashes that they should match. These hashes should have been produced by hashPasswordWithSalt(). | ||
* @param hashes The hashes that they should match. These hashes should have been produced by hashLowEntropyPasswordWithSalt(). | ||
*/ | ||
export declare function verifyPasswordAgainstHashes(password: string, salt: string, hashes: string[]): boolean; | ||
//# sourceMappingURL=HashHelpers.d.ts.map |
@@ -86,2 +86,4 @@ import { hmac, sha256 } from 'hash.js'; | ||
* Hashes the given password using the given salt and returns the resulting base64 encoded hash. | ||
* Should only be used for low-entropy passwords like 5-digit codes or passwords that were generated by a user themselves. | ||
* For high-entropy passwords, use hashHighEntropyPasswordWithSalt(). | ||
* | ||
@@ -92,3 +94,3 @@ * Returns a V1 hash that indicates that scrypt was used for the hashing process. | ||
*/ | ||
export function hashPasswordWithSalt(password, salt) { | ||
export function hashLowEntropyPasswordWithSalt(password, salt) { | ||
if (!password) { | ||
@@ -109,3 +111,3 @@ throw new Error('Invalid password. Must not be null or undefined.'); | ||
* This function is designed for high-entropy passwords (at least 128 bits of unguessable information) and is not designed | ||
* for regular passwords. Use hashPasswordWithSalt() for regular low-entropy passwords. | ||
* for regular passwords. Use hashLowEntropyPasswordWithSalt() for regular low-entropy passwords. | ||
* | ||
@@ -135,3 +137,3 @@ * Returns a V2 hash that indicates that HMAC-SHA-256 was used for the hashing process. | ||
* @param salt The base64 encoded salt to use for the password. | ||
* @param hashes The hashes that they should match. These hashes should have been produced by hashPasswordWithSalt(). | ||
* @param hashes The hashes that they should match. These hashes should have been produced by hashLowEntropyPasswordWithSalt(). | ||
*/ | ||
@@ -138,0 +140,0 @@ export function verifyPasswordAgainstHashes(password, salt, hashes) { |
{ | ||
"name": "@casual-simulation/crypto", | ||
"version": "3.2.7", | ||
"version": "3.3.8-alpha.10146812598", | ||
"description": "Crypto helpers used by AUX", | ||
@@ -50,3 +50,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "90cad6020f3b60f67771679be4c01fa439faaa12" | ||
"gitHead": "fa305e70ffae2a7db952ef49002955d89d58cb46" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82691
1384
1