Documentation
¶
Index ¶
- Constants
- func DecryptBackupFile(backupPath string, decrypt bool, identityFiles []string) (string, bool, error)
- func DecryptFile(inputPath, outputPath string, opts *DecryptOptions) error
- func DecryptFileWithIdentities(inputPath, outputPath string, identities []string) error
- func DecryptFileWithPassphrase(inputPath, outputPath, passphrase string) error
- func EncryptBackupFile(backupPath string, encrypt bool, recipients []string) (string, error)
- func EncryptFile(inputPath, outputPath string, opts *EncryptOptions) error
- func EncryptFileWithPassphrase(inputPath, outputPath, passphrase string) error
- func EncryptFileWithRecipients(inputPath, outputPath string, recipients []string) error
- func FindLatestBackup(dir, pattern string) (string, error)
- func GenerateIdentity() (*age.X25519Identity, error)
- func GetDecryptIdentitiesFromEnvOrFlag(identityFiles []string) ([]string, error)
- func GetDecryptIdentityFilesFromEnvOrFlag(flagIdentities []string) ([]string, error)
- func GetEncryptRecipientsFromEnvOrFlag(recipientInputs []string) ([]string, error)
- func GetIdentityFilesFromEnv() []string
- func GetPassphraseFromEnv() string
- func GetRecipientsFromEnv() []string
- func IsEncrypted(path string) bool
- func ReadAndConfirmPassphrase() (string, error)
- func ReadPassphrase(prompt string) (string, error)
- func ReadPassphraseForDecryption() (string, error)
- func ValidatePassphrase(passphrase string) error
- type DecryptOptions
- type EncryptOptions
Constants ¶
const ( EnvEncryptRecipient = "OWUI_ENCRYPTED_RECIPIENT" EnvDecryptIdentity = "OWUI_DECRYPT_IDENTITY" )
Environment variable constants
Variables ¶
This section is empty.
Functions ¶
func DecryptBackupFile ¶
func DecryptBackupFile(backupPath string, decrypt bool, identityFiles []string) (string, bool, error)
DecryptBackupFile decrypts a backup file if needed Returns the path to the decrypted file (temp file or original if not encrypted) The caller is responsible for cleaning up the temp file if one was created
func DecryptFile ¶
func DecryptFile(inputPath, outputPath string, opts *DecryptOptions) error
DecryptFile decrypts an age-encrypted file
func DecryptFileWithIdentities ¶
DecryptFileWithIdentities is a convenience function for identity-based decryption identities should contain the raw age identity content as strings
func DecryptFileWithPassphrase ¶
DecryptFileWithPassphrase is a convenience function for passphrase decryption
func EncryptBackupFile ¶
EncryptBackupFile encrypts a backup file if encryption options are provided Returns the path to the encrypted file (or original if no encryption)
func EncryptFile ¶
func EncryptFile(inputPath, outputPath string, opts *EncryptOptions) error
EncryptFile encrypts a file using age encryption
func EncryptFileWithPassphrase ¶
EncryptFileWithPassphrase is a convenience function for passphrase encryption
func EncryptFileWithRecipients ¶
EncryptFileWithRecipients is a convenience function for public key encryption
func FindLatestBackup ¶
FindLatestBackup finds the most recent backup file matching the pattern
func GenerateIdentity ¶ added in v0.7.0
func GenerateIdentity() (*age.X25519Identity, error)
GenerateIdentity generates a new X25519 age identity
func GetDecryptIdentitiesFromEnvOrFlag ¶ added in v0.12.0
GetDecryptIdentitiesFromEnvOrFlag gets decryption identities from flag or environment Returns slice of identity strings (file contents)
func GetDecryptIdentityFilesFromEnvOrFlag ¶ added in v0.4.0
GetDecryptIdentityFilesFromEnvOrFlag returns decryption identity files from flag or environment variable Priority: flag values > environment variable Returns error if no identity files are provided from either source
func GetEncryptRecipientsFromEnvOrFlag ¶ added in v0.4.0
GetEncryptRecipientsFromEnvOrFlag gets encryption recipients from flag or environment Supports both file paths and direct recipient strings Returns slice of recipient strings (file contents or direct values)
func GetIdentityFilesFromEnv ¶
func GetIdentityFilesFromEnv() []string
GetIdentityFilesFromEnv retrieves identity file paths from environment variable
func GetPassphraseFromEnv ¶
func GetPassphraseFromEnv() string
GetPassphraseFromEnv retrieves passphrase from environment variable
func GetRecipientsFromEnv ¶
func GetRecipientsFromEnv() []string
GetRecipientsFromEnv retrieves recipients from environment variable
func IsEncrypted ¶
IsEncrypted checks if a file appears to be age-encrypted
func ReadAndConfirmPassphrase ¶
ReadAndConfirmPassphrase reads a passphrase twice and ensures they match
func ReadPassphrase ¶
ReadPassphrase reads a passphrase from stdin without echoing
func ReadPassphraseForDecryption ¶
ReadPassphraseForDecryption reads a passphrase for decryption
func ValidatePassphrase ¶
ValidatePassphrase checks if a passphrase meets minimum requirements
Types ¶
type DecryptOptions ¶
type DecryptOptions struct {
Passphrase string // Passphrase for symmetric decryption
Identities []string // Raw age identity content as strings
}
DecryptOptions contains decryption configuration
type EncryptOptions ¶
type EncryptOptions struct {
Passphrase string // Passphrase for symmetric encryption
Recipients []string // Age recipient public keys for asymmetric encryption
}
EncryptOptions contains encryption configuration