unipass_sigverify

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

README

UniPass-sigverify-go

there are two methods you can use to verify signature signed by a eoa accout or UniPass wallet account.

//  Verify ethereum account signature, including EOA account and Contract account.
// - parameter
//  - param ctx
//  - param account: account address.
//  - param message.
//  - param signature.
//  - param isEIP191Prefix boolean: Does the personal hash algorithm use EIP191 prefix.
//                       There are two message prefix for personal hash algorithm during signing:
//                                    - EIP191Prefix: `\x19Ethereum Signed Message:\n`
//                                    - UniPassPrefix: `\x18UniPass Signed Message:\n`
//   - param client: optional param, for contract signature validation
//   - returns signature validation result and error message
func VerifyMessageSignature(
	ctx context.Context,
	account common.Address,
	message, signature []byte,
	isEIP191 bool,
	client *ethclient.Client) (bool, error)


//  Verify typedData signature, including EOA account and Contract account.
// - parameter
//  - param ctx
//  - param account: account address.
//  - param data.
//  - param signature.
//  - param client: optional param, for contract signature validation
//  - returns signature validation result and error message
func VerifyTypedDataSignature(
	ctx context.Context,
	account common.Address,
	data apitypes.TypedData,
	signature []byte,
	client *ethclient.Client) (bool, error)

Documentation

Index

Constants

View Source
const EIP191MessagePrefix = "\x19Ethereum Signed Message:\n"
View Source
const IsValidSignatureABI = "" /* 328-byte string literal not displayed */
View Source
const UnipassMessagePrefix = "\x18UniPass Signed Message:\n"

Variables

View Source
var EIP1271_SELECTOR = [32]byte{22, 38, 186, 126}

0x1626ba7e

Functions

func EIP191HashMessage

func EIP191HashMessage(message []byte) []byte

func UnipassHashMessage

func UnipassHashMessage(message []byte) []byte

func VerifyMessageSignature

func VerifyMessageSignature(
	ctx context.Context,
	account common.Address,
	message, signature []byte,
	isEIP191 bool,
	client *ethclient.Client) (bool, error)
Verify ethereum account signature, including EOA account and Contract account.

- parameter

  • param ctx
  • param account: account address.
  • param message.
  • param signature.
  • param isEIP191Prefix boolean: Does the personal hash algorithm use EIP191 prefix. There are two message prefix for personal hash algorithm during signing:
  • EIP191Prefix: `\x19Ethereum Signed Message:\n`
  • UniPassPrefix: `\x18UniPass Signed Message:\n`
  • param client: optional param, for contract signature validation
  • returns signature validation result and error message

func VerifySignature

func VerifySignature(
	ctx context.Context,
	account common.Address,
	msgHash [32]byte,
	sig []byte,
	client *ethclient.Client) (bool, error)

func VerifyTypedDataSignature

func VerifyTypedDataSignature(
	ctx context.Context,
	account common.Address,
	data apitypes.TypedData,
	signature []byte,
	client *ethclient.Client) (bool, error)
Verify typedData signature, including EOA account and Contract account.

- parameter

  • param ctx
  • param account: account address.
  • param data.
  • param signature.
  • param client: optional param, for contract signature validation
  • returns signature validation result and error message

Types

This section is empty.

Jump to

Keyboard shortcuts

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