Documentation ¶
Index ¶
- Constants
- Variables
- func ServiceVersion() string
- func Version() string
- type AppState
- type AppStateStorage
- type AppStateStorageMock
- type Autofill
- type ByString
- type Favicon
- type FaviconDownloaderPreferences
- type FaviconFormat
- type Format
- type FyneStorage
- func (s *FyneStorage) CreateVault(name string, key *Key) (*Vault, error)
- func (s *FyneStorage) CreateVaultKey(name string, password string) (*Key, error)
- func (s *FyneStorage) DeleteItem(vault *Vault, item Item) error
- func (s *FyneStorage) DeleteVault(name string) error
- func (s *FyneStorage) LoadAppState() (*AppState, error)
- func (s *FyneStorage) LoadItem(vault *Vault, itemMetadata *Metadata) (Item, error)
- func (s *FyneStorage) LoadVault(name string, key *Key) (*Vault, error)
- func (s *FyneStorage) LoadVaultKey(name string, password string) (*Key, error)
- func (s *FyneStorage) LockFilePath() string
- func (s *FyneStorage) LogFilePath() string
- func (s *FyneStorage) Root() string
- func (s *FyneStorage) SocketAgentPath() string
- func (s *FyneStorage) StoreAppState(appState *AppState) error
- func (s *FyneStorage) StoreItem(vault *Vault, item Item) error
- func (s *FyneStorage) StoreVault(vault *Vault) error
- func (s *FyneStorage) Vaults() ([]string, error)
- type Imported
- type Item
- type ItemStorage
- type ItemStorageMock
- type ItemType
- type Key
- func (k *Key) Decrypt(src io.Reader) (io.Reader, error)
- func (k *Key) Encrypt(dst io.Writer) (io.WriteCloser, error)
- func (k *Key) MarshalJSON() ([]byte, error)
- func (k *Key) Passphrase(numWords int) (string, error)
- func (k *Key) Secret(seeder Seeder) (string, error)
- func (k *Key) String() string
- func (k *Key) UnmarshalJSON(data []byte) error
- type LogStorage
- type Login
- type LoginURL
- type Metadata
- type MetadataSubtitler
- type Note
- type OSStorage
- func (s *OSStorage) CreateVault(name string, key *Key) (*Vault, error)
- func (s *OSStorage) CreateVaultKey(name string, password string) (*Key, error)
- func (s *OSStorage) DeleteItem(vault *Vault, item Item) error
- func (s *OSStorage) DeleteVault(name string) error
- func (s *OSStorage) LoadAppState() (*AppState, error)
- func (s *OSStorage) LoadItem(vault *Vault, itemMetadata *Metadata) (Item, error)
- func (s *OSStorage) LoadVault(name string, key *Key) (*Vault, error)
- func (s *OSStorage) LoadVaultKey(name string, password string) (*Key, error)
- func (s *OSStorage) LockFilePath() string
- func (s *OSStorage) LogFilePath() string
- func (s *OSStorage) Root() string
- func (s *OSStorage) SocketAgentPath() string
- func (s *OSStorage) StoreAppState(appState *AppState) error
- func (s *OSStorage) StoreItem(vault *Vault, item Item) error
- func (s *OSStorage) StoreVault(vault *Vault) error
- func (s *OSStorage) Vaults() ([]string, error)
- type PassphrasePasswordPreferences
- type Password
- type PasswordMode
- type PasswordPreferences
- type PinPasswordPreferences
- type Preferences
- type RandomPasswordPreferences
- type Rule
- type Ruler
- type SSHKey
- type SecretMaker
- type Seeder
- type Storage
- type StorageMock
- type TOTP
- type TOTPHash
- type TOTPPreferences
- type Vault
- func (v *Vault) AddItem(item Item) error
- func (v *Vault) DeleteItem(item Item)
- func (v *Vault) FilterItemMetadata(opts *VaultFilterOptions) []*Metadata
- func (v *Vault) HasItem(item Item) bool
- func (v *Vault) Key() *Key
- func (v *Vault) Range(f func(id string, meta *Metadata) bool)
- func (v *Vault) Size() int
- func (v *Vault) SizeByType(itemType ItemType) int
- type VaultFilterOptions
- type VaultStorage
- type VaultStorageMock
- func (c *VaultStorageMock) CreateVault(name string, key *Key) (*Vault, error)
- func (c *VaultStorageMock) CreateVaultKey(name string, password string) (*Key, error)
- func (c *VaultStorageMock) DeleteVault(name string) error
- func (c *VaultStorageMock) LoadVault(name string, key *Key) (*Vault, error)
- func (c *VaultStorageMock) LoadVaultKey(name string, password string) (*Key, error)
- func (c *VaultStorageMock) StoreVault(vault *Vault) error
- func (c *VaultStorageMock) Vaults() ([]string, error)
Constants ¶
const ( ENV_HOME = "PAW_HOME" // The env var name can be used to override the Paw HOME directory ENV_SESSION = "PAW_SESSION" // The env var name can be used to specify a Paw session ID )
const ( RandomPasswordDefaultLength = 16 RandomPasswordMinLength = 8 RandomPasswordMaxLength = 120 RandomPasswordDefaultFormat = LowercaseFormat | DigitsFormat | SymbolsFormat | UppercaseFormat PinPasswordDefaultLength = 4 PinPasswordMinLength = 3 PinPasswordMaxLength = 10 PinPasswordDefaultFormat = DigitsFormat PassphrasePasswordDefaultLength = 4 PassphrasePasswordMinLength = 3 PassphrasePasswordMaxLength = 12 )
const ( TOTPHashDefault = SHA1 TOTPDigitsDefault = otp.DefaultDigits TOTPIntervalDefault = otp.DefaultInterval )
const ( ID = "dev.lucor.paw" ServicePrefix = "paw/" // UserAgentFaviconDownloader is the UserAgent user by the favicon downloader UserAgentFaviconDownloader = "Paw/1.0 (+https://paw.pm/paw-favicon-downloader)" )
Variables ¶
var ( // BuildVersion allow to set the version at link time BuildVersion string )
var (
ErrCallbackRequired = errors.New("callback required")
)
Functions ¶
func ServiceVersion ¶ added in v0.21.0
func ServiceVersion() string
ServiceVersion returns the Paw's service version
Types ¶
type AppState ¶ added in v0.24.0
type AppState struct { // Modified is the last time the state was modified, example: preferences changed or vaults modified Modified time.Time `json:"modified,omitempty"` // Preferences contains the application preferences Preferences *Preferences `json:"preferences,omitempty"` }
AppState represents the application state
type AppStateStorage ¶ added in v0.24.0
type AppStateStorageMock ¶ added in v0.24.0
type AppStateStorageMock struct { OnLoadAppState func() (*AppState, error) OnStoreAppState func(s *AppState) error }
func (*AppStateStorageMock) LoadAppState ¶ added in v0.24.0
func (c *AppStateStorageMock) LoadAppState() (*AppState, error)
LoadAppState implements AppStateStorage.
func (*AppStateStorageMock) StoreAppState ¶ added in v0.24.0
func (c *AppStateStorageMock) StoreAppState(s *AppState) error
StoreAppState implements AppStateStorage.
type Favicon ¶ added in v0.15.0
type Favicon struct { Host string `json:"host,omitempty"` Data []byte `json:"data,omitempty"` Format string `json:"format,omitempty"` }
Favicon represents a login favicon and it is a bundled fyne.resource compiled into the application
func NewFavicon ¶ added in v0.15.0
type FaviconDownloaderPreferences ¶ added in v0.24.0
type FaviconDownloaderPreferences struct {
Disabled bool `json:"disabled,omitempty"` // Disabled is true if the favicon downloader is disabled.
}
FaviconDownloaderPreferences represents the preferences for the favicon downloader. FaviconDownloader tool is opt-out, hence the default value is false.
type FaviconFormat ¶ added in v0.24.0
type FaviconFormat string
func (FaviconFormat) String ¶ added in v0.24.0
func (f FaviconFormat) String() string
type Format ¶
type Format int
Format represents the format for a rule
const ( // LowercaseFormat specify a format with all lowercase chars LowercaseFormat Format = 1 << iota // LowercaseFormat specify a format with all uppercase chars UppercaseFormat // DigitsFormat specify a format with all digits chars DigitsFormat // DigitsFormat specify a format with all symbols chars SymbolsFormat )
type FyneStorage ¶ added in v0.18.0
type FyneStorage struct {
fyne.Storage
}
func (*FyneStorage) CreateVault ¶ added in v0.18.0
func (s *FyneStorage) CreateVault(name string, key *Key) (*Vault, error)
CreateVault encrypts and stores an empty vault into the underlying storage.
func (*FyneStorage) CreateVaultKey ¶ added in v0.18.0
func (s *FyneStorage) CreateVaultKey(name string, password string) (*Key, error)
CreateVault encrypts and stores an empty vault into the underlying storage.
func (*FyneStorage) DeleteItem ¶ added in v0.18.0
func (s *FyneStorage) DeleteItem(vault *Vault, item Item) error
DeleteItem delete the item from the specified vaultName
func (*FyneStorage) DeleteVault ¶ added in v0.18.0
func (s *FyneStorage) DeleteVault(name string) error
DeleteVault delete the specified vault
func (*FyneStorage) LoadAppState ¶ added in v0.24.0
func (s *FyneStorage) LoadAppState() (*AppState, error)
LoadAppState load the configuration from the underlying storage
func (*FyneStorage) LoadItem ¶ added in v0.18.0
func (s *FyneStorage) LoadItem(vault *Vault, itemMetadata *Metadata) (Item, error)
LoadItem returns a item from the vault decrypting from the underlying storage
func (*FyneStorage) LoadVault ¶ added in v0.18.0
func (s *FyneStorage) LoadVault(name string, key *Key) (*Vault, error)
LoadVault returns a vault decrypting from the underlying storage
func (*FyneStorage) LoadVaultKey ¶ added in v0.18.0
func (s *FyneStorage) LoadVaultKey(name string, password string) (*Key, error)
LoadVaultIdentity returns a vault decrypting from the underlying storage
func (*FyneStorage) LockFilePath ¶ added in v0.22.0
func (s *FyneStorage) LockFilePath() string
LockFilePath return the lock file path
func (*FyneStorage) LogFilePath ¶ added in v0.23.0
func (s *FyneStorage) LogFilePath() string
LogFilePath return the log file path
func (*FyneStorage) Root ¶ added in v0.18.0
func (s *FyneStorage) Root() string
func (*FyneStorage) SocketAgentPath ¶ added in v0.20.0
func (s *FyneStorage) SocketAgentPath() string
SocketAgentPath return the socket agent path
func (*FyneStorage) StoreAppState ¶ added in v0.24.0
func (s *FyneStorage) StoreAppState(appState *AppState) error
StoreAppState store the configuration into the underlying storage
func (*FyneStorage) StoreItem ¶ added in v0.18.0
func (s *FyneStorage) StoreItem(vault *Vault, item Item) error
StoreItem encrypts and encrypts and stores the item into the specified vault
func (*FyneStorage) StoreVault ¶ added in v0.18.0
func (s *FyneStorage) StoreVault(vault *Vault) error
StoreVault encrypts and stores the vault into the underlying storage
func (*FyneStorage) Vaults ¶ added in v0.18.0
func (s *FyneStorage) Vaults() ([]string, error)
Vaults returns the list of vault names from the storage
type Imported ¶ added in v0.12.0
type Imported struct {
Items []Item
}
func (*Imported) UnmarshalJSON ¶ added in v0.12.0
type Item ¶
type Item interface { // ID returns the identity ID ID() string GetMetadata() *Metadata fmt.Stringer }
Item wraps all methods allow to generate a password with paw
type ItemStorage ¶ added in v0.15.0
type ItemStorage interface { // DeleteItem delete the item from the specified vaultName DeleteItem(vault *Vault, item Item) error // LoadItem returns a item from the vault decrypting from the underlying storage LoadItem(vault *Vault, itemMetadata *Metadata) (Item, error) // StoreItem encrypts and encrypts and stores the item into the specified vault StoreItem(vault *Vault, item Item) error }
type ItemStorageMock ¶ added in v0.23.0
type ItemStorageMock struct { // DeleteItem delete the item from the specified vaultName OnDeleteItem func(vault *Vault, item Item) error // LoadItem returns a item from the vault decrypting from the underlying storage OnLoadItem func(vault *Vault, itemMetadata *Metadata) (Item, error) // StoreItem encrypts and encrypts and stores the item into the specified vault OnStoreItem func(vault *Vault, item Item) error }
func (*ItemStorageMock) DeleteItem ¶ added in v0.23.0
func (c *ItemStorageMock) DeleteItem(vault *Vault, item Item) error
DeleteItem implements ItemStorage.
type ItemType ¶
type ItemType int
ItemType represents the Item type
const ( // MetadataItemType is the Metadata Item type MetadataItemType ItemType = 1 << iota // NoteItemType is the Note Item type NoteItemType // PasswordItemType is the Password Item type PasswordItemType // LoginItemType is the Website Item type LoginItemType // SSHKeyItemType is the SSH Key Item type SSHKeyItemType )
func ItemTypeFromString ¶ added in v0.15.0
ItemTypeFromString returns the item type from a string
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func LoadKey ¶ added in v0.14.0
LoadKey decrypts an age secret key from the reader r using the provided password
func MakeKey ¶ added in v0.14.0
MakeKey generates an age secret key. The key is encrypted to w and protect using the provided password
func MakeOneTimeKey ¶ added in v0.15.0
MakeOneTimeKey generates a one time age secret key. The key can be used to generate random passwords
func (*Key) MarshalJSON ¶ added in v0.20.0
func (*Key) UnmarshalJSON ¶ added in v0.20.0
type LogStorage ¶ added in v0.23.0
type LogStorage interface {
LogFilePath() string
}
type Login ¶ added in v0.13.0
type LoginURL ¶ added in v0.24.0
type LoginURL struct {
// contains filtered or unexported fields
}
func NewLoginURL ¶ added in v0.24.0
func NewLoginURL() *LoginURL
func (*LoginURL) MarshalJSON ¶ added in v0.24.0
func (*LoginURL) TLDPlusOne ¶ added in v0.24.0
func (*LoginURL) UnmarshalJSON ¶ added in v0.24.0
type Metadata ¶
type Metadata struct { // Name reprents the item name Name string `json:"name,omitempty"` // Subtitle represents the item subtitle Subtitle string `json:"subtitle,omitempty"` // Type represents the item type Type ItemType `json:"type,omitempty"` // Modified holds the modification date Modified time.Time `json:"modified,omitempty"` // Created holds the creation date Created time.Time `json:"created,omitempty"` // Icon Favicon *Favicon `json:"favicon,omitempty"` // Autofill Autofill *Autofill `json:"autofill,omitempty"` }
Item represents the basic paw identity
func (*Metadata) GetMetadata ¶
type MetadataSubtitler ¶ added in v0.23.0
type MetadataSubtitler interface {
Subtitle() string
}
MetadataSubtitler is the interface to implement to provide a subtitle to an item
type OSStorage ¶ added in v0.15.0
type OSStorage struct {
// contains filtered or unexported fields
}
func (*OSStorage) CreateVault ¶ added in v0.15.0
CreateVault encrypts and stores an empty vault into the underlying storage.
func (*OSStorage) CreateVaultKey ¶ added in v0.15.0
CreateVault encrypts and stores an empty vault into the underlying storage.
func (*OSStorage) DeleteItem ¶ added in v0.15.0
DeleteItem delete the item from the specified vaultName
func (*OSStorage) DeleteVault ¶ added in v0.15.0
DeleteVault delete the specified vault
func (*OSStorage) LoadAppState ¶ added in v0.24.0
LoadAppState load the configuration from the underlying storage
func (*OSStorage) LoadItem ¶ added in v0.15.0
LoadItem returns a item from the vault decrypting from the underlying storage
func (*OSStorage) LoadVault ¶ added in v0.15.0
LoadVault returns a vault decrypting from the underlying storage
func (*OSStorage) LoadVaultKey ¶ added in v0.15.0
LoadVaultIdentity returns a vault decrypting from the underlying storage
func (*OSStorage) LockFilePath ¶ added in v0.22.0
LockFilePath return the lock file path
func (*OSStorage) LogFilePath ¶ added in v0.23.0
LogFilePath return the log file path
func (*OSStorage) SocketAgentPath ¶ added in v0.20.0
SocketAgentPath return the socket agent path
func (*OSStorage) StoreAppState ¶ added in v0.24.0
StoreAppState store the configuration into the underlying storage
func (*OSStorage) StoreItem ¶ added in v0.15.0
StoreItem encrypts and encrypts and stores the item into the specified vault
func (*OSStorage) StoreVault ¶ added in v0.15.0
StoreVault encrypts and stores the vault into the underlying storage
type PassphrasePasswordPreferences ¶ added in v0.24.0
type Password ¶
type Password struct { Value string `json:"value,omitempty"` Format Format `json:"format,omitempty"` Length int `json:"length,omitempty"` Mode PasswordMode `json:"mode,omitempty"` *Metadata `json:"metadata,omitempty"` *Note `json:"note,omitempty"` }
func NewCustomPassword ¶ added in v0.15.0
func NewCustomPassword() *Password
func NewPassphrasePassword ¶ added in v0.15.0
func NewPassphrasePassword() *Password
func NewPassword ¶
func NewPassword() *Password
func NewPinPassword ¶ added in v0.15.0
func NewPinPassword() *Password
func NewRandomPassword ¶ added in v0.15.0
func NewRandomPassword() *Password
type PasswordMode ¶
type PasswordMode uint32
const ( CustomPassword PasswordMode = 0 RandomPassword PasswordMode = 1 PassphrasePassword PasswordMode = 2 PinPassword PasswordMode = 3 StatelessPassword PasswordMode = 4 )
func (PasswordMode) String ¶
func (pm PasswordMode) String() string
type PasswordPreferences ¶ added in v0.24.0
type PasswordPreferences struct { Passphrase PassphrasePasswordPreferences `json:"passphrase,omitempty"` Pin PinPasswordPreferences `json:"pin,omitempty"` Random RandomPasswordPreferences `json:"random,omitempty"` }
type PinPasswordPreferences ¶ added in v0.24.0
type Preferences ¶ added in v0.24.0
type Preferences struct { FaviconDownloader FaviconDownloaderPreferences `json:"favicon_downloader,omitempty"` Password PasswordPreferences `json:"password,omitempty"` TOTP TOTPPreferences `json:"totp,omitempty"` }
type RandomPasswordPreferences ¶ added in v0.24.0
type Rule ¶
Rule defines the policy for password generation
func NewRule ¶
NewRule defines a policy for password generation specifying the lenght and the desired format
func (*Rule) WithFilter ¶
WithFilter filters characters from the password
type SSHKey ¶ added in v0.17.0
type SSHKey struct { *Metadata `json:"metadata,omitempty"` *Note `json:"note,omitempty"` AddToAgent bool `json:"add_to_agent,omitempty"` Comment string `json:"comment,omitempty"` Fingerprint string `json:"fingerprint,omitempty"` Passphrase *Password `json:"passphrase,omitempty"` PrivateKey string `json:"private_key,omitempty"` PublicKey string `json:"public_key,omitempty"` }
type SecretMaker ¶
type Storage ¶ added in v0.11.0
type Storage interface { Root() string AppStateStorage VaultStorage ItemStorage LogStorage SocketAgentPath() string LockFilePath() string }
func NewFyneStorage ¶ added in v0.18.0
NewFyneStorage returns an Fyne Storage implementation
func NewOSStorage ¶ added in v0.15.0
NewOSStorage returns an OS Storage implementation rooted at os.UserConfigDir()
func NewOSStorageRooted ¶ added in v0.15.0
NewOSStorageRooted returns an OS Storage implementation rooted at root
type StorageMock ¶ added in v0.23.0
type StorageMock struct { AppStateStorageMock VaultStorageMock ItemStorageMock OnSocketAgentPath func() string }
func (*StorageMock) LockFilePath ¶ added in v0.23.0
func (*StorageMock) LockFilePath() string
LockFilePath implements Storage.
func (*StorageMock) LogFilePath ¶ added in v0.23.0
func (*StorageMock) LogFilePath() string
LogFilePath implements Storage.
func (*StorageMock) Root ¶ added in v0.23.0
func (c *StorageMock) Root() string
Root implements Storage.
func (*StorageMock) SocketAgentPath ¶ added in v0.23.0
func (c *StorageMock) SocketAgentPath() string
SocketAgentPath implements Storage.
type TOTP ¶ added in v0.10.0
type TOTP struct { Digits int `json:"digits,omitempty"` Hash TOTPHash `json:"hash,omitempty"` Interval int `json:"interval,omitempty"` Secret string `json:"secret,omitempty"` }
func NewDefaultTOTP ¶ added in v0.10.0
func NewDefaultTOTP() *TOTP
type TOTPPreferences ¶ added in v0.24.0
type Vault ¶
type Vault struct { Name string // Items represents the list of the item IDs available into the vault grouped by ItemType ItemMetadata map[ItemType]map[string]*Metadata //map[ItemType]map[<ID>] // Version represents the specification version Version string // Created represents the creation date Created time.Time // Modified represents the modification date Modified time.Time // contains filtered or unexported fields }
func (*Vault) DeleteItem ¶
func (*Vault) FilterItemMetadata ¶ added in v0.11.0
func (v *Vault) FilterItemMetadata(opts *VaultFilterOptions) []*Metadata
func (*Vault) HasItem ¶ added in v0.11.0
HasItem returns true if a item with the same ID is present into the vault
func (*Vault) Range ¶ added in v0.14.0
Range calls f sequentially for each key and value present in the vault. If f returns false, range stops the iteration.
func (*Vault) SizeByType ¶ added in v0.14.0
type VaultFilterOptions ¶
type VaultStorage ¶ added in v0.15.0
type VaultStorage interface { // CreateVault encrypts and stores an empty vault into the underlying storage. CreateVault(name string, key *Key) (*Vault, error) // LoadVaultKey creates and stores a Key used to encrypt and decrypt the vault data // The file containing the key is encrypted using the provided password CreateVaultKey(name string, password string) (*Key, error) // DeleteVault delete the specified vault DeleteVault(name string) error // LoadVault returns a vault decrypting from the underlying storage LoadVault(name string, key *Key) (*Vault, error) // LoadVaultKey returns the Key used to encrypt and decrypt the vault data LoadVaultKey(name string, password string) (*Key, error) // StoreVault encrypts and stores the vault into the underlying storage StoreVault(vault *Vault) error // Vaults returns the list of vault names from the storage Vaults() ([]string, error) }
type VaultStorageMock ¶ added in v0.23.0
type VaultStorageMock struct { // CreateVault encrypts and stores an empty vault into the underlying storage. OnCreateVault func(name string, key *Key) (*Vault, error) // LoadVaultKey creates and stores a Key used to encrypt and decrypt the vault data // The file containing the key is encrypted using the provided password OnCreateVaultKey func(name string, password string) (*Key, error) // DeleteVault delete the specified vault OnDeleteVault func(name string) error // LoadVault returns a vault decrypting from the underlying storage OnLoadVault func(name string, key *Key) (*Vault, error) // LoadVaultKey returns the Key used to encrypt and decrypt the vault data OnLoadVaultKey func(name string, password string) (*Key, error) // StoreVault encrypts and stores the vault into the underlying storage OnStoreVault func(vault *Vault) error // Vaults returns the list of vault names from the storage OnVaults func() ([]string, error) }
func (*VaultStorageMock) CreateVault ¶ added in v0.23.0
func (c *VaultStorageMock) CreateVault(name string, key *Key) (*Vault, error)
CreateVault implements VaultStorage.
func (*VaultStorageMock) CreateVaultKey ¶ added in v0.23.0
func (c *VaultStorageMock) CreateVaultKey(name string, password string) (*Key, error)
CreateVaultKey implements VaultStorage.
func (*VaultStorageMock) DeleteVault ¶ added in v0.23.0
func (c *VaultStorageMock) DeleteVault(name string) error
DeleteVault implements VaultStorage.
func (*VaultStorageMock) LoadVault ¶ added in v0.23.0
func (c *VaultStorageMock) LoadVault(name string, key *Key) (*Vault, error)
LoadVault implements VaultStorage.
func (*VaultStorageMock) LoadVaultKey ¶ added in v0.23.0
func (c *VaultStorageMock) LoadVaultKey(name string, password string) (*Key, error)
LoadVaultKey implements VaultStorage.
func (*VaultStorageMock) StoreVault ¶ added in v0.23.0
func (c *VaultStorageMock) StoreVault(vault *Vault) error
StoreVault implements VaultStorage.
func (*VaultStorageMock) Vaults ¶ added in v0.23.0
func (c *VaultStorageMock) Vaults() ([]string, error)
Vaults implements VaultStorage.