(name string, value string)
| 217 | } |
| 218 | |
| 219 | func SetSecret(name string, value string) error { |
| 220 | if name == "" { |
| 221 | return fmt.Errorf("secret name cannot be empty") |
| 222 | } |
| 223 | if !secretNameRegexp.MatchString(name) { |
| 224 | return fmt.Errorf("secret name must start with a letter and contain only letters, numbers, and underscores") |
| 225 | } |
| 226 | if err := initSecretStore(); err != nil { |
| 227 | return err |
| 228 | } |
| 229 | lock.Lock() |
| 230 | defer lock.Unlock() |
| 231 | |
| 232 | secrets[name] = strings.TrimRight(value, "\r\n") |
| 233 | requestWrite() |
| 234 | return nil |
| 235 | } |
| 236 | |
| 237 | func DeleteSecret(name string) error { |
| 238 | if name == "" { |
no test coverage detected