keymint

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSessionSignature added in v1.1.1

func GenerateSessionSignature(sessionID, nonce, sessionSecret string) string

GenerateSessionSignature generates a cryptographic signature for a heartbeat or checkin request using the sessionSecret and the rotating nextNonce (passed as the timestamp).

sessionID: The 22-character unique session ID. nonce: The rotating nonce string (nextNonce) received from the previous response. sessionSecret: The temporary session secret key received during checkout. Returns a 64-character hexadecimal signature string.

func GetMachineID added in v1.1.0

func GetMachineID() string

GetMachineID returns a best-effort hardware fingerprint as a SHA-256 hex string.

It attempts to read the BIOS UUID, then falls back through OS-level IDs and network MAC addresses. May return different values after hardware changes or OS reinstalls. May fail or collide on cheap/virtualized hardware.

Use this for logging, display, or secondary validation. For activation HostID, prefer GetOrCreateInstallationID.

Returns an empty string if every layer failed.

func GetOrCreateInstallationID added in v1.1.0

func GetOrCreateInstallationID(storagePath string) (string, error)

GetOrCreateInstallationID returns a guaranteed-unique, guaranteed-stable installation identifier. On first call, it generates a UUIDv4 seeded with whatever hardware info is available and persists it to disk. Every subsequent call returns the same value — even across reboots, app updates, and hardware upgrades.

This is the recommended value to pass as HostID when activating a license key.

storagePath: Optional custom path for the persistence file. Defaults to ~/.keymint/installation-id.

func VerifyWebhookSignature added in v1.2.0

func VerifyWebhookSignature(payload string, header string, secret string, tolerance time.Duration) error

VerifyWebhookSignature verifies a webhook payload signature received from Keymint. payload: The raw request body as string. header: The value of the "Keymint-Signature" header. secret: The webhook endpoint's signing secret. tolerance: Time tolerance duration (e.g. 5 * time.Minute) to prevent replay attacks. Set to 0 to use default (5 minutes). Returns nil if verification is successful, or an error if verification fails.

Types

type ActivateKeyParams

type ActivateKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to activate.
	LicenseKey string `json:"licenseKey"`
	// HostID is an optional unique identifier for the device.
	HostID *string `json:"hostId,omitempty"`
	// DeviceTag is an optional user-friendly name for the device.
	DeviceTag *string `json:"deviceTag,omitempty"`
	// Licensee is an optional customer name and email to set during activation.
	Licensee *ActivationLicensee `json:"licensee,omitempty"`
	// Version is an optional product version string (max 32 chars).
	Version *string `json:"version,omitempty"`
}

ActivateKeyParams represents parameters for the activateKey API endpoint.

type ActivateKeyResponse

type ActivateKeyResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Message is the activation status message (e.g., "License valid").
	Message string `json:"message"`
	// LicenseeName is the optional name of the licensee.
	LicenseeName *string `json:"licenseeName,omitempty"`
	// LicenseeEmail is the optional email of the licensee.
	LicenseeEmail *string `json:"licenseeEmail,omitempty"`
	// Metadata is the optional custom dictionary attached to the license key.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// VersionID is the optional associated product version ID.
	VersionID *string `json:"versionId,omitempty"`
	// Version is the optional detailed product version information.
	Version map[string]interface{} `json:"version,omitempty"`
	// AllowedHosts is an optional list of authorized machine IDs.
	AllowedHosts []string `json:"allowedHosts,omitempty"`
}

ActivateKeyResponse represents response structure for a successful activateKey API call.

type ActivationLicensee added in v1.4.0

type ActivationLicensee struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

ActivationLicensee represents customer info set during activation.

type ApiError

type ApiError struct {
	// Message is a descriptive error message.
	Message string `json:"message"`
	// Code is the API specific error code.
	Code int `json:"code"`
	// Status is the optional HTTP status code.
	Status *int `json:"status,omitempty"`
}

ApiError represents standard error response structure from the KeyMint API.

func (*ApiError) Error

func (e *ApiError) Error() string

Error implements the error interface for ApiError.

type BlockKeyParams

type BlockKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to block.
	LicenseKey string `json:"licenseKey"`
}

BlockKeyParams represents parameters for the blockKey API endpoint.

type BlockKeyResponse

type BlockKeyResponse struct {
	// Message is the confirmation message (e.g., "Key blocked").
	Message string `json:"message"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

BlockKeyResponse represents response structure for a successful blockKey API call.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the main entry point for the KeyMint API client Client provides methods to interact with the KeyMint API for license and customer management.

func New

func New(apiKey string, baseURL string) (*Client, error)

New creates a new KeyMint API client instance. apiKey: Your Keymint API key (required). baseURL: Optional API base URL (defaults to https://api.keymint.dev). Returns a new Client instance or an error if apiKey is missing.

func (*Client) ActivateKey

func (c *Client) ActivateKey(params ActivateKeyParams, opts ...*RequestOptions) (*ActivateKeyResponse, error)

ActivateKey activates a license key for a specific device.

IMPORTANT: If hostId is omitted, Keymint generates a random, unique Device ID. Every subsequent activation attempt without a hostId will be treated as a NEW machine. Applications using anonymous activations MUST cache the validation results locally. params: Parameters for activating the key. opts: Optional request configurations (e.g. idempotency keys). Returns the activation status or an error.

func (*Client) BlockKey

func (c *Client) BlockKey(params BlockKeyParams, opts ...*RequestOptions) (*BlockKeyResponse, error)

BlockKey blocks a specific license key. params: Parameters for blocking the key. opts: Optional request configurations (e.g. idempotency keys). Returns the block confirmation or an error.

func (*Client) CreateCustomer

func (c *Client) CreateCustomer(params CreateCustomerParams, opts ...*RequestOptions) (*CreateCustomerResponse, error)

CreateCustomer creates a new customer. params: Parameters for creating the customer. opts: Optional request configurations (e.g. idempotency keys). Returns the created customer information or an error.

func (*Client) CreateKey

func (c *Client) CreateKey(params CreateKeyParams, opts ...*RequestOptions) (*CreateKeyResponse, error)

CreateKey creates a new license key. params: Parameters for creating the key. opts: Optional request configurations (e.g. idempotency keys). Returns the created key information or an error.

func (*Client) DeactivateKey

func (c *Client) DeactivateKey(params DeactivateKeyParams, opts ...*RequestOptions) (*DeactivateKeyResponse, error)

DeactivateKey deactivates a device from a license key. params: Parameters for deactivating the key. opts: Optional request configurations (e.g. idempotency keys). Returns the deactivation confirmation or an error.

func (*Client) DeleteCustomer

func (c *Client) DeleteCustomer(params DeleteCustomerParams, opts ...*RequestOptions) (*DeleteCustomerResponse, error)

DeleteCustomer deletes a customer and all associated license keys permanently. params: Parameters containing the customer ID. opts: Optional request configurations (e.g. idempotency keys). Returns the deletion confirmation or an error.

func (*Client) FloatingCheckin added in v1.1.1

func (c *Client) FloatingCheckin(params FloatingCheckinParams, opts ...*RequestOptions) (*FloatingCheckinResponse, error)

FloatingCheckin checks in a floating license session, releasing the seat. params: Parameters for checking in the license. opts: Optional request configurations (e.g. idempotency keys). Returns the checkin response or an error.

func (*Client) FloatingCheckout added in v1.1.1

func (c *Client) FloatingCheckout(params FloatingCheckoutParams, opts ...*RequestOptions) (*FloatingCheckoutResponse, error)

FloatingCheckout checks out a floating license seat. params: Parameters for checking out the license. opts: Optional request configurations (e.g. idempotency keys). Returns the checkout response or an error.

func (*Client) FloatingHeartbeat added in v1.1.1

func (c *Client) FloatingHeartbeat(params FloatingHeartbeatParams, opts ...*RequestOptions) (*FloatingHeartbeatResponse, error)

FloatingHeartbeat sends a heartbeat to keep a floating license session alive. params: Parameters for the heartbeat. opts: Optional request configurations (e.g. idempotency keys). Returns the heartbeat response or an error.

func (*Client) GetAllCustomers

func (c *Client) GetAllCustomers(params GetAllCustomersParams) (*GetAllCustomersResponse, error)

GetAllCustomers retrieves all customers. params: Optional parameters for pagination and filtering. Returns a list of all customers or an error.

func (*Client) GetCustomerById

func (c *Client) GetCustomerById(params GetCustomerByIdParams) (*GetCustomerByIdResponse, error)

GetCustomerById retrieves detailed information about a specific customer by ID. params: Parameters containing the customer ID. Returns the customer information or an error.

func (*Client) GetCustomerWithKeys

func (c *Client) GetCustomerWithKeys(params GetCustomerWithKeysParams) ([]CustomerLicenseKey, error)

GetCustomerWithKeys retrieves license keys belonging to a specific customer. Returns a flat list of license keys.

func (*Client) GetKey

func (c *Client) GetKey(params GetKeyParams) (*GetKeyResponse, error)

GetKey retrieves detailed information about a specific license key. params: Parameters for fetching the key details. Returns the license key details or an error.

func (*Client) SignKey added in v1.4.0

func (c *Client) SignKey(params SignKeyParams, opts ...*RequestOptions) (*SignKeyResponse, error)

SignKey signs a license key for offline (air-gapped) validation via POST /api/key/sign.

func (*Client) ToggleCustomerStatus

func (c *Client) ToggleCustomerStatus(params ToggleCustomerStatusParams, opts ...*RequestOptions) (*ToggleCustomerStatusResponse, error)

ToggleCustomerStatus toggles the status of a customer (active/inactive). params: Parameters containing the customer ID. opts: Optional request configurations (e.g. idempotency keys). Returns the status toggle confirmation or an error.

func (*Client) UnblockKey

func (c *Client) UnblockKey(params UnblockKeyParams, opts ...*RequestOptions) (*UnblockKeyResponse, error)

UnblockKey unblocks a previously blocked license key. params: Parameters for unblocking the key. opts: Optional request configurations (e.g. idempotency keys). Returns the unblock confirmation or an error.

func (*Client) UpdateCustomer

func (c *Client) UpdateCustomer(params UpdateCustomerParams, opts ...*RequestOptions) (*UpdateCustomerResponse, error)

UpdateCustomer updates an existing customer. params: Parameters for updating the customer. opts: Optional request configurations (e.g. idempotency keys). Returns the update confirmation or an error.

func (*Client) UpdateKey added in v1.4.0

func (c *Client) UpdateKey(params UpdateKeyParams, opts ...*RequestOptions) (*UpdateKeyResponse, error)

UpdateKey updates an existing license key via PATCH /api/key.

type CreateCustomerParams

type CreateCustomerParams struct {
	// Name is the required customer name.
	Name string `json:"name"`
	// Email is the required customer email.
	Email string `json:"email"`
}

CreateCustomerParams represents parameters for the createCustomer API endpoint.

type CreateCustomerResponse

type CreateCustomerResponse struct {
	// ID is the customer ID.
	ID string `json:"id"`
	// Action is the action performed (e.g., "createCustomer").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Message is the success message.
	Message string `json:"message"`
	// Data contains the created customer details.
	Data struct {
		// ID is the customer ID.
		ID string `json:"id"`
		// Name is the customer name.
		Name string `json:"name"`
		// Email is the customer email.
		Email string `json:"email"`
	} `json:"data"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

CreateCustomerResponse represents response structure for a successful createCustomer API call.

type CreateKeyParams

type CreateKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// MaxActivations is the optional maximum number of times the key can be activated.
	MaxActivations *string `json:"maxActivations,omitempty"`
	// ExpiryDate is the optional expiration date of the key in ISO 8601 format.
	ExpiryDate *string `json:"expiryDate,omitempty"`
	// CustomerID is the optional ID of an existing customer to associate with the key.
	CustomerID *string `json:"customerId,omitempty"`
	// VersionID is the optional ID of a specific product version to associate with the key.
	VersionID *string `json:"versionId,omitempty"`
	// Metadata is an optional custom dictionary payload to attach to the license key.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// NewCustomer is an optional object to create and associate a new customer with the key.
	NewCustomer *NewCustomer `json:"newCustomer,omitempty"`
	// AllowedHosts is an optional list of machine IDs authorized to use this license.
	AllowedHosts []string `json:"allowedHosts,omitempty"`
	// Format is an optional custom key format.
	Format *KeyFormat `json:"format,omitempty"`
	// AmountKeys is the optional number of keys to generate at once (bulk creation).
	AmountKeys *string `json:"amountKeys,omitempty"`
	// LicenseType is the optional license type: "node-locked" or "floating" (defaults to "node-locked").
	LicenseType *string `json:"licenseType,omitempty"`
	// MaxConcurrentSessions is the optional max concurrent floating sessions.
	MaxConcurrentSessions *int `json:"maxConcurrentSessions,omitempty"`
	// HeartbeatInterval is the optional floating heartbeat interval in seconds (min 60).
	HeartbeatInterval *int `json:"heartbeatInterval,omitempty"`
	// SessionLeaseDuration is the optional floating session lease duration in seconds (min 300).
	SessionLeaseDuration *int `json:"sessionLeaseDuration,omitempty"`
}

CreateKeyParams represents parameters for the createKey API endpoint.

type CreateKeyResponse

type CreateKeyResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Key is the generated license key.
	Key string `json:"key"`
}

CreateKeyResponse represents response structure for a successful createKey API call.

type Customer

type Customer struct {
	// ID is the customer ID.
	ID string `json:"id"`
	// Name is the customer name.
	Name string `json:"name"`
	// Email is the customer email.
	Email string `json:"email"`
	// Active indicates if the customer is active.
	Active bool `json:"active"`
	// CreatedAt is the timestamp when the customer was created.
	CreatedAt string `json:"createdAt"`
	// UpdatedAt is the timestamp when the customer was last updated.
	UpdatedAt string `json:"updatedAt"`
	// CreatedBy is the identifier of the user who created the customer.
	CreatedBy string `json:"createdBy"`
}

Customer represents customer information in the getAllCustomers response.

type CustomerDetails

type CustomerDetails struct {
	// ID is the customer ID.
	ID string `json:"id"`
	// Name is the optional updated customer name.
	Name *string `json:"name,omitempty"`
	// Email is the optional updated customer email.
	Email *string `json:"email,omitempty"`
	// Active indicates if the customer is active.
	Active bool `json:"active"`
}

CustomerDetails represents customer details included in the GetKeyResponse.

type CustomerLicenseKey

type CustomerLicenseKey struct {
	// ID is the license key ID.
	ID string `json:"id"`
	// Key is the license key.
	Key string `json:"key"`
	// ProductID is the product ID associated with the license key.
	ProductID string `json:"productId"`
	// MaxActivations is the maximum number of activations for the license key.
	MaxActivations int `json:"maxActivations"`
	// Activations is the number of times the license key has been activated.
	Activations int `json:"activations"`
	// Activated indicates if the license key is activated.
	Activated bool `json:"activated"`
	// ExpirationDate is the expiration date of the license key.
	ExpirationDate *string `json:"expirationDate,omitempty"`
	// Metadata is the optional custom dictionary attached to the license key.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// VersionID is the optional associated product version ID.
	VersionID *string `json:"versionId,omitempty"`
	// AllowedHosts is the optional list of authorized machine IDs.
	AllowedHosts []string `json:"allowedHosts,omitempty"`
}

CustomerLicenseKey represents license key information in customer with keys response.

type DeactivateKeyParams

type DeactivateKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to deactivate.
	LicenseKey string `json:"licenseKey"`
	// HostID is an optional unique identifier of the device to deactivate. If omitted, all devices are deactivated.
	HostID *string `json:"hostId,omitempty"`
}

DeactivateKeyParams represents parameters for the deactivateKey API endpoint.

type DeactivateKeyResponse

type DeactivateKeyResponse struct {
	// Message is the confirmation message (e.g., "Device deactivated").
	Message string `json:"message"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

DeactivateKeyResponse represents response structure for a successful deactivateKey API call.

type DeleteCustomerParams

type DeleteCustomerParams struct {
	// CustomerID is the required customer ID.
	CustomerID string `json:"customerId"`
}

DeleteCustomerParams represents parameters for the deleteCustomer API endpoint.

type DeleteCustomerResponse

type DeleteCustomerResponse struct {
	// Action is the action performed (e.g., "deleteCustomer").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Message is the status message (e.g., "Customer deleted").
	Message string `json:"message"`
	// Code is the API response code.
	Code int `json:"code"`
}

DeleteCustomerResponse represents response structure for a successful deleteCustomer API call.

type DeviceDetails

type DeviceDetails struct {
	// HostID is the updated field name.
	HostID string `json:"hostId"`
	// DeviceTag is the updated field name.
	DeviceTag *string `json:"deviceTag,omitempty"`
	// IPAddress is the updated field name.
	IPAddress *string `json:"ipAddress,omitempty"`
	// ActivationTime is the updated field name.
	ActivationTime string `json:"activationTime"`
}

DeviceDetails represents device details included in the GetKeyResponse.

type FloatingCheckinParams added in v1.1.1

type FloatingCheckinParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key.
	LicenseKey string `json:"licenseKey"`
	// SessionID is the unique session ID.
	SessionID string `json:"sessionId"`
	// Timestamp is the rotating nonce (nextNonce) received from the previous response.
	Timestamp interface{} `json:"timestamp"`
	// Signature is the HMAC-SHA256 signature generated using the sessionSecret over the payload 'sessionId:nonce'.
	Signature string `json:"signature"`
}

FloatingCheckinParams represents parameters for the floating license checkin API endpoint.

type FloatingCheckinResponse added in v1.1.1

type FloatingCheckinResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Message is the confirmation message.
	Message string `json:"message"`
}

FloatingCheckinResponse represents response structure for a successful floating license checkin API call.

type FloatingCheckoutParams added in v1.1.1

type FloatingCheckoutParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key.
	LicenseKey string `json:"licenseKey"`
	// HostID is the unique hardware identifier of the device.
	HostID string `json:"hostId"`
	// DeviceTag is an optional friendly name for the device.
	DeviceTag *string `json:"deviceTag,omitempty"`
	// UserIdentifier is an optional user identifier.
	UserIdentifier *string `json:"userIdentifier,omitempty"`
}

FloatingCheckoutParams represents parameters for the floating license checkout API endpoint.

type FloatingCheckoutResponse added in v1.1.1

type FloatingCheckoutResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Message is the activation status message.
	Message string `json:"message"`
	// SessionID is the unique session ID.
	SessionID string `json:"sessionId"`
	// SessionSecret is the temporary session secret key.
	SessionSecret string `json:"sessionSecret"`
	// NextNonce is the rotating nonce string to use for the next request.
	NextNonce string `json:"nextNonce"`
	// ExpiresAt is the expiration time of the session in ISO 8601 format.
	ExpiresAt string `json:"expiresAt"`
	// HeartbeatInterval is the interval (in seconds) the client must heartbeat within.
	HeartbeatInterval int `json:"heartbeatInterval"`
	// Metadata is the optional custom dictionary attached to the license key.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// CurrentSessions is the number of active sessions for the license key.
	CurrentSessions *int `json:"currentSessions,omitempty"`
	// MaxSessions is the maximum concurrent sessions allowed for the license key.
	MaxSessions *int `json:"maxSessions,omitempty"`
	// LicenseeName is the optional name of the customer licensee.
	LicenseeName *string `json:"licenseeName,omitempty"`
	// LicenseeEmail is the optional email of the customer licensee.
	LicenseeEmail *string `json:"licenseeEmail,omitempty"`
}

FloatingCheckoutResponse represents response structure for a successful floating license checkout API call.

type FloatingHeartbeatParams added in v1.1.1

type FloatingHeartbeatParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key.
	LicenseKey string `json:"licenseKey"`
	// SessionID is the unique session ID.
	SessionID string `json:"sessionId"`
	// Timestamp is the rotating nonce (nextNonce) received from the previous response.
	Timestamp interface{} `json:"timestamp"`
	// Signature is the HMAC-SHA256 signature generated using the sessionSecret over the payload 'sessionId:nonce'.
	Signature string `json:"signature"`
}

FloatingHeartbeatParams represents parameters for the floating license heartbeat API endpoint.

type FloatingHeartbeatResponse added in v1.1.1

type FloatingHeartbeatResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Message is the response status message.
	Message string `json:"message"`
	// ExpiresAt is the extended expiration time of the session in ISO 8601 format.
	ExpiresAt string `json:"expiresAt"`
	// NextNonce is the newly rotated nonce to be used for the next subsequent heartbeat.
	NextNonce string `json:"nextNonce"`
}

FloatingHeartbeatResponse represents response structure for a successful floating license heartbeat API call.

type GetAllCustomersParams added in v1.0.3

type GetAllCustomersParams struct {
	// Page is the optional page number.
	Page *int `json:"page,omitempty"`
	// Limit is the optional number of items per page.
	Limit *int `json:"limit,omitempty"`
	// Email is the optional filter by email.
	Email *string `json:"email,omitempty"`
}

GetAllCustomersParams represents parameters for the getAllCustomers API endpoint.

type GetAllCustomersResponse

type GetAllCustomersResponse struct {
	// Action is the action performed (e.g., "getCustomers").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Data is the array of customer objects.
	Data []Customer `json:"data"`
	// Meta contains pagination metadata.
	Meta *PaginationMeta `json:"meta,omitempty"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

GetAllCustomersResponse represents response structure for a successful getAllCustomers API call.

type GetCustomerByIdParams

type GetCustomerByIdParams struct {
	// CustomerID is the required customer ID.
	CustomerID string `json:"customerId"`
}

GetCustomerByIdParams represents parameters for the getCustomerById API endpoint.

type GetCustomerByIdResponse

type GetCustomerByIdResponse struct {
	// Action is the action performed (e.g., "getCustomerById").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Data is the array containing the customer object.
	Data []Customer `json:"data"`
	// Code is the API response code.
	Code int `json:"code"`
}

GetCustomerByIdResponse represents response structure for a successful getCustomerById API call.

type GetCustomerWithKeysParams

type GetCustomerWithKeysParams struct {
	// CustomerID is the required customer ID.
	CustomerID string `json:"customerId"`
}

GetCustomerWithKeysParams represents parameters for the getCustomerWithKeys API endpoint.

type GetCustomerWithKeysResponse

type GetCustomerWithKeysResponse []CustomerLicenseKey

GetCustomerWithKeysResponse represents response structure for a successful getCustomerWithKeys API call. Returns a flat list of license keys for the customer.

type GetKeyParams

type GetKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to retrieve.
	LicenseKey string `json:"licenseKey"`
}

GetKeyParams represents parameters for the getKey API endpoint.

type GetKeyResponse

type GetKeyResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Data contains the license and optional customer details.
	Data struct {
		// License contains the license details.
		License LicenseDetails `json:"license"`
		// Customer contains the optional customer details.
		Customer *CustomerDetails `json:"customer,omitempty"`
	} `json:"data"`
}

GetKeyResponse represents response structure for a successful getKey API call.

type KeyFormat added in v1.4.0

type KeyFormat struct {
	// Sections is the optional number of sections (1-10).
	Sections *int `json:"sections,omitempty"`
	// SectionLength is the optional length of each section (1-32).
	SectionLength *int `json:"sectionLength,omitempty"`
	// Separator is the optional separator character (max 3 chars).
	Separator *string `json:"separator,omitempty"`
	// Charset is the optional custom character set (no whitespace).
	Charset *string `json:"charset,omitempty"`
	// Prefix is the optional prefix prepended to the key (max 16 chars).
	Prefix *string `json:"prefix,omitempty"`
	// Suffix is the optional suffix appended to the key (max 16 chars).
	Suffix *string `json:"suffix,omitempty"`
	// Case is the optional character case: "upper", "lower", or "mixed".
	Case *string `json:"case,omitempty"`
}

KeyFormat represents key format options for custom license key shapes.

