sign

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BitcoinSignature added in v1.2.0

func BitcoinSignature(data []byte, hexPrivateKey string, compress bool, segwitType SegwitType) ([]byte, error)

func DoEIP712Sign added in v1.2.0

func DoEIP712Sign(chainId int64, signMsg, private string, mmJsonObj *common.MMJsonObj) (string, error)

func DogeSignature added in v1.0.1

func DogeSignature(data []byte, hexPrivateKey string, compress bool) ([]byte, error)

func EIP712Signature

func EIP712Signature(typedData apitypes.TypedData, hexPrivateKey string) ([]byte, []byte, error)

func Ed25519Signature

func Ed25519Signature(privateKey, message []byte) []byte

func EthSignature

func EthSignature(data []byte, hexPrivateKey string) ([]byte, error)

func GenerateAddressByArgs

func GenerateAddressByArgs(net common.DasNetType, args string) (string, error)

func GetSignedPubKey

func GetSignedPubKey(rawByte []byte, sign []byte) (*ecdsa.PublicKey, error)

func PersonalSignature

func PersonalSignature(data []byte, hexPrivateKey string) ([]byte, error)

func TronSignature

func TronSignature(signType bool, data []byte, hexPrivateKey string) ([]byte, error)

func TronVerifySignature

func TronVerifySignature(signType bool, sign []byte, rawByte []byte, base58Addr string) bool

func VerifyBitcoinSignature added in v1.2.0

func VerifyBitcoinSignature(sig []byte, data []byte, payload string) (bool, error)

func VerifyDogeSignature added in v1.0.1

func VerifyDogeSignature(sig []byte, data []byte, payload string) (bool, error)

func VerifyEIP712Signature

func VerifyEIP712Signature(typedData apitypes.TypedData, sign []byte, address string) (bool, error)

func VerifyEcdsaP256Signature added in v1.1.0

func VerifyEcdsaP256Signature(hash []byte, R, S *big.Int, pubkey *ecdsa.PublicKey) (res bool, err error)

func VerifyEd25519Signature

func VerifyEd25519Signature(publicKey, message, sig []byte) bool

func VerifyEthSignature

func VerifyEthSignature(sign []byte, rawByte []byte, address string) (bool, error)

func VerifyPersonalSignature

func VerifyPersonalSignature(sign []byte, rawByte []byte, address string) (bool, error)

func VerifyWebauthnSignature added in v1.1.0

func VerifyWebauthnSignature(challenge, dataBys []byte, signAddressPk1 string) (res bool, err error)

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, apiUrl string) (*Client, error)

func (*Client) Client

func (c *Client) Client() rpc.Client

func (*Client) SignCkbMessage

func (c *Client) SignCkbMessage(ckbSignerAddress, message string) ([]byte, error)

type ClientDataJson added in v1.1.0

type ClientDataJson struct {
	Type        string `json:"type"`
	Challenge   string `json:"challenge"`
	Origin      string `json:"origin"`
	CrossOrigin string `json:"croosOrigin"`
}

type HandleSignCkbMessage

type HandleSignCkbMessage func(message string) ([]byte, error)

func LocalSign

func LocalSign(privateKey string) HandleSignCkbMessage

func RemoteSign

func RemoteSign(c *Client, net common.DasNetType, args string) HandleSignCkbMessage

func RemoteSignNew added in v1.0.1

func RemoteSignNew(c *Client, addr string) HandleSignCkbMessage

type SegwitType added in v1.0.1

type SegwitType int
const (
	P2WPKH SegwitType = iota
	P2SH_P2WPKH
	P2PKH SegwitType = 255
)

type SignatureInfo added in v1.0.1

type SignatureInfo struct {
	Compressed bool
	SegwitType *SegwitType
	Recovery   int
	Signature  []byte
}

func DecodeSignature added in v1.0.1

func DecodeSignature(buffer []byte) (*SignatureInfo, error)

func (*SignatureInfo) ToSig added in v1.0.1

func (s *SignatureInfo) ToSig() []byte

Jump to

Keyboard shortcuts

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