MCPcopy Create free account
hub / github.com/compozy/agh / validateEnvelopeHeader

Function validateEnvelopeHeader

internal/network/validate.go:413–433  ·  view source on GitHub ↗
(env Envelope)

Source from the content-addressed store, hash-verified

411}
412
413func 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
435func validateEnvelopeParticipants(env Envelope) error {
436 if env.From == "" {

Callers 1

NormalizeEnvelopeFunction · 0.85

Calls 3

ValidateWorkspaceIDFunction · 0.85
ValidateChannelFunction · 0.85
ValidateMethod · 0.65

Tested by

no test coverage detected