Skip to content

Commit

Permalink
signature: Add CapabilityTeller interface
Browse files Browse the repository at this point in the history
This new interface, currently with a single method that indicates
whether the event can be signed, is used to return an error if
the event given to Signer.Sign is too old to support signing.
All events implement the CapabilityTeller interface. In the future
we might want to add additional methods for expressing other
capabilities of events, e.g. if they support meta.source.domainId.
  • Loading branch information
magnusbaeck committed Jun 26, 2024
1 parent ad92e77 commit 600e15a
Show file tree
Hide file tree
Showing 81 changed files with 983 additions and 166 deletions.
14 changes: 12 additions & 2 deletions EiffelActivityCanceledEventV1.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityCanceledV1) String() string {
return string(b)
}

var _ FieldSetter = &ActivityCanceledV1{}
var _ MetaTeller = &ActivityCanceledV1{}
var (
_ CapabilityTeller = &ActivityCanceledV1{}
_ FieldSetter = &ActivityCanceledV1{}
_ MetaTeller = &ActivityCanceledV1{}
)

// ID returns the value of the meta.id field.
func (e ActivityCanceledV1) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityCanceledV1) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityCanceledV1) SupportsSigning() bool {
return false
}

type ActivityCanceledV1 struct {
// Mandatory fields
Data ActCV1Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityCanceledEventV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityCanceledV2) String() string {
return string(b)
}

var _ FieldSetter = &ActivityCanceledV2{}
var _ MetaTeller = &ActivityCanceledV2{}
var (
_ CapabilityTeller = &ActivityCanceledV2{}
_ FieldSetter = &ActivityCanceledV2{}
_ MetaTeller = &ActivityCanceledV2{}
)

// ID returns the value of the meta.id field.
func (e ActivityCanceledV2) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityCanceledV2) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityCanceledV2) SupportsSigning() bool {
return false
}

type ActivityCanceledV2 struct {
// Mandatory fields
Data ActCV2Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityCanceledEventV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityCanceledV3) String() string {
return string(b)
}

var _ FieldSetter = &ActivityCanceledV3{}
var _ MetaTeller = &ActivityCanceledV3{}
var (
_ CapabilityTeller = &ActivityCanceledV3{}
_ FieldSetter = &ActivityCanceledV3{}
_ MetaTeller = &ActivityCanceledV3{}
)

// ID returns the value of the meta.id field.
func (e ActivityCanceledV3) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityCanceledV3) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityCanceledV3) SupportsSigning() bool {
return true
}

type ActivityCanceledV3 struct {
// Mandatory fields
Data ActCV3Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityFinishedEventV1.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityFinishedV1) String() string {
return string(b)
}

var _ FieldSetter = &ActivityFinishedV1{}
var _ MetaTeller = &ActivityFinishedV1{}
var (
_ CapabilityTeller = &ActivityFinishedV1{}
_ FieldSetter = &ActivityFinishedV1{}
_ MetaTeller = &ActivityFinishedV1{}
)

// ID returns the value of the meta.id field.
func (e ActivityFinishedV1) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityFinishedV1) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityFinishedV1) SupportsSigning() bool {
return false
}

type ActivityFinishedV1 struct {
// Mandatory fields
Data ActFV1Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityFinishedEventV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityFinishedV2) String() string {
return string(b)
}

var _ FieldSetter = &ActivityFinishedV2{}
var _ MetaTeller = &ActivityFinishedV2{}
var (
_ CapabilityTeller = &ActivityFinishedV2{}
_ FieldSetter = &ActivityFinishedV2{}
_ MetaTeller = &ActivityFinishedV2{}
)

// ID returns the value of the meta.id field.
func (e ActivityFinishedV2) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityFinishedV2) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityFinishedV2) SupportsSigning() bool {
return false
}

type ActivityFinishedV2 struct {
// Mandatory fields
Data ActFV2Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityFinishedEventV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityFinishedV3) String() string {
return string(b)
}

var _ FieldSetter = &ActivityFinishedV3{}
var _ MetaTeller = &ActivityFinishedV3{}
var (
_ CapabilityTeller = &ActivityFinishedV3{}
_ FieldSetter = &ActivityFinishedV3{}
_ MetaTeller = &ActivityFinishedV3{}
)

// ID returns the value of the meta.id field.
func (e ActivityFinishedV3) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityFinishedV3) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityFinishedV3) SupportsSigning() bool {
return true
}

type ActivityFinishedV3 struct {
// Mandatory fields
Data ActFV3Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityStartedEventV1.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityStartedV1) String() string {
return string(b)
}

var _ FieldSetter = &ActivityStartedV1{}
var _ MetaTeller = &ActivityStartedV1{}
var (
_ CapabilityTeller = &ActivityStartedV1{}
_ FieldSetter = &ActivityStartedV1{}
_ MetaTeller = &ActivityStartedV1{}
)

// ID returns the value of the meta.id field.
func (e ActivityStartedV1) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityStartedV1) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityStartedV1) SupportsSigning() bool {
return false
}

type ActivityStartedV1 struct {
// Mandatory fields
Data ActSV1Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityStartedEventV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityStartedV2) String() string {
return string(b)
}

var _ FieldSetter = &ActivityStartedV2{}
var _ MetaTeller = &ActivityStartedV2{}
var (
_ CapabilityTeller = &ActivityStartedV2{}
_ FieldSetter = &ActivityStartedV2{}
_ MetaTeller = &ActivityStartedV2{}
)

// ID returns the value of the meta.id field.
func (e ActivityStartedV2) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityStartedV2) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityStartedV2) SupportsSigning() bool {
return false
}

type ActivityStartedV2 struct {
// Mandatory fields
Data ActSV2Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityStartedEventV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityStartedV3) String() string {
return string(b)
}

var _ FieldSetter = &ActivityStartedV3{}
var _ MetaTeller = &ActivityStartedV3{}
var (
_ CapabilityTeller = &ActivityStartedV3{}
_ FieldSetter = &ActivityStartedV3{}
_ MetaTeller = &ActivityStartedV3{}
)

// ID returns the value of the meta.id field.
func (e ActivityStartedV3) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityStartedV3) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityStartedV3) SupportsSigning() bool {
return false
}

type ActivityStartedV3 struct {
// Mandatory fields
Data ActSV3Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityStartedEventV4.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityStartedV4) String() string {
return string(b)
}

var _ FieldSetter = &ActivityStartedV4{}
var _ MetaTeller = &ActivityStartedV4{}
var (
_ CapabilityTeller = &ActivityStartedV4{}
_ FieldSetter = &ActivityStartedV4{}
_ MetaTeller = &ActivityStartedV4{}
)

// ID returns the value of the meta.id field.
func (e ActivityStartedV4) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityStartedV4) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityStartedV4) SupportsSigning() bool {
return true
}

type ActivityStartedV4 struct {
// Mandatory fields
Data ActSV4Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityTriggeredEventV1.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityTriggeredV1) String() string {
return string(b)
}

var _ FieldSetter = &ActivityTriggeredV1{}
var _ MetaTeller = &ActivityTriggeredV1{}
var (
_ CapabilityTeller = &ActivityTriggeredV1{}
_ FieldSetter = &ActivityTriggeredV1{}
_ MetaTeller = &ActivityTriggeredV1{}
)

// ID returns the value of the meta.id field.
func (e ActivityTriggeredV1) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityTriggeredV1) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityTriggeredV1) SupportsSigning() bool {
return false
}

type ActivityTriggeredV1 struct {
// Mandatory fields
Data ActTV1Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityTriggeredEventV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityTriggeredV2) String() string {
return string(b)
}

var _ FieldSetter = &ActivityTriggeredV2{}
var _ MetaTeller = &ActivityTriggeredV2{}
var (
_ CapabilityTeller = &ActivityTriggeredV2{}
_ FieldSetter = &ActivityTriggeredV2{}
_ MetaTeller = &ActivityTriggeredV2{}
)

// ID returns the value of the meta.id field.
func (e ActivityTriggeredV2) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityTriggeredV2) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityTriggeredV2) SupportsSigning() bool {
return false
}

type ActivityTriggeredV2 struct {
// Mandatory fields
Data ActTV2Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityTriggeredEventV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityTriggeredV3) String() string {
return string(b)
}

var _ FieldSetter = &ActivityTriggeredV3{}
var _ MetaTeller = &ActivityTriggeredV3{}
var (
_ CapabilityTeller = &ActivityTriggeredV3{}
_ FieldSetter = &ActivityTriggeredV3{}
_ MetaTeller = &ActivityTriggeredV3{}
)

// ID returns the value of the meta.id field.
func (e ActivityTriggeredV3) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityTriggeredV3) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityTriggeredV3) SupportsSigning() bool {
return false
}

type ActivityTriggeredV3 struct {
// Mandatory fields
Data ActTV3Data `json:"data"`
Expand Down
14 changes: 12 additions & 2 deletions EiffelActivityTriggeredEventV4.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ func (e *ActivityTriggeredV4) String() string {
return string(b)
}

var _ FieldSetter = &ActivityTriggeredV4{}
var _ MetaTeller = &ActivityTriggeredV4{}
var (
_ CapabilityTeller = &ActivityTriggeredV4{}
_ FieldSetter = &ActivityTriggeredV4{}
_ MetaTeller = &ActivityTriggeredV4{}
)

// ID returns the value of the meta.id field.
func (e ActivityTriggeredV4) ID() string {
Expand All @@ -117,6 +120,13 @@ func (e ActivityTriggeredV4) DomainID() string {
return e.Meta.Source.DomainID
}

// SupportsSigning returns true if the event supports signatures according
// to V3 of the meta field, i.e. events where the signature is found under
// meta.security.integrityProtection.
func (e ActivityTriggeredV4) SupportsSigning() bool {
return true
}

type ActivityTriggeredV4 struct {
// Mandatory fields
Data ActTV4Data `json:"data"`
Expand Down
Loading

0 comments on commit 600e15a

Please sign in to comment.