Documentation ¶
Index ¶
- type CloseAllInput
- type CloseAllOutput
- type CloseInput
- type CloseOutput
- type CreateInput
- type DefaultDigitalSignatureManagerFactory
- func (u *DefaultDigitalSignatureManagerFactory) Close(ctx context.Context, _ CloseInput) (*CloseOutput, error)
- func (u *DefaultDigitalSignatureManagerFactory) Create(ctx context.Context, input CreateInput) (signaturemanager.DigitalSignatureManager, error)
- func (u *DefaultDigitalSignatureManagerFactory) Reset(ctx context.Context, kind ModuleKind) error
- type DefaultDigitalSignatureManagerFactoryOptions
- type DefaultUseCase
- func (d DefaultUseCase) CloseAll(ctx context.Context, _ CloseAllInput) (*CloseAllOutput, error)
- func (d DefaultUseCase) GenerateAddress(ctx context.Context, input GenerateAddressInput) (*GenerateAddressOutput, error)
- func (d DefaultUseCase) IsAlive(ctx context.Context, input IsAliveInput) (*IsAliveOutput, error)
- func (d DefaultUseCase) ListAddresses(ctx context.Context, input ListAddressesInput) (*ListAddressesOutput, error)
- func (d DefaultUseCase) RemoveAddress(ctx context.Context, input RemoveAddressInput) (*RemoveAddressOutput, error)
- func (d DefaultUseCase) Reset(ctx context.Context, input ResetInput) (*ResetOutput, error)
- func (d DefaultUseCase) SignTx(ctx context.Context, input SignTxInput) (*SignTxOutput, error)
- type DefaultUseCaseOptions
- type DigitalSignatureManagerFactory
- type EthereumTransaction
- type EthereumTransactionSignature
- type GenerateAddressInput
- type GenerateAddressOutput
- type HSMConnector
- type IsAliveInput
- type IsAliveOutput
- type ListAddressesInput
- type ListAddressesOutput
- type ModuleKind
- type PKCS11ConnectionDetails
- type PKCS11ConnectionDetailsConfiguration
- type PKCS11Library
- type RemoveAddressInput
- type RemoveAddressOutput
- type ResetInput
- type ResetOutput
- type SignTxInput
- type SignTxOutput
- type SlotConnectionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseAllInput ¶
type CloseAllInput struct { }
CloseAllInput input to close all the signature manager resources.
type CloseAllOutput ¶
type CloseAllOutput struct { }
CloseAllOutput input to close all the signature manager resources.
type CloseInput ¶
type CloseInput struct { }
CloseInput input to close all the signature manager resources.
type CloseOutput ¶
type CloseOutput struct { }
CloseOutput input to close all the signature manager resources.
type CreateInput ¶
type CreateInput struct {
ModuleKind ModuleKind
}
CreateInput input data to create a new instance using the factory.
type DefaultDigitalSignatureManagerFactory ¶
type DefaultDigitalSignatureManagerFactory struct {
// contains filtered or unexported fields
}
DefaultDigitalSignatureManagerFactory implements DigitalSignatureManagerFactory to create PKCS11 digital signature manager compatible instances. It Initializes the pkcs11 library at creation time so that there is one pkcs11.Ctx per digital signature manager supported type.
func ProvideDefaultDigitalSignatureManagerFactory ¶
func ProvideDefaultDigitalSignatureManagerFactory(options DefaultDigitalSignatureManagerFactoryOptions) (*DefaultDigitalSignatureManagerFactory, error)
ProvideDefaultDigitalSignatureManagerFactory creates a new DigitalSignatureManagerFactory with the given options.
func (*DefaultDigitalSignatureManagerFactory) Close ¶
func (u *DefaultDigitalSignatureManagerFactory) Close(ctx context.Context, _ CloseInput) (*CloseOutput, error)
func (*DefaultDigitalSignatureManagerFactory) Create ¶
func (u *DefaultDigitalSignatureManagerFactory) Create(ctx context.Context, input CreateInput) (signaturemanager.DigitalSignatureManager, error)
func (*DefaultDigitalSignatureManagerFactory) Reset ¶
func (u *DefaultDigitalSignatureManagerFactory) Reset(ctx context.Context, kind ModuleKind) error
type DefaultDigitalSignatureManagerFactoryOptions ¶
type DefaultDigitalSignatureManagerFactoryOptions struct { // SoftHSMLibrary path to the library to connect to a PKCS11 compatible HSM. SoftHSMLibrary *PKCS11Library }
DefaultDigitalSignatureManagerFactoryOptions options to create a new DigitalSignatureManagerFactory instance.
type DefaultUseCase ¶
type DefaultUseCase struct {
// contains filtered or unexported fields
}
DefaultUseCase implements the HSMConnector interface.
func ProvideDefaultHSMConnector ¶
func ProvideDefaultHSMConnector(options DefaultUseCaseOptions) (*DefaultUseCase, error)
ProvideDefaultHSMConnector creates a new DefaultUseCase instance, returning an error if it fails.
func (DefaultUseCase) CloseAll ¶
func (d DefaultUseCase) CloseAll(ctx context.Context, _ CloseAllInput) (*CloseAllOutput, error)
func (DefaultUseCase) GenerateAddress ¶
func (d DefaultUseCase) GenerateAddress(ctx context.Context, input GenerateAddressInput) (*GenerateAddressOutput, error)
func (DefaultUseCase) IsAlive ¶
func (d DefaultUseCase) IsAlive(ctx context.Context, input IsAliveInput) (*IsAliveOutput, error)
func (DefaultUseCase) ListAddresses ¶
func (d DefaultUseCase) ListAddresses(ctx context.Context, input ListAddressesInput) (*ListAddressesOutput, error)
func (DefaultUseCase) RemoveAddress ¶
func (d DefaultUseCase) RemoveAddress(ctx context.Context, input RemoveAddressInput) (*RemoveAddressOutput, error)
func (DefaultUseCase) Reset ¶
func (d DefaultUseCase) Reset(ctx context.Context, input ResetInput) (*ResetOutput, error)
func (DefaultUseCase) SignTx ¶
func (d DefaultUseCase) SignTx(ctx context.Context, input SignTxInput) (*SignTxOutput, error)
type DefaultUseCaseOptions ¶
type DefaultUseCaseOptions struct { // DigitalSignatureManagerFactory defines the factory to create DigitalSignatureManager connections DigitalSignatureManagerFactory DigitalSignatureManagerFactory }
DefaultUseCaseOptions options to create a new DefaultUseCase.
type DigitalSignatureManagerFactory ¶
type DigitalSignatureManagerFactory interface { // Create returns the connection to a DigitalSignatureManager. Create(ctx context.Context, input CreateInput) (signaturemanager.DigitalSignatureManager, error) // Close closes open resources to the digital signature manager. Close(ctx context.Context, input CloseInput) (*CloseOutput, error) // Reset the snapshot of a given module kind to include slots created after the initialization. Reset(_ context.Context, kind ModuleKind) error }
DigitalSignatureManagerFactory defines the factory to create DigitalSignatureManager connections.
type EthereumTransaction ¶
type EthereumTransaction struct { // From address. From address.Address // To address. To *address.Address // Gas amount to use for transaction execution. Gas entities.HexUInt64 // GasPrice to use for each paid gas. GasPrice entities.HexInt256 // Value amount sent with this transaction. Value *entities.HexInt256 // Data arguments packed according to json rpc standard. Data entities.HexBytes // Nonce integer to identify request. Nonce entities.HexUInt64 // ChainID id of the blockchain network where the transaction is sent to. ChainID entities.HexInt256 // Signature Ethereum transaction signature. Signature *EthereumTransactionSignature }
EthereumTransaction represents an Ethereum transaction.
func (EthereumTransaction) Hash ¶
func (tx EthereumTransaction) Hash() (*entities.HexBytes, error)
Hash calculates the Ethereum transaction hash.
func (EthereumTransaction) RLPEncode ¶
func (tx EthereumTransaction) RLPEncode() (*entities.HexBytes, error)
RLPEncode RLP encodes the Ethereum transaction (including its signature) according to EIP-155. This function fails if the transaction doesn't have a signature yet. As a summary, the result is rlp(nonce, gasPrice, gas, to, value, data, V, R, S)
type EthereumTransactionSignature ¶
EthereumTransactionSignature represents an Ethereum transaction signature.
type GenerateAddressInput ¶
type GenerateAddressInput struct { // SlotConnectionData configuration to connect to a slot. SlotConnectionData }
GenerateAddressInput for account generation requests.
type GenerateAddressOutput ¶
type GenerateAddressOutput struct { // Address an Ethereum account to interact with the network. Address address.Address `json:"address"` }
GenerateAddressOutput for account generation responses.
type HSMConnector ¶
type HSMConnector interface { // GenerateAddress generates a key pair in the underlying signature manager and returns the Ethereum address or an error if it fails. GenerateAddress(ctx context.Context, input GenerateAddressInput) (*GenerateAddressOutput, error) // RemoveAddress removes the key pair associated with the given Ethereum address. RemoveAddress(ctx context.Context, input RemoveAddressInput) (*RemoveAddressOutput, error) // ListAddresses lists the addresses associated with their corresponding key pairs that exist in all the slots of an application. ListAddresses(ctx context.Context, input ListAddressesInput) (*ListAddressesOutput, error) // SignTx signs an Ethereum transaction using the private key associated with the address specific in the "From" input attribute. SignTx(ctx context.Context, input SignTxInput) (*SignTxOutput, error) // CloseAll closes all signature manager resources. CloseAll(ctx context.Context, input CloseAllInput) (*CloseAllOutput, error) // IsAlive checks the availability of a given slot. IsAlive(ctx context.Context, input IsAliveInput) (*IsAliveOutput, error) // Reset updates the state of the snapshot taken by the HSM library. Reset(ctx context.Context, input ResetInput) (*ResetOutput, error) }
HSMConnector connects with the HSM and operates with it.
type IsAliveInput ¶
type IsAliveInput struct { // Slot to be accessed. Slot string `valid:"required"` // Pin that grants access to the slot. Pin string `valid:"required"` // ModuleKind of the Hardware Security Module. ModuleKind ModuleKind `valid:"in(SoftHSM)"` }
IsAliveInput input to check the availability of the HSM slot.
type IsAliveOutput ¶
type IsAliveOutput struct { //IsAlive is true if the slot is reachable. IsAlive bool }
IsAliveOutput whether the slot is available.
type ListAddressesInput ¶
type ListAddressesInput struct { // SlotConnectionData configuration to connect to a slot. SlotConnectionData }
ListAddressesInput for account listing requests.
type ListAddressesOutput ¶
type ListAddressesOutput struct { // Items is an array of Ethereum accounts to interact with the network. Items []address.Address `json:"items"` }
ListAddressesOutput for account listing responses.
type ModuleKind ¶
type ModuleKind string
ModuleKind HSM type.
const (
SoftHSMModuleKind ModuleKind = "SoftHSM"
)
type PKCS11ConnectionDetails ¶
type PKCS11ConnectionDetails struct { // Configuration details for the HSM. Configuration PKCS11ConnectionDetailsConfiguration // Slot to be accessed. Slot string // Pin that grants access to the slot. Pin string }
PKCS11ConnectionDetails HSM connection details.
type PKCS11ConnectionDetailsConfiguration ¶
type PKCS11ConnectionDetailsConfiguration struct{}
PKCS11ConnectionDetailsConfiguration configuration details for the HSM.
type PKCS11Library ¶
type PKCS11Library string
PKCS11Library path to the library to connect to a PKCS11 compatible HSM.
type RemoveAddressInput ¶
type RemoveAddressInput struct { // SlotConnectionData configuration to connect to a slot. SlotConnectionData // Address an Ethereum account to interact with the network. Address address.Address `valid:"address"` }
RemoveAddressInput for account removal requests.
type RemoveAddressOutput ¶
type RemoveAddressOutput struct { // Address an Ethereum account to interact with the network. Address address.Address `json:"address"` }
RemoveAddressOutput for address removal responses.
type ResetInput ¶
type ResetInput struct { // ModuleKind is the kind of the module that will be reset. ModuleKind ModuleKind }
ResetInput input to reset the connection with the HSM library.
type SignTxInput ¶
type SignTxInput struct { // SlotConnectionData configuration to connect to a slot. SlotConnectionData // From address. From address.Address `valid:"address"` // To address. To *address.Address `valid:"optional"` // Gas amount to use for transaction execution. Gas *entities.HexUInt64 `valid:"optional"` // GasPrice to use for each paid gas. GasPrice *entities.HexInt256 `valid:"optional"` // Value amount sent with this transaction. Value *entities.HexInt256 `valid:"optional"` // Data arguments packed according to JSON RPC standard. Data entities.HexBytes // it can be empty (byte array of length 0) in eth-transfers // Nonce integer to identify request. Nonce entities.HexUInt64 }
SignTxInput for transaction signing requests.
type SignTxOutput ¶
type SignTxOutput struct { // SignedTx an encrypted transaction with the corresponding private key of the Ethereum account. SignedTx string // Transaction represents an Ethereum transaction. Transaction EthereumTransaction }
SignTxOutput for transaction signing responses.
type SlotConnectionData ¶
type SlotConnectionData struct { // Slot to be accessed. Slot string `valid:"required"` // Pin that grants access to the slot. Pin string `valid:"required"` // ModuleKind of the Hardware Security Module. ModuleKind ModuleKind `valid:"in(SoftHSM)"` // ChainID id of the chain. ChainID entities.Int256 `valid:"required"` }
SlotConnectionData configuration to connect to a slot.