Documentation
¶
Index ¶
- type AllowedKeyInfo
- type ApprovalAPIRequest
- type ApprovalAPIResponse
- type ApprovalHandler
- type CreateKeystoreRequest
- type CreateRuleRequest
- type CreateSignerRequest
- type CreateSignerResponse
- type ErrorResponse
- type HDWalletHandler
- type JSRuleTestCase
- type ListHandler
- type ListRequestsResponse
- type ListRulesResponse
- type ListSignersResponse
- type PreviewRuleAPIRequest
- type PreviewRuleHandler
- type RequestDetailResponse
- type RequestHandler
- type RuleHandler
- type RuleHandlerOption
- type RuleResponse
- type SignHandler
- type SignRequest
- type SignResponse
- type SignerHandler
- type SignerResponse
- type UnlockSignerRequest
- type UpdateRuleRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowedKeyInfo ¶ added in v0.1.0
type AllowedKeyInfo struct {
ID string `json:"id"`
Name string `json:"name"`
AccessType string `json:"access_type"` // "unrestricted" or "explicit"
}
AllowedKeyInfo represents an API key that has access to a signer
type ApprovalAPIRequest ¶
type ApprovalAPIRequest struct {
Approved bool `json:"approved"`
RuleType string `json:"rule_type,omitempty"` // evm_address_list, evm_contract_method, evm_value_limit
RuleMode string `json:"rule_mode,omitempty"` // whitelist, blocklist
RuleName string `json:"rule_name,omitempty"`
MaxValue string `json:"max_value,omitempty"` // Required for evm_value_limit
}
ApprovalAPIRequest represents the request body for approval
type ApprovalAPIResponse ¶
type ApprovalAPIResponse struct {
RequestID string `json:"request_id"`
Status string `json:"status"`
Signature string `json:"signature,omitempty"`
SignedData string `json:"signed_data,omitempty"`
Message string `json:"message,omitempty"`
GeneratedRule *types.Rule `json:"generated_rule,omitempty"`
}
ApprovalAPIResponse represents the response for an approval request
type ApprovalHandler ¶
type ApprovalHandler struct {
// contains filtered or unexported fields
}
ApprovalHandler handles manual approval requests
func NewApprovalHandler ¶
func NewApprovalHandler(signService *service.SignService, logger *slog.Logger, rulesReadOnly bool) (*ApprovalHandler, error)
NewApprovalHandler creates a new approval handler
func (*ApprovalHandler) ServeHTTP ¶
func (h *ApprovalHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles POST /api/v1/evm/requests/{id}/approve
type CreateKeystoreRequest ¶
type CreateKeystoreRequest struct {
Password string `json:"password"`
}
CreateKeystoreRequest contains keystore creation parameters
type CreateRuleRequest ¶
type CreateRuleRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
Config map[string]interface{} `json:"config"`
Enabled bool `json:"enabled"`
TestCases []JSRuleTestCase `json:"test_cases,omitempty"` // required for evm_js rules
}
CreateRuleRequest represents a request to create a new rule
type CreateSignerRequest ¶
type CreateSignerRequest struct {
Type string `json:"type"`
Keystore *CreateKeystoreRequest `json:"keystore,omitempty"`
}
CreateSignerRequest represents the request to create a signer
type CreateSignerResponse ¶
type CreateSignerResponse struct {
Address string `json:"address"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
}
CreateSignerResponse represents the response after creating a signer
type ErrorResponse ¶
ErrorResponse represents an error response
type HDWalletHandler ¶ added in v0.1.0
type HDWalletHandler struct {
// contains filtered or unexported fields
}
HDWalletHandler handles HD wallet management endpoints.
func NewHDWalletHandler ¶ added in v0.1.0
func NewHDWalletHandler(signerManager evmchain.SignerManager, logger *slog.Logger, readOnly bool) (*HDWalletHandler, error)
NewHDWalletHandler creates a new HD wallet handler.
func (*HDWalletHandler) ServeHTTP ¶ added in v0.1.0
func (h *HDWalletHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles /api/v1/evm/hd-wallets
type JSRuleTestCase ¶ added in v0.1.0
type JSRuleTestCase struct {
Name string `json:"name"`
Input map[string]interface{} `json:"input"`
ExpectPass bool `json:"expect_pass"`
ExpectReason string `json:"expect_reason,omitempty"`
}
JSRuleTestCase is a test case for evm_js rules submitted via API.
type ListHandler ¶
type ListHandler struct {
// contains filtered or unexported fields
}
ListHandler handles listing requests
func NewListHandler ¶
func NewListHandler(signService *service.SignService, ruleRepo storage.RuleRepository, logger *slog.Logger) (*ListHandler, error)
NewListHandler creates a new list handler
func (*ListHandler) ServeHTTP ¶
func (h *ListHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /api/v1/evm/requests
type ListRequestsResponse ¶
type ListRequestsResponse struct {
Requests []RequestDetailResponse `json:"requests"`
Total int `json:"total"`
NextCursor *string `json:"next_cursor,omitempty"`
NextCursorID *string `json:"next_cursor_id,omitempty"`
HasMore bool `json:"has_more"`
}
ListRequestsResponse represents the response for listing requests
type ListRulesResponse ¶
type ListRulesResponse struct {
Rules []RuleResponse `json:"rules"`
Total int `json:"total"`
}
ListRulesResponse represents the response for listing rules
type ListSignersResponse ¶
type ListSignersResponse struct {
Signers []SignerResponse `json:"signers"`
Total int `json:"total"`
HasMore bool `json:"has_more"`
}
ListSignersResponse represents the response for listing signers
type PreviewRuleAPIRequest ¶
type PreviewRuleAPIRequest struct {
RuleType string `json:"rule_type"` // Required
RuleMode string `json:"rule_mode"` // Required
RuleName string `json:"rule_name,omitempty"`
MaxValue string `json:"max_value,omitempty"` // Required for evm_value_limit
}
PreviewRuleAPIRequest represents the request body for rule preview
type PreviewRuleHandler ¶
type PreviewRuleHandler struct {
// contains filtered or unexported fields
}
PreviewRuleHandler handles POST /api/v1/evm/requests/{id}/preview-rule
func NewPreviewRuleHandler ¶
func NewPreviewRuleHandler(signService *service.SignService, logger *slog.Logger) (*PreviewRuleHandler, error)
NewPreviewRuleHandler creates a new preview rule handler
func (*PreviewRuleHandler) ServeHTTP ¶
func (h *PreviewRuleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles POST /api/v1/evm/requests/{id}/preview-rule
type RequestDetailResponse ¶
type RequestDetailResponse struct {
ID string `json:"id"`
APIKeyID string `json:"api_key_id"`
ChainType string `json:"chain_type"`
ChainID string `json:"chain_id"`
SignerAddress string `json:"signer_address"`
SignType string `json:"sign_type"`
Status string `json:"status"`
ClientIP string `json:"client_ip,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
Signature string `json:"signature,omitempty"`
SignedData string `json:"signed_data,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
RuleMatchedID *string `json:"rule_matched_id,omitempty"`
RuleMatchedName *string `json:"rule_matched_name,omitempty"`
ApprovedBy *string `json:"approved_by,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CompletedAt *string `json:"completed_at,omitempty"`
}
RequestDetailResponse represents a detailed request response (GET /api/v1/evm/requests/{id}). Payload is included so operators can inspect full request content for debugging and rule analysis.
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
RequestHandler handles request status queries
func NewRequestHandler ¶
func NewRequestHandler(signService *service.SignService, ruleRepo storage.RuleRepository, logger *slog.Logger) (*RequestHandler, error)
NewRequestHandler creates a new request handler
func (*RequestHandler) ServeHTTP ¶
func (h *RequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /api/v1/evm/requests/{id}
type RuleHandler ¶
type RuleHandler struct {
// contains filtered or unexported fields
}
RuleHandler handles rule management endpoints
func NewRuleHandler ¶
func NewRuleHandler(ruleRepo storage.RuleRepository, logger *slog.Logger, opts ...RuleHandlerOption) (*RuleHandler, error)
NewRuleHandler creates a new rule handler
func (*RuleHandler) ServeHTTP ¶
func (h *RuleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles /api/v1/evm/rules and /api/v1/evm/rules/{id}
type RuleHandlerOption ¶
type RuleHandlerOption func(*RuleHandler)
RuleHandlerOption is a functional option for RuleHandler
func WithJSEvaluator ¶ added in v0.1.0
func WithJSEvaluator(eval *evmchain.JSRuleEvaluator) RuleHandlerOption
WithJSEvaluator sets the JS rule evaluator for test-case validation on API-created evm_js rules.
func WithReadOnly ¶ added in v0.1.0
func WithReadOnly() RuleHandlerOption
WithReadOnly disables all rule mutation endpoints (create/update/delete).
func WithSolidityValidator ¶
func WithSolidityValidator(validator *evmchain.SolidityRuleValidator) RuleHandlerOption
WithSolidityValidator sets the Solidity rule validator for the handler
type RuleResponse ¶
type RuleResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
Source string `json:"source"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
Config json.RawMessage `json:"config,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ExpiresAt *string `json:"expires_at,omitempty"`
MatchCount uint64 `json:"match_count"`
LastMatchedAt *string `json:"last_matched_at,omitempty"`
}
RuleResponse represents a rule in API responses
type SignHandler ¶
type SignHandler struct {
// contains filtered or unexported fields
}
SignHandler handles EVM sign requests
func NewSignHandler ¶
func NewSignHandler(signService *service.SignService, signerManager evm.SignerManager, logger *slog.Logger) (*SignHandler, error)
NewSignHandler creates a new sign handler
func (*SignHandler) ServeHTTP ¶
func (h *SignHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles the sign request
type SignRequest ¶
type SignRequest struct {
ChainID string `json:"chain_id"`
SignerAddress string `json:"signer_address"`
SignType string `json:"sign_type"`
Payload json.RawMessage `json:"payload"`
}
SignRequest represents the request body for signing
type SignResponse ¶
type SignResponse struct {
RequestID string `json:"request_id"`
Status string `json:"status"`
Signature string `json:"signature,omitempty"` // hex encoded
SignedData string `json:"signed_data,omitempty"` // hex encoded
Message string `json:"message,omitempty"`
}
SignResponse represents the response for a sign request
type SignerHandler ¶
type SignerHandler struct {
// contains filtered or unexported fields
}
SignerHandler handles signer management endpoints
func NewSignerHandler ¶
func NewSignerHandler(signerManager evm.SignerManager, apiKeyRepo storage.APIKeyRepository, logger *slog.Logger, readOnly bool) (*SignerHandler, error)
NewSignerHandler creates a new signer handler
func (*SignerHandler) HandleSignerAction ¶ added in v0.1.0
func (h *SignerHandler) HandleSignerAction(w http.ResponseWriter, r *http.Request)
HandleSignerAction handles /api/v1/evm/signers/{address}/{action}
func (*SignerHandler) ServeHTTP ¶
func (h *SignerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles /api/v1/evm/signers
type SignerResponse ¶
type SignerResponse struct {
Address string `json:"address"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
Locked bool `json:"locked"`
AllowedKeys []AllowedKeyInfo `json:"allowed_keys,omitempty"`
}
SignerResponse represents a signer in API responses
type UnlockSignerRequest ¶ added in v0.1.0
type UnlockSignerRequest struct {
Password string `json:"password"`
}
UnlockSignerRequest represents the request to unlock a locked signer
type UpdateRuleRequest ¶
type UpdateRuleRequest struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
TestCases []JSRuleTestCase `json:"test_cases,omitempty"` // required for evm_js when updating config
}
UpdateRuleRequest represents a request to update an existing rule