yubihsm-go/connector/connector.go

27 lines
740 B
Go
Raw Normal View History

2018-09-02 05:46:37 -07:00
package connector
2018-11-30 07:49:18 -08:00
import "github.com/loomnetwork/yubihsm-go/commands"
2018-09-02 05:46:37 -07:00
type (
2018-10-01 05:48:56 -07:00
// Connector implements a simple request interface with a YubiHSM2
2018-09-02 05:46:37 -07:00
Connector interface {
2018-10-01 05:48:56 -07:00
// Request executes a command on the HSM and returns the binary response
2018-09-02 05:46:37 -07:00
Request(command *commands.CommandMessage) ([]byte, error)
2018-10-01 05:48:56 -07:00
// GetStatus requests the status of the HSM connector (not working for direct USB)
2018-09-02 05:46:37 -07:00
GetStatus() (*StatusResponse, error)
}
2018-10-01 05:48:56 -07:00
// Status represents a status state of the HSM
Status string
// StatusResponse is the response to the GetStatus command containing information about the connector and HSM
StatusResponse struct {
Status Status
Serial string
Version string
Pid string
Address string
Port string
}
2018-09-02 05:46:37 -07:00
)