storage

package
v1.1.10-0...-9a24f55 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Name  string
	Token string
}

Account represents a TOTP account.

type Namespace

type Namespace struct {
	Name     string
	Accounts []*Account
}

Namespace represents a Namespace "category".

func (*Namespace) DeleteAccount

func (n *Namespace) DeleteAccount(account *Account)

DeleteAccount removes a specific Account from the Namespace.

func (*Namespace) FindAccount

func (n *Namespace) FindAccount(name string) (account *Account, err error)

FindAccount returns with an account under a specific Namespace if the account does not exist error is not nil.

type Storage

type Storage struct {
	File     string
	Password []byte

	Namespaces []*Namespace
}

Storage structure represents the credential storage

func PrepareStorage

func PrepareStorage() *Storage

PrepareStorage loads, decrypt and parse the Storage. If the storage file does not exists it creates one.

func (*Storage) Decrypt

func (s *Storage) Decrypt()

Decrypt tries to decrypt the storage

func (*Storage) DeleteNamespace

func (s *Storage) DeleteNamespace(namespace *Namespace)

DeleteNamespace removes a specific namespace from the Storage

func (*Storage) FindNamespace

func (s *Storage) FindNamespace(name string) (namespace *Namespace, err error)

FindNamespace returns with a namespace if the namespace does not exist error is not nil

func (*Storage) Save

func (s *Storage) Save()

Save tries to encrypt and save the storage

Jump to

Keyboard shortcuts

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