Documentation ¶
Overview ¶
Data folder structure:
appsalts users/ {id1}/ kmdata/ # this is managed by keys manager keys passwordhashfile # in the user's case, this file is redundant salts recordfile1 # these are encrypted with kmdata just above recordfile2 ... {id2}/ kmdata/ keys passwordhashfile salts recordfile1 recordfile2 ... The appsalts contains two salts: saltcookie # the salt used to generate the keys used to # sign the cookies saltpassword # the salt used to encrypt the passwords # within the database
Index ¶
- Variables
- type API
- func (api *API) AddPayment(u *db.User, serializedpayment []byte) error
- func (api *API) Initialize() error
- func (api *API) ListPayments(u *db.User) ([]Payment, error)
- func (api *API) Login(email, password string) (*db.User, error)
- func (api *API) Logout(user *db.User) error
- func (api *API) Resume() error
- func (api *API) Scan(user *db.User, header *multipart.FileHeader, img image.Image) (*Payment, error)
- func (api *API) SignUp(email, password string) (*db.User, error)
- type ErrInvalidPayment
- type Payment
Constants ¶
This section is empty.
Variables ¶
var ErrEmailAlreadyUsed = errors.New("email already used")
var ErrWrongIdentifiers = errors.New("wrong identifiers")
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Usersdir string // contains filtered or unexported fields }
func (*API) Initialize ¶
Initialize creates all the required file (should only be run if they don't already exist)
func (*API) Logout ¶
Logout has nothing to do to log out someone from the api's point of view so we just at least check that the current user is valid
func (*API) Scan ¶
func (api *API) Scan(user *db.User, header *multipart.FileHeader, img image.Image) (*Payment, error)
Scan requires user just to make sure that only members use this expensive feature
func (*API) SignUp ¶
SignUp creates a new user
FIXME: this function can change the state of the application but still return an error. It needs to clean up after itself if that happens, because otherwise, we are left with a corrupted state
FIXME: this is extrememly inefficient. It reads all the user data into memory just to compare emails and possibly add one entry
type ErrInvalidPayment ¶
type ErrInvalidPayment error