authutils

package
v3.1.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

authutils package provides functions for all authentication and singature validation related operations

Index

Constants

View Source
const (
	AllowedBlockChainDifference = 5
)

Variables

This section is empty.

Functions

func CheckIfTokenHasExpired

func CheckIfTokenHasExpired(expiredBlock *big.Int) error

Check if the block number ( date on which the token was issued is not more than 1 month)

func CompareWithLatestBlockNumber

func CompareWithLatestBlockNumber(blockNumberPassed *big.Int) error

Check if the block number passed is not more +- 5 from the latest block number on chain

func CurrentBlock

func CurrentBlock() (*big.Int, error)

Get the current block number from on chain

func GetSignature

func GetSignature(message []byte, privateKey *ecdsa.PrivateKey) (signature []byte)

func GetSignerAddressFromMessage

func GetSignerAddressFromMessage(message, signature []byte) (signer *common.Address, err error)

func VerifyAddress

func VerifyAddress(address common.Address, otherAddress common.Address) error

Check if the payment address/signer passed matches to what is present in the metadata

func VerifySigner

func VerifySigner(message []byte, signature []byte, signer common.Address) error

Verify the signature done by given singer or not returns nil if signer indeed sign the message and singature proves it, if not throws an error

Types

This section is empty.

Jump to

Keyboard shortcuts

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