gotp icon indicating copy to clipboard operation
gotp copied to clipboard

Provide a method for checking if secret is valid to avoid panic checking

Open djherbis opened this issue 2 years ago • 1 comments

Calls time Now() and At() can panic if the secret is invalid, but there's no safe way using this library to check if the secret is valid without handling the panic.

Providing a non-panic method for checking this would be ideal (IsValid() or something which could return the err from byteSecret() instead of panicing).

Most APIs should not panic and should just push errors up the stack instead.

djherbis avatar Feb 22 '22 15:02 djherbis

good point @djherbis, if anybody has time to implement it and send PR, I will review this.

mergenchik avatar Feb 27 '22 03:02 mergenchik

Closing this issue, implemented in #24

mergenchik avatar Aug 17 '22 08:08 mergenchik