Documentation
¶
Overview ¶
Package confirmation owns short-lived, single-use proofs for high-risk device operations. Proofs are opaque to adapters and are consumed only by the hardware execution service at the final send boundary.
Index ¶
- Constants
- Variables
- func DigestArguments(canonical []byte) [sha256.Size]byte
- func WithPrincipal(ctx context.Context, principal Principal) context.Context
- func WithProof(ctx context.Context, proof Proof) context.Context
- type Authority
- type Binding
- type Config
- type MemoryNonceStore
- type NonceStore
- type Principal
- type Proof
Constants ¶
const (
DefaultTTL = 2 * time.Minute
)
Variables ¶
var ( ErrInvalidConfiguration = errors.New("invalid confirmation configuration") ErrPrincipalRequired = errors.New("authenticated principal is required") ErrProofRequired = errors.New("confirmation proof is required") ErrProofInvalid = errors.New("confirmation proof is invalid") ErrProofExpired = errors.New("confirmation proof has expired") ErrProofMismatch = errors.New("confirmation proof does not match the operation") ErrProofReplayed = errors.New("confirmation proof was already consumed") )
Functions ¶
func DigestArguments ¶
DigestArguments derives the unkeyed identity of canonical arguments. The HMAC-sealed proof prevents callers from substituting this digest.
func WithPrincipal ¶
WithPrincipal attaches the identity established by stdio process ownership or HTTP authentication. Device-facing request arguments must never choose it.
Types ¶
type Authority ¶
type Authority struct {
// contains filtered or unexported fields
}
Authority mints and verifies proofs. Key material is supplied by the composition root and is never generated or persisted by this package.
func NewAuthority ¶
type Binding ¶
type Binding struct {
DeviceID domain.DeviceID
Generation uint64
Effect domain.EffectClass
Action string
ArgumentsDigest [sha256.Size]byte
PolicyRevision string
}
Binding is the complete authority identity for one high-risk operation. ArgumentsDigest must cover deterministic, versioned canonical arguments.
type MemoryNonceStore ¶
type MemoryNonceStore struct {
// contains filtered or unexported fields
}
MemoryNonceStore is suitable for the single-process stdio and loopback HTTP deployment supported by the first release.
func NewMemoryNonceStore ¶
func NewMemoryNonceStore() *MemoryNonceStore
type NonceStore ¶
NonceStore is the atomic single-use authority. Implementations used by multi-process servers must place this state in their shared durable store.
type Principal ¶
Principal is the authenticated caller identity established by a trusted transport adapter. ID must be stable within the adapter's trust domain.
func LocalProcessPrincipal ¶
func LocalProcessPrincipal() Principal
LocalProcessPrincipal is the identity used by the local stdio adapter.