Skip to content

Commit 66537fb

Browse files
authored
Merge pull request #35 from silinternational/develop
Release 2.0.1
2 parents c798e2a + 66e0942 commit 66537fb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

api.raml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,15 @@ protocols: [HTTPS]
160160
example: |
161161
{"code": "012345"}
162162
responses:
163-
204:
163+
200:
164+
description: |
165+
The given TOTP code was valid.
164166
400:
165167
description: |
166-
The request body was invlalid, such as if no `code` value was found.
168+
The request body was invalid, such as if no `code` value was found.
167169
401:
170+
description: |
171+
The given TOTP code was wrong.
168172
404:
169173

170174
/u2f:

models/totp.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ module.exports.create = (apiKeyValue, apiSecret, {issuer, label = 'SecretKey'} =
2020

2121
const otpSecrets = speakeasy.generateSecret({length: 10});
2222
let otpAuthUrlOptions = {
23-
'label': label,
23+
'label': encodeURIComponent(label),
2424
'secret': otpSecrets.base32,
2525
'encoding': 'base32'
2626
};
2727
if (issuer) {
2828
otpAuthUrlOptions.issuer = issuer;
29-
otpAuthUrlOptions.label = issuer + ':' + label;
29+
30+
// Note: The issuer and account-name used in the `label` need to be
31+
// URL-encoded. Presumably speakeasy doesn't automatically do so because
32+
// the colon (:) separating them needs to NOT be encoded.
33+
otpAuthUrlOptions.label = encodeURIComponent(issuer) + ':' + encodeURIComponent(label);
3034
}
3135

3236
const otpAuthUrl = speakeasy.otpauthURL(otpAuthUrlOptions);

0 commit comments

Comments
 (0)