import (
"errors"
+ "fmt"
+ "net/url"
)
func (ied *APIInvokerEnrolmentDetails) Validate() error {
return errors.New("APIInvokerEnrolmentDetails missing required NotificationDestination")
}
+ if _, err := url.ParseRequestURI(string(ied.NotificationDestination)); err != nil {
+ return fmt.Errorf("APIInvokerEnrolmentDetails has invalid NotificationDestination, err=%s", err)
+ }
+
if ied.OnboardingInformation.ApiInvokerPublicKey == "" {
return errors.New("APIInvokerEnrolmentDetails missing required OnboardingInformation.ApiInvokerPublicKey")
}
return nil
}
+
+func (ied *APIInvokerEnrolmentDetails) ValidateAlreadyOnboarded(otherInvoker APIInvokerEnrolmentDetails) error {
+ if ied.OnboardingInformation.ApiInvokerPublicKey == otherInvoker.OnboardingInformation.ApiInvokerPublicKey {
+ return errors.New("invoker with identical public key already onboarded")
+ }
+ return nil
+}