diff --git a/validation/validation.go b/validation/validation.go index 888df11..765ffd1 100644 --- a/validation/validation.go +++ b/validation/validation.go @@ -1,6 +1,7 @@ package validation import ( + "github.com/google/uuid" "regexp" "github.com/spiffe/spike-sdk-go/api/errors" @@ -67,3 +68,13 @@ func ValidatePathPattern(pathPattern string) error { return nil } + +// ValidatePolicyId verifies if the given policyId is a valid UUID format. +// Returns errors.ErrInvalidInput if the validation fails. +func ValidatePolicyId(policyId string) error { + err := uuid.Validate(policyId) + if err != nil { + return errors.ErrInvalidInput + } + return nil +}