auth

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear() error

Clear removes the auth file.

func Save

func Save(info *AuthInfo) error

Save writes auth info to disk with restrictive permissions.

Types

type AuthInfo

type AuthInfo struct {
	SessionToken string `json:"session_token"`
	Handle       string `json:"handle"`
	ConnectedAt  string `json:"connected_at"`
	Endpoint     string `json:"endpoint"`
}

AuthInfo stores the companion app's session with SC Bridge.

func Load

func Load() *AuthInfo

Load reads auth info from disk. Returns nil if not found or invalid.

func NewAuthInfo

func NewAuthInfo(sessionToken, handle, endpoint string) *AuthInfo

NewAuthInfo creates an AuthInfo for a successful connection.

type OAuthFlow

type OAuthFlow struct {
	// contains filtered or unexported fields
}

OAuthFlow manages the temporary HTTP server for the OAuth callback.

func NewOAuthFlow

func NewOAuthFlow(endpoint string) (*OAuthFlow, error)

NewOAuthFlow creates a new OAuth flow with a random state and port.

func (*OAuthFlow) ConnectURL

func (f *OAuthFlow) ConnectURL() string

ConnectURL returns the URL to open in the browser.

func (*OAuthFlow) Start

func (f *OAuthFlow) Start(ctx context.Context) OAuthResult

Start begins serving the callback endpoint. Returns when a result is received or timeout.

type OAuthResult

type OAuthResult struct {
	Token string
	Error error
}

OAuthResult contains the result of an OAuth flow.

Jump to

Keyboard shortcuts

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