MCPcopy Create free account
hub / github.com/bytebase/bytebase / hashSecret

Function hashSecret

backend/api/oauth2/oauth2.go:136–142  ·  view source on GitHub ↗
(secret string)

Source from the content-addressed store, hash-verified

134}
135
136func hashSecret(secret string) (string, error) {
137 hash, err := bcrypt.GenerateFromPassword([]byte(secret), bcrypt.DefaultCost)
138 if err != nil {
139 return "", err
140 }
141 return string(hash), nil
142}
143
144func verifySecret(hash, secret string) bool {
145 return bcrypt.CompareHashAndPassword([]byte(hash), []byte(secret)) == nil

Callers 1

handleRegisterMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected