Skip to content

Commit

Permalink
fix: upgrade to @otplib/core 12 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and bcoe committed Jan 11, 2020
1 parent 0371d6a commit ff7484a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
18 changes: 5 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"dependencies": {
"@google-cloud/datastore": "^5.0.3",
"@npm/types": "^1.0.1",
"@otplib/core": "^12.0.0",
"cookie-session": "^2.0.0-beta.3",
"dotenv": "^8.0.0",
"express": "^4.16.4",
Expand All @@ -61,7 +62,6 @@
"is-uuid": "^1.0.2",
"morgan": "^1.9.1",
"octonode": "^0.9.5",
"otplib": "^10.0.1",
"request": "^2.88.0",
"source-map-support": "^0.5.9",
"uuid": "^3.3.2",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/totp-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

import * as crypto from 'crypto';
import * as otplib from 'otplib';
import {Authenticator} from '@otplib/core';

export const totpCode = (secret: string, epoch?: number) => {
if (epoch) epoch = epoch / 1000;
const authen = new otplib.authenticator.Authenticator();
const authen = new Authenticator();
authen.options = {epoch, crypto};
return authen.generate(secret);
};

0 comments on commit ff7484a

Please sign in to comment.