Help us shape the future of Go! Take the 2026 Go Developer Survey

id

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package id defines TypeID-based identity types for all AuthSome entities.

Every entity in AuthSome uses a single ID struct with a prefix that identifies the entity type. IDs are K-sortable (UUIDv7-based), globally unique, and URL-safe in the format "prefix_suffix".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyID

type APIKeyID = ID

APIKeyID is a type-safe identifier for API keys (prefix: "akey").

type AgentGrantID

type AgentGrantID = ID

AgentGrantID is a type-safe identifier for agent grants (prefix: "aagr").

type AgentID

type AgentID = ID

AgentID is a type-safe identifier for agents (prefix: "aagt").

type AnyID

type AnyID = ID

AnyID is a TypeID that accepts any valid prefix.

type AppClientConfigID

type AppClientConfigID = ID

AppClientConfigID is a type-safe identifier for app client configs (prefix: "aacf").

type AppID

type AppID = ID

AppID is a type-safe identifier for apps (prefix: "aapp").

type AppSessionConfigID

type AppSessionConfigID = ID

AppSessionConfigID is a type-safe identifier for app session configs (prefix: "ascf").

type AuthCodeID

type AuthCodeID = ID

AuthCodeID is a type-safe identifier for authorization codes (prefix: "aaco").

type BrandingConfigID

type BrandingConfigID = ID

BrandingConfigID is a type-safe identifier for branding configurations (prefix: "abrd").

type ConsentID

type ConsentID = ID

ConsentID is a type-safe identifier for consent records (prefix: "acns").

type DelegationID

type DelegationID = ID

DelegationID is a type-safe identifier for delegation grants (prefix: "adel"). A delegation records that one principal may act on behalf of another.

type DeviceCodeID

type DeviceCodeID = ID

DeviceCodeID is a type-safe identifier for OAuth2 device codes (prefix: "advc").

type DeviceID

type DeviceID = ID

DeviceID is a type-safe identifier for devices (prefix: "adev").

type EnvironmentID

type EnvironmentID = ID

EnvironmentID is a type-safe identifier for environments (prefix: "aenv").

type FormConfigID

type FormConfigID = ID

FormConfigID is a type-safe identifier for form configurations (prefix: "afcf").

type ID

type ID struct {
	// contains filtered or unexported fields
}

ID is the primary identifier type for all AuthSome entities. It wraps a TypeID providing a prefix-qualified, globally unique, sortable, URL-safe identifier in the format "prefix_suffix".

var Nil ID

Nil is the zero-value ID.

func MustParse

func MustParse(s string) ID

MustParse is like Parse but panics on error. Use for hardcoded ID values.

func MustParseWithPrefix

func MustParseWithPrefix(s string, expected Prefix) ID

MustParseWithPrefix is like ParseWithPrefix but panics on error.

func New

func New(prefix Prefix) ID

New generates a new globally unique ID with the given prefix. It panics if prefix is not a valid TypeID prefix (programming error).

func NewAPIKeyID

func NewAPIKeyID() ID

NewAPIKeyID generates a new unique API key ID.

func NewAgentGrantID

func NewAgentGrantID() ID

NewAgentGrantID generates a new unique agent grant ID.

func NewAgentID

func NewAgentID() ID

NewAgentID generates a new unique agent ID.

func NewAppClientConfigID

func NewAppClientConfigID() ID

NewAppClientConfigID generates a new unique app client config ID.

func NewAppID

func NewAppID() ID

NewAppID generates a new unique app ID.

func NewAppSessionConfigID

func NewAppSessionConfigID() ID

NewAppSessionConfigID generates a new unique app session config ID.

func NewAuthCodeID

func NewAuthCodeID() ID

NewAuthCodeID generates a new unique authorization code ID.

func NewBrandingConfigID

func NewBrandingConfigID() ID

NewBrandingConfigID generates a new unique branding config ID.

func NewConsentID

func NewConsentID() ID

