DecryptSensitiveFields decrypts all sensitive fields in a ProfileConfig. Fields that are not encrypted are left unchanged.
(profile *ProfileConfig)
| 221 | // DecryptSensitiveFields decrypts all sensitive fields in a ProfileConfig. |
| 222 | // Fields that are not encrypted are left unchanged. |
| 223 | func DecryptSensitiveFields(profile *ProfileConfig) error { |
| 224 | var err error |
| 225 | |
| 226 | if profile.Password != "" { |
| 227 | profile.Password, err = DecryptField(profile.Password) |
| 228 | if err != nil { |
| 229 | return fmt.Errorf("decrypt password: %w", err) |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | if profile.TokenSecret != "" { |
| 234 | profile.TokenSecret, err = DecryptField(profile.TokenSecret) |
| 235 | if err != nil { |
| 236 | return fmt.Errorf("decrypt token_secret: %w", err) |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return nil |
| 241 | } |
| 242 | |
| 243 | // EncryptConfigSensitiveFields encrypts sensitive fields in the entire Config. |
| 244 | // This includes both profile-based and legacy fields. |
no test coverage detected