{"modulePath":"github.com/ModelRocket/hiro","version":"v0.1.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package session\n\n## Variables\n\n```go\nvar (\n\t// ErrSessionExpired should be returned by stores for expired sessions\n\tErrSessionExpired = errors.New(\"session expired\")\n)\n```\n\n## Types\n\n```go\ntype Controller interface {\n\t// SessionLoad loads a session by id\n\tSessionLoad(ctx context.Context, id string) (Session, error)\n\n\t// SessionCreate creates a session\n\tSessionCreate(ctx context.Context, session *Session) error\n\n\t// SessionUpdate updates a session\n\tSessionUpdate(ctx context.Context, session *Session) error\n\n\t// SessionDestroy destroys a session by id\n\tSessionDestroy(ctx context.Context, id string) error\n\n\t// SessionOptions returns the options from the audience\n\tSessionOptions(ctx context.Context, aud string) (Options, error)\n\n\t// SessionCleanup should remove expired sessions from the store\n\tSessionCleanup(ctx context.Context) error\n}\n```\nController represents the backend session storage interface\n\n```go\ntype Manager struct {\n\tController\n\t// contains filtered or unexported fields\n}\n```\nManager store is a session store\n\n```go\nfunc NewManager(ctrl Controller) *Manager\n```\nNewManager gets a store manager\n\n```go\nfunc (s *Manager) GetStore(ctx context.Context, aud string, sub ...string) (sessions.Store, error)\n```\nGetStore gets a store for the given context\n\n```go\ntype Options struct {\n\tsessions.Options\n\tKeyPairs [][]byte\n\t// contains filtered or unexported fields\n}\n```\nOptions provide cookie hashing and encryption\n\n```go\ntype Session struct {\n\tID        string     `json:\"id\"`\n\tAudience  string     `json:\"aud\"`\n\tSubject   string     `json:\"sub\"`\n\tData      string     `json:\"data\"`\n\tCreatedAt time.Time  `json:\"iat\"`\n\tExpiresAt time.Time  `json:\"exp\"`\n\tRevokedAt *time.Time `json:\"rev,omitempty\"`\n}\n```\nSession represents an oauth session stored in a browser cookie and backed by the controller\n\n","path":"github.com/ModelRocket/hiro/pkg/api/session","name":"session","synopsis":"","isRedistributable":true}