NewConsentID generates a new unique consent record ID.

func NewDelegationID

func NewDelegationID() ID

NewDelegationID generates a new unique delegation ID.

func NewDeviceCodeID

func NewDeviceCodeID() ID

NewDeviceCodeID generates a new unique device code ID.

func NewDeviceID

func NewDeviceID() ID

NewDeviceID generates a new unique device ID.

func NewEnvironmentID

func NewEnvironmentID() ID

NewEnvironmentID generates a new unique environment ID.

func NewFormConfigID

func NewFormConfigID() ID

NewFormConfigID generates a new unique form config ID.

func NewInvitationID

func NewInvitationID() ID

NewInvitationID generates a new unique invitation ID.

func NewMFAID

func NewMFAID() ID

NewMFAID generates a new unique MFA enrollment ID.

func NewMemberID

func NewMemberID() ID

NewMemberID generates a new unique member ID.

func NewNotificationID

func NewNotificationID() ID

NewNotificationID generates a new unique notification ID.

func NewOAuth2ClientID

func NewOAuth2ClientID() ID

NewOAuth2ClientID generates a new unique OAuth2 client ID.

func NewOAuth2GrantID

func NewOAuth2GrantID() ID

NewOAuth2GrantID generates a new unique OAuth2 consent grant ID.

func NewOAuthConnectionID

func NewOAuthConnectionID() ID

NewOAuthConnectionID generates a new unique OAuth connection ID.

func NewOrgID

func NewOrgID() ID

NewOrgID generates a new unique organization ID.

func NewPasskeyID

func NewPasskeyID() ID

NewPasskeyID generates a new unique passkey ID.

func NewPasswordResetID

func NewPasswordResetID() ID

NewPasswordResetID generates a new unique password reset ID.

func NewPermissionID

func NewPermissionID() ID

NewPermissionID generates a new unique permission ID.

func NewRecoveryCodeID

func NewRecoveryCodeID() ID

NewRecoveryCodeID generates a new unique recovery code ID.

func NewRetentionJobID

func NewRetentionJobID() ID

NewRetentionJobID generates a new unique retention outbox job ID.

func NewRetentionRefID

func NewRetentionRefID() ID

NewRetentionRefID generates a new unique retention contact ref ID.

func NewRoleID

func NewRoleID() ID

NewRoleID generates a new unique role ID.

func NewSCIMConfigID

func NewSCIMConfigID() ID

NewSCIMConfigID generates a new unique SCIM config ID.

func NewSCIMLogID

func NewSCIMLogID() ID

NewSCIMLogID generates a new unique SCIM provision log ID.

func NewSCIMTokenID

func NewSCIMTokenID() ID

NewSCIMTokenID generates a new unique SCIM token ID.

func NewSSFEventID

func NewSSFEventID() ID

NewSSFEventID generates a new received-event ID.

func NewSSFLinkID

func NewSSFLinkID() ID

NewSSFLinkID generates a new Shared Signals subject link ID.

func NewSSFSignalID

func NewSSFSignalID() ID

NewSSFSignalID generates a new Shared Signals risk signal ID.

func NewSSFStreamID

func NewSSFStreamID() ID

NewSSFStreamID generates a new Shared Signals stream ID.

func NewSSOConnectionID

func NewSSOConnectionID() ID

NewSSOConnectionID generates a new unique SSO connection ID.

func NewServiceAccountID

func NewServiceAccountID() ID

NewServiceAccountID generates a new unique service account ID.

func NewSessionFamilyID

func NewSessionFamilyID() ID

NewSessionFamilyID generates a new unique session-family ID. Every fresh sign-in begins a new family; refresh rotations inherit the parent family.

func NewSessionID

func NewSessionID() ID

NewSessionID generates a new unique session ID.

func NewSettingID

func NewSettingID() ID

NewSettingID generates a new unique setting ID.

func NewTeamID

func NewTeamID() ID

NewTeamID generates a new unique team ID.

func NewUserEmailID

