Documentation ¶
Overview ¶
Package uidp contains utilities for reasoning about and manipulating the Chainguard IAM "UIDP" (UID Path) concept.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Valid = regexp.MustCompile(`^[0-9a-f]{40}(?:/[0-9a-f]{16})*$`).MatchString
Valid returns true for valid UIDP values. The base segment of a UIDP is 20 hex-encoded bytes (40 characters). This may be followed by zero or more parts with 8 hex-encoded bytes (16 characters).
Functions ¶
func Ancestry ¶
Ancestry returns all parent UIDPs and the child. Returns only the child if it is root.
Example:
Ancestry("a/b/c/d") returns ["a/b/c/d", "a/b/c", "a/b", "a"]
func IsAncestor ¶
IsAncestor checks whether the "parent" UIDP is an ancestor (non-inclusive) of the given "child" UIDP.
func IsAncestorOrSelf ¶
IsAncestorOrSelf checks whether the "parent" UIDP is an ancestor (inclusive) of the given "child" UIDP.
Types ¶
type SUID ¶
type SUID string
SUID is be used to form the primary key for items that must be unique within some scoping (non-global).
- A SUID is 8 random bytes, URL safe hex encoded.
type UID ¶
type UID string
UID will is used for the primary key for items that must be globally unique.
- A UID is 20 bytes of random bytes, URL safe hex encoded.