Documentation
¶
Overview ¶
Package session handles session and token storage for authentication.
Index ¶
- func ExtractRawToken(tokenData string) string
- type Session
- type Store
- func (s *Store) DeleteSession() error
- func (s *Store) DeleteToken(email string) error
- func (s *Store) ListTokens() ([]string, error)
- func (s *Store) LoadSession() (*Session, error)
- func (s *Store) LoadToken(email string) (string, error)
- func (s *Store) SaveSession(session *Session) error
- func (s *Store) SaveToken(email, token string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractRawToken ¶
ExtractRawToken extracts the raw machine token value from a token string. PHP Terminus stores tokens as JSON with token, email, and date fields. This function handles both formats: raw token strings and PHP-style JSON.
Types ¶
type Session ¶
type Session struct {
SessionToken string `json:"session"`
UserID string `json:"user_id"`
ExpiresAt int64 `json:"expires_at"`
}
Session represents an authenticated session
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles session and token persistence
func (*Store) DeleteSession ¶
DeleteSession deletes the session file
func (*Store) DeleteToken ¶
DeleteToken deletes a machine token
func (*Store) ListTokens ¶
ListTokens returns a list of saved token emails
func (*Store) LoadSession ¶
LoadSession loads a session from disk
func (*Store) SaveSession ¶
SaveSession saves a session to disk
Click to show internal directories.
Click to hide internal directories.