attestation

package
v0.0.0-test.4 Latest Latest
Warning

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

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

Documentation

Overview

Package attestation owns the backend attestation workflow.

Index

Constants

View Source
const (
	// DefaultRetryInterval is the delay after a failed attestation attempt.
	DefaultRetryInterval = 5 * time.Minute

	// DefaultStartupJitter is the maximum random delay before the first attestation attempt.
	DefaultStartupJitter = time.Minute
)

Variables

View Source
var ErrNotEnrolled = errors.New("agent not enrolled")

ErrNotEnrolled indicates attestation cannot run yet because the agent is not enrolled.

Functions

func NewStateNodeUUIDProvider added in v1.3.0

func NewStateNodeUUIDProvider(state agentstate.State) func(context.Context) (string, error)

NewStateNodeUUIDProvider returns a node UUID provider backed by persisted agent state.

Types

type AttestationConfig added in v1.3.0

type AttestationConfig struct {
	Interval      time.Duration
	RetryInterval time.Duration
	Timeout       time.Duration
	StartupJitter time.Duration
}

AttestationConfig controls periodic attestation workflow scheduling.

type BackendClient added in v1.3.0

type BackendClient interface {
	SubmitAttestation(ctx context.Context, nodeUUID string, req *backendclient.AttestationRequest, jwt string) error
}

BackendClient is the backend client view required by the attestation workflow.

type EvidenceCollector added in v1.3.0

type EvidenceCollector interface {
	Collect(ctx context.Context, nonce string) (*SDKResponse, error)
}

EvidenceCollector collects attestation evidence from local tooling.

func NewCLIEvidenceCollector added in v1.3.0

func NewCLIEvidenceCollector(timeout time.Duration) EvidenceCollector

NewCLIEvidenceCollector creates an evidence collector backed by the nvattest CLI.

type EvidenceItem

type EvidenceItem struct {
	Arch          string `json:"arch"`
	Certificate   string `json:"certificate"`
	DriverVersion string `json:"driver_version"`
	Evidence      string `json:"evidence"`
	Nonce         string `json:"nonce"`
	VBIOSVersion  string `json:"vbios_version"`
	Version       string `json:"version"`
}

type JWTProvider added in v1.3.0

type JWTProvider interface {
	GetJWT(ctx context.Context) (string, error)
	SetJWT(ctx context.Context, value string) error
}

JWTProvider retrieves the current backend JWT.

func NewStateJWTProvider added in v1.3.0

func NewStateJWTProvider(state agentstate.State) JWTProvider

NewStateJWTProvider returns a JWT provider backed by persisted agent state.

type Manager

type Manager interface {
	Run(ctx context.Context) error
	CollectOnce(ctx context.Context) (*Result, error)
	LastResult() *Result
	IsResultUpdated(since time.Time) bool
}

Manager coordinates periodic attestation collection into a store.

func NewManager

func NewManager(
	nodeUUIDProvider func(context.Context) (string, error),
	jwtProvider JWTProvider,
	nonceProvider NonceProvider,
	collector EvidenceCollector,
	submitter Submitter,
	cfg AttestationConfig,
) Manager

NewManager creates an attestation loop manager skeleton.

type NonceBackendClient added in v1.3.0

type NonceBackendClient interface {
	GetNonce(ctx context.Context, nodeUUID string, jwt string) (*backendclient.NonceResponse, error)
}

NonceBackendClient is the backend client view required by the nonce provider.

type NonceProvider added in v1.3.0

type NonceProvider interface {
	GetNonce(ctx context.Context, nodeUUID, jwt string) (nonce string, refreshTS time.Time, refreshedJWT string, err error)
}

NonceProvider retrieves a backend nonce for a node.

func NewBackendNonceProvider added in v1.3.0

func NewBackendNonceProvider(client NonceBackendClient) NonceProvider

NewBackendNonceProvider creates a nonce provider backed by the agent backend client.

func NewStateNonceProvider added in v1.3.0

func NewStateNonceProvider(state agentstate.State) NonceProvider

NewStateNonceProvider creates a nonce provider that resolves backend state dynamically.

type Result added in v1.3.0

type Result struct {
	CollectedAt           time.Time
	NodeUUID              string
	NonceRefreshTimestamp time.Time
	Success               bool
	ErrorMessage          string
	SDKResponse           SDKResponse
}

Result is the agent-owned attestation state model for the new backend sync loop.

type SDKResponse added in v1.3.0

type SDKResponse struct {
	Evidences     []EvidenceItem `json:"evidences"`
	ResultCode    int            `json:"result_code"`
	ResultMessage string         `json:"result_message"`
}

type Submitter added in v1.3.0

type Submitter interface {
	Submit(ctx context.Context, result *Result, jwt string) error
}

Submitter submits attestation results to the backend.

func NewBackendSubmitter added in v1.3.0

func NewBackendSubmitter(client BackendClient) Submitter

NewBackendSubmitter creates a backend submitter backed by the agent backend client.

func NewStateBackendSubmitter added in v1.3.0

func NewStateBackendSubmitter(state agentstate.State) Submitter

NewStateBackendSubmitter creates a submitter that resolves backend state dynamically.

Jump to

Keyboard shortcuts

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