encryption

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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

func DecryptFileWithIdentities(inputPath, outputPath string, identities []string) error

DecryptFileWithIdentities is a convenience function for identity-based decryption identities should contain the raw age identity content as strings

func DecryptFileWithPassphrase

func DecryptFileWithPassphrase(inputPath, outputPath, passphrase string) error

DecryptFileWithPassphrase is a convenience function for passphrase decryption

func EncryptBackupFile

func EncryptBackupFile(backupPath string, encrypt bool, recipients []string) (string, error)

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

func EncryptFileWithPassphrase(inputPath, outputPath, passphrase string) error

EncryptFileWithPassphrase is a convenience function for passphrase encryption

func EncryptFileWithRecipients

func EncryptFileWithRecipients(inputPath, outputPath string, recipients []string) error

EncryptFileWithRecipients is a convenience function for public key encryption

func FindLatestBackup

func FindLatestBackup(dir, pattern string) (string, error)

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

func GetDecryptIdentitiesFromEnvOrFlag(identityFiles []string) ([]string, error)

GetDecryptIdentitiesFromEnvOrFlag gets decryption identities from flag or environment Returns slice of identity strings (file contents)

func GetDecryptIdentityFilesFromEnvOrFlag added in v0.4.0

func GetDecryptIdentityFilesFromEnvOrFlag(flagIdentities []string) ([]string, error)

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

func GetEncryptRecipientsFromEnvOrFlag(recipientInputs []string) ([]string, error)

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

func IsEncrypted(path string) bool

IsEncrypted checks if a file appears to be age-encrypted

func ReadAndConfirmPassphrase

func ReadAndConfirmPassphrase() (string, error)

ReadAndConfirmPassphrase reads a passphrase twice and ensures they match

func ReadPassphrase

func ReadPassphrase(prompt string) (string, error)

ReadPassphrase reads a passphrase from stdin without echoing

func ReadPassphraseForDecryption

func ReadPassphraseForDecryption() (string, error)

ReadPassphraseForDecryption reads a passphrase for decryption

func ValidatePassphrase

func ValidatePassphrase(passphrase string) error

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

Jump to

Keyboard shortcuts

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