creds

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credential

type Credential struct {
	Service           string             `json:"service"`
	Email             string             `json:"email"`
	Username          string             `json:"username"`
	Password          string             `json:"password"`
	Description       string             `json:"description"`
	SecurityQuestions []SecurityQuestion `json:"security_questions"`
	CreatedAt         int64              `json:"created_at"`
	UpdatedAt         int64              `json:"updated_at"`
}

Credential houses all pertinent information for a given service

func (*Credential) GetCreatedAt

func (c *Credential) GetCreatedAt() time.Time

GetCreatedAt retrieves the credential's creation time

func (*Credential) GetUpdatedAt

func (c *Credential) GetUpdatedAt() time.Time

GetUpdatedAt retrieves the credential's last update time

func (Credential) PrintCredential

func (c Credential) PrintCredential()

PrintCredential prints the credentials while redacting the password

type Crypt

type Crypt struct {
	Credentials map[string]Credential `json:"credentials"`
	UpdatedAt   int64                 `json:"updated_at"`
	CreatedAt   int64                 `json:"created_at"`
}

Crypt represents contents of a crypt file

func FromJSON

func FromJSON(data []byte) (*Crypt, error)

FromJSON unmarshalls a Crypt object from json

func (*Crypt) FindCredential

func (c *Crypt) FindCredential(service string) *Credential

FindCredential finds the Credential struct corresponding to the given service name.

func (*Crypt) GetCreatedAt

func (c *Crypt) GetCreatedAt() time.Time

GetCreatedAt retrieves the crypt's creation time

func (*Crypt) GetJSON

func (c *Crypt) GetJSON() ([]byte, error)

GetJSON marshals the Crypt object into json

func (*Crypt) GetSuggestions

func (c *Crypt) GetSuggestions(service string) []string

GetSuggestions get the closest services to the given input service based on the edit distance of the service name

func (*Crypt) GetUpdatedAt

func (c *Crypt) GetUpdatedAt() time.Time

GetUpdatedAt retrieves the crypt's last update time

func (*Crypt) IsValid

func (c *Crypt) IsValid(service string) bool

IsValid determines if the given service exists the Crypt

func (*Crypt) Len

func (c *Crypt) Len() int

Len determines the number of credentials that are part of this crypt

func (*Crypt) RemoveCredential

func (c *Crypt) RemoveCredential(service string)

RemoveCredential removes the given service from the Store

func (*Crypt) SetCredential

func (c *Crypt) SetCredential(cred Credential)

SetCredential is used to add/update the list of credentials

type SecurityQuestion

type SecurityQuestion struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

SecurityQuestion holds a security question and its answer

Jump to

Keyboard shortcuts

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