signature

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 8 Imported by: 4

Documentation

Overview

Package signature provides functionality for interacting with the X-Flashbots-Signature header.

Index

Constants

View Source
const HTTPHeader = "X-Flashbots-Signature"

HTTPHeader is the name of the X-Flashbots-Signature header.

Variables

View Source
var (
	ErrNoSignature      = errors.New("no signature provided")
	ErrInvalidSignature = errors.New("invalid signature provided")
)

Functions

func Verify

func Verify(header string, body []byte) (common.Address, error)

Verify takes a X-Flashbots-Signature header and a body and verifies that the signature is valid for the body. It returns the signing address if the signature is valid or an error if the signature is invalid.

Types

type Signer added in v0.8.2

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

func NewRandomSigner added in v0.8.2

func NewRandomSigner() (*Signer, error)

func NewSigner added in v0.8.2

func NewSigner(privateKey *ecdsa.PrivateKey) Signer

func NewSignerFromHexPrivateKey added in v0.8.2

func NewSignerFromHexPrivateKey(hexPrivateKey string) (*Signer, error)

NewSignerFromHexPrivateKey creates new signer from 0x-prefixed hex-encoded private key

func (*Signer) Address added in v0.8.2

func (s *Signer) Address() common.Address

func (*Signer) Create added in v0.8.2

func (s *Signer) Create(body []byte) (string, error)

Create takes a body and a private key and returns a X-Flashbots-Signature header value. The header value can be included in a HTTP request to sign the body.

Jump to

Keyboard shortcuts

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