Documentation
¶
Overview ¶
Package sdkey is the official Go client for SDKey license authentication.
It implements the sealed session protocol (Ed25519-verified handshake, HKDF session keys, AES-256-GCM validate envelopes). See PROTOCOL.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the SDKey license client.
Flow: Init (session handshake) → Validate (sealed request). Validate calls Init automatically when no session exists.
func NewClient ¶
func NewClient(opts ClientOptions) *Client
NewClient constructs a Client from options.
func (*Client) ClearSession ¶
func (c *Client) ClearSession()
ClearSession drops the current session (next Validate will re-init).
func (*Client) GetSession ¶
func (c *Client) GetSession() *SessionState
GetSession is an alias for Session (API parity with Python get_session).
func (*Client) Init ¶
func (c *Client) Init(ctx context.Context) (*SessionState, error)
Init performs the challenge handshake, verifies the signed hello, and derives the AES session key.
func (*Client) Session ¶
func (c *Client) Session() *SessionState
Session returns the active session, if any.
type ClientOptions ¶
type ClientOptions struct {
// APIBaseURL is the API origin (trailing slashes are stripped).
APIBaseURL string
// AppID is the application UUID from the SDKey dashboard.
AppID string
// AppPublicKeyB64 is the raw Ed25519 public key (32 bytes), standard or URL-safe base64.
AppPublicKeyB64 string
// HTTPPost optionally overrides the default HTTPS JSON transport (tests / custom agents).
HTTPPost HTTPPost
}
ClientOptions configures NewClient.
type Error ¶
Error is a protocol or transport failure. License denials (banned, HWID mismatch, etc.) return ValidateResult, not Error.
type ErrorCode ¶
type ErrorCode string
ErrorCode identifies protocol / transport failures (not license denials).
const ( ErrInitFailed ErrorCode = "INIT_FAILED" ErrHelloSignatureInvalid ErrorCode = "HELLO_SIGNATURE_INVALID" ErrValidateResponseInvalid ErrorCode = "VALIDATE_RESPONSE_INVALID" ErrResponseSignatureInvalid ErrorCode = "RESPONSE_SIGNATURE_INVALID" ErrSessionMismatch ErrorCode = "SESSION_MISMATCH" ErrClockSkew ErrorCode = "CLOCK_SKEW" ErrNetwork ErrorCode = "NETWORK" ErrUnknown ErrorCode = "UNKNOWN" )
type HTTPPost ¶
type HTTPPost func(ctx context.Context, url string, body map[string]any) (status int, response map[string]any, err error)
HTTPPost posts a JSON body and returns status code plus parsed JSON object. Used for injectable transport in tests and custom HTTP stacks.