Skip to content

Commit

Permalink
Update: use existed function
Browse files Browse the repository at this point in the history
  • Loading branch information
fnix6 committed Sep 10, 2022
1 parent a63b9d0 commit 87b2558
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 87b2558

Please sign in to comment.