client

package
v0.0.0-...-f5bbbf4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Overview

nolint

Index

Constants

View Source
const (
	RequestHeaderKey key = "request-headers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasClient

type AliasClient interface {
	CreateAlias(ctx context.Context, registry, aliasKey string, req *aliastypes.AliasRequest) (*aliastypes.AliasResponse, error)
	GetAlias(ctx context.Context, registry, aliasKey string) (*aliastypes.AliasResponse, error)
	UpdateAlias(ctx context.Context, registry, aliasKey string, req *aliastypes.AliasRequest) (*aliastypes.AliasResponse, error)
	DeleteAlias(ctx context.Context, registry, aliasKey string) error
}

type AliasRegistryClient

type AliasRegistryClient interface {
	CreateRegistry(ctx context.Context, registry string, req *aliastypes.CreateRegistryRequest) (*aliastypes.RegistryResponse, error)
	GetRegistry(ctx context.Context, registry string) (*aliastypes.RegistryResponse, error)
	DeleteRegistry(ctx context.Context, registry string) error
}

type Config

type Config struct {
	URL string
}

func NewConfig

func NewConfig(url string) *Config

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message" example:"error message"`
	Code    string `json:"code,omitempty" example:"IR001"`
}

ErrorResponse is the raw error type returned from the key manager

type EthClient

type EthClient interface {
	CreateEthAccount(ctx context.Context, storeName string, request *storestypes.CreateEthAccountRequest) (*storestypes.EthAccountResponse, error)
	ImportEthAccount(ctx context.Context, storeName string, request *storestypes.ImportEthAccountRequest) (*storestypes.EthAccountResponse, error)
	UpdateEthAccount(ctx context.Context, storeName, address string, request *storestypes.UpdateEthAccountRequest) (*storestypes.EthAccountResponse, error)
	SignMessage(ctx context.Context, storeName, account string, request *storestypes.SignMessageRequest) (string, error)
	SignTypedData(ctx context.Context, storeName, address string, request *storestypes.SignTypedDataRequest) (string, error)
	SignTransaction(ctx context.Context, storeName, address string, request *storestypes.SignETHTransactionRequest) (string, error)
	SignQuorumPrivateTransaction(ctx context.Context, storeName, address string, request *storestypes.SignQuorumPrivateTransactionRequest) (string, error)
	SignEEATransaction(ctx context.Context, storeName, address string, request *storestypes.SignEEATransactionRequest) (string, error)
	GetEthAccount(ctx context.Context, storeName, address string) (*storestypes.EthAccountResponse, error)
	ListEthAccounts(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
	ListDeletedEthAccounts(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
	DeleteEthAccount(ctx context.Context, storeName, address string) error
	DestroyEthAccount(ctx context.Context, storeName, address string) error
	RestoreEthAccount(ctx context.Context, storeName, address string) error
}

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(h *http.Client, c *Config) *HTTPClient

func (*HTTPClient) Call

func (c *HTTPClient) Call(ctx context.Context, nodeID, method string, args ...interface{}) (*jsonrpc.ResponseMsg, error)

func (*HTTPClient) CreateAlias

func (c *HTTPClient) CreateAlias(ctx context.Context, registry, aliasKey string, req *types.AliasRequest) (*types.AliasResponse, error)

CreateAlias creates an alias in the registry.

func (*HTTPClient) CreateEthAccount

func (c *HTTPClient) CreateEthAccount(ctx context.Context, storeName string, req *types.CreateEthAccountRequest) (*types.EthAccountResponse, error)

func (*HTTPClient) CreateKey

func (c *HTTPClient) CreateKey(ctx context.Context, storeName, id string, req *types.CreateKeyRequest) (*types.KeyResponse, error)

func (*HTTPClient) CreateRegistry

func (c *HTTPClient) CreateRegistry(ctx context.Context, registryName string, req *types.CreateRegistryRequest) (*types.RegistryResponse, error)

CreateRegistry creates an alias in the registry.

func (*HTTPClient) DeleteAlias

func (c *HTTPClient) DeleteAlias(ctx context.Context, registry, aliasKey string) error

DeleteAlias deletes an alias from the registry.

func (*HTTPClient) DeleteEthAccount

func (c *HTTPClient) DeleteEthAccount(ctx context.Context, storeName, address string) error

func (*HTTPClient) DeleteKey

func (c *HTTPClient) DeleteKey(ctx context.Context, storeName, id string) error

func (*HTTPClient) DeleteRegistry

func (c *HTTPClient) DeleteRegistry(ctx context.Context, registryName string) error

DeleteRegistry deletes a registry, with all the aliases it contained.

func (*HTTPClient) DeleteSecret

func (c *HTTPClient) DeleteSecret(ctx context.Context, storeName, id string) error

func (*HTTPClient) DestroyEthAccount

func (c *HTTPClient) DestroyEthAccount(ctx context.Context, storeName, address string) error

func (*HTTPClient) DestroyKey

func (c *HTTPClient) DestroyKey(ctx context.Context, storeName, id string) error

func (*HTTPClient) DestroySecret

func (c *HTTPClient) DestroySecret(ctx context.Context, storeName, id string) error

func (*HTTPClient) ECRecover

func (c *HTTPClient) ECRecover(ctx context.Context, req *types.ECRecoverRequest) (string, error)

func (*HTTPClient) GetAlias

func (c *HTTPClient) GetAlias(ctx context.Context, registry, aliasKey string) (*types.AliasResponse, error)

GetAlias gets an alias from the registry.

func (*HTTPClient) GetDeletedKey

func (c *HTTPClient) GetDeletedKey(ctx context.Context, storeName, id string) (*types.KeyResponse, error)

func (*HTTPClient) GetDeletedSecret

func (c *HTTPClient) GetDeletedSecret(ctx context.Context, storeName, id string) (*types.SecretResponse, error)

func (*HTTPClient) GetEthAccount

func (c *HTTPClient) GetEthAccount(ctx context.Context, storeName, address string) (*types.EthAccountResponse, error)

func (*HTTPClient) GetKey

func (c *HTTPClient) GetKey(ctx context.Context, storeName, id string) (*types.KeyResponse, error)

func (*HTTPClient) GetRegistry

func (c *HTTPClient) GetRegistry(ctx context.Context, registryName string) (*types.RegistryResponse, error)

GetRegistry lists all aliases from a registry.

func (*HTTPClient) GetSecret

func (c *HTTPClient) GetSecret(ctx context.Context, storeName, id, version string) (*types.SecretResponse, error)

func (*HTTPClient) ImportEthAccount

func (c *HTTPClient) ImportEthAccount(ctx context.Context, storeName string, req *types.ImportEthAccountRequest) (*types.EthAccountResponse, error)

func (*HTTPClient) ImportKey

func (c *HTTPClient) ImportKey(ctx context.Context, storeName, id string, req *types.ImportKeyRequest) (*types.KeyResponse, error)

func (*HTTPClient) ListDeletedEthAccounts

func (c *HTTPClient) ListDeletedEthAccounts(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) ListDeletedKeys

func (c *HTTPClient) ListDeletedKeys(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) ListDeletedSecrets

func (c *HTTPClient) ListDeletedSecrets(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) ListEthAccounts

func (c *HTTPClient) ListEthAccounts(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) ListKeys

func (c *HTTPClient) ListKeys(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) ListSecrets

func (c *HTTPClient) ListSecrets(ctx context.Context, storeName string, limit, page uint64) ([]string, error)

func (*HTTPClient) RestoreEthAccount

func (c *HTTPClient) RestoreEthAccount(ctx context.Context, storeName, address string) error

func (*HTTPClient) RestoreKey

func (c *HTTPClient) RestoreKey(ctx context.Context, storeName, id string) error

func (*HTTPClient) RestoreSecret

func (c *HTTPClient) RestoreSecret(ctx context.Context, storeName, id string) error

func (*HTTPClient) SetSecret

func (c *HTTPClient) SetSecret(ctx context.Context, storeName, id string, req *types.SetSecretRequest) (*types.SecretResponse, error)

func (*HTTPClient) SignEEATransaction

func (c *HTTPClient) SignEEATransaction(ctx context.Context, storeName, address string, req *types.SignEEATransactionRequest) (string, error)

func (*HTTPClient) SignKey

func (c *HTTPClient) SignKey(ctx context.Context, storeName, id string, req *types.SignBase64PayloadRequest) (string, error)

func (*HTTPClient) SignMessage

func (c *HTTPClient) SignMessage(ctx context.Context, storeName, address string, req *types.SignMessageRequest) (string, error)

func (*HTTPClient) SignQuorumPrivateTransaction

func (c *HTTPClient) SignQuorumPrivateTransaction(ctx context.Context, storeName, address string, req *types.SignQuorumPrivateTransactionRequest) (string, error)

func (*HTTPClient) SignTransaction

func (c *HTTPClient) SignTransaction(ctx context.Context, storeName, address string, req *types.SignETHTransactionRequest) (string, error)

func (*HTTPClient) SignTypedData

func (c *HTTPClient) SignTypedData(ctx context.Context, storeName, address string, req *types.SignTypedDataRequest) (string, error)

func (*HTTPClient) UpdateAlias

func (c *HTTPClient) UpdateAlias(ctx context.Context, registry, aliasKey string, req *types.AliasRequest) (*types.AliasResponse, error)

UpdateAlias updates an alias in the registry.

func (*HTTPClient) UpdateEthAccount

func (c *HTTPClient) UpdateEthAccount(ctx context.Context, storeName, address string, req *types.UpdateEthAccountRequest) (*types.EthAccountResponse, error)

func (*HTTPClient) UpdateKey

func (c *HTTPClient) UpdateKey(ctx context.Context, storeName, id string, req *types.UpdateKeyRequest) (*types.KeyResponse, error)

func (*HTTPClient) VerifyKeySignature

func (c *HTTPClient) VerifyKeySignature(ctx context.Context, req *types.VerifyKeySignatureRequest) error

func (*HTTPClient) VerifyMessage

func (c *HTTPClient) VerifyMessage(ctx context.Context, req *types.VerifyRequest) error

func (*HTTPClient) VerifyTypedData

func (c *HTTPClient) VerifyTypedData(ctx context.Context, req *types.VerifyTypedDataRequest) error

type JSONRPC

type JSONRPC interface {
	Call(ctx context.Context, nodeID, method string, args ...interface{}) (*jsonrpc.ResponseMsg, error)
}

type JSONRPCMessage

type JSONRPCMessage struct {
	Version string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
	ID      json.RawMessage `json:"id,omitempty"`
}

type KeysClient

type KeysClient interface {
	CreateKey(ctx context.Context, storeName, id string, request *storestypes.CreateKeyRequest) (*storestypes.KeyResponse, error)
	ImportKey(ctx context.Context, storeName, id string, request *storestypes.ImportKeyRequest) (*storestypes.KeyResponse, error)
	SignKey(ctx context.Context, storeName, id string, request *storestypes.SignBase64PayloadRequest) (string, error)
	GetKey(ctx context.Context, storeName, id string) (*storestypes.KeyResponse, error)
	ListKeys(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
	DeleteKey(ctx context.Context, storeName, id string) error
	GetDeletedKey(ctx context.Context, storeName, id string) (*storestypes.KeyResponse, error)
	ListDeletedKeys(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
	RestoreKey(ctx context.Context, storeName, id string) error
	DestroyKey(ctx context.Context, storeName, id string) error
}

type ResponseError

type ResponseError struct {
	// StatusCode is the HTTP status code.
	StatusCode int `json:"statusCode,omitempty" example:"404"`

	// ErrorCode is the key manager error code.
	ErrorCode string `json:"code,omitempty" example:"IR001"`

	// Errors are the underlying errors returned by Vault.
	Message string `json:"message" example:"error message"`
}

ResponseError is the error returned from the client when Key Manager responds with an error or non-success HTTP status code. ResponseError gives access to the underlying errors and status code.

func (*ResponseError) Error

func (r *ResponseError) Error() string

Error returns a human-readable error string for the response error.

type SecretsClient

type SecretsClient interface {
	SetSecret(ctx context.Context, storeName, id string, request *storestypes.SetSecretRequest) (*storestypes.SecretResponse, error)
	GetSecret(ctx context.Context, storeName, id, version string) (*storestypes.SecretResponse, error)
	GetDeletedSecret(ctx context.Context, storeName, id string) (*storestypes.SecretResponse, error)
	DeleteSecret(ctx context.Context, storeName, id string) error
	RestoreSecret(ctx context.Context, storeName, id string) error
	DestroySecret(ctx context.Context, storeName, id string) error
	ListSecrets(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
	ListDeletedSecrets(ctx context.Context, storeName string, limit, page uint64) ([]string, error)
}

type UtilsClient

type UtilsClient interface {
	VerifyKeySignature(ctx context.Context, request *utilstypes.VerifyKeySignatureRequest) error
	ECRecover(ctx context.Context, request *utilstypes.ECRecoverRequest) (string, error)
	VerifyMessage(ctx context.Context, request *utilstypes.VerifyRequest) error
	VerifyTypedData(ctx context.Context, request *utilstypes.VerifyTypedDataRequest) error
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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