Documentation
¶
Overview ¶
Package attestation owns the backend attestation workflow.
Index ¶
- Constants
- Variables
- func NewStateNodeUUIDProvider(state agentstate.State) func(context.Context) (string, error)
- type AttestationConfig
- type BackendClient
- type EvidenceCollector
- type EvidenceItem
- type JWTProvider
- type Manager
- type NonceBackendClient
- type NonceProvider
- type Result
- type SDKResponse
- type Submitter
Constants ¶
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 ¶
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
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 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
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.