Remove js-sha512

pull/1033/head
Mikunj 5 years ago
parent 1cadb01e8d
commit b38c666e95

@ -1,4 +1,4 @@
const { sha512 } = require('js-sha512');
const crypto = require('crypto');
const ERRORS = {
TYPE: 'Password must be a string',
@ -6,6 +6,12 @@ const ERRORS = {
CHARACTER: 'Password must only contain letters, numbers and symbols',
};
const sha512 = text => {
const hash = crypto.createHash('sha512');
hash.update(text.trim());
return hash.digest('hex');
};
const generateHash = phrase => phrase && sha512(phrase.trim());
const matchesHash = (phrase, hash) =>
phrase && sha512(phrase.trim()) === hash.trim();
@ -29,6 +35,7 @@ const validatePassword = (phrase, i18n) => {
return null;
};
module.exports = {
generateHash,
matchesHash,

@ -84,7 +84,6 @@
"glob": "7.1.2",
"he": "1.2.0",
"jquery": "3.3.1",
"js-sha512": "0.8.0",
"js-yaml": "3.13.0",
"jsbn": "1.1.0",
"linkify-it": "2.0.3",

@ -5558,11 +5558,6 @@ js-base64@^2.1.8, js-base64@^2.1.9:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.2.tgz#313b6274dda718f714d00b3330bbae6e38e90209"
integrity sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==
js-sha512@0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.8.0.tgz#dd22db8d02756faccf19f218e3ed61ec8249f7d4"
integrity sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==
"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

Loading…
Cancel
Save