helium_crypto

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NETTYPE_MAIN byte = 0x00
	NETTYPE_TEST byte = 0x10

	KEYTYPE_SECP256K1   byte = 0x03
	KEYTYPE_MULTISIG    byte = 0x02
	KEYTYPE_ED25519     byte = 0x01
	KEYTYPE_ECC_COMPACT byte = 0x00
)

Variables

This section is empty.

Functions

func SignRequest

func SignRequest[T SignedTimestampedRequest](req T, keypair *KeyPair) T

func SignRequestNoTimestamp

func SignRequestNoTimestamp[T SignedRequest](req T, keypair *KeyPair) T

func VerifyRequest

func VerifyRequest[T SignedTimestampedRequest](req T, keypair *KeyPair) bool

Types

type KeyPair

type KeyPair struct {
	NetType    byte
	KeyType    byte
	PublicKey  []byte
	PrivateKey []byte
}

func KeyPairFromBytes

func KeyPairFromBytes(input []byte) (*KeyPair, error)

func KeyPairFromString

func KeyPairFromString(input string) (*KeyPair, error)

func KeyPairGenerate

func KeyPairGenerate(networkType byte, keyType byte) *KeyPair

func (*KeyPair) Bytes

func (k *KeyPair) Bytes() []byte

func (*KeyPair) Public

func (k *KeyPair) Public() *KeyPair

func (*KeyPair) Sign

func (k *KeyPair) Sign(message []byte) []byte

func (*KeyPair) String

func (k *KeyPair) String() string

func (*KeyPair) Verify

func (k *KeyPair) Verify(message []byte, signature []byte) bool

type SignedRequest

type SignedRequest interface {
	proto.Message
	GetSignature() []byte
	GetSigner() []byte
}

type SignedTimestampedRequest

type SignedTimestampedRequest interface {
	SignedRequest
	GetTimestamp() uint64
}

Jump to

Keyboard shortcuts

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