Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsurePaired ¶
func EnsurePaired(ctx context.Context, api PairingAPI, store *TokenStore, cfg *config.Config, logger *zap.SugaredLogger) (token string, firstRun bool, err error)
EnsurePaired ensures the device is paired with the WinDash backend Returns (token, firstRun, error)
func GetMachineID ¶
GetMachineID returns a stable unique identifier for this machine
func OpenDashboard ¶
OpenDashboard opens the WinDash dashboard in the default browser
Types ¶
type MockPairingAPI ¶
type MockPairingAPI struct {
// contains filtered or unexported fields
}
MockPairingAPI simulates the pairing flow for development/testing
func NewMockPairingAPI ¶
func NewMockPairingAPI(logger *zap.SugaredLogger) *MockPairingAPI
NewMockPairingAPI creates a new mock pairing API
func (*MockPairingAPI) ExchangeCode ¶
ExchangeCode simulates polling for device approval
func (*MockPairingAPI) RequestCode ¶
RequestCode simulates requesting a device code from the backend
type PairingAPI ¶
type PairingAPI interface {
RequestCode(ctx context.Context) (code string, expiresAt time.Time, err error)
ExchangeCode(ctx context.Context, code string) (token string, err error)
}
PairingAPI defines the interface for device pairing operations
type RealPairingAPI ¶
type RealPairingAPI struct {
// contains filtered or unexported fields
}
RealPairingAPI implements device pairing with the WinDash backend
func NewRealPairingAPI ¶
func NewRealPairingAPI(logger *zap.SugaredLogger, baseURL string) *RealPairingAPI
NewRealPairingAPI creates a new real pairing API client
func (*RealPairingAPI) ExchangeCode ¶
ExchangeCode polls the backend for device approval and token
func (*RealPairingAPI) RequestCode ¶
RequestCode requests a new device pairing code from the backend
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore manages secure storage of authentication tokens Uses Windows DPAPI via go-keyring
func NewTokenStore ¶
func NewTokenStore(logger *zap.SugaredLogger) *TokenStore
NewTokenStore creates a new token store
func (*TokenStore) DeleteToken ¶
func (s *TokenStore) DeleteToken(deviceID string) error
DeleteToken removes the authentication token from the OS keychain
func (*TokenStore) GetToken ¶
func (s *TokenStore) GetToken(deviceID string) (string, error)
GetToken retrieves the authentication token from the OS keychain
func (*TokenStore) SaveToken ¶
func (s *TokenStore) SaveToken(deviceID, token string) error
SaveToken stores the authentication token securely in the OS keychain