func NewUserEmailID() ID

NewUserEmailID generates a new unique user email record ID.

func NewUserID

func NewUserID() ID

NewUserID generates a new unique user ID.

func NewVerificationID

func NewVerificationID() ID

NewVerificationID generates a new unique verification ID.

func NewWaitlistID

func NewWaitlistID() ID

NewWaitlistID generates a new unique waitlist entry ID.

func NewWebhookID

func NewWebhookID() ID

NewWebhookID generates a new unique webhook ID.

func Parse

func Parse(s string) (ID, error)

Parse parses a TypeID string (e.g., "ausr_01h2xcejqtf2nbrexx3vqjhp41") into an ID. Returns an error if the string is not valid.

func ParseAPIKeyID

func ParseAPIKeyID(s string) (ID, error)

ParseAPIKeyID parses a string and validates the "akey" prefix.

func ParseAgentGrantID

func ParseAgentGrantID(s string) (ID, error)

ParseAgentGrantID parses a string and validates the "aagr" prefix.

func ParseAgentID

func ParseAgentID(s string) (ID, error)

ParseAgentID parses a string and validates the "aagt" prefix.

func ParseAny

func ParseAny(s string) (ID, error)

ParseAny parses a string into an ID without type checking the prefix.

func ParseAppClientConfigID

func ParseAppClientConfigID(s string) (ID, error)

ParseAppClientConfigID parses a string and validates the "aacf" prefix.

func ParseAppID

func ParseAppID(s string) (ID, error)

ParseAppID parses a string and validates the "aapp" prefix.

func ParseAppSessionConfigID

func ParseAppSessionConfigID(s string) (ID, error)

ParseAppSessionConfigID parses a string and validates the "ascf" prefix.

func ParseAuthCodeID

func ParseAuthCodeID(s string) (ID, error)

ParseAuthCodeID parses a string and validates the "aaco" prefix.

func ParseBrandingConfigID

func ParseBrandingConfigID(s string) (ID, error)

ParseBrandingConfigID parses a string and validates the "abrd" prefix.

func ParseConsentID

func ParseConsentID(s string) (ID, error)

ParseConsentID parses a string and validates the "acns" prefix.

func ParseDelegationID

func ParseDelegationID(s string) (ID, error)

ParseDelegationID parses a string and validates the "adel" prefix.

func ParseDeviceCodeID

func ParseDeviceCodeID(s string) (ID, error)

ParseDeviceCodeID parses a string and validates the "advc" prefix.

func ParseDeviceID

func ParseDeviceID(s string) (ID, error)

ParseDeviceID parses a string and validates the "adev" prefix.

func ParseEnvironmentID

func ParseEnvironmentID(s string) (ID, error)

ParseEnvironmentID parses a string and validates the "aenv" prefix.

func ParseFormConfigID

func ParseFormConfigID(s string) (ID, error)

ParseFormConfigID parses a string and validates the "afcf" prefix.

func ParseInvitationID

func ParseInvitationID(s string) (ID, error)

ParseInvitationID parses a string and validates the "ainv" prefix.

func ParseMFAID

func ParseMFAID(s string) (ID, error)

ParseMFAID parses a string and validates the "amfa" prefix.

func ParseMemberID

func ParseMemberID(s string) (ID, error)

ParseMemberID parses a string and validates the "amem" prefix.

func ParseNotificationID

func ParseNotificationID(s string) (ID, error)

ParseNotificationID parses a string and validates the "antf" prefix.

func ParseOAuth2ClientID

func ParseOAuth2ClientID(s string) (ID, error)

ParseOAuth2ClientID parses a string and validates the "aoac" prefix.

func ParseOAuth2GrantID

func ParseOAuth2GrantID(s string) (ID, error)

ParseOAuth2GrantID parses a string and validates the "aoag" prefix.

func ParseOAuthConnectionID

func ParseOAuthConnectionID(s string) (ID, error)

