keys

package
v0.15.0 Latest Latest
Warning

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

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

Documentation

Overview

Package keys wires keyforge into SystemForge (ADR-013): one key library for every encryption need on the platform, with the root key read through omnivault and lifecycle events sent to the platform audit trail.

This first version runs keyforge's single-host setup: the keyring and its registry live together in one directory, so they are backed up together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VaultSource

func VaultSource(v vault.Vault, path string) local.RootKeySource

VaultSource returns a root key source that reads the key from a secret in an omnivault vault. The secret holds 32 bytes as standard base64 or as 64 hex digits, the forms keyforge accepts from a file or the environment.

Types

type Keys

type Keys struct {
	// contains filtered or unexported fields
}

Keys is a running key system.

func Open

func Open(ctx context.Context, o Options) (*Keys, error)

Open opens the key system in o.Dir, creating it on first use.

func (*Keys) Client

func (k *Keys) Client() *keyforge.Client

Client returns the keyforge client, for callers that need envelopes.

func (*Keys) Close

func (k *Keys) Close() error

Close releases the key system.

func (*Keys) Open

func (k *Keys) Open(ctx context.Context, purpose keyforge.Purpose, sealed, aad []byte) ([]byte, error)

Open decrypts a binary envelope produced by Keys.Seal with the same purpose and aad.

func (*Keys) Ready

func (k *Keys) Ready(ctx context.Context) error

Ready reports whether the key system can serve.

func (*Keys) Run

func (k *Keys) Run(ctx context.Context) error

Run runs the lifecycle jobs until ctx is cancelled.

func (*Keys) Seal

func (k *Keys) Seal(ctx context.Context, purpose keyforge.Purpose, plaintext, aad []byte) ([]byte, error)

Seal encrypts plaintext under purpose, bound to aad, and returns the envelope in its binary form.

type Options

type Options struct {
	// Dir holds the keyring, the registry and the job state. Required.
	Dir string
	// Root supplies the root key that protects the keyring, for example
	// [VaultSource]. It must not be a file in Dir. Required.
	Root local.RootKeySource
	// Purposes are the purposes to manage. Each gets a key on first start.
	// Required.
	Purposes []keyforge.Purpose
	// Audit receives key lifecycle events. Optional.
	Audit sfaudit.Store
	// AcceptRollback opens a keyring older than one this host has seen, as
	// restoring from backup produces. Set it only after confirming the restore.
	AcceptRollback bool
}

Options configures Open.

Jump to

Keyboard shortcuts

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