Documentation
¶
Overview ¶
Package crypto wraps age. Cipher is satisfied by PassphraseCipher (MVP) and, post-MVP, a recipients-based cipher.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWrongPassphrase = errors.New("wrong passphrase")
ErrWrongPassphrase is returned when a passphrase does not match the ciphertext (or, for Header.Unlock, any key slot).
Functions ¶
Types ¶
type Header ¶
type Header struct {
Version int `json:"version"`
Recipient string `json:"recipient"` // master public key
Slots []Slot `json:"slots"`
}
Header is the parsed header object.
func ParseHeader ¶
type MasterKey ¶
type MasterKey struct {
// contains filtered or unexported fields
}
MasterKey is the unwrapped master identity. It satisfies Cipher: Encrypt seals to the master recipient, Decrypt opens with the identity.
func ParseMasterKey ¶
ParseMasterKey parses the identity string form (used by the session cache, which stores the unwrapped master key, not the passphrase).
type PassphraseCipher ¶
type PassphraseCipher struct {
// contains filtered or unexported fields
}
PassphraseCipher encrypts to an age scrypt recipient (symmetric, passphrase-derived). In the header model it wraps key-slot contents, not data blobs.
func NewPassphraseCipher ¶
func NewPassphraseCipher(passphrase string) *PassphraseCipher
type Slot ¶
type Slot struct {
Name string `json:"name,omitempty"`
Primary bool `json:"primary,omitempty"`
Wrapped []byte `json:"wrapped"` // age scrypt ciphertext of the master identity
}
Slot is one wrapped copy of the master key. Name identifies whose slot it is (user@host), the future hook for per-user factors (TOTP, etc). Primary marks the slot whose owner may rotate/remove other slots; advisory until header signing exists (no server = no cryptographic enforcement), but tooling refuses to remove or demote it.