17 lines
397 B
Go
17 lines
397 B
Go
package tenant
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ValidateDispatcherID requires a canonical lowercase UUID v4.
|
|
func ValidateDispatcherID(id string) error {
|
|
parsed, err := uuid.Parse(id)
|
|
if err != nil || parsed.Version() != 4 || parsed.Variant() != uuid.RFC4122 || parsed.String() != id {
|
|
return fmt.Errorf("dispatcher_id must be a canonical lowercase UUID v4")
|
|
}
|
|
return nil
|
|
}
|