Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type ConfigFunc
- type ConfigOptions
- type Field
- type SearchMethod
- type Vault
- func (lp *Vault) CreateAccount(account *Account) (*Account, error)
- func (lp *Vault) DeleteAccount(account *Account) error
- func (lp *Vault) DeleteAccountById(id string) error
- func (lp Vault) Email() string
- func (lp Vault) GetAccount(id string) (*Account, error)
- func (lp Vault) GetAccounts() ([]*Account, error)
- func (lp Vault) Search(value string, field Field, method SearchMethod) ([]*Account, error)
- func (lp *Vault) UpdateAccount(account *Account) (*Account, error)
Constants ¶
const ( // Account fields Id Field = iota Name Url Username // Match function types CaseSensitive SearchMethod = iota CaseInsensitive Regex SubstringSensitive SubstringInsensitive )
Variables ¶
var ( ErrInvalidPassword = fmt.Errorf("invalid password") ErrInvalidEmail = fmt.Errorf("invalid username or password") ErrInvalidGoogleAuthCode = fmt.Errorf("googleauthfailed") ErrInvalidYubiKey = fmt.Errorf("yubikeyrestricted") )
var (
ErrAccountNotFound = fmt.Errorf("account not found")
)
Functions ¶
This section is empty.
Types ¶
type Account ¶
type ConfigFunc ¶ added in v1.2.0
type ConfigFunc func(opts *ConfigOptions)
ConfigFunc allows modification of configurations in the Vault struct
func WithMultiFactor ¶ added in v1.2.0
func WithMultiFactor(code string) ConfigFunc
WithMultiFactor adds multi-factor auth to your vault.
type ConfigOptions ¶ added in v1.2.0
type ConfigOptions struct {
// contains filtered or unexported fields
}
ConfigOptions are config options that set behaviours in Vault. Current supported configs is multi-factor auth.
type SearchMethod ¶
type SearchMethod uint32
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
func New ¶
func New(email, password string, opts ...ConfigFunc) (*Vault, error)
New logs into LastPass and returns a new Vault
func (*Vault) CreateAccount ¶
CreateAccount sync LastPass vault with the account info given. The return value is the struct with an added Account ID
func (*Vault) DeleteAccount ¶
DeleteAccount removes an account from the LastPass vault by the Account ID
func (*Vault) DeleteAccountById ¶
DeleteAccountById removes an account from LastPass by the Account ID
func (Vault) GetAccount ¶
GetAccount gets LastPass account by unique ID If not found, returns ErrAccountNotFound error
func (Vault) GetAccounts ¶
GetAccounts returns all accounts in the LastPass vault