type LicenseDetails

type LicenseDetails struct {
	// ID is the license ID.
	ID string `json:"id"`
	// Key is the license key.
	Key string `json:"key"`
	// ProductID is the updated field name.
	ProductID string `json:"productId"`
	// MaxActivations is the updated field name.
	MaxActivations int `json:"maxActivations"`
	// Activations is the number of times the license has been activated.
	Activations int `json:"activations"`
	// Devices is the list of devices associated with the license.
	Devices []DeviceDetails `json:"devices"`
	// Activated indicates if the license is activated.
	Activated bool `json:"activated"`
	// ExpirationDate is the updated field name.
	ExpirationDate *string `json:"expirationDate,omitempty"`
	// Metadata is the optional custom dictionary attached to the license key.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// VersionID is the optional associated product version ID.
	VersionID *string `json:"versionId,omitempty"`
	// Version is the optional detailed product version information.
	Version map[string]interface{} `json:"version,omitempty"`
	// AllowedHosts is the optional list of authorized machine IDs.
	AllowedHosts []string `json:"allowedHosts,omitempty"`
}

LicenseDetails represents license details included in the GetKeyResponse.

type NewCustomer

type NewCustomer struct {
	// Name is the name of the new customer.
	Name string `json:"name"`
	// Email is the optional email of the new customer.
	Email *string `json:"email,omitempty"`
}

NewCustomer represents the structure for creating a new customer when creating a license key.

type PaginationMeta added in v1.0.3

type PaginationMeta struct {
	// Total is the total number of items.
	Total int `json:"total"`
	// Page is the current page number.
	Page int `json:"page"`
	// Limit is the number of items per page.
	Limit int `json:"limit"`
	// TotalPages is the total number of pages.
	TotalPages int `json:"totalPages"`
}

PaginationMeta represents pagination metadata included in list responses.

type RequestOptions added in v1.3.0

type RequestOptions struct {
	IdempotencyKey string
}

RequestOptions contains optional parameters for Keymint API requests (e.g. idempotency keys).

type SignKeyParams added in v1.4.0

type SignKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to sign.
	LicenseKey string `json:"licenseKey"`
	// HostID is the required machine code to bind the offline license to.
	HostID string `json:"hostId"`
	// TTL is the optional time-to-live in seconds (min 60).
	TTL *int `json:"ttl,omitempty"`
}

SignKeyParams represents parameters for the signKey API endpoint (POST /api/key/sign).

type SignKeyResponse added in v1.4.0

type SignKeyResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// File contains the signed license file (signedKey, keyId, publicKeyFingerprint) — may be a JSON string.
	File interface{} `json:"file"`
}

SignKeyResponse represents response structure for a successful signKey API call.

type ToggleCustomerStatusParams

type ToggleCustomerStatusParams struct {
	// CustomerID is the required customer ID.
	CustomerID string `json:"customerId"`
}

ToggleCustomerStatusParams represents parameters for the toggleCustomerStatus API endpoint.

type ToggleCustomerStatusResponse

type ToggleCustomerStatusResponse struct {
	// Action is the action performed (e.g., "toggleActive").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Message is the status message (e.g., "Customer disabled").
	Message string `json:"message"`
	// Code is the API response code.
	Code int `json:"code"`
}

ToggleCustomerStatusResponse represents response structure for a successful toggleCustomerStatus API call.

type UnblockKeyParams

type UnblockKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to unblock.
	LicenseKey string `json:"licenseKey"`
}

UnblockKeyParams represents parameters for the unblockKey API endpoint.

type UnblockKeyResponse

type UnblockKeyResponse struct {
	// Message is the confirmation message (e.g., "Key unblocked").
	Message string `json:"message"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

UnblockKeyResponse represents response structure for a successful unblockKey API call.

type UpdateCustomerParams

type UpdateCustomerParams struct {
	// CustomerID is the required customer ID.
	CustomerID string `json:"customerId"`
	// Name is the optional updated customer name.
	Name *string `json:"name,omitempty"`
	// Email is the optional updated customer email.
	Email *string `json:"email,omitempty"`
}

UpdateCustomerParams represents parameters for the updateCustomer API endpoint.

type UpdateCustomerResponse

type UpdateCustomerResponse struct {
	// Action is the action performed (e.g., "updateCustomer").
	Action string `json:"action"`
	// Status indicates the success status.
	Status bool `json:"status"`
	// Message is the status message.
	Message string `json:"message"`
	// Data contains the updated customer details.
	Data Customer `json:"data"`
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
}

UpdateCustomerResponse represents response structure for a successful updateCustomer API call.

type UpdateKeyParams added in v1.4.0

type UpdateKeyParams struct {
	// ProductID is the unique identifier of the product.
	ProductID string `json:"productId"`
	// LicenseKey is the license key to update.
	LicenseKey string `json:"licenseKey"`
	// MaxActivations is the optional new max activations count (string or number).
	MaxActivations interface{} `json:"maxActivations,omitempty"`
	// ExpiryDate is the optional new expiration date in ISO 8601 format.
	ExpiryDate *string `json:"expiryDate,omitempty"`
	// CustomerID is the optional new customer ID to associate.
	CustomerID *string `json:"customerId,omitempty"`
	// NewCustomer is an optional object to create and associate a new customer.
	NewCustomer *NewCustomer `json:"newCustomer,omitempty"`
	// Metadata is the optional updated custom metadata.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	// VersionID is the optional updated product version ID.
	VersionID *string `json:"versionId,omitempty"`
	// AllowedHosts is the optional updated list of authorized machine IDs.
	AllowedHosts []string `json:"allowedHosts,omitempty"`
	// LicenseType is the optional license type: "node-locked" or "floating".
	LicenseType *string `json:"licenseType,omitempty"`
	// MaxConcurrentSessions is the optional updated max concurrent sessions.
	MaxConcurrentSessions *int `json:"maxConcurrentSessions,omitempty"`
	// HeartbeatInterval is the optional updated heartbeat interval in seconds (min 60).
	HeartbeatInterval *int `json:"heartbeatInterval,omitempty"`
	// SessionLeaseDuration is the optional updated session lease duration in seconds (min 300).
	SessionLeaseDuration *int `json:"sessionLeaseDuration,omitempty"`
}

UpdateKeyParams represents parameters for the updateKey API endpoint (PATCH /api/key).

type UpdateKeyResponse added in v1.4.0

type UpdateKeyResponse struct {
	// Code is the API response code (e.g., 0 for success).
	Code int `json:"code"`
	// Message is the confirmation message.
	Message string `json:"message"`
	// AffectedCount is the number of keys affected.
	AffectedCount *int `json:"affectedCount,omitempty"`
}

UpdateKeyResponse represents response structure for a successful updateKey API call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL