(secret string)
| 134 | } |
| 135 | |
| 136 | func 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 | |
| 144 | func verifySecret(hash, secret string) bool { |
| 145 | return bcrypt.CompareHashAndPassword([]byte(hash), []byte(secret)) == nil |