Documentation ¶
Index ¶
- Constants
- Variables
- func MasterPassword(mpwseed, passwordType, passwordPurpose, fullname, password, site string, ...) (string, error)
- func ValidateCounter(counter uint32) error
- func ValidateFullname(fullname string) error
- func ValidateMasterPasswordSeed(seed string) error
- func ValidatePassword(password string) error
- func ValidatePasswordPurpose(purpose string) error
- func ValidatePasswordType(passwordType string) error
- func ValidateSite(site string) error
- type MasterPW
- func (m *MasterPW) GetPasswordTypes() []string
- func (mpw *MasterPW) MasterPassword() (string, error)
- func (mpw *MasterPW) MergeConfig() error
- func (mpw *MasterPW) MergeConfigEX(c *config.MPConfig) error
- func (mpw *MasterPW) SetCounter(counter uint32) (err error)
- func (mpw *MasterPW) SetFullname(fullname string) (err error)
- func (mpw *MasterPW) SetMasterPasswordSeed(seed string) (err error)
- func (mpw *MasterPW) SetPassword(password string) (err error)
- func (mpw *MasterPW) SetPasswordPurpose(purpose string) (err error)
- func (mpw *MasterPW) SetPasswordType(pwtype string) (err error)
- func (mpw *MasterPW) SetSite(site string) (err error)
- func (mpw *MasterPW) Validate() error
- func (mpw *MasterPW) ValidatePasswordPurpose() error
- type PasswordPurpose
Constants ¶
const DefaultMasterPasswordSeed = common.DefaultMasterPasswordSeed
DefaultMasterPasswordSeed is the default seed and allows it to be compatible with http://masterpasswordapp.com/algorithm.html
const MasterPasswordTypes = "basic, long, maximum, medium, name, phrase, pin, short"
MasterPasswordTypes is for listing the current supported password types.
Default: long
const MpwSeries = "2.6"
MpwSeries denotes the mpw cli client version compatibility.
Variables ¶
var ( Dbg = debug.NewDebug().Dbg DbgO = debug.NewDebug().DbgO )
Debugging helpers
var ( ErrPasswordPurposeEmpty = errors.New("Site password purpose must be set") ErrPasswordPurposeInvalid = errors.New("Invalid site password purpose") ErrPasswordPurposeCounterOutOfRange = errors.New("Site password purpose is using an out of range counter") )
PasswordPurpose exported errors
var ( ErrCounter = errors.New("site password counter must be >= 1") ErrFullnameEmpty = errors.New("Site fullname must be set") ErrMasterPasswordSeedEmpty = errors.New("MasterPassword seed must be set") ErrPasswordEmpty = errors.New("Site password must be set") ErrPasswordTypeEmpty = errors.New("Password type must be set") ErrPasswordTypeInvalid = errors.New("Password type is invalid") ErrSiteEmpty = errors.New("Site name must be set") )
Validation exported errors
Functions ¶
func MasterPassword ¶
func MasterPassword(mpwseed, passwordType, passwordPurpose, fullname, password, site string, counter uint32) (string, error)
MasterPassword returns a derived password according to: http://masterpasswordapp.com/algorithm.html
Valid PasswordTypes: basic, long, maximum, medium, name, phrase, pin, short
func ValidateCounter ¶
ValidateCounter validates that the site counter value is >= 1
func ValidateFullname ¶
ValidateFullname validates that fullname is not empty
func ValidateMasterPasswordSeed ¶
ValidateMasterPasswordSeed validates that seed is not empty
func ValidatePassword ¶
ValidatePassword verifies that password is not empty
func ValidatePasswordPurpose ¶
ValidatePasswordPurpose will test if given purpose is valid
func ValidatePasswordType ¶
ValidatePasswordType verifies that passwordType is not empty and a valid type
func ValidateSite ¶
ValidateSite validates that site is not empty
Types ¶
type MasterPW ¶
MasterPW contains all relevant items for MasterPassword to act upon.
func NewMasterPassword ¶
func NewMasterPassword() *MasterPW
NewMasterPassword returns a new empty MasterPW struct
func (*MasterPW) GetPasswordTypes ¶
GetPasswordTypes returns a sorted list of valid password types
func (*MasterPW) MasterPassword ¶
MasterPassword returns a derived password according to: http://masterpasswordapp.com/algorithm.html
Valid PasswordTypes: basic, long, maximum, medium, name, phrase, pin, short
func (*MasterPW) MergeConfig ¶
MergeConfig will transfer and validate data from Config to MasterPW for any nil values.
func (*MasterPW) MergeConfigEX ¶
MergeConfigEX will transfer and validate data from given MPConfig to MasterPW for any nil values.
func (*MasterPW) SetCounter ¶
SetCounter is a setter for MasterPW.counter
func (*MasterPW) SetFullname ¶
SetFullname is a setter for MasterPW.fullname
func (*MasterPW) SetMasterPasswordSeed ¶
SetMasterPasswordSeed is a setter for MasterPW.masterPasswordSeed
func (*MasterPW) SetPassword ¶
SetPassword is a setter for MasterPW.password
func (*MasterPW) SetPasswordPurpose ¶
SetPasswordPurpose sets the MasterPassword's generated password purpose
func (*MasterPW) SetPasswordType ¶
SetPasswordType is a setter for MasterPW.passwordType
func (*MasterPW) Validate ¶
Validate ensures that MasterPW is ready for MasterPassword().
- masterPasswordSeed
- passwordType
- passwordPurpose
- fullname
- password
- site
- counter
func (*MasterPW) ValidatePasswordPurpose ¶
ValidatePasswordPurpose will test if MasterPW password purpose is valid
type PasswordPurpose ¶
type PasswordPurpose int
PasswordPurpose allows for different generated passwords for same Site depending on its intended purpose.
Given the same {fullname, password, site}, specifying a different 'purpose' will perturb the final generated password in a consistent manner.
*Unset*
Authentication (counter=N)
Identification (counter=1)
Recovery (counter=1)
NOTE: Authentication is perturbed by counter, whereas the others are not.
const ( PasswordPurposeUnSet PasswordPurpose = iota PasswordPurposeAuthentication PasswordPurposeIdentification PasswordPurposeRecovery )
PasswordPurpose lookup tokens
func PasswordPurposeToToken ¶
func PasswordPurposeToToken(purpose string) (PasswordPurpose, error)
PasswordPurposeToToken returns the const token associated with given purpose
func (*PasswordPurpose) String ¶
func (pp *PasswordPurpose) String() string
func (*PasswordPurpose) Validate ¶
func (pp *PasswordPurpose) Validate() error
Validate will test if password purpose is valid