signer

package
v0.0.0-...-f21d47c Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: LGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaymentSigner

type PaymentSigner struct {
	Key *ecdsa.PrivateKey
}

PaymentSigner is used to signed payment messages and holds the ecdsa private key we used

func NewPaymentSigner

func NewPaymentSigner(cfg *config.TemporalConfig) (*PaymentSigner, error)

NewPaymentSigner is used to generate our helper struct for signing payments keyFilePath is the path to a key as generated by geth

func (*PaymentSigner) GenerateSignedPaymentMessagePrefixed

func (ps *PaymentSigner) GenerateSignedPaymentMessagePrefixed(ethAddress common.Address, paymentMethod uint8, paymentNumber, chargeAmountInWei *big.Int) (*SignedMessage, error)

GenerateSignedPaymentMessagePrefixed generates a signed payment message. The format is slightly different and involves generating the hash to sign first, prefixing with `"\x19Ethereum Signed Message:\n32"

type SignedMessage

type SignedMessage struct {
	H             [32]byte       `json:"h"`
	R             [32]byte       `json:"r"`
	S             [32]byte       `json:"s"`
	V             uint8          `json:"v"`
	Address       common.Address `json:"address"`
	PaymentMethod uint8          `json:"payment_method"`
	PaymentNumber *big.Int       `json:"payment_number"`
	ChargeAmount  *big.Int       `json:"charge_amount"`
	Hash          []byte         `json:"hash"`
	Sig           []byte         `json:"sig"`
}

SignedMessage is the response to a message signing request

Jump to

Keyboard shortcuts

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