Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(password string, data []byte) ([]byte, error)
- func Encrypt(password string, data []byte) ([]byte, error)
- func GenerateKey(password string, salt []byte) ([]byte, []byte, error)
- type Folder
- type Token
- type TokenType
- type Vault
- func (vault *Vault) AddFolder(name string) error
- func (vault *Vault) AddToken(folder string, uri string) error
- func (vault *Vault) AddTokenFromToken(folder string, token Token) error
- func (vault *Vault) ChangePassword(password string)
- func (vault *Vault) DeleteFolder(name string)
- func (vault *Vault) DeleteToken(folder string, token Token)
- func (vault *Vault) GetTokens(folder string) []Token
- func (vault *Vault) IncreaseCounter(folder string, token Token)
- func (vault *Vault) MoveFolderDown(name string) bool
- func (vault *Vault) MoveFolderUp(name string) bool
- func (vault *Vault) MoveToken(token Token, fromFolder, toFolder string)
- func (vault *Vault) MoveTokenDown(folder string, token Token) bool
- func (vault *Vault) MoveTokenUp(folder string, token Token) bool
- func (vault *Vault) PostInit()
- func (vault *Vault) RenameFolder(old, newName string) error
- func (vault *Vault) ReplaceToken(fromFolder string, token, newToken Token) error
- func (vault Vault) ValidateToken(secret string) (string, error)
Constants ¶
const ( TokenTypeTOTP = iota TokenTypeHOTP )
Token types
Variables ¶
var ERR_FOLDER_EMPTY = errors.New("Folder name cannot be empty")
Error representing that the folder name is empty
var ERR_FOLDER_EXISTS = errors.New("Folder with that name already exists")
Error representing that the folder with that name already exists
var ERR_PASSWORD_INVALID = errors.New("Wrong password, please try again")
Error represents that the password is invalid
var ERR_TOKEN_EMPTY = errors.New("Secret value cannot be empty")
Error representing that the token secret is empty
var ERR_TOKEN_EXISTS = errors.New("Token with that secret already exists")
Error representing that the secret already exists
var ERR_TOKEN_INVALID = errors.New("Secret is invalid, are you sure it is typed correctly?")
Error representing that the secret is invalid
var ERR_VAULT_DELETED = errors.New("The vault does not exist, did you delete it?")
Error represents the vault may be been moved or deleted
var SALT_SIZE = 32
Size of the salt
Functions ¶
func Decrypt ¶
Decrypts the given piece of encrypted byte array It returns an error if decryption fails, because of the invalid key
Types ¶
type Token ¶
type Token struct { // Type Type TokenType // Issuer name Issuer string // Account name Account string // Secret Secret string // Initial counter [only in case of HOTP based tokens] InitialCounter int // Period [only in case of TOTP based tokens] Period int // Digits Digits int // Hasing function HashingAlgorithm otp.Algorithm // Usage counter [only in case of HOTP based tokens] UsageCounter int }
Token
type Vault ¶
type Vault struct { // All the folders and their data Folders []Folder // contains filtered or unexported fields }
Vault securely stores all the tokens inside of the file for tlock
func Initialize ¶
Initializes a new instance of the vault at the given path
func (*Vault) AddTokenFromToken ¶
Adds a new token to the given folder
func (*Vault) ChangePassword ¶
Updates the password for the vault
func (*Vault) DeleteFolder ¶
Deletes a folder by its name
func (*Vault) DeleteToken ¶
Deletes a token in the given folder
func (*Vault) IncreaseCounter ¶
Move a token to the given folder
func (*Vault) MoveFolderDown ¶
Moves the folder down
func (*Vault) MoveTokenDown ¶
Moves the token down
func (*Vault) MoveTokenUp ¶
Moves the token up
func (*Vault) RenameFolder ¶
Renames the folder to a new name
func (*Vault) ReplaceToken ¶
Replace a token in the given folder