Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return await new Promise((resolveFunction, rejectFunction) => {
pbkdf2(password, salt, iterations, length, algo, (error, response) => {
if (error) {
rejectFunction(error)
}
resolveFunction(response)
})
})
}
return new Promise((resolve, reject) => {
pbkdf2(secret, salt, iterations, keylen, digest, (err: any, derivedKey: any) => {
if (err) {
reject(err);
} else {
resolve(new Uint8Array(derivedKey));
}
});
});
}
return new Promise((resolve, reject) => {
pbkdf2Js.pbkdf2(
password,
salt,
iterations,
keylen,
digest,
(err, result) => {
if (err) {
reject(err);
return;
}
resolve(result);
}
);
});
}
return new Promise((resolve, reject) => {
pbkdf2(password, salt, iterations, keylen, digest, (err: any, res: any) => {
if (err) {
reject(err);
} else {
resolve(res);
}
});
});
}
return new Promise((resolve, reject) => {
deriveKey(
password,
salt,
rounds,
bits / 8,
DERIVED_KEY_ALGORITHM,
(err?: Error, key?: Buffer) => {
if (err) {
return reject(err);
}
return resolve(key);
}
);
});
}
return new Promise((resolve, reject) => {
pbkdf2Lib.pbkdf2(password, salt, iterations, dklen, 'sha256', (err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
}
return new Promise(function (resolve, reject) {
_pbkdf2.pbkdf2(password, salt, round, keyLength,
(err, derivedKey)=> {
if (err) reject(err);
else resolve(derivedKey);
}
)
});
}