wasm

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FatalCheck

func FatalCheck(err error)

func GetCache

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

delete: beforeDelleteFunc return true

func LogDebugf

func LogDebugf(format string, datas ...interface{})

func LogDebugln

func LogDebugln(datas ...interface{})

func SetCache

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

func SetCacheByTime

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

func Str

func Str(data any) string

func Web2DataInit

func Web2DataInit(wd2 *pkg.Web2Data, user *User, selfKey []byte) *pkg.Web2Data

func Web2DecryptWebAuthnKey

func Web2DecryptWebAuthnKey(user *User, selfKey []byte) (string, error)

func Web2EncryptWeb2Data

func Web2EncryptWeb2Data(wd2 *pkg.Web2Data) (string, error)

func WebError

func WebError(err error, webErr string) string

Types

type Response

type Response struct {
	Data  interface{}
	Error string
}

func WasmAuthorizeCode

func WasmAuthorizeCode(datas ...string) *Response

@request userID: unique user ID @request authorizedID: ID used for dynamic authorization, such as email address, mobile phone number, etc @response successed or error

func WasmHandle

func WasmHandle(datas ...string) *Response

@request userID: wallet address @request params: Optional, specific business parameters for the next step of the process after dynamic authorization is successful @response business data or error

func WasmInit

func WasmInit(datas ...string) *Response

@request userID unique user ID @request selfPass selfPass input by user @request web2NetPublic we2 network publicKey @request web2Datas web2 response params @response successed or error

func WasmPublic

func WasmPublic(datas ...string) *Response

@response publicKey

func WasmRegister

func WasmRegister(datas ...string) *Response

@request userID unique user ID @request recoverID: Unique ID for social recovery, such as email address, mobile phone number, etc @response web3User or error

func WasmStatus added in v1.0.1

func WasmStatus(datas ...string) *Response

@request userID unique user ID @response user status or error

func WasmVerify

func WasmVerify(datas ...string) *Response

@request userID: wallet address @request kind: kind need verify for dynamic authorization, such as TOTP, email, etc. @request code: Verification code for dynamic authorization, such as TOTP, email, mobile phone verification codes, etc @request params: Optional, specific business parameters for the next step of the process after dynamic authorization is successful @response business data or error

type SelfData

type SelfData struct {
	pkg.Web2Data
}

type User

type User struct {
	SelfData *SelfData

	SelfKey3     string
	RecoverID3   string
	SelfPrivate3 string

	// init by NewUser
	Web2PublicKey *ecdsa.PublicKey
	Web3PublicKey *ecdsa.PublicKey

	RelateTimes        int
	RelateVerifyParams [][]byte
}

func GetUser

func GetUser(userID string) *User

func NewUser

func NewUser(userID string, sd *pkg.Web2Data) (*User, error)

func (*User) GetTOTPKey

func (p *User) GetTOTPKey(selfPrivate *ecdsa.PrivateKey) (string, error)

func (*User) HandleAssociatedVerify

func (p *User) HandleAssociatedVerify(action, relateTimes string, selfPrivate *ecdsa.PrivateKey) (any, error)

func (*User) InitTOTPKey

func (p *User) InitTOTPKey(selfPrivate *ecdsa.PrivateKey) (string, []byte, error)

func (*User) InitWeb3User

func (p *User) InitWeb3User(recoverID string, wd2 *pkg.Web2Data) (*Web3User, string, *ecdsa.PrivateKey, error)

func (*User) Load

func (p *User) Load() ([]byte, *ecdsa.PrivateKey, error)

func (*User) PackSigAndMerkleLeaves

func (p *User) PackSigAndMerkleLeaves(action string, selfPrivate *ecdsa.PrivateKey) (any, error)

func (*User) Register

func (p *User) Register(recoverID string) (*Web3User, error)

func (*User) ResetSelfKey

func (p *User) ResetSelfKey(kind, random, web2Key string, selfPrivate *ecdsa.PrivateKey) (any, error)

func (*User) ResetTOTPKey

func (p *User) ResetTOTPKey(recoverID, encryptedRecoverID string, selfPrivate *ecdsa.PrivateKey) (any, error)

func (*User) VerifyTOTP

func (p *User) VerifyTOTP(code string) error

type Web3User

type Web3User struct {
	QRCode      string
	Web2Data    string
	SelfAddress string

	SelfKey     string
	RecoverID   string
	SelfPrivate string
}

type Worker

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

func Init

func Init() *Worker

Jump to

Keyboard shortcuts

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