hashSecret hashes the given secret using bcrypt.
(secret string)
| 1173 | |
| 1174 | // hashSecret hashes the given secret using bcrypt. |
| 1175 | func hashSecret(secret string) (string, error) { |
| 1176 | // Use default cost for simplicity. |
| 1177 | hashedBytes, err := bcrypt.GenerateFromPassword([]byte(secret), bcrypt.DefaultCost) |
| 1178 | if err != nil { |
| 1179 | return "", err |
| 1180 | } |
| 1181 | return string(hashedBytes), nil |
| 1182 | } |
| 1183 | |
| 1184 | // SaveConfigPreserveComments writes the config back to YAML while preserving existing comments |
| 1185 | // and key ordering by loading the original file into a yaml.Node tree and updating values in-place. |
no outgoing calls
no test coverage detected