Documentation
¶
Overview ¶
Package auth handles QR code login and credential persistence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearCredentials ¶
ClearCredentials removes stored credentials.
func DefaultCredPath ¶
func DefaultCredPath() string
DefaultCredPath returns ~/.wechatbot/credentials.json
func SaveCredentials ¶
func SaveCredentials(creds *Credentials, path string) error
SaveCredentials persists credentials to disk with 0600 permissions.
Types ¶
type Credentials ¶
type Credentials struct {
Token string `json:"token"`
BaseURL string `json:"baseUrl"`
AccountID string `json:"accountId"`
UserID string `json:"userId"`
SavedAt string `json:"savedAt,omitempty"`
}
Credentials holds bot authentication data.
func LoadCredentials ¶
func LoadCredentials(path string) (*Credentials, error)
LoadCredentials loads stored credentials from disk.
func Login ¶
func Login(ctx context.Context, client *protocol.Client, opts LoginOptions) (*Credentials, error)
Login performs QR code login, returning credentials. If stored credentials exist and Force is false, returns them directly. Handles IDC redirect (scaned_but_redirect), verify codes, already-bound accounts, and limits QR refreshes.
Click to show internal directories.
Click to hide internal directories.