execsigner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package execsigner is the adapter's `exec` signer transport: a one-shot subprocess per request with a JSON request on stdin and a JSON response on stdout (bytes base64-encoded), suiting air-gap bridges and custom HSM shims (contract: signer-interface.md §Remote signer transports).

Failure contract: the subprocess exits non-zero and prints {"error_code": "...", "detail": "..."} — the error code maps 1:1 onto the kit's typed signer errors. A missing binary, timeout, or kill maps to SIGNER_UNAVAILABLE so withdrawals stay queued.

The bundled reference implementation of the subprocess side is cmd/sovren-exec-signer-demo (backed by the UNSAFE_TEST_ONLY local signer); it doubles as the certification test double for the exec kind.

Index

Constants

View Source
const (
	OpGetPublicKey = "get_public_key"
	OpSign         = "sign"
)

Op values for Request.Op.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Path is the signer binary (from adapter config; never guessed).
	Path string
	// Args are fixed arguments prepended to every invocation.
	Args []string
	// Timeout bounds one subprocess run. Zero means 30s.
	Timeout time.Duration
}

Config configures the exec transport.

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"error_code"`
	Detail    string `json:"detail,omitempty"`
}

ErrorResponse is the JSON document expected on stdout (or stderr) when the subprocess exits non-zero.

type Request

type Request struct {
	Op              string   `json:"op"`
	KeyRef          string   `json:"key_ref"`
	SignMode        string   `json:"sign_mode,omitempty"`
	SignDocBytesB64 string   `json:"sign_doc_bytes_b64,omitempty"`
	Summary         *Summary `json:"summary,omitempty"`
}

Request is the single JSON document written to the subprocess's stdin.

type Response

type Response struct {
	KeyRef                 string `json:"key_ref"`
	Algorithm              string `json:"algorithm,omitempty"`
	PublicKeyCompressedB64 string `json:"public_key_compressed_b64"`
	SignatureB64           string `json:"signature_b64,omitempty"`
}

Response is the single JSON document expected on stdout on success.

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer runs one subprocess per request.

func New

func New(cfg Config) (*Signer, error)

New validates cfg and returns the exec transport.

func (*Signer) GetPublicKey

GetPublicKey implements signer.TransactionSigner.

func (*Signer) Sign

Sign implements signer.TransactionSigner.

type Summary

type Summary struct {
	ChainID          string `json:"chain_id"`
	AccountNumber    string `json:"account_number"`
	Sequence         string `json:"sequence"`
	MessageType      string `json:"message_type"`
	SenderAddress    string `json:"sender_address"`
	RecipientAddress string `json:"recipient_address"`
	AmountBaseUnits  string `json:"amount_base_units"`
	Denom            string `json:"denom"`
	FeeBaseUnits     string `json:"fee_base_units"`
	GasLimit         string `json:"gas_limit"`
	Memo             string `json:"memo"`
}

Summary is the wire form of signer.SigningSummary (snake_case JSON).

func SummaryFrom

func SummaryFrom(s signer.SigningSummary) *Summary

SummaryFrom converts the kit summary to its wire form.

func (*Summary) ToSigningSummary

func (s *Summary) ToSigningSummary() signer.SigningSummary

ToSigningSummary converts the wire form back to the kit summary.

Jump to

Keyboard shortcuts

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