keymanager

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func IsGenericError(err error) bool

IsGenericError returns true if the given error is GenericError

func IsHTTPRequestError

func IsHTTPRequestError(err error) bool

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,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 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

Sign implements IKeymanager interface.

type SignResponse

type SignResponse struct {
	Data SignatureModel `json:"data"`
}

SignResponse is the vault sign response model.

type SignatureModel

type SignatureModel struct {
	Signature string `json:"signature"`
}

SignatureModel represents vault signature model.

Jump to

Keyboard shortcuts

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