(env Envelope)
| 411 | } |
| 412 | |
| 413 | func validateEnvelopeHeader(env Envelope) error { |
| 414 | if env.Protocol == "" { |
| 415 | return fmt.Errorf("%w: protocol is required", ErrMissingField) |
| 416 | } |
| 417 | if env.Protocol != ProtocolV0 { |
| 418 | return fmt.Errorf("%w: protocol=%q", ErrInvalidField, env.Protocol) |
| 419 | } |
| 420 | if env.ID == "" { |
| 421 | return fmt.Errorf("%w: id is required", ErrMissingField) |
| 422 | } |
| 423 | if err := ValidateWorkspaceID(env.WorkspaceID); err != nil { |
| 424 | return err |
| 425 | } |
| 426 | if err := env.Kind.Validate(); err != nil { |
| 427 | return err |
| 428 | } |
| 429 | if env.Channel == "" { |
| 430 | return fmt.Errorf("%w: channel is required", ErrMissingField) |
| 431 | } |
| 432 | return ValidateChannel(env.Channel) |
| 433 | } |
| 434 | |
| 435 | func validateEnvelopeParticipants(env Envelope) error { |
| 436 | if env.From == "" { |
no test coverage detected