Security Updates

This commit is contained in:
2026-03-06 12:30:05 +02:00
parent ffbaf0ee1d
commit ec8e8911ce
8 changed files with 277 additions and 78 deletions

View File

@@ -62,6 +62,13 @@ func passwordMatches(password, salt, expectedHash string) bool {
return subtle.ConstantTimeCompare([]byte(computed), []byte(expectedHash)) == 1
}
func secureTokenMatches(expected, provided string) bool {
if expected == "" || provided == "" || len(expected) != len(provided) {
return false
}
return subtle.ConstantTimeCompare([]byte(expected), []byte(provided)) == 1
}
func nowUTC() time.Time {
return time.Now().UTC()
}