mock

package
v0.0.0-...-4cc0a05 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package mock provides an in-memory mock implementation of the backend interfaces for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyProvider

type PolicyProvider struct {
	Policies *backend.PolicyResponse
}

PolicyProvider is a mock backend.PolicyProvider with static policies.

func NewPolicyProvider

func NewPolicyProvider() *PolicyProvider

NewPolicyProvider creates a mock PolicyProvider with a default template.

func (*PolicyProvider) GetPolicies

func (p *PolicyProvider) GetPolicies(_ context.Context) (*backend.PolicyResponse, error)

type Signer

type Signer struct {
	// IssuerCert is used as the CA certificate for signing.
	IssuerCert *x509.Certificate
	IssuerKey  *ecdsa.PrivateKey

	// PendingRequestIDs tracks requests that should be returned as pending.
	PendingRequestIDs map[string]bool
}

Signer is a mock backend.Signer that issues self-signed certificates.

func NewPersistentSigner

func NewPersistentSigner(dir string) (*Signer, error)

NewPersistentSigner creates a mock Signer whose CA certificate and key are loaded from dir if present, or generated and saved there otherwise. This keeps the CA stable across restarts so clients only need to trust it once.

func NewSigner

func NewSigner() (*Signer, error)

NewSigner creates a mock Signer with a self-signed CA.

func (*Signer) Enroll

func (*Signer) Poll

func (s *Signer) Poll(_ context.Context, requestID string) (*backend.EnrollmentResult, error)

func (*Signer) Renew

Jump to

Keyboard shortcuts

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