LambdAuth
LambdAuth copied to clipboard
digest string in crypto.pbkdf2
I notice an error using the: LambdAuthCreateUser
this piece of code:
crypto.pbkdf2(password, salt, iterations, len, function(err, derivedKey) { if (err) return fn(err); fn(null, salt, derivedKey.toString('base64')); });
don't work if I don't add after len a digest string, for example null
crypto.pbkdf2(password, salt, iterations, len, null, function(err, derivedKey) { if (err) return fn(err); fn(null, salt, derivedKey.toString('base64')); });
Is it just my problem?
According the Nodejs documentation for pbkdf2 function:
crypto.pbkdf2(password, salt, iterations, keylen, digest, callback) [...] If digest is null, 'sha1' will be used. This behavior is deprecated, please specify a digest explicitly.
So, I think the problem is that init.sh is specifying an old version of Nodejs and in new versions they changed the signature of pbkdf2
function.
https://github.com/danilop/LambdAuth/blob/ef2e82854f66fde2279fb3200cb655c875623180/init.sh#L140-L145