id

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package id provides unique identifier generation for moat resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(prefix string) string

Generate creates a unique identifier with the given prefix. Format: <prefix>_<12 hex chars> (e.g., "run_abc123def456", "snap_def678abc123") Uses 6 cryptographically random bytes encoded as 12 hex characters. This provides 2^48 possible IDs (~281 trillion), making collisions extremely unlikely.

func IsValid

func IsValid(id string, prefix string) bool

IsValid checks if an ID has the expected format: <prefix>_<12 hex chars>. Returns true if the ID matches the format, false otherwise. Returns false if prefix is empty or contains whitespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL