publicid

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package publicid generates and parses the opaque public_id of every resource (ADR-0008): a type prefix and 12 random characters of Crockford base32 (60 bits) from crypto/rand, written in upper case. Input is read in any case, with O as 0 and I and L as 1, and checked against the prefix the caller expects.

Index

Constants

View Source
const Alphabet = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"

Alphabet is Crockford base32: the digits and the upper-case letters without I, L, O and U.

View Source
const RandomLength = 12

RandomLength is the number of random characters after the prefix.

Variables

View Source
var ErrInvalid = errors.New("invalid public id")

ErrInvalid is wrapped by every error of Parse.

Functions

func New

func New(p Prefix) string

New returns a new public_id with prefix p.

func Parse

func Parse(want Prefix, s string) (string, error)

Parse normalizes s — upper case, O read as 0, I and L as 1 — and returns it when it is a public_id with prefix want; the error says why not without repeating s.

Types

type Prefix

type Prefix string

Prefix is the type prefix of a public_id, as in the table of api/README.md.

const (
	AuditLogEntry      Prefix = "AE"
	AlertGroup         Prefix = "AG"
	AccountLink        Prefix = "AK"
	AccountLinkRequest Prefix = "AR"
	GatewayCall        Prefix = "CA"
	Connection         Prefix = "CN"
	CheckRun           Prefix = "CR"
	DeliveryEvent      Prefix = "DE"
	Destination        Prefix = "DS"
	EscalationChain    Prefix = "EC"
	EscalationRun      Prefix = "ER"
	GatewayContact     Prefix = "GC"
	LinkRule           Prefix = "KR"
	Note               Prefix = "NE"
	IntegrationToken   Prefix = "NK"
	Integration        Prefix = "NT"
	PersonalToken      Prefix = "PT"
	Organization       Prefix = "RG"
	RequestRecord      Prefix = "RQ"
	Route              Prefix = "RT"
	RotationLayer      Prefix = "RY"
	ServiceAccount     Prefix = "SA"
	Schedule           Prefix = "SC"
	Session            Prefix = "SN"
	User               Prefix = "SR"
	StoredSnapshot     Prefix = "SS"
	ServiceToken       Prefix = "ST"
	LookupTable        Prefix = "TB"
	TimelineEntry      Prefix = "TE"
	Team               Prefix = "TM"
	ScheduleOverride   Prefix = "VR"
)

Jump to

Keyboard shortcuts

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