subscription

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package subscription exposes the OpenAI subscription registration policy boundary. It deliberately has no credential, transport, or discovery implementation: the current policy is to reject unsanctioned third-party registration attempts before they can become an inference flow.

Index

Constants

View Source
const (
	// StatusUnavailable means the provider has not published a sanctioned
	// third-party subscription-registration contract.
	StatusUnavailable Status = "unavailable"
	// StatusBlocked means callers must not proceed through this gate.
	StatusBlocked Status = "blocked"

	// RegistrationStatusUnavailable and RegistrationStatusBlocked are explicit
	// aliases for callers that prefer the longer enum names.
	RegistrationStatusUnavailable = StatusUnavailable
	RegistrationStatusBlocked     = StatusBlocked
)
View Source
const (
	EvidenceAuthURL                   = "https://learn.chatgpt.com/docs/auth"
	EvidenceCodexPlanURL              = "https://help.openai.com/en/articles/11369540-using-codex-with-your-chatgpt-plan"
	EvidenceEnterpriseAccessTokensURL = "https://learn.chatgpt.com/docs/enterprise/access-tokens" // #nosec G101 -- "access-tokens" is a documentation URL phrase, not a credential.
	EvidenceSignInWithChatGPTURL      = "https://help.openai.com/en/articles/20001410-sign-in-with-chatgpt"
	EvidenceAPIQuickstartURL          = "https://platform.openai.com/docs/quickstart/make-your-first-api-request"
)

The evidence set is deliberately fixed and bounded. These are documentation references only; no value from them is used to construct a request.

View Source
const ReviewedAtDate = "2026-08-09"

ReviewedAtDate is the date on which the official evidence for this gate was reviewed. It is a date, not a timestamp, so it has no local-time ambiguity.

Variables

This section is empty.

Functions

This section is empty.

Types

type RegistrationGate

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

RegistrationGate is an immutable, provider-specific registration policy. Its state is private so callers can only observe copies of the metadata. Require always fails closed for the current OpenAI subscription policy.

func OpenAIRegistration

func OpenAIRegistration() RegistrationGate

OpenAIRegistration returns the current OpenAI subscription registration gate. Every call returns an independent value; its evidence accessor also returns a fresh copy.

func (RegistrationGate) EvidenceURLs

func (g RegistrationGate) EvidenceURLs() []string

EvidenceURLs returns a bounded copy of the official evidence URL metadata.

func (RegistrationGate) Format

func (g RegistrationGate) Format(state fmt.State, verb rune)

Format keeps diagnostics from reflecting private fields. The gate contains only bounded policy metadata today, but this formatter makes that boundary durable if the representation grows later.

func (RegistrationGate) LogValue

func (g RegistrationGate) LogValue() slog.Value

LogValue exposes only the safe gate state needed for policy diagnostics; evidence URLs and any future registration fields are intentionally omitted.

func (RegistrationGate) Provider

func (g RegistrationGate) Provider() llm.Provider

Provider reports the provider policy label covered by the gate.

func (RegistrationGate) Require

func (g RegistrationGate) Require() error

Require rejects use of this registration path. A zero-value gate also fails closed, so an uninitialized value cannot accidentally authorize a flow.

func (RegistrationGate) ReviewedAt

func (g RegistrationGate) ReviewedAt() time.Time

ReviewedAt reports the UTC midnight at which the evidence was reviewed.

func (RegistrationGate) ReviewedDate

func (g RegistrationGate) ReviewedDate() string

ReviewedDate reports the reviewed-at date in ISO-8601 calendar form.

func (RegistrationGate) Status

func (g RegistrationGate) Status() Status

Status reports the gate's fail-closed status.

type Status

type Status string

Status is the immutable state of a subscription registration gate.

type UnsupportedRegistrationError

type UnsupportedRegistrationError struct{}

UnsupportedRegistrationError is the redaction-safe, typed failure returned by a blocked subscription registration gate. It intentionally carries no caller input, credential, endpoint, or provider-controlled value.

func (*UnsupportedRegistrationError) Error

Error reports the stable policy boundary without exposing registration details that are not part of a sanctioned public contract.

func (*UnsupportedRegistrationError) Format

func (e *UnsupportedRegistrationError) Format(state fmt.State, verb rune)

Format keeps every fmt verb redaction-safe. In particular, %#v must not fall back to reflecting an error's fields, and unsupported verbs must not trigger a formatting diagnostic containing implementation details.

func (*UnsupportedRegistrationError) LogValue

func (e *UnsupportedRegistrationError) LogValue() slog.Value

LogValue prevents structured logging from reflecting the error value or attempting to serialize fields that could later become caller-controlled.

Jump to

Keyboard shortcuts

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