zboxapi

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidJsonResponse = errors.New("zbox-srv: invalid json response")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient() *Client

NewClient create a zbox api client with wallet info

func (*Client) CreateJwtSession

func (c *Client) CreateJwtSession(ctx context.Context, phoneNumber string) (int64, error)

CreateJwtSession create a jwt session with phone number

func (*Client) CreateJwtToken

func (c *Client) CreateJwtToken(ctx context.Context, phoneNumber string, jwtSessionID int64, otp string) (string, error)

CreateJwtToken create a jwt token with jwt session id and otp

func (*Client) GetCsrfToken

func (c *Client) GetCsrfToken(ctx context.Context) (string, error)

GetCsrfToken obtain a fresh csrf token from 0box api server

func (*Client) RefreshJwtToken

func (c *Client) RefreshJwtToken(ctx context.Context, phoneNumber string, token string) (string, error)

RefreshJwtToken refresh jwt token

func (*Client) SetRequest added in v1.8.12

func (c *Client) SetRequest(baseUrl, appType string)

SetRequest set base url and app type of zbox api request

func (*Client) SetWallet

func (c *Client) SetWallet(clientID, clientPrivateKey, clientPublicKey string)

type CsrfTokenResponse

type CsrfTokenResponse struct {
	Token string `json:"csrf_token"`
}

type ErrorResponse

type ErrorResponse struct {
	Error json.RawMessage `json:"error"`
}

type JwtTokenResponse added in v1.8.17

type JwtTokenResponse struct {
	Token string `json:"jwt_token"`
}

Jump to

Keyboard shortcuts

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