ParseOAuthConnectionID parses a string and validates the "aoau" prefix.

func ParseOrgID

func ParseOrgID(s string) (ID, error)

ParseOrgID parses a string and validates the "aorg" prefix.

func ParsePasskeyID

func ParsePasskeyID(s string) (ID, error)

ParsePasskeyID parses a string and validates the "apsk" prefix.

func ParsePasswordResetID

func ParsePasswordResetID(s string) (ID, error)

ParsePasswordResetID parses a string and validates the "apwr" prefix.

func ParsePermissionID

func ParsePermissionID(s string) (ID, error)

ParsePermissionID parses a string and validates the "aprm" prefix.

func ParseRecoveryCodeID

func ParseRecoveryCodeID(s string) (ID, error)

ParseRecoveryCodeID parses a string and validates the "arec" prefix.

func ParseRetentionJobID

func ParseRetentionJobID(s string) (ID, error)

ParseRetentionJobID parses a string and validates the "artj" prefix.

func ParseRetentionRefID

func ParseRetentionRefID(s string) (ID, error)

ParseRetentionRefID parses a string and validates the "artr" prefix.

func ParseRoleID

func ParseRoleID(s string) (ID, error)

ParseRoleID parses a string and validates the "arol" prefix.

func ParseSCIMConfigID

func ParseSCIMConfigID(s string) (ID, error)

ParseSCIMConfigID parses a string and validates the "ascm" prefix.

func ParseSCIMLogID

func ParseSCIMLogID(s string) (ID, error)

ParseSCIMLogID parses a string and validates the "ascl" prefix.

func ParseSCIMTokenID

func ParseSCIMTokenID(s string) (ID, error)

ParseSCIMTokenID parses a string and validates the "asct" prefix.

func ParseSSOConnectionID

func ParseSSOConnectionID(s string) (ID, error)

ParseSSOConnectionID parses a string and validates the "asso" prefix.

func ParseServiceAccountID

func ParseServiceAccountID(s string) (ID, error)

ParseServiceAccountID parses a string and validates the "svc" prefix.

func ParseSessionFamilyID

func ParseSessionFamilyID(s string) (ID, error)

ParseSessionFamilyID parses a string and validates the "asfm" prefix.

func ParseSessionID

func ParseSessionID(s string) (ID, error)

ParseSessionID parses a string and validates the "ases" prefix.

func ParseSettingID

func ParseSettingID(s string) (ID, error)

ParseSettingID parses a string and validates the "aset" prefix.

func ParseTeamID

func ParseTeamID(s string) (ID, error)

ParseTeamID parses a string and validates the "atm" prefix.

func ParseUserEmailID

func ParseUserEmailID(s string) (ID, error)

ParseUserEmailID parses a string and validates the "auem" prefix.

func ParseUserID

func ParseUserID(s string) (ID, error)

ParseUserID parses a string and validates the "ausr" prefix.

func ParseVerificationID

func ParseVerificationID(s string) (ID, error)

ParseVerificationID parses a string and validates the "avrf" prefix.

func ParseWaitlistID

func ParseWaitlistID(s string) (ID, error)

ParseWaitlistID parses a string and validates the "awlt" prefix.

func ParseWebhookID

func ParseWebhookID(s string) (ID, error)

ParseWebhookID parses a string and validates the "awhk" prefix.

func ParseWithPrefix

func ParseWithPrefix(s string, expected Prefix) (ID, error)

ParseWithPrefix parses a TypeID string and validates that its prefix matches the expected value.

func (ID) IsNil

func (i ID) IsNil() bool

IsNil reports whether this ID is the zero value.

func (ID) MarshalBSONValue

func (i ID) MarshalBSONValue() (bsonType byte, data []byte, err error)

MarshalBSONValue satisfies bson.ValueMarshaler (mongo-driver v2) so the ID is stored as a BSON string instead of an opaque struct. No bson import needed because Go uses structural typing for interface satisfaction.

func (ID) MarshalText

