feat: add Creator username password login
CI / test (push) Failing after 15m55s

This commit is contained in:
m
2026-08-16 16:56:38 +03:00
parent 111ad75dea
commit 5fca81531a
15 changed files with 279 additions and 34 deletions
+10
View File
@@ -47,6 +47,16 @@ func ValidateCreatorSession(secret []byte, token string, now time.Time) (identit
func BootstrapMatches(expected, supplied string) bool {
return expected != "" && supplied != "" && subtle.ConstantTimeCompare([]byte(expected), []byte(supplied)) == 1
}
func CreatorCredentialsMatch(expectedUsername, expectedPassword string, supplied identity.CreatorCredentials) bool {
if expectedUsername == "" || expectedPassword == "" || supplied.Username == "" || supplied.Password == "" {
return false
}
usernameMatches := subtle.ConstantTimeCompare([]byte(expectedUsername), []byte(supplied.Username))
passwordMatches := subtle.ConstantTimeCompare([]byte(expectedPassword), []byte(supplied.Password))
return usernameMatches&passwordMatches == 1
}
func signature(secret []byte, payload string) string {
mac := hmac.New(sha256.New, secret)
mac.Write([]byte(payload))