Documentation
¶
Overview ¶
Package secrets encrypts values at rest with the controller's master key (AES-256-GCM, §14). The key file is protected by permissions; a copy wrapped by the recovery key goes into backups (§5.0.1).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWrongRecoveryKey = errors.New("the recovery key does not match this backup")
ErrWrongRecoveryKey means the key does not unwrap this master key.
Functions ¶
func NewRecoveryKey ¶
func NewRecoveryKey() string
NewRecoveryKey returns a 200-bit key like SYNRK-ABCDE-FGHIJ-… (8 groups).
func RecoveryKeySuffix ¶
RecoveryKeySuffix is what the setup wizard asks the user to type back: the key's last 6 characters, dashes and spaces not counted. Applied to the user's answer too, so "2-IRWKX", "2IRWKX" or the whole key all match.
func Restore ¶
Restore writes a master key (unwrapped from a backup) and its wrapped copy into dataDir.
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
func LoadOrCreate ¶
LoadOrCreate reads <dataDir>/master.key, creating it (0600) on first start, and makes sure a wrapped copy exists. When it creates a new recovery key (first start, or an install from before recovery keys), it returns it so the caller can show it once; otherwise recoveryKey is "".