Documentation ¶
Overview ¶
Package signature contains the cryptographic signature types.
Index ¶
Constants ¶
const ( // ContextKeySigContext is the key to retrieve the transaction's signature context object from a // context. ContextKeySigContext = contextKey("runtime/signature-context") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface { // Derive derives the chain domain separation context used for signing transactions. Derive() []byte }
Context is the interface used to derive the chain domain separation context.
type HwContext ¶ added in v0.4.0
type HwContext struct { RuntimeID string `json:"runtime_id"` ChainContext string `json:"chain_context"` OrigTo string `json:"orig_to,omitempty"` }
HwContext is ADR 14-compatible struct appropriate for CBOR encoding as Meta component.
func NewHwContext ¶ added in v0.4.0
func NewHwContext(sc *RichContext) *HwContext
NewHwContext creates a new hardware-wallet context from in-memory Context object.
type PublicKey ¶
type PublicKey interface { // String returns a string representation of the public key. String() string // Equal compares vs another public key for equality. Equal(other PublicKey) bool // Verify returns true iff the signature is valid for the public key over the context and // message. Verify(context, message, signature []byte) bool }
PublicKey is a public key.
type RawContext ¶ added in v0.4.0
type RawContext []byte
RawContext is chain domain separation which can be directly used for signing.
func (RawContext) Derive ¶ added in v0.4.0
func (rc RawContext) Derive() []byte
Derive derives the chain domain separation context used for signing transactions.
type RichContext ¶ added in v0.4.0
type RichContext struct { // RuntimeID used for deriving the signature context. RuntimeID common.Namespace // ChainContext used for deriving the signature context. ChainContext string // Base contains chain context separator base. Base []byte // TxDetails contains optional transaction-specific details. TxDetails *TxDetails }
RichContext stores runtime ID, consensus chain context and optional transaction-specific details.
func (*RichContext) Derive ¶ added in v0.4.0
func (sc *RichContext) Derive() []byte
Derive derives the chain domain separation context used for signing transactions.
type Signer ¶
type Signer interface { // Public returns the PublicKey corresponding to the signer. Public() PublicKey // ContextSign generates a signature with the private key over the context and // message. ContextSign(context Context, message []byte) ([]byte, error) // Sign generates a signature with the private key over the message only. Sign(message []byte) ([]byte, error) // String returns the string representation of a Signer, which MUST not // include any sensitive information. String() string // Reset tears down the Signer and obliterates any sensitive state if any. Reset() }
Signer is an opaque interface for private keys that is capable of producing signatures, in the spirit of `crypto.Signer`.