Help us shape the future of Go! Take the 2026 Go Developer Survey

keycache

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package keycache keeps an unlocked vault root key in a short-lived background process, so commands run shortly after one another do not ask for the password again (like sudo's timestamp). The key lives only in that process's memory; it is handed out over a Unix socket in a private per-user directory, to peers running as the same user.

Index

Constants

View Source
const Supported = true

Supported reports whether this platform has an unlock cache.

Variables

View Source
var ErrNotCached = errors.New("vault is not cached")

ErrNotCached means no cache process holds the key for this vault.

Functions

func Get

func Get(dbID string) ([]byte, error)

Get returns the cached root key and extends the cache's lifetime.

func Lock

func Lock(dbID string) error

Lock stops the cache process for dbID.

func RunDaemon

func RunDaemon(in io.Reader, out io.Writer) error

RunDaemon is the body of the cache process: it reads the payload from in, reports "ready" (or an error) on out, then serves until the idle timeout passes or it is locked.

func Serve

func Serve(l net.Listener, dbID string, root []byte, idle time.Duration) error

Serve answers cache requests on l until idle passes without a successful get, or a lock request arrives.

func SocketPath

func SocketPath(dbID string) (string, error)

SocketPath returns the socket of the cache for vault dbID.

func Start

func Start(exe string, args []string, dbID string, root []byte, idle time.Duration) error

Start launches exe with args as a detached cache process holding root for idle after its last use, replacing any running cache for dbID. The command must call RunDaemon.

func Status

func Status(dbID string) (time.Time, error)

Status returns when the cache expires unless it is used again.

Types

This section is empty.

Jump to

Keyboard shortcuts

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