func (i ID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ID) Prefix

func (i ID) Prefix() Prefix

Prefix returns the prefix component of this ID.

func (*ID) Scan

func (i *ID) Scan(src any) error

Scan implements sql.Scanner for database retrieval.

func (ID) String

func (i ID) String() string

String returns the full TypeID string representation (prefix_suffix). Returns an empty string for the Nil ID.

func (*ID) UnmarshalBSONValue

func (i *ID) UnmarshalBSONValue(t byte, data []byte) error

UnmarshalBSONValue satisfies bson.ValueUnmarshaler (mongo-driver v2).

func (*ID) UnmarshalText

func (i *ID) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ID) Value

func (i ID) Value() (driver.Value, error)

Value implements driver.Valuer for database storage. Returns nil for the Nil ID so that optional foreign key columns store NULL.

type InvitationID

type InvitationID = ID

InvitationID is a type-safe identifier for invitations (prefix: "ainv").

type MFAID

type MFAID = ID

MFAID is a type-safe identifier for MFA enrollment records (prefix: "amfa").

type MemberID

type MemberID = ID

MemberID is a type-safe identifier for organization members (prefix: "amem").

type NotificationID

type NotificationID = ID

NotificationID is a type-safe identifier for notifications (prefix: "antf").

type OAuth2ClientID

type OAuth2ClientID = ID

OAuth2ClientID is a type-safe identifier for OAuth2 clients (prefix: "aoac").

type OAuth2GrantID

type OAuth2GrantID = ID

OAuth2GrantID is a type-safe identifier for OAuth2 consent grants (prefix: "aoag").

type OAuthConnectionID

type OAuthConnectionID = ID

OAuthConnectionID is a type-safe identifier for OAuth connections (prefix: "aoau").

type OrgID

type OrgID = ID

OrgID is a type-safe identifier for organizations (prefix: "aorg").

type PasskeyID

type PasskeyID = ID

PasskeyID is a type-safe identifier for passkeys (prefix: "apsk").

type PasswordResetID

type PasswordResetID = ID

PasswordResetID is a type-safe identifier for password reset tokens (prefix: "apwr").

type PermissionID

type PermissionID = ID

PermissionID is a type-safe identifier for permissions (prefix: "aprm").

type Prefix

type Prefix string

Prefix identifies the entity type encoded in a TypeID.

const (
	PrefixUser            Prefix = "ausr"
	PrefixSession         Prefix = "ases"
	PrefixApp             Prefix = "aapp"
	PrefixOrg             Prefix = "aorg"
	PrefixMember          Prefix = "amem"
	PrefixTeam            Prefix = "atm"
	PrefixInvitation      Prefix = "ainv"
	PrefixDevice          Prefix = "adev"
	PrefixWebhook         Prefix = "awhk"
	PrefixNotification    Prefix = "antf"
	PrefixVerification    Prefix = "avrf"
	PrefixPasswordReset   Prefix = "apwr"
	PrefixAPIKey          Prefix = "akey"
	PrefixOAuthConnection Prefix = "aoau"
	PrefixPasskey         Prefix = "apsk"
	PrefixMFA             Prefix = "amfa"
	PrefixEnvironment     Prefix = "aenv"
	PrefixRole            Prefix = "arol"
	PrefixPermission      Prefix = "aprm"
	PrefixRecoveryCode    Prefix = "arec"
	PrefixSSOConnection   Prefix = "asso"
	PrefixConsent         Prefix = "acns"
	PrefixFormConfig      Prefix = "afcf"
	PrefixBrandingConfig  Prefix = "abrd"
	PrefixAppSessionCfg   Prefix = "ascf"
	PrefixOAuth2Client    Prefix = "aoac"
	PrefixOAuth2Grant     Prefix = "aoag"
	PrefixAuthCode        Prefix = "aaco"
	PrefixSetting         Prefix = "aset"
	PrefixAppClientConfig Prefix = "aacf"
	PrefixDeviceCode      Prefix = "advc"
	PrefixSCIMConfig      Prefix = "ascm"
	PrefixSCIMToken       Prefix = "asct"
	PrefixSCIMLog         Prefix = "ascl"
	PrefixWaitlist        Prefix = "awlt"
	PrefixSessionFamily   Prefix = "asfm"
	PrefixServiceAccount  Prefix = "svc"
	PrefixUserEmail       Prefix = "auem"
	PrefixDelegation      Prefix = "adel"
	PrefixSSFStream       Prefix = "assf"
	PrefixSSFLink         Prefix = "assl"
	PrefixSSFEvent        Prefix = "asse"
	PrefixSSFSignal       Prefix = "assg"
	PrefixAgent           Prefix = "aagt"
	PrefixAgentGrant      Prefix = "aagr"
	PrefixRetentionJob    Prefix = "artj"
	PrefixRetentionRef    Prefix = "artr"
)

