Go: package foundry
Generated from the Go source by scripts/gen-docs.sh — do not edit; run it to regenerate. Guides and account setup: https://docs.dnsid.ai.
import "github.com/dnsid-ai/dnsid-go/foundry"Package foundry implements Known Foundry named caller-key Live creation. Importing it requires the dnsid_foundry build tag. The package remains gated until the server’s named-Live requirements are released. Core DNSid, ordinary registration, and configuration loading do not depend on it.
- func IssuanceKey(registrationKey string) string
- func RegistrationKey(organizationID, name, initialKeyID string) (string, error)
- func ValidateName(name string) error
- type Client
- type CreationInput
- type Dependencies
- type Error
- type ErrorKind
- type FileFoundryStore
- func NewFileFoundryStore(directory string) (*FileFoundryStore, error)
- func (s *FileFoundryStore) Import(ctx context.Context, data []byte) error
- func (s *FileFoundryStore) LoadIdentity(ctx context.Context, registryURL, organizationID, identityID string) (*RecoveryDocument, error)
- func (s *FileFoundryStore) Lock(ctx context.Context, key OperationKey) (FoundryLease, error)
- type FoundryIdentity
- func Create(ctx context.Context, name string) (*FoundryIdentity, error)
- func (i *FoundryIdentity) Active(ctx context.Context) (identity *FoundryIdentity, err error)
- func (i *FoundryIdentity) Domain() string
- func (i *FoundryIdentity) IdentityManager() (*dnsid.IdentityManager, error)
- func (i *FoundryIdentity) RegistryStatus() string
- func (i *FoundryIdentity) Sign(data []byte) ([]byte, error)
- func (i *FoundryIdentity) State() dnsid.AgentState
- type FoundryLease
- type FoundryStore
- type IssuanceState
- type OperationKey
- type ProofState
- type RecoveryDocument
- type RegistryClient
- type SigningPaused
- type UnsupportedRegistry
func IssuanceKey(registrationKey string) stringIssuanceKey derives the stable ISSUANCE submission key.
func RegistrationKey(organizationID, name, initialKeyID string) (string, error)RegistrationKey derives the stable caller-key Live request ID.
func ValidateName(name string) errorValidateName checks exact Unicode names without trimming or normalization.
Client composes the same workflow used by the configured Create facade.
type Client struct { // contains filtered or unexported fields}func New(loaded config.Loaded, deps Dependencies) (*Client, error)New validates configuration without discovery, provisioning, or registration. LoadDeploymentFile and Merge can supply file and code configuration explicitly.
func (*Client) Create
Section titled “func (*Client) Create”func (c *Client) Create(ctx context.Context, name string) (identity *FoundryIdentity, err error)Create stops after the identity ID and domain are saved; it does not wait for public ACTIVE.
CreationInput freezes the complete non-secret Live wire request.
type CreationInput struct { Name string `json:"name"` PublicKey json.RawMessage `json:"public_key"` Environment string `json:"environment"` CapabilitiesURL string `json:"capabilities_url,omitempty"` Tier string `json:"tier"` Managed bool `json:"managed"`}Dependencies supplies explicit runtime dependencies. Injected providers, registry clients, and log registries take precedence over loaded selection. Credential is used only by the authenticated registry client and is never saved.
type Dependencies struct { Credential string KeyProvider dnsid.KeyProvider RegistryClient RegistryClient LogRegistry *dnsidlog.LogRegistry Store FoundryStore DNSResolver dnsid.DNSResolver HTTPSFetcher dnsid.HTTPSFetcher}Error preserves known facts and the original cause across interrupted calls.
type Error struct { Kind ErrorKind Phase string StatusCode int Code string IdentityID string Domain string RegistryStatus string Resumable bool Cause error}func (*Error) Error
Section titled “func (*Error) Error”func (e *Error) Error() stringError returns the workflow facts, operator remedy, and cause.
func (*Error) Unwrap
Section titled “func (*Error) Unwrap”func (e *Error) Unwrap() errorUnwrap retains cancellation, transport, and registry error classification.
ErrorKind classifies a Foundry workflow failure independently of server codes.
type ErrorKind stringWorkflow failure categories. Server wire codes remain unchanged in Error.Code.
const ( KeyMissing ErrorKind = "KEY_MISSING" KeyMismatch ErrorKind = "KEY_MISMATCH" KeyRevoked ErrorKind = "KEY_REVOKED" Busy ErrorKind = "busy" Deadline ErrorKind = "deadline" UnsupportedContract ErrorKind = "unsupported_contract" UnsupportedAlgorithm ErrorKind = "unsupported_algorithm" WorkflowOutcome ErrorKind = "workflow_outcome" Terminal ErrorKind = "terminal" Integrity ErrorKind = "integrity" Unresolved ErrorKind = "unresolved")FileFoundryStore stores recovery documents separately from private keys. Back up this directory and the provider’s own recovery state. Container-local storage does not coordinate replicas or survive replacement of the container.
type FileFoundryStore struct { // contains filtered or unexported fields}func NewFileFoundryStore(directory string) (*FileFoundryStore, error)NewFileFoundryStore selects directory, or ~/.dnsid/foundry when empty. It does not read recovery state or create files until a workflow takes a lock.
func (*FileFoundryStore) Import
Section titled “func (*FileFoundryStore) Import”func (s *FileFoundryStore) Import(ctx context.Context, data []byte) errorImport validates a portable document and stores it under the same lock used by Create and Active. It never replaces different or more advanced local state.
func (*FileFoundryStore) LoadIdentity
Section titled “func (*FileFoundryStore) LoadIdentity”func (s *FileFoundryStore) LoadIdentity(ctx context.Context, registryURL, organizationID, identityID string) (*RecoveryDocument, error)LoadIdentity loads retained public recovery state by immutable identity ID.
func (*FileFoundryStore) Lock
Section titled “func (*FileFoundryStore) Lock”func (s *FileFoundryStore) Lock(ctx context.Context, key OperationKey) (FoundryLease, error)Lock waits for the cross-process lock until ctx expires. OS locks are also exclusive between independently opened file descriptors in the same process.
FoundryIdentity is a durable identity handle. Observation accessors are safe during Sign and Active. Domain never changes after Create returns the handle.
type FoundryIdentity struct { // contains filtered or unexported fields}func Create(ctx context.Context, name string) (*FoundryIdentity, error)Create loads environment configuration and the separate DNSID_API_KEY secret. Applications with file configuration or injected dependencies use New(…).Create.
func (*FoundryIdentity) Active
Section titled “func (*FoundryIdentity) Active”func (i *FoundryIdentity) Active(ctx context.Context) (identity *FoundryIdentity, err error)Active completes durable setup and makes a new, isolated public observation on every call. Cancellation preserves progress and does not cancel the identity.
func (*FoundryIdentity) Domain
Section titled “func (*FoundryIdentity) Domain”func (i *FoundryIdentity) Domain() stringDomain returns the immutable registry-assigned domain.
func (*FoundryIdentity) IdentityManager
Section titled “func (*FoundryIdentity) IdentityManager”func (i *FoundryIdentity) IdentityManager() (*dnsid.IdentityManager, error)IdentityManager returns the manager sharing this handle’s signing controller. It returns SigningPaused until the publication configuration is saved. All subsequent successful calls return the same instance.
func (*FoundryIdentity) RegistryStatus
Section titled “func (*FoundryIdentity) RegistryStatus”func (i *FoundryIdentity) RegistryStatus() stringRegistryStatus returns the last control-plane observation, not protocol state.
func (*FoundryIdentity) Sign
Section titled “func (*FoundryIdentity) Sign”func (i *FoundryIdentity) Sign(data []byte) ([]byte, error)Sign signs raw bytes without adding a JOSE or other application format.
func (*FoundryIdentity) State
Section titled “func (*FoundryIdentity) State”func (i *FoundryIdentity) State() dnsid.AgentStateState returns the last real public observation, or the empty state.
FoundryLease owns an exclusive operation until Close. Load returns nil only when no document exists. Save must be atomic, durable, and owner-only.
type FoundryLease interface { Load(context.Context) (*RecoveryDocument, error) Save(context.Context, *RecoveryDocument) error Close() error}FoundryStore serializes each workflow call and provides durable named state. A lease must prevent writes after Close, including writes from another process.
type FoundryStore interface { Lock(context.Context, OperationKey) (FoundryLease, error)}IssuanceState retains local coordinator state separately from a verified accepted entry recovered from another replica. Its receipt never acknowledges the local entry bytes.
type IssuanceState struct { Operation *c2sptlog.ManagedIssuanceState `json:"operation,omitempty"` Recovered bool `json:"recovered,omitempty"` AcceptedReference string `json:"acceptedReference,omitempty"` PreparedBytes string `json:"preparedBytes,omitempty"` StatusCode int `json:"statusCode,omitempty"`}OperationKey scopes an exact name to its registry and authenticated account.
type OperationKey struct{ RegistryURL, OrganizationID, Name string }ProofState retains the exact server challenge and completed request.
type ProofState struct { Challenge string `json:"challenge"` ChallengeMessage string `json:"challengeMessage"` Signature string `json:"signature,omitempty"` Outcome string `json:"outcome,omitempty"`}RecoveryDocument is the non-secret, portable recovery state for an exact name. Use ParseRecoveryDocument and Export to validate imported and exported state.
type RecoveryDocument struct { SchemaVersion int `json:"schemaVersion"` Phase string `json:"phase"` RegistryURL string `json:"registryUrl"` OrganizationID string `json:"organizationId"` Name string `json:"name"` GovernanceID string `json:"governanceId"` LogTrust json.RawMessage `json:"logTrust,omitempty"` KeySource config.KeySource `json:"keySource"` CurrentKeySource *config.KeySource `json:"currentKeySource,omitempty"` InitialPublicKey json.RawMessage `json:"initialPublicKey"` CurrentPublicKey json.RawMessage `json:"currentPublicKey,omitempty"` CreationInput CreationInput `json:"creationInput"` IdentityID string `json:"identityId,omitempty"` Domain string `json:"domain,omitempty"` RequestID string `json:"requestId,omitempty"` RegistryStatus string `json:"registryStatus,omitempty"` RegistryError *dnsid.AgentError `json:"registryError,omitempty"` ProtocolState string `json:"protocolState,omitempty"` SigningPaused bool `json:"signingPaused,omitempty"` Proof *ProofState `json:"proof,omitempty"` PublicationConfig *dnsid.PublicationConfig `json:"publicationConfig,omitempty"` OIDCIssuerURL string `json:"oidcIssuerUrl,omitempty"` EntityPublicKey json.RawMessage `json:"entityPublicKey,omitempty"` Issuance *IssuanceState `json:"issuance,omitempty"` // contains filtered or unexported fields}func ParseRecoveryDocument(data []byte) (*RecoveryDocument, error)ParseRecoveryDocument rejects corrupt, duplicate, invalid-Unicode, and unsupported recovery documents. Unknown members are retained on export.
func (*RecoveryDocument) Export
Section titled “func (*RecoveryDocument) Export”func (d *RecoveryDocument) Export() ([]byte, error)Export returns UTF-8 RFC 8785 JSON without private keys or credentials.
RegistryClient is the existing low-level registry surface used by Foundry.
type RegistryClient interface { CreateLiveAgent(context.Context, *dnsid.LiveAgentRegistrationInput, string) (*dnsid.LiveProvisioningResponse, error) GetOrganizationOnboarding(context.Context) (*dnsid.OrganizationOnboardingResponse, error) GetAgentStatus(context.Context, string) (*dnsid.AgentDetail, error) SubmitLiveProof(context.Context, string, *dnsid.LiveProofRequest) (*dnsid.LiveProofResponse, error) ReissueLiveProof(context.Context, string, *dnsid.LiveProofReissueRequest) (*dnsid.LiveProofReissueResponse, error) dnsid.RegistryPreparedEventClient}SigningPaused rejects application signatures until the identity is verified.
type SigningPaused struct { Reason string Phase string IdentityID string Domain string RegistryStatus string}func (*SigningPaused) Error
Section titled “func (*SigningPaused) Error”func (e *SigningPaused) Error() stringError describes why application signing is paused.
UnsupportedRegistry means onboarding did not provide the required contract.
type UnsupportedRegistry struct{ Detail *Error }func (*UnsupportedRegistry) Error
Section titled “func (*UnsupportedRegistry) Error”func (e *UnsupportedRegistry) Error() stringError describes the unsupported registry contract.
func (*UnsupportedRegistry) Unwrap
Section titled “func (*UnsupportedRegistry) Unwrap”func (e *UnsupportedRegistry) Unwrap() errorUnwrap preserves structured workflow and HTTP facts.
Generated by gomarkdoc