auth

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserLogin

func BrowserLogin() (*models.SavedSession, error)

BrowserLogin opens a visible browser for the user to log in to Perplexity, waits for the session cookie, and returns the saved session. If Chrome/Chromium is not installed, it automatically downloads one via Rod.

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the path to the deplexity config directory.

func CookieLogin

func CookieLogin(ctx context.Context, token string) (*models.SavedSession, error)

CookieLogin creates a session from a manually provided session token, bypassing browser-based authentication entirely.

func DeleteSession

func DeleteSession() error

DeleteSession removes the saved session file.

func LoadSession

func LoadSession() (*models.SavedSession, error)

LoadSession reads the saved session from disk.

func SaveSession

func SaveSession(session *models.SavedSession) error

SaveSession persists the session to disk with restricted permissions.

func SessionExists

func SessionExists() bool

SessionExists checks whether a session file exists on disk.

func SessionPath

func SessionPath() (string, error)

SessionPath returns the full path to the session file.

Types

type SessionInfo

type SessionInfo struct {
	Valid     bool
	Email     string
	ExpiresAt time.Time
}

SessionInfo holds the result of validating a session.

func ValidateSession

func ValidateSession(ctx context.Context, session *models.SavedSession) (*SessionInfo, error)

ValidateSession checks if the saved session is still valid by calling Perplexity's NextAuth session endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL