passwords

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Password

type Password struct {
	ID       string `json:"id"`
	Alias    string `json:"alias"`
	Username string `json:"username"`
	Password string `json:"password"`
}

Password is the struct that represents a password, it has an username and a password.

func (*Password) Export

func (p *Password) Export() ([]byte, error)

Export returns the json representation of the password.

func (*Password) String

func (p *Password) String() string

String returns the string representation of the password. It uses the Export() method to get the json representation of the password and then converts it to string.

type Passwords

type Passwords struct {
	// contains filtered or unexported fields
}

Passwords is the struct that represents a collection of passwords, it is a map of alias to password.

func (*Passwords) Del

func (p *Passwords) Del(id string)

Del deletes the password with the given ID, if it exists.

func (*Passwords) Export

func (p *Passwords) Export() ([]byte, error)

Export returns the json representation of the passwords.

func (*Passwords) Get

func (p *Passwords) Get(id string) *Password

Get returns the password with the given ID.

func (*Passwords) Import

func (p *Passwords) Import(data []byte) error

Import imports the passwords from the json representation.

func (*Passwords) List

func (p *Passwords) List() []*Password

List returns a list with a copy of the current Password's.

func (*Passwords) Set

func (p *Passwords) Set(alias, username, password string)

Set sets the password with the given alias, username and password. If it already exists, it will be overwritten.

func (*Passwords) String

func (p *Passwords) String() string

String returns the string representation of the passwords. It uses the Export() method to get the json representation of the passwords and then converts it to string.

Jump to

Keyboard shortcuts

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