MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / VerifyOTPHash

Function VerifyOTPHash

internal/crypto/otp.go:23–26  ·  view source on GitHub ↗

VerifyOTPHash compares a candidate plaintext OTP against a stored HMAC digest in constant time.

(candidate, stored, key string)

Source from the content-addressed store, hash-verified

21// VerifyOTPHash compares a candidate plaintext OTP against a stored HMAC
22// digest in constant time.
23func VerifyOTPHash(candidate, stored, key string) bool {
24 expected := HashOTP(candidate, key)
25 return subtle.ConstantTimeCompare([]byte(expected), []byte(stored)) == 1
26}

Callers 7

TestResendOTPFunction · 0.92
ResetPasswordMethod · 0.92
VerifyOTPMethod · 0.92
TestHashOTP_RoundTripFunction · 0.85

Calls 1

HashOTPFunction · 0.85

Tested by 5

TestResendOTPFunction · 0.74
TestHashOTP_RoundTripFunction · 0.68