account

package
v1.6.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAdminIfNotExist

func CreateAdminIfNotExist(ctx context.Context) (string, error)

func FetchOrCreateAccountByEthAddress added in v1.1.0

func FetchOrCreateAccountByEthAddress(ctx context.Context, address types.EthAddress) (*models.Account, *models.AccountIdentity, error)

func GetAccountByAccountID

func GetAccountByAccountID(ctx context.Context, accountID types.SFID) (*models.Account, error)

func UpdateAccountPassword

func UpdateAccountPassword(ctx context.Context, accountID types.SFID, r *UpdatePasswordReq) error

func ValidateLoginByEthAddress added in v1.1.0

func ValidateLoginByEthAddress(ctx context.Context, r *LoginByEthAddressReq) (*models.Account, error)

func ValidateLoginByUsername added in v1.1.0

func ValidateLoginByUsername(ctx context.Context, r *LoginByUsernameReq) (*models.Account, error)

Types

type CreateAccountByUsernameReq

type CreateAccountByUsernameReq struct {
	Username  string              `json:"username"`
	Role      enums.AccountRole   `json:"role"`
	AvatarURL string              `json:"avatarURL,omitempty" validate:"@url"`
	Password  string              `json:"-"`
	Source    enums.AccountSource `json:"-"`
}

type CreateAccountByUsernameRsp added in v1.1.0

type CreateAccountByUsernameRsp struct {
	*models.Account
	Password string `json:"password"`
}

type LoginByEthAddressReq added in v1.1.0

type LoginByEthAddressReq struct {
	Message   string `json:"message"`   // Message siwe serialized message
	Signature string `json:"signature"` // Signature should have '0x' prefix
}

type LoginByUsernameReq added in v1.1.0

type LoginByUsernameReq struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginRsp added in v1.1.0

type LoginRsp struct {
	AccountID   types.SFID        `json:"accountID"`
	AccountRole enums.AccountRole `json:"accountRole"`
	Token       string            `json:"token"`
	ExpireAt    types.Timestamp   `json:"expireAt"`
	Issuer      string            `json:"issuer"`
}

type UpdatePasswordReq

type UpdatePasswordReq struct {
	OldPassword string `json:"oldPassword"`
	Password    string `json:"password"`
}

Jump to

Keyboard shortcuts

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