Skip to content

OTP verified with negative time delta #88

Open
@Circles24

Description

@Circles24

I was able to validate a TOTP with negative delta, lets say the OTP was generated on x timestamp then validating OTP on x-10 timestamp is working.

The issue is not reproducible at go playground, there the validation in failing, here's the go playground link : https://go.dev/play/p/xmCJkmRkzXA

This is the go version I'm using at my machine

➜  temp git:(main) ✗ go version  
go version go1.21.3 darwin/amd64

library version

github.com/pquerna/otp v1.4.0

here are the logs I get at my machine

➜  temp git:(main) ✗ go run main.go
2023/11/09 07:39:10 otp generated 118067
2023/11/09 07:39:10 2023-11-09 07:39:10.457564 +0530 IST m=+0.000233439
2023/11/09 07:39:10 2023-11-09 07:39:00.457564 +0530 IST m=-9.999766561
2023/11/09 07:39:10 otp verified

logs from go-playground

2009/11/10 23:00:00 otp generated 470478
2009/11/10 23:00:00 2009-11-10 23:00:00 +0000 UTC m=+0.000000001
2009/11/10 23:00:00 2009-11-10 22:59:59 +0000 UTC m=-0.999999999
2009/11/10 23:00:00 otp verification failed

Program exited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions