npm i google_authenticator --save
var googleAuth=require('google_authenticator').authenticator;
var nya=new googleAuth();
The main class.
- codeLength:optional,the length of the verifiction code,defaults to 6.
To create a random secret string.
return the secret string.
- secretLength:optional,the length of the secret string,defaults to 16。
get the code
return a string of code consists by numbers.
- secret:the secret string.
- timeSlice:optional,specifies the time slice.
verify the code.
if verified,return true,otherwise return false.
- secret:the secret string.
- code:the verifiction code.
- discrepancy:the allowed time discrepancy.
- currentTimeSlice:you know.
get the QR code raw text
- name:the name to display in the GoogleAuthenticator client.
- secret:the secret string.
- title:optional,I can't find if this is displayed anywhere.....
get the QR code image using google api.
return the url of the QR image.