auth

package
v0.0.0-...-0b06f50 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: BSD-3-Clause Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const (
	SignerTypeEd25519   = "ed25519"
	SignerTypeSecp256k1 = "secp256k1"
	SignerTypeYubiHsm   = "yubihsm"
	SignerTypeTron      = "tron"
)

Variables

This section is empty.

Functions

func GetTxHash

func GetTxHash(_ []byte) ([]byte, error)

Types

type BinanceSigner

type BinanceSigner struct {
	PrivateKey *ecdsa.PrivateKey
}

func NewBinanceSigner

func NewBinanceSigner(privateKey []byte) *BinanceSigner

func (*BinanceSigner) PublicKey

func (k *BinanceSigner) PublicKey() []byte

func (*BinanceSigner) Sign

func (k *BinanceSigner) Sign(_ []byte) []byte

type Ed25519Signer

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

Ed25519Signer implements the Signer interface using ed25519 keys.

func NewEd25519Signer

func NewEd25519Signer(privateKey []byte) *Ed25519Signer

func (*Ed25519Signer) PublicKey

func (s *Ed25519Signer) PublicKey() []byte

func (*Ed25519Signer) Sign

func (s *Ed25519Signer) Sign(msg []byte) []byte

type EthSigner66Byte

type EthSigner66Byte struct {
	PrivateKey *ecdsa.PrivateKey
}

func (*EthSigner66Byte) PublicKey

func (k *EthSigner66Byte) PublicKey() []byte

func (*EthSigner66Byte) Sign

func (k *EthSigner66Byte) Sign(_ []byte) []byte

type NonceTx

type NonceTx struct {
	Inner                []byte   `protobuf:"bytes,1,opt,name=inner,proto3" json:"inner,omitempty"`
	Sequence             uint64   `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*NonceTx) Descriptor

func (*NonceTx) Descriptor() ([]byte, []int)

func (*NonceTx) GetInner

func (m *NonceTx) GetInner() []byte

func (*NonceTx) GetSequence

func (m *NonceTx) GetSequence() uint64

func (*NonceTx) ProtoMessage

func (*NonceTx) ProtoMessage()

func (*NonceTx) Reset

func (m *NonceTx) Reset()

func (*NonceTx) String

func (m *NonceTx) String() string

func (*NonceTx) XXX_DiscardUnknown

func (m *NonceTx) XXX_DiscardUnknown()

func (*NonceTx) XXX_Marshal

func (m *NonceTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NonceTx) XXX_Merge

func (dst *NonceTx) XXX_Merge(src proto.Message)

func (*NonceTx) XXX_Size

func (m *NonceTx) XXX_Size() int

func (*NonceTx) XXX_Unmarshal

func (m *NonceTx) XXX_Unmarshal(b []byte) error

type SignedTx

type SignedTx struct {
	Inner                []byte   `protobuf:"bytes,1,opt,name=inner,proto3" json:"inner,omitempty"`
	Signature            []byte   `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	PublicKey            []byte   `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func SignTx

func SignTx(signer Signer, txBytes []byte) *SignedTx

SignTx generates a signed tx containing the given bytes.

func (*SignedTx) Descriptor

func (*SignedTx) Descriptor() ([]byte, []int)

func (*SignedTx) GetInner

func (m *SignedTx) GetInner() []byte

func (*SignedTx) GetPublicKey

func (m *SignedTx) GetPublicKey() []byte

func (*SignedTx) GetSignature

func (m *SignedTx) GetSignature() []byte

func (*SignedTx) ProtoMessage

func (*SignedTx) ProtoMessage()

func (*SignedTx) Reset

func (m *SignedTx) Reset()

func (*SignedTx) String

func (m *SignedTx) String() string

func (*SignedTx) XXX_DiscardUnknown

func (m *SignedTx) XXX_DiscardUnknown()

func (*SignedTx) XXX_Marshal

func (m *SignedTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignedTx) XXX_Merge

func (dst *SignedTx) XXX_Merge(src proto.Message)

func (*SignedTx) XXX_Size

func (m *SignedTx) XXX_Size() int

func (*SignedTx) XXX_Unmarshal

func (m *SignedTx) XXX_Unmarshal(b []byte) error

type Signer

type Signer interface {
	Sign(msg []byte) []byte
	PublicKey() []byte
}

Signer interface is used to sign transactions.

func NewSecp256k1Signer

func NewSecp256k1Signer(_ []byte) Signer

func NewSigner

func NewSigner(signerType string, privKey interface{}) Signer

type TronSigner

type TronSigner struct {
	PrivateKey *ecdsa.PrivateKey
}

func NewTronSigner

func NewTronSigner(privateKey []byte) *TronSigner

func (*TronSigner) PublicKey

func (k *TronSigner) PublicKey() []byte

func (*TronSigner) Sign

func (k *TronSigner) Sign(_ []byte) []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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