Prefix constants for all AuthSome entity types.

type RecoveryCodeID

type RecoveryCodeID = ID

RecoveryCodeID is a type-safe identifier for MFA recovery codes (prefix: "arec").

type RetentionJobID

type RetentionJobID = ID

RetentionJobID is a type-safe identifier for retention outbox jobs (prefix: "artj").

type RetentionRefID

type RetentionRefID = ID

RetentionRefID is a type-safe identifier for retention contact refs (prefix: "artr").

type RoleID

type RoleID = ID

RoleID is a type-safe identifier for roles (prefix: "arol").

type SCIMConfigID

type SCIMConfigID = ID

SCIMConfigID is a type-safe identifier for SCIM configurations (prefix: "ascm").

type SCIMLogID

type SCIMLogID = ID

SCIMLogID is a type-safe identifier for SCIM provision logs (prefix: "ascl").

type SCIMTokenID

type SCIMTokenID = ID

SCIMTokenID is a type-safe identifier for SCIM bearer tokens (prefix: "asct").

type SSFEventID

type SSFEventID = ID

SSFEventID identifies a received Security Event Token.

type SSFLinkID

type SSFLinkID = ID

SSFLinkID identifies a Shared Signals subject link.

type SSFSignalID

type SSFSignalID = ID

SSFSignalID identifies a stored Shared Signals risk signal.

type SSFStreamID

type SSFStreamID = ID

SSFStreamID identifies a Shared Signals inbound stream.

type SSOConnectionID

type SSOConnectionID = ID

SSOConnectionID is a type-safe identifier for SSO connections (prefix: "asso").

type ServiceAccountID

type ServiceAccountID = ID

ServiceAccountID is a type-safe identifier for service accounts (prefix: "svc").

type SessionFamilyID

type SessionFamilyID = ID

SessionFamilyID is a type-safe identifier for refresh-token session families (prefix: "asfm"). All sessions descended from a single sign-in (via successive refresh-token rotations) share the same SessionFamilyID, enabling cascade revocation when a refresh-token replay is detected (RFC 6819 §5.2.2.3).

type SessionID

type SessionID = ID

SessionID is a type-safe identifier for sessions (prefix: "ases").

type SettingID

type SettingID = ID

SettingID is a type-safe identifier for settings (prefix: "aset").

type TeamID

type TeamID = ID

TeamID is a type-safe identifier for teams (prefix: "atm").

type UserEmailID

type UserEmailID = ID

UserEmailID is a type-safe identifier for user email records (prefix: "auem").

type UserID

type UserID = ID

UserID is a type-safe identifier for users (prefix: "ausr").

type VerificationID

type VerificationID = ID

VerificationID is a type-safe identifier for verification tokens (prefix: "avrf").

type WaitlistID

type WaitlistID = ID

WaitlistID is a type-safe identifier for waitlist entries (prefix: "awlt").

type WebhookID

type WebhookID = ID

WebhookID is a type-safe identifier for webhooks (prefix: "awhk").

Jump to

Keyboard shortcuts

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