authutils

package
v5.1.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package authutils provides functions for all authentication and signature validation related operations

Index

Constants

View Source
const (
	AllowedBlockChainDifference = 5
)

Variables

This section is empty.

Functions

func CheckIfTokenHasExpired

func CheckIfTokenHasExpired(expiredBlock *big.Int) error

CheckIfTokenHasExpired 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

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

func CurrentBlock

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

CurrentBlock 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

VerifyAddress 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

VerifySigner Verify the signature done by given singer or not returns nil if signer indeed sign the message and signature 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