Documentation
¶
Overview ¶
Package tokenstore owns PostgreSQL token families and retained generations. Applications consume auth/token's typed interfaces, never these storage rows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Entries = orm.Define("foundry_token_generations", func(b orm.Builder[Entry], m *Entry) EntryTable { table := orm.TableOf(b, &m.ID) field0 := table.Key() field1 := orm.TextOf(b, &m.Scope) field2 := orm.ColumnOf(b, &m.FamilyID) field3 := orm.NumberOf(b, &m.Generation) field4 := orm.TextOf(b, &m.AccessHash) field5 := orm.NullableTextOf(b, &m.RefreshHash) field6 := orm.TimeOf(b, &m.IssuedAt) field7 := orm.TimeOf(b, &m.LastSeenAt) field8 := orm.TimeOf(b, &m.AccessExpiresAt) field9 := orm.NullableTimeOf(b, &m.RefreshExpiresAt) return EntryTable{ Table: table, ID: field0, Scope: field1, FamilyID: field2, Generation: field3, AccessHash: field4, RefreshHash: field5, IssuedAt: field6, LastSeenAt: field7, AccessExpiresAt: field8, RefreshExpiresAt: field9, } }, orm.ModelFingerprint("787b01497eb288b8d6ea0ac87431a3e97be67624c14c9de76743cbe3fe62d70d"))
Entries is the foundry_token_generations table.
var Families = orm.Define("foundry_token_families", func(b orm.Builder[Family], m *Family) FamilyTable { table := orm.TableOf(b, &m.ID) field0 := table.Key() field1 := orm.TextOf(b, &m.Scope) field2 := orm.TextOf(b, &m.SubjectKey) field3 := orm.TextOf(b, &m.Name) field4 := orm.JSONOf(b, &m.Scopes) field5 := orm.NumberOf(b, &m.Mode) field6 := orm.NumberOf(b, &m.Assurance) field7 := orm.NumberOf(b, &m.AccessNanos) field8 := orm.NumberOf(b, &m.RefreshIdleNanos) field9 := orm.NumberOf(b, &m.RotationLimit) field10 := orm.NumberOf(b, &m.Generation) field11 := orm.TimeOf(b, &m.CreatedAt) field12 := orm.TimeOf(b, &m.ExpiresAt) field13 := orm.NullableTextOf(b, &m.ClientIP) field14 := orm.NullableTextOf(b, &m.UserAgent) return FamilyTable{ Table: table, ID: field0, Scope: field1, SubjectKey: field2, Name: field3, Scopes: field4, Mode: field5, Assurance: field6, AccessNanos: field7, RefreshIdleNanos: field8, RotationLimit: field9, Generation: field10, CreatedAt: field11, ExpiresAt: field12, ClientIP: field13, UserAgent: field14, } }, orm.ModelFingerprint("a39b34189b1683a962e0459a26f5b3c22523596de13df0b896d6c76dc9947480"))
Families is the foundry_token_families table.
var Subjects = orm.Define("foundry_token_subjects", func(b orm.Builder[Subject], m *Subject) SubjectTable { table := orm.TableOf(b, &m.Key) field1 := orm.TextOf(b, &m.Scope) field2 := orm.JSONOf(b, &m.Identity) return SubjectTable{ Table: table, Scope: field1, Identity: field2, } }, orm.ModelFingerprint("e1fd8e443cb9969f9f8eb87ecec01660b8b51946d3619acbf326b1540965cb1b"))
Subjects is the foundry_token_subjects table.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
//
// ID binds the persisted Entry.ID column.
// Example: orm.Eq(Entries.ID, id).
ID model.ID[Entry] `foundry:"member=ID"`
// Scope binds the persisted Entry.Scope column.
// Example: orm.Set(Entries.Scope, scope).
Scope string
// FamilyID binds the persisted Entry.FamilyID column.
// Example: orm.Set(Entries.FamilyID, familyID).
FamilyID model.ID[Family] `foundry:"role=column"`
// Generation binds the persisted Entry.Generation column.
// Example: orm.Set(Entries.Generation, generation).
Generation uint32
// AccessHash binds the persisted Entry.AccessHash column.
// Example: orm.Set(Entries.AccessHash, accessHash).
AccessHash string
// RefreshHash binds the persisted Entry.RefreshHash column.
// Example: orm.SetNull(Entries.RefreshHash).
RefreshHash value.Nullable[string]
// IssuedAt binds the persisted Entry.IssuedAt column.
// Example: orm.Set(Entries.IssuedAt, issuedAt).
IssuedAt temporal.DateTime
// LastSeenAt binds the persisted Entry.LastSeenAt column.
// Example: orm.Set(Entries.LastSeenAt, lastSeenAt).
LastSeenAt temporal.DateTime
// AccessExpiresAt binds the persisted Entry.AccessExpiresAt column.
// Example: orm.Set(Entries.AccessExpiresAt, accessExpiresAt).
AccessExpiresAt temporal.DateTime
// RefreshExpiresAt binds the persisted Entry.RefreshExpiresAt column.
// Example: orm.SetNull(Entries.RefreshExpiresAt).
RefreshExpiresAt value.Nullable[temporal.DateTime]
}
Entry retains the current generation and the one before it. The previous access hash authenticates only within the configured refresh grace; its refresh hash, like every older one kept in foundry_token_consumed_refreshes, identifies reuse and revokes the family.
type EntryTable ¶
type EntryTable struct {
//
// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
//
// ID binds the persisted Entry.ID column.
// Example: orm.Eq(Entries.ID, id).
//
// See [Entry.ID].
orm.Table[Entry, model.ID[Entry]]
//
// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
//
// ID binds the persisted Entry.ID column.
// Example: orm.Eq(Entries.ID, id).
//
// See [Entry.ID].
ID orm.Key[Entry, model.ID[Entry]]
//
// Scope binds the persisted Entry.Scope column.
// Example: orm.Set(Entries.Scope, scope).
//
// See [Entry.Scope].
Scope orm.Text[Entry, string]
//
// FamilyID binds the persisted Entry.FamilyID column.
// Example: orm.Set(Entries.FamilyID, familyID).
//
// See [Entry.FamilyID].
FamilyID orm.Column[Entry, model.ID[Family]]
//
// Generation binds the persisted Entry.Generation column.
// Example: orm.Set(Entries.Generation, generation).
//
// See [Entry.Generation].
Generation orm.Number[Entry, uint32]
//
// AccessHash binds the persisted Entry.AccessHash column.
// Example: orm.Set(Entries.AccessHash, accessHash).
//
// See [Entry.AccessHash].
AccessHash orm.Text[Entry, string]
//
// RefreshHash binds the persisted Entry.RefreshHash column.
// Example: orm.SetNull(Entries.RefreshHash).
//
// See [Entry.RefreshHash].
RefreshHash orm.NullableText[Entry, string]
//
// IssuedAt binds the persisted Entry.IssuedAt column.
// Example: orm.Set(Entries.IssuedAt, issuedAt).
//
// See [Entry.IssuedAt].
IssuedAt orm.Time[Entry, temporal.DateTime]
//
// LastSeenAt binds the persisted Entry.LastSeenAt column.
// Example: orm.Set(Entries.LastSeenAt, lastSeenAt).
//
// See [Entry.LastSeenAt].
LastSeenAt orm.Time[Entry, temporal.DateTime]
//
// AccessExpiresAt binds the persisted Entry.AccessExpiresAt column.
// Example: orm.Set(Entries.AccessExpiresAt, accessExpiresAt).
//
// See [Entry.AccessExpiresAt].
AccessExpiresAt orm.Time[Entry, temporal.DateTime]
//
// RefreshExpiresAt binds the persisted Entry.RefreshExpiresAt column.
// Example: orm.SetNull(Entries.RefreshExpiresAt).
//
// See [Entry.RefreshExpiresAt].
RefreshExpiresAt orm.NullableTime[Entry, temporal.DateTime]
}
EntryTable binds the declared fields of Entry.
type Family ¶
type Family struct {
// Table provides Family queries and writes. Example: Families.Query().Limit(10).
//
// ID binds the persisted Family.ID column.
// Example: orm.Eq(Families.ID, id).
ID model.ID[Family] `foundry:"member=ID"`
// Scope binds the persisted Family.Scope column.
// Example: orm.Set(Families.Scope, scope).
Scope string
// SubjectKey binds the persisted Family.SubjectKey column.
// Example: orm.Set(Families.SubjectKey, subjectKey).
SubjectKey string
// Name binds the persisted Family.Name column.
// Example: orm.Set(Families.Name, name).
Name string
// Scopes binds the persisted Family.Scopes column.
// Example: encoded, err := value.NewJSON(scopes); if err == nil { _ = orm.Set(Families.Scopes, encoded) }.
Scopes value.JSON[[]auth.AccessScopeName]
// Mode binds the persisted Family.Mode column.
// Example: orm.Set(Families.Mode, mode).
Mode uint8
// Assurance binds the persisted Family.Assurance column.
// Example: orm.Set(Families.Assurance, assurance).
Assurance uint8
// AccessNanos binds the persisted Family.AccessNanos column.
// Example: orm.Set(Families.AccessNanos, accessNanos).
AccessNanos int64
// RefreshIdleNanos binds the persisted Family.RefreshIdleNanos column.
// Example: orm.Set(Families.RefreshIdleNanos, refreshIdleNanos).
RefreshIdleNanos int64
// RotationLimit binds the persisted Family.RotationLimit column.
// Example: orm.Set(Families.RotationLimit, rotationLimit).
RotationLimit uint32
// Generation binds the persisted Family.Generation column.
// Example: orm.Set(Families.Generation, generation).
Generation uint32
// CreatedAt binds the caller-supplied creation time; the ORM does not automatically populate or refresh it.
// Example: orm.Set(Families.CreatedAt, createdAt).
CreatedAt temporal.DateTime `foundry:"role=time"`
// ExpiresAt binds the persisted Family.ExpiresAt column.
// Example: orm.Set(Families.ExpiresAt, expiresAt).
ExpiresAt temporal.DateTime
// ClientIP and UserAgent are display-only device metadata from issuance.
//
// ClientIP binds the persisted Family.ClientIP column.
// Example: orm.SetNull(Families.ClientIP).
ClientIP value.Nullable[string]
// UserAgent binds the persisted Family.UserAgent column.
// Example: orm.SetNull(Families.UserAgent).
UserAgent value.Nullable[string]
}
Family owns identity, grant, immutable expiry policy and the current generation.
type FamilyTable ¶
type FamilyTable struct {
//
// Table provides Family queries and writes. Example: Families.Query().Limit(10).
//
// ID binds the persisted Family.ID column.
// Example: orm.Eq(Families.ID, id).
//
// See [Family.ID].
orm.Table[Family, model.ID[Family]]
//
// Table provides Family queries and writes. Example: Families.Query().Limit(10).
//
// ID binds the persisted Family.ID column.
// Example: orm.Eq(Families.ID, id).
//
// See [Family.ID].
ID orm.Key[Family, model.ID[Family]]
//
// Scope binds the persisted Family.Scope column.
// Example: orm.Set(Families.Scope, scope).
//
// See [Family.Scope].
Scope orm.Text[Family, string]
//
// SubjectKey binds the persisted Family.SubjectKey column.
// Example: orm.Set(Families.SubjectKey, subjectKey).
//
// See [Family.SubjectKey].
SubjectKey orm.Text[Family, string]
//
// Name binds the persisted Family.Name column.
// Example: orm.Set(Families.Name, name).
//
// See [Family.Name].
Name orm.Text[Family, string]
//
// Scopes binds the persisted Family.Scopes column.
// Example: encoded, err := value.NewJSON(scopes); if err == nil { _ = orm.Set(Families.Scopes, encoded) }.
//
// See [Family.Scopes].
Scopes orm.JSON[Family, []auth.AccessScopeName]
//
// Mode binds the persisted Family.Mode column.
// Example: orm.Set(Families.Mode, mode).
//
// See [Family.Mode].
Mode orm.Number[Family, uint8]
//
// Assurance binds the persisted Family.Assurance column.
// Example: orm.Set(Families.Assurance, assurance).
//
// See [Family.Assurance].
Assurance orm.Number[Family, uint8]
//
// AccessNanos binds the persisted Family.AccessNanos column.
// Example: orm.Set(Families.AccessNanos, accessNanos).
//
// See [Family.AccessNanos].
AccessNanos orm.Number[Family, int64]
//
// RefreshIdleNanos binds the persisted Family.RefreshIdleNanos column.
// Example: orm.Set(Families.RefreshIdleNanos, refreshIdleNanos).
//
// See [Family.RefreshIdleNanos].
RefreshIdleNanos orm.Number[Family, int64]
//
// RotationLimit binds the persisted Family.RotationLimit column.
// Example: orm.Set(Families.RotationLimit, rotationLimit).
//
// See [Family.RotationLimit].
RotationLimit orm.Number[Family, uint32]
//
// Generation binds the persisted Family.Generation column.
// Example: orm.Set(Families.Generation, generation).
//
// See [Family.Generation].
Generation orm.Number[Family, uint32]
//
// CreatedAt binds the caller-supplied creation time; the ORM does not automatically populate or refresh it.
// Example: orm.Set(Families.CreatedAt, createdAt).
//
// See [Family.CreatedAt].
CreatedAt orm.Time[Family, temporal.DateTime]
//
// ExpiresAt binds the persisted Family.ExpiresAt column.
// Example: orm.Set(Families.ExpiresAt, expiresAt).
//
// See [Family.ExpiresAt].
ExpiresAt orm.Time[Family, temporal.DateTime]
//
// ClientIP and UserAgent are display-only device metadata from issuance.
//
// ClientIP binds the persisted Family.ClientIP column.
// Example: orm.SetNull(Families.ClientIP).
//
// See [Family.ClientIP].
ClientIP orm.NullableText[Family, string]
//
// UserAgent binds the persisted Family.UserAgent column.
// Example: orm.SetNull(Families.UserAgent).
//
// See [Family.UserAgent].
UserAgent orm.NullableText[Family, string]
}
FamilyTable binds the declared fields of Family.
type Subject ¶
type Subject struct {
// Table provides Subject queries and writes. Example: Subjects.Query().Limit(10).
Key string
// Scope binds the persisted Subject.Scope column.
// Example: orm.Set(Subjects.Scope, scope).
Scope string
// Identity binds the persisted Subject.Identity column.
// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Subjects.Identity, encoded) }.
Identity value.JSON[model.Identity]
}
Subject is a stable lock identity for create/revoke/refresh serialization.
type SubjectTable ¶
type SubjectTable struct {
//
// Table provides Subject queries and writes. Example: Subjects.Query().Limit(10).
//
// See [Subject.Key].
orm.Table[Subject, string]
//
// Scope binds the persisted Subject.Scope column.
// Example: orm.Set(Subjects.Scope, scope).
//
// See [Subject.Scope].
Scope orm.Text[Subject, string]
//
// Identity binds the persisted Subject.Identity column.
// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Subjects.Identity, encoded) }.
//
// See [Subject.Identity].
Identity orm.JSON[Subject, model.Identity]
}
SubjectTable binds the declared fields of Subject.