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

keyfile

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package keyfile writes a newly generated key to disk so it survives a crash.

The secrets key and the API token key are each created once, on first start, and everything encrypted or digested afterwards depends on them. A key that was linked into place but never flushed can come back from a power loss as an empty file, while the secrets encrypted under it are already committed to Postgres and can no longer be read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(path string, key []byte) error

Create writes key to path, 0600, and flushes it and its directory entry to disk before returning.

The key is written beside path and linked into place, which fails with an error matching os.ErrExist if a file is already there. Several replicas sharing one volume start at once, and two that each wrote their own key would each use one the other cannot; the one that loses the link reads the winner's instead (issue #72).

Types

This section is empty.

Jump to

Keyboard shortcuts

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