Documentation
¶
Overview ¶
Package signer defines the kit's external signing boundary — the single interface between transaction construction and key material (FR-012, FR-021, FR-061). Contract: specs/008-exchange-integration-kit/contracts/signer-interface.md.
Index ¶
Constants ¶
const ( CodeKeyNotFound = "KEY_NOT_FOUND" CodeSummaryMismatch = "SUMMARY_MISMATCH" CodePolicyRejected = "POLICY_REJECTED" CodeInternal = "INTERNAL" )
Error codes (contract semantics §4). Remote transports map these 1:1.
const ( // SignModeDirect is the only supported sign mode in v1 (R4). SignModeDirect = "SIGN_MODE_DIRECT" // AlgorithmSecp256k1 is the only supported key algorithm. AlgorithmSecp256k1 = "secp256k1" // MsgTypeBankSend is the only message type a v1 sign doc may carry. MsgTypeBankSend = "/cosmos.bank.v1beta1.MsgSend" // DenomUsovr is the only settlement denom in v1. DenomUsovr = "usovr" )
Variables ¶
var ( ErrKeyNotFound = &Error{Code: CodeKeyNotFound} ErrSummaryMismatch = &Error{Code: CodeSummaryMismatch} ErrPolicyRejected = &Error{Code: CodePolicyRejected} ErrInternal = &Error{Code: CodeInternal} )
Functions ¶
Types ¶
type Error ¶
Error is a typed signer error. Two Errors match under errors.Is when their codes are equal, so detail-carrying instances match the sentinels below.
type PublicKeyRequest ¶
type PublicKeyRequest struct {
KeyRef string
}
PublicKeyRequest identifies a key by an opaque exchange-side handle.
type PublicKeyResponse ¶
type SigningRequest ¶
type SigningRequest struct {
KeyRef string
SignMode string // SignModeDirect
SignDocBytes []byte
Summary SigningSummary
}
SigningRequest carries the exact ADR-020 SignDoc protobuf bytes to hash+sign. SignDocBytes is authoritative; Summary exists for display and cross-checking only — production signers must decode SignDocBytes and policy-check the decoded contents.
type SigningResponse ¶
type SigningSummary ¶
type SigningSummary struct {
ChainID string
AccountNumber string
Sequence string
MessageType string // MsgTypeBankSend
SenderAddress string
RecipientAddress string
AmountBaseUnits string // integer usovr string
Denom string // DenomUsovr
FeeBaseUnits string
GasLimit string
Memo string
}
SigningSummary is derived from SignDocBytes by the tx builder; signers may independently re-derive and must be able to reject on mismatch. All numeric fields are base-10 integer strings.
type TransactionSigner ¶
type TransactionSigner interface {
GetPublicKey(ctx context.Context, req PublicKeyRequest) (PublicKeyResponse, error)
Sign(ctx context.Context, req SigningRequest) (SigningResponse, error)
}
TransactionSigner is implemented by every signing backend (local test signer, remote transports). Signing is stateless: chain ID, account number, and sequence travel inside SignDocBytes, so no node connectivity is needed.
Directories
¶
| Path | Synopsis |
|---|---|
|
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).
|
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). |
|
Package grpcremote is the adapter's `grpc-remote` signer transport: a signer.TransactionSigner client for the sovren.signer.v1.SignerService an exchange's signing system implements (contract: signer-interface.md §Remote signer transports).
|
Package grpcremote is the adapter's `grpc-remote` signer transport: a signer.TransactionSigner client for the sovren.signer.v1.SignerService an exchange's signing system implements (contract: signer-interface.md §Remote signer transports). |
|
Package local is the in-memory secp256k1 TransactionSigner (adapter kind "unsafe-local").
|
Package local is the in-memory secp256k1 TransactionSigner (adapter kind "unsafe-local"). |