server

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: 28 Imported by: 0

Documentation

Index

Constants

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

	C_Url_host = "https://selfrscrypto.refitor.com"
)

global const

View Source
const (
	C_Store_User = "user"
)

Variables

View Source
var (
	UserSaveToStore  func(key string, val any) error
	UserGetFromStore func(key string, ptrObject any) error
)
View Source
var (
	WebauthnSaveToStore  func(key, encryptKey string, val any) error
	WebauthnGetFromStore func(key, decryptKey string, ptrObject any) error
)
View Source
var (
	DBPath = flag.String("dbpath", "./selfweb3.db", "--dbPath=./selfweb3.db")
)

flag

Functions

func FatalCheck

func FatalCheck(err error)

func InitWebAuthn

func InitWebAuthn(rpOrigin string) error

func NewWebauthnUser

func NewWebauthnUser(name string, displayName string) *webauthnUser

NewUser creates and returns a new User

func RouterHook

func RouterHook(router *httprouter.Router, method string, path string, handleFunc http.HandlerFunc, hookFuncs ...func(w http.ResponseWriter, r *http.Request) bool)

func RouterInit

func RouterInit(router *httprouter.Router)

func Run

func Run(ctx context.Context, fs *embed.FS)

func SendEmailToUser

func SendEmailToUser(title, email, content string) error

func Str

func Str(data any) string

func UserAfterWebAuthnLogin

func UserAfterWebAuthnLogin()

func UserAuthVerify

func UserAuthVerify(w http.ResponseWriter, r *http.Request)

func UserBindWallet

func UserBindWallet(oldWallet, newWallet string) error

func UserLoadWeb2Data

func UserLoadWeb2Data(userID, webPublic, params string) (any, error)

func UserSessionCheck

func UserSessionCheck(w http.ResponseWriter, r *http.Request) bool

func UserStoreWeb2Data

func UserStoreWeb2Data(userID, recoverID, encryptWeb2Data string) error

func UserVerify

func UserVerify(w http.ResponseWriter, r *http.Request) bool

func WauthnBeginLogin

func WauthnBeginLogin(username, webAuthnKey string) (interface{}, error, string)

func WauthnBeginRegister

func WauthnBeginRegister(username string) (interface{}, error, string)

webauthn handler

func WauthnClean

func WauthnClean(username string)

func WauthnFinishLogin

func WauthnFinishLogin(username string, bufReader io.Reader) (interface{}, error, string)

func WauthnFinishRegister

func WauthnFinishRegister(username, webAuthnKey string, bufReader io.Reader) (*webauthnUser, error, string)

func WebAuthnBeginLogin

func WebAuthnBeginLogin(w http.ResponseWriter, r *http.Request)

func WebAuthnBeginRegister

func WebAuthnBeginRegister(w http.ResponseWriter, r *http.Request)

====== webauthn ======

func WebAuthnFinishLogin

func WebAuthnFinishLogin(w http.ResponseWriter, r *http.Request)

func WebAuthnFinishRegister

func WebAuthnFinishRegister(w http.ResponseWriter, r *http.Request)

Types

type Meta

type Meta struct {
	EncryptedPrivateKey string `json:"private"`
}

type User

type User struct {
	pkg.Web2Data

	Web2Key      []byte
	Web2Nonce    int64
	RecoverID    []byte
	WebauthnUser []byte
}

func CreateUser

func CreateUser(userID string) (*User, error)

func GetUser

func GetUser(username string) *User

type Worker

type Worker struct {
	WebPublic *ecdsa.PublicKey
	// contains filtered or unexported fields
}

func (*Worker) Init

func (p *Worker) Init()

func (*Worker) UnInit

func (p *Worker) UnInit()

Jump to

Keyboard shortcuts

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