Skip to content

Commit

Permalink
Merge pull request #25 from dlPtr/priv_dlptr_dev
Browse files Browse the repository at this point in the history
NowWithExpiration function refactored
  • Loading branch information
mergenchik authored Sep 15, 2022
2 parents a63b9d0 + 87b2558 commit 1546cf1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions totp.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ func (t *TOTP) Now() string {

// Generate the current time OTP and expiration time
func (t *TOTP) NowWithExpiration() (string, int64) {
interval64 := int64(t.interval)
timeCodeInt64 := time.Now().Unix() / interval64
expirationTime := (timeCodeInt64 + 1) * interval64
timeCodeInt64 := t.timecode(currentTimestamp())
expirationTime := (timeCodeInt64 + 1) * int64(t.interval)
return t.generateOTP(timeCodeInt64), expirationTime
}

Expand Down

0 comments on commit 1546cf1

Please sign in to comment.