()
| 343 | } |
| 344 | |
| 345 | func (f *decryptFlags) valid() error { |
| 346 | if f.PostgresURL == "" { |
| 347 | return xerrors.Errorf("no database configured") |
| 348 | } |
| 349 | |
| 350 | if len(f.Keys) == 0 { |
| 351 | return xerrors.Errorf("no keys provided") |
| 352 | } |
| 353 | |
| 354 | for i, k := range f.Keys { |
| 355 | if val, err := base64.StdEncoding.DecodeString(k); err != nil { |
| 356 | return xerrors.Errorf("key at index %d must be base64-encoded", i) |
| 357 | } else if len(val) != 32 { |
| 358 | return xerrors.Errorf("key at index %d must be exactly 32 bytes in length", i) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | return nil |
| 363 | } |
| 364 | |
| 365 | type deleteFlags struct { |
| 366 | PostgresURL string |
no test coverage detected