Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrLocationMissing = NewGenericErrorMessage("wallet location is required") ErrTokenMissing = NewGenericErrorMessage("wallet access token is required") ErrPubKeyMissing = NewGenericErrorMessage("wallet public key is required") ErrUnsupportedSigning = NewGenericErrorWithMessage("remote HTTP key manager does not support such signing method") ErrNoSuchKey = NewGenericErrorWithMessage("no such key") )
Predefined errors
Functions ¶
func IsGenericError ¶
IsGenericError returns true if the given error is GenericError
func IsHTTPRequestError ¶
IsHTTPRequestError returns true if the given error is HTTPRequestError
Types ¶
type Config ¶
type Config struct { Location string `json:"location"` AccessToken string `json:"access_token"` PubKey string `json:"public_key"` Network string `json:"network"` }
Config contains configuration of the remote HTTP keymanager
func UnmarshalConfigFile ¶
func UnmarshalConfigFile(r io.ReadCloser) (*Config, error)
UnmarshalConfigFile attempts to JSON unmarshal a keymanager configuration file into the *Config{} struct.
type GenericError ¶
type GenericError struct {
ErrorMsg string `json:"error"`
}
GenericError represents the generic error of keymanager.
func NewGenericError ¶
func NewGenericError(err error, desc string, args ...interface{}) *GenericError
NewGenericError is the constructor of GenericError.
func NewGenericErrorMessage ¶
func NewGenericErrorMessage(desc string, args ...interface{}) *GenericError
NewGenericErrorMessage is the constructor of GenericError.
func NewGenericErrorWithMessage ¶
func NewGenericErrorWithMessage(msg string) *GenericError
NewGenericErrorWithMessage is the constructor of GenericError.
func (*GenericError) Error ¶
func (e *GenericError) Error() string
Error implements error interface.
func (*GenericError) String ¶
func (e *GenericError) String() string
String implements fmt.Stringer interface.
type HTTPRequestError ¶
type HTTPRequestError struct { URL string `json:"url"` // TODO add required? StatusCode int `json:"status_code,omitempty"` ResponseBody []byte `json:"response_body,omitempty"` Message string `json:"message,omitempty"` }
HTTPRequestError represents an HTTP request error.
func NewHTTPRequestError ¶
func NewHTTPRequestError(url string, statusCode int, responseBody []byte, message string) *HTTPRequestError
NewHTTPRequestError is the constructor of HTTPRequestError.
func (*HTTPRequestError) Error ¶
func (e *HTTPRequestError) Error() string
Error implements error interface
func (*HTTPRequestError) String ¶
func (e *HTTPRequestError) String() string
String returns a readable string representation of a HTTPRequestError struct.
type IkeyManager ¶ added in v1.3.8
type IkeyManager interface { FetchValidatingPublicKeys(_ context.Context) ([][48]byte, error) FetchAllValidatingPublicKeys(_ context.Context) ([][48]byte, error) Sign(_ context.Context, req *models.SignRequest) (bls.Signature, error) // contains filtered or unexported methods }
IkeyManager interface contains functions from prysm kv
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
KeyManager is a key manager that accesses a remote vault wallet daemon through HTTP connection.
func NewKeyManager ¶
func NewKeyManager(log *logrus.Entry, opts *Config) (*KeyManager, error)
NewKeyManager is the constructor of KeyManager.
func (*KeyManager) FetchAllValidatingPublicKeys ¶
func (km *KeyManager) FetchAllValidatingPublicKeys(_ context.Context) ([][48]byte, error)
FetchAllValidatingPublicKeys implements KeyManager-v2 interface.
func (*KeyManager) FetchValidatingPublicKeys ¶
func (km *KeyManager) FetchValidatingPublicKeys(_ context.Context) ([][48]byte, error)
FetchValidatingPublicKeys implements KeyManager-v2 interface.
func (*KeyManager) Sign ¶
func (km *KeyManager) Sign(_ context.Context, req *models.SignRequest) (bls.Signature, error)
Sign implements IKeymanager interface.