encrypt

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FileName = "pass.yaml"

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encrypted []byte, ciphBlock cipher.Block) []byte

Input: the encrypted slice and a cipher block made from the same original password. Return: a decrypted slice. Decrypts the encrypted bytes using the cipher block If the decryption failed (wrong password), nonsense will be returned.

func Encrypt

func Encrypt(plaintext []byte, ciphBlock cipher.Block) []byte

Input: the plaintext slice and a cipher block. Return: the encrypted bytes. Encrypts a slice of bytes using the cipher block (from the key)

func KeyGeneration

func KeyGeneration(password string) (cipher.Block, string)

Input: the user's password. Output: cipher block made from a key from the password. If the following function is changed, also change it in changeKey.go

func ReadFromFile added in v1.3.0

func ReadFromFile(entries *[]Entry, ciphBlock cipher.Block) string

Input: entries slice to write into and cipher block from the master password Return: an error string, empty "" if no error

func WriteToFile added in v1.3.0

func WriteToFile(entries []Entry, ciphBlock cipher.Block) string

Input: the decrypted entries slice and cipher block made from the master password. Return: an error string, empty "" if no error

Types

type Entry added in v1.3.0

type Entry struct {
	Name      string
	Tags      string
	Usernames []Field
	Passwords []Field
	SecurityQ []Field
	// notes is 6 because that looks the best in /new as individual inputs,
	// textArea has unpredictable copy and pasting
	Notes     [6]string
	Circulate bool
	Urls      []string
	Created   time.Time
	Modified  time.Time
	Opened    time.Time
}

An entry represents an account or site

type Field added in v1.3.0

type Field struct {
	DisplayName string
	Value       string
}

Jump to

Keyboard shortcuts

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