Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
Conflicts:
	test/generate.js
  • Loading branch information
railsstudent committed Jan 20, 2017
2 parents bcf6dd4 + 2adce34 commit 5acafbe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ Authenticator URL to obtain a QR code you can scan into the app.
| [options.name] | <code>String</code> | | The name to use with Google Authenticator. |
| [options.qr_codes] | <code>Boolean</code> | <code>false</code> | (DEPRECATED. Do not use to prevent leaking of secret to a third party. Use your own QR code implementation.) Output QR code URLs for the token. |
| [options.google_auth_qr] | <code>Boolean</code> | <code>false</code> | (DEPRECATED. Do not use to prevent leaking of secret to a third party. Use your own QR code implementation.) Output a Google Authenticator otpauth:// QR code URL. |
| [options.issuer] | <code>String</code> | | The provider or service with which the secret key is associated. |

<a name="generateSecretASCII"></a>
### generateSecretASCII([length], [symbols]) ⇒ <code>String</code>
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ exports.totp.verify = function totpVerify (options) {
* @param {Boolean} [options.google_auth_qr=false] (DEPRECATED. Do not use to
* prevent leaking of secret to a third party. Use your own QR code
* implementation.) Output a Google Authenticator otpauth:// QR code URL.
* @param {String} [options.issuer=''] The provider or service with which the
* secret key is associated.
* @return {Object}
* @return {GeneratedSecret} The generated secret key.
*/
Expand All @@ -484,6 +486,7 @@ exports.generateSecret = function generateSecret (options) {
var google_auth_qr = options.google_auth_qr || false;
var otpauth_url = options.otpauth_url != null ? options.otpauth_url : true;
var symbols = true;
var issuer = options.issuer;

// turn off symbols only when explicity told to
if (options.symbols !== undefined && options.symbols === false) {
Expand Down Expand Up @@ -511,7 +514,8 @@ exports.generateSecret = function generateSecret (options) {
if (otpauth_url) {
SecretKey.otpauth_url = exports.otpauthURL({
secret: SecretKey.ascii,
label: name
label: name,
issuer: issuer
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Generator tests', function () {
var secret = new Buffer(answer.ascii, 'ascii');
if (Buffer.isBuffer(secret)) secret = base32.encode(secret);

var expect = 'otpauth://totp/Example%3Aalice%40google.com?secret=' + secret + '&issuer=issuer%20name&algorithm=SHA1&digits=6&period=30';
var expect = 'otpauth://totp/Example%3Aalice%40google.com?secret=' + secret + '&issuer=issuer%20name';
assert.deepEqual(
answer.otpauth_url,
expect
Expand Down

0 comments on commit 5acafbe

Please sign in to comment.