models

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypto

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

type MasterPassword

type MasterPassword struct {
	Value string `clover:"value"`
	// contains filtered or unexported fields
}

func NewMasterPassword

func NewMasterPassword(value string) MasterPassword

func NewMasterPasswordFromB64

func NewMasterPasswordFromB64(value string) MasterPassword

func (*MasterPassword) Check

func (m *MasterPassword) Check(value string, cb func(v string)) bool

func (*MasterPassword) GetCrypto

func (m *MasterPassword) GetCrypto() Crypto

func (*MasterPassword) SetClear added in v0.2.2

func (m *MasterPassword) SetClear(clear string)

type PasswordEntry

type PasswordEntry struct {
	Id        string
	Website   string
	Username  string
	Password  string
	Timestamp int64
}

func NewPasswordEntry

func NewPasswordEntry(website, username, password string) PasswordEntry

func (*PasswordEntry) ToDTO added in v0.2.1

func (p *PasswordEntry) ToDTO(crypto *Crypto) PasswordEntryDTO

ToDTO turns PasswordEntry into a DTO that stores the encrypted password using the master password as key.

type PasswordEntryDTO added in v0.2.1

type PasswordEntryDTO struct {
	Id        string
	Website   string `clover:"website"`
	Username  string `clover:"username"`
	Password  string `clover:"password"`
	Timestamp int64  `clover:"timestamp"`
}

PasswordEntryDTO represents the object that will be saved in the database. This struct is used so that the change of state that means the passage from an unencrypted password to an encrypted one is "detected" by the type system, making it impossible to save objects with an unencrypted password in the database.

func (*PasswordEntryDTO) ToMap added in v0.2.1

func (p *PasswordEntryDTO) ToMap() map[string]interface{}

ToMap converts the DTO to a map, which is necessary for clover-db to update the DTO. It adds a new timestamp to the object to be updated.

func (*PasswordEntryDTO) ToPasswordEntry added in v0.2.1

func (p *PasswordEntryDTO) ToPasswordEntry(crypto *Crypto) PasswordEntry

ToPasswordEntry converts the DTO into a PasswordEntry that stores the decrypted password so that it is visible to the user, using the master password as the key to perform the decryption.

Jump to

Keyboard shortcuts

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