crypto

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(data *EncryptedData, password []byte) ([]byte, error)

func InitMasterPassword

func InitMasterPassword(password []byte) error

func MarshalEncrypted

func MarshalEncrypted(data *EncryptedData) (string, error)

func MasterPasswordInitialized

func MasterPasswordInitialized() bool

func ReadPassword

func ReadPassword() (string, error)

ReadPassword reads a password from the terminal with echo disabled. The caller is responsible for printing the prompt.

func VerifyMasterPassword

func VerifyMasterPassword(password []byte) error

Types

type EncryptedData

type EncryptedData struct {
	Salt       string `json:"salt"`
	Nonce      string `json:"nonce"`
	Ciphertext string `json:"ciphertext"`
	Version    int    `json:"version,omitempty"` // 0 = legacy (t=1), 1 = current (t=3)
}

EncryptedData holds the encrypted payload with versioning for parameter migration.

func Encrypt

func Encrypt(plaintext, password []byte) (*EncryptedData, error)

func UnmarshalEncrypted

func UnmarshalEncrypted(s string) (*EncryptedData, error)

Jump to

Keyboard shortcuts

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