You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Create store with custom pathstore:=devices.NewDeviceStore("/custom/config/path")
// Create pairing managerpairingMgr:=devices.NewPairingManager(store)
Check Pairing Status
// Check if any devices are pairedifpairingMgr.IsPaired() {
fmt.Println("Devices are paired")
} else {
code, _:=pairingMgr.GenerateCodeOnce()
fmt.Printf("Pair with code: %s\n", code)
}
Regenerate Code
// Force regenerate code (invalidates old one)newCode, err:=pairingMgr.RegenerateCode()
iferr!=nil {
log.Fatal(err)
}
fmt.Printf("New code: %s\n", newCode)
Security Considerations
Authorization Codes
Short-lived (5 minutes)
Single use only
Displayed locally only
Not transmitted over network until pairing
Tokens
Cryptographically random
Long enough to prevent brute force
Transmitted over HTTPS
Stored securely on both ends
Storage
File permissions restricted to owner
Tokens hashed for comparison
Automatic cleanup of expired tokens
Troubleshooting
Code Expired
Error: authorization code expired
Solution: Generate new code and retry
Code Already Used
Error: authorization code already used
Solution: Generate new code and retry
Token Invalid
Error: invalid token
Solution: Re-pair device with new authorization code
Token Expired
Error: token expired
Solution: Re-pair device with new authorization code