Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encrypter ¶
type Encrypter interface { Encrypt(data []byte) (encrypted []byte, err error) Decrypt(data []byte) (decrypted []byte, err error) }
Encrypter represents a data encrypter.
type JSONSession ¶
type JSONSession struct {
// contains filtered or unexported fields
}
JSONSession contains session and encryption objects.
func NewJSONSession ¶
func NewJSONSession(sd SessionStorer, encrypter Encrypter) (*JSONSession, error)
NewJSONSession returns a new JSONSession.
func (*JSONSession) All ¶
func (s *JSONSession) All() (map[string][]byte, error)
All returns a map of all records.
func (*JSONSession) Commit ¶
Commit adds a session token and data to the store with the given expiry time. If the session token already exists then the data and expiry time are updated.
func (*JSONSession) Delete ¶
func (s *JSONSession) Delete(token string) error
Delete removes a session token and corresponding data from the store.
type SessionData ¶
type SessionData struct { ID string `json:"id"` Data []byte `json:"data"` Expire time.Time `json:"expire"` }
SessionData is a session record.
type SessionDatabase ¶
type SessionDatabase struct {
Records map[string]SessionData `json:"db"`
}
SessionDatabase contains all the session records.
func (*SessionDatabase) Load ¶
func (sd *SessionDatabase) Load(ss SessionStorer, en Encrypter) error
Load all sessions.
func (*SessionDatabase) Save ¶
func (sd *SessionDatabase) Save(ss SessionStorer, en Encrypter) error
Save all sessions.
Click to show internal directories.
Click to hide internal directories.