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

Function TestVerifyOTPHash_WrongKey

internal/crypto/otp_test.go:49–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestVerifyOTPHash_WrongKey(t *testing.T) {
50 const plain = "123456"
51 stored := HashOTP(plain, "key-a")
52
53 // Same plaintext, different server key → must not verify. This is
54 // what protects against cross-tenant or cross-deployment leakage.
55 assert.False(t, VerifyOTPHash(plain, stored, "key-b"))
56 assert.True(t, VerifyOTPHash(plain, stored, "key-a"))
57}
58
59func TestVerifyOTPHash_DifferentLengthDigest(t *testing.T) {
60 // Constant-time compare must still return false for differing

Callers

nothing calls this directly

Calls 2

HashOTPFunction · 0.85
VerifyOTPHashFunction · 0.85

Tested by

no test coverage detected