model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedUnlock = errors.New("no age identity in the keyring can decrypt this file")

Functions

func CollectRecipients added in v0.4.0

func CollectRecipients(root string) ([]string, error)

func CreateFile added in v0.3.0

func CreateFile(recipients []string, entries []Entry, now time.Time) ([]byte, error)

func EnsureCreationRule added in v0.4.0

func EnsureCreationRule(root, pathRegex string, recipients []string) error

func EnvStrings

func EnvStrings(entries []Entry) []string

func FileRuleRegex added in v0.4.0

func FileRuleRegex(rel string) string

func HasKey

func HasKey(entries []Entry, name string) bool

func ParseRecipients added in v0.4.0

func ParseRecipients(raw string) ([]string, error)

func ReadCiphertext

func ReadCiphertext(root string, sf SecretFile) ([]byte, error)

func ValidateKey

func ValidateKey(name string) error

func WriteCiphertext

func WriteCiphertext(root string, sf SecretFile, data []byte) error

func WriteNewFile added in v0.3.0

func WriteNewFile(root string, sf SecretFile, data []byte) error

func WriteNewSecretFile added in v0.4.0

func WriteNewSecretFile(root string, sf SecretFile, recipients []string, entries []Entry, now time.Time) error

Types

type Entry

type Entry struct {
	Key   string
	Value string
}

type Identity added in v0.3.0

type Identity struct {
	Secret    string
	Recipient string
}

func GenerateIdentity added in v0.3.0

func GenerateIdentity() (Identity, error)

type Keyring

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

func NewKeyring

func NewKeyring() *Keyring

func (*Keyring) DecryptFile

func (k *Keyring) DecryptFile(ciphertext []byte) ([]Entry, error)

func (*Keyring) Empty

func (k *Keyring) Empty() bool

func (*Keyring) EncryptFile

func (k *Keyring) EncryptFile(ciphertext []byte, entries []Entry, now time.Time) ([]byte, error)

func (*Keyring) Unlock

func (k *Keyring) Unlock(secret string) error

type NewFilePlan added in v0.3.0

type NewFilePlan struct {
	File               SecretFile
	ExistingRecipients []string
}

func PlanNewFile added in v0.3.0

func PlanNewFile(root, name string) (NewFilePlan, error)

type SecretFile

type SecretFile struct {
	Abs string
	Rel string
}

func DiscoverSecretFiles

func DiscoverSecretFiles(root string) ([]SecretFile, error)

Jump to

Keyboard shortcuts

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