Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
7heMech committed May 5, 2024
1 parent e5f454f commit 1a17c9f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class TOTP {
const _options: Required<Options> = { digits: 6, algorithm: "SHA-1", period: 30, timestamp: Date.now(), ...options }
const epoch = Math.floor(_options.timestamp / 1000.0)
const time = this.leftpad(this.dec2hex(Math.floor(epoch / _options.period)), 16, "0")

const shaObj = new JsSHA(_options.algorithm, "HEX")

shaObj.setHMACKey(this.base32tohex(key), "HEX")
Expand All @@ -41,7 +41,6 @@ export class TOTP {

otp = otp.substring(start, start + _options.digits)

// Calculate expiry time of the OTP
const expires = Math.ceil((_options.timestamp + 1) / (_options.period * 1000)) * _options.period * 1000

return { otp, expires }
Expand Down

0 comments on commit 1a17c9f

Please sign in to comment.