storage

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAESKey

func GenerateAESKey(size int) ([]byte, error)

GenerateAESKey generates a random AES key of the specified size (16, 24, or 32 bytes)

Types

type Config

type Config struct {
	PrivKeyPath string
	GitRepoPath string
}

func ParseConfig

func ParseConfig() (*Config, error)

ParseConfig reads the config file, fills config fields, and validates them.

type Folder

type Folder struct {
	Name      string
	SubFolder []*Folder
	Pass      string
}

func (*Folder) Add

func (f *Folder) Add(folderPath, pass string) error

func (*Folder) Delete added in v0.0.3

func (f *Folder) Delete(folderPath string) error

func (*Folder) GetSubFolder

func (f *Folder) GetSubFolder(key string) (*Folder, bool)

func (*Folder) SecureString

func (f *Folder) SecureString(prefix string) func() string

func (*Folder) String

func (f *Folder) String(prefix string) func() string

type Storage

type Storage struct {
	PrivKey []byte
	Data    string
	Cfg     *Config
	// contains filtered or unexported fields
}

Storage struct to hold the data read from the file

func New

func New(cfg *Config) (*Storage, error)

New initializes a new Storage instance

func (*Storage) AddPass added in v0.0.3

func (s *Storage) AddPass(key, pass string) (err error)

func (*Storage) Decrypt

func (s *Storage) Decrypt() (*Folder, error)

Decrypt get's data from the repository, decrypts in and unmarshal.

func (*Storage) Encrypt

func (s *Storage) Encrypt(topFolder *Folder) error

Encrypt encrypts data inside of a Storage.

func (*Storage) Store

func (s *Storage) Store(message *string) error

Store stores s.Data in the git repo.

func (*Storage) Update

func (s *Storage) Update() error

Update updates data inside of a storage from the git repo.

Jump to

Keyboard shortcuts

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