connector

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidResponseValueLength = errors.New("invalid response value length")

Functions

This section is empty.

Types

type Connector

type Connector interface {
	// Request executes a command on the HSM and returns the binary response
	Request(command *commands.CommandMessage) ([]byte, error)
	// GetStatus requests the status of the HSM connector (not working for direct USB)
	GetStatus() (*StatusResponse, error)
}

Connector implements a simple request interface with a YubiHSM2

type HTTPConnector

type HTTPConnector struct {
	URL string
}

HTTPConnector implements the HTTP based connection with the YubiHSM2 connector

func NewHTTPConnector

func NewHTTPConnector(url string) *HTTPConnector

NewHTTPConnector creates a new instance of HTTPConnector

func (*HTTPConnector) GetStatus

func (c *HTTPConnector) GetStatus() (status *StatusResponse, err error)

GetStatus requests the status of the HSM connector route /connector/status

func (*HTTPConnector) Request

func (c *HTTPConnector) Request(command *commands.CommandMessage) (data []byte, err error)

Request encodes and executes a command on the HSM and returns the binary response

type Status

type Status string

Status represents a status state of the HSM

type StatusResponse

type StatusResponse struct {
	Status  Status
	Serial  string
	Version string
	Pid     string
	Address string
	Port    string
}

StatusResponse is the response to the GetStatus command containing information about the connector and HSM

Jump to

Keyboard shortcuts

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