Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) AppVariables() map[string]interface{}
- func (c *Client) GetAppVariables() map[string]interface{}
- func (c *Client) GetLicenseVariables() map[string]interface{}
- func (c *Client) GetSessionData() map[string]interface{}
- func (c *Client) IsAuthenticated() bool
- func (c *Client) LicenseVariables() map[string]interface{}
- func (c *Client) Login(licenseKey string) (*LoginResult, error)
- func (c *Client) Logout()
- func (c *Client) SelfBan(licenseKey string, sessionToken string, revokeLicense bool, blacklistHwid bool, ...) (map[string]interface{}, error)
- func (c *Client) SessionData() map[string]interface{}
- func (c *Client) ValidateLicense(licenseKey string) (*LoginResult, error)
- type Config
- type LoginResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidApp = errors.New("authforge: invalid app credentials") ErrInvalidKey = errors.New("authforge: invalid license key") ErrExpired = errors.New("authforge: license expired") ErrRevoked = errors.New("authforge: license revoked") ErrHwidMismatch = errors.New("authforge: HWID slots full") ErrNoCredits = errors.New("authforge: no credits") ErrAppBurnCapReached = errors.New("authforge: app credit burn cap reached") ErrBlocked = errors.New("authforge: blocked") ErrRateLimited = errors.New("authforge: rate limited") ErrReplayDetected = errors.New("authforge: replay detected") ErrAppDisabled = errors.New("authforge: app disabled") ErrSessionExpired = errors.New("authforge: session expired") ErrRevokeRequiresSession = errors.New("authforge: revoke requires session-authenticated self-ban") ErrBadRequest = errors.New("authforge: bad request") ErrServerError = errors.New("authforge: server error") ErrSignatureMismatch = errors.New("authforge: signature verification failed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AppVariables ¶
func (*Client) GetAppVariables ¶
func (*Client) GetLicenseVariables ¶
func (*Client) GetSessionData ¶
func (*Client) IsAuthenticated ¶
func (*Client) LicenseVariables ¶
func (*Client) SessionData ¶
func (*Client) ValidateLicense ¶ added in v1.0.3
func (c *Client) ValidateLicense(licenseKey string) (*LoginResult, error)
ValidateLicense performs the same /auth/validate request and signature checks as Login, without updating client session state or starting the heartbeat goroutine.
type Config ¶
type Config struct {
AppID string
AppSecret string
// PublicKey is the trusted Ed25519 public key (base64-encoded). For the
// common single-key case set this directly; during a server-side rotation
// pass the previous and current keys via PublicKeys instead so the SDK
// trusts both for the duration of the cutover.
PublicKey string
// PublicKeys is the optional rotation set; when non-empty it takes
// precedence over PublicKey. The first entry is treated as the primary
// (current) key for telemetry/logging purposes; verification accepts a
// signature that matches any entry.
PublicKeys []string
HeartbeatMode string
HeartbeatInterval time.Duration
APIBaseURL string
OnFailure func(error string)
RequestTimeout time.Duration
HWIDOverride string
// SessionTTL overrides the session token lifetime requested from the
// server on Login. Zero means "use the server default" (24h today).
// Server clamps to [1h, 7d]; out-of-range values are silently clamped.
SessionTTL time.Duration
}
type LoginResult ¶
type LoginResult struct {
SessionToken string `json:"sessionToken"`
ExpiresIn int64 `json:"expiresIn"`
SessionExpiresAt string `json:"sessionExpiresAt,omitempty"`
LicenseExpiresAt *string `json:"licenseExpiresAt,omitempty"`
MaxHwidSlots *int `json:"maxHwidSlots,omitempty"`
HwidCount *int `json:"hwidCount,omitempty"`
LicenseLabel *string `json:"licenseLabel,omitempty"`
AppVariables map[string]interface{} `json:"appVariables,omitempty"`
LicenseVariables map[string]interface{} `json:"licenseVariables,omitempty"`
RequestID string `json:"requestId,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.