Remove error returns from crypto random helpers and callers (#37240)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
This commit is contained in:
Copilot
2026-04-17 00:59:26 +08:00
committed by GitHub
parent 82bfde2a37
commit 4a2bba9aed
23 changed files with 64 additions and 153 deletions
+4 -10
View File
@@ -18,18 +18,12 @@ import (
"code.gitea.io/gitea/modules/util"
)
func generateSaltedToken() (string, string, string, string, error) {
salt, err := util.CryptoRandomString(10)
if err != nil {
return "", "", "", "", err
}
buf, err := util.CryptoRandomBytes(20)
if err != nil {
return "", "", "", "", err
}
func generateSaltedToken() (string, string, string, string) {
salt := util.CryptoRandomString(10)
buf := util.CryptoRandomBytes(20)
token := hex.EncodeToString(buf)
hash := auth_model.HashToken(token, salt)
return token, salt, hash, token[len(token)-8:], nil
return token, salt, hash, token[len(token)-8:]
}
/*