crypto

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package crypto encrypts credentials (indexer API keys, download client passwords, VPN configs) at rest in the SQLite DB.

The encryption key lives in a separate file (secret.key, 0600) next to app.db, generated on first run — so the DB file alone is not sufficient to decrypt stored credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateKeyFile

func ValidateKeyFile(data []byte) error

ValidateKeyFile reports whether data is a well-formed secret.key file (exactly what LoadOrCreateKey would accept), without keeping the key.

Types

type Box

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

Box encrypts/decrypts values with a fixed key loaded from disk.

func LoadOrCreateKey

func LoadOrCreateKey(path string) (*Box, error)

LoadOrCreateKey reads the encryption key from path, generating and persisting a new random one (0600) if it doesn't exist yet.

func (*Box) Decrypt

func (b *Box) Decrypt(encoded string) (string, error)

Decrypt reverses Encrypt.

func (*Box) Encrypt

func (b *Box) Encrypt(plaintext string) (string, error)

Encrypt returns a base64-encoded nonce||ciphertext string.

Jump to

Keyboard shortcuts

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