wasm

package
v0.0.0-...-a87b5f3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_date_time = "2006-01-02 15:04:05"
)

global const

Variables

This section is empty.

Functions

func GetRandom

func GetRandom(n int, isNO bool) string

func GetRandomInt

func GetRandomInt(max *big.Int) (int, error)

===================================help function=====================================

func UnInit

func UnInit()

func WebError

func WebError(err error, webErr string) string

Types

type AuthUser

type AuthUser struct {
	ActiveTime  time.Time
	Web3Public  *ecdsa.PublicKey
	SelfPrivate *ecdsa.PrivateKey
}

func GetAuthUser

func GetAuthUser(authID, web3Public, backendKey string) (*AuthUser, error)

func (*AuthUser) GetQrcode

func (p *AuthUser) GetQrcode(authID string) (string, error)

func (*AuthUser) HandleCrypto

func (p *AuthUser) HandleCrypto(action, content string) (ret string, retErr error)

func (*AuthUser) Init

func (p *AuthUser) Init(authID, recoverID string, privateKey *ecdsa.PrivateKey) (string, string, error)

func (*AuthUser) Reset

func (p *AuthUser) Reset(authID, pushID, recoverID, web3Public string) (*AuthUser, error)

type Response

type Response struct {
	Data  interface{}
	Error string
}

func Auth

func Auth(datas ...string) *Response

@request authID: wallet address @request code: code input for dynamic authorization @request kind: kind need verify for dynamic authorization @request params: params need verify for dynamic authorization @response for email verify qrcode for dynamic authorization verify @response for dynamic authorization content encrypted or decrypted by backend key

func Load

func Load(datas ...string) *Response

@request authID wallet address @response backendPublic backend public key @response web3Public wallet account public key

func Recover

func Recover(datas ...string) *Response

Post: /api/user/recover @request authID: wallet address @request pushID: push channel used to recover the backend (email phone number, etc.) @response successed or error

func Register

func Register(datas ...string) *Response

@request authID: wallet address @request recoverID: push channel used to recover the backend (email phone number, etc.) @response recoverID: recovery ID encrypted by backend key @response qrcode: QR code for Google Authenticator scanning to add account @response backendKey: encrypted by backend public key

type Server

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

func Init

func Init() *Server

func (*Server) FatalCheck

func (p *Server) FatalCheck(err error)

func (*Server) GetCache

func (p *Server) GetCache(key string, bDelete bool, beforeDelleteFunc func(v interface{}) bool) interface{}

delete: beforeDelleteFunc return true

func (*Server) GetConf

func (p *Server) GetConf(key string) string

func (*Server) GetVar

func (p *Server) GetVar(key string, bDelete bool, beforeDelleteFunc func(v interface{}) bool) interface{}

delete: beforeDelleteFunc return true

func (*Server) SetCache

func (p *Server) SetCache(key string, val interface{}, bForce bool) error

func (*Server) SetCacheByTime

func (p *Server) SetCacheByTime(key string, val interface{}, bForce bool, timeout time.Duration, callback func(string) bool) error

func (*Server) SetConf

func (p *Server) SetConf(key, val string)

func (*Server) SetVar

func (p *Server) SetVar(key string, val interface{}, bForce bool) error

Jump to

Keyboard shortcuts

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