You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var crypto = require('crypto');
var otp = require('otp')({
secret: crypto.randomBytes(256);
});
console.log(otp.hotp());
throws the following error
/Users/detj/tmp/plivo-try/node_modules/otp/node_modules/thirty-two/lib/thirty-two/thirty-two.js:121
throw new Error('Invalid input - it is not base32 encoded string');
^
Error: Invalid input - it is not base32 encoded string
at Object.exports.decode (plivo-try/node_modules/otp/node_modules/thirty-two/lib/thirty-two/thirty-two.js:121:16)
at OTP.hotp (plivo-try/node_modules/otp/otp.js:65:58)
at Object.<anonymous> (/Users/detj/tmp/plivo-try/otp.js:20:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Tried with node 0.12.2 and node 0.10.38
The text was updated successfully, but these errors were encountered:
detj
changed the title
Throws error is buffer is passed in secret
Throws error if buffer is passed in secret
Apr 22, 2015
Sorry for the late response. The reason for this is because passing in a buffer is in fact invalid.
This requires not a buffer, but rather a bas32 encoded string. If you want to generate a new secret, all you have to do is not pass it in during creation and it will then be available on the istance as secret.
var otp = require('otp')({});
console.log('Secret: ', otp.secret)
Passing buffer in
secret
doesn't workthrows the following error
Tried with node 0.12.2 and node 0.10.38
The text was updated successfully, but these errors were encountered: