Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadRequest = errors.New("bad request") ErrForbidden = errors.New("action not allowed") ErrMethodNotAllowed = errors.New("method not allowed") ErrTooManyRequests = errors.New("too many requests") ErrServer = errors.New("server error") ErrUnknown = errors.New("unknown error") ErrBitStateNotFound = errors.New("bit state not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to use DeviceCheck API.
func New ¶
func New(cred Credential, cfg Config, options ...Option) *Client
New returns a new DeviceCheck API client.
func (*Client) QueryTwoBits ¶
func (client *Client) QueryTwoBits(ctx context.Context, deviceToken string, result *QueryTwoBitsResult) error
QueryTwoBits queries two bits for device token. Returns ErrBitStateNotFound if the bits have not been set.
func (*Client) UpdateTwoBits ¶
UpdateTwoBits updates two bits for device token.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config provides configuration for DeviceCheck API.
func NewConfig ¶
func NewConfig(issuer, keyID string, env Environment) Config
NewConfig returns a new configuration.
type Credential ¶
type Credential interface {
// contains filtered or unexported methods
}
Credential provides credential for DeviceCheck API.
func NewCredentialBytes ¶
func NewCredentialBytes(raw []byte) Credential
NewCredentialBytes returns credential from private key bytes.
func NewCredentialFile ¶
func NewCredentialFile(filename string) Credential
NewCredentialFile returns credential from private key file.
func NewCredentialString ¶
func NewCredentialString(str string) Credential
NewCredentialString returns credential from private key string.
type Environment ¶
type Environment int
Environment specifies DeviceCheck API environment.
const ( // Development specifies Apple's development environment. Development Environment = iota + 1 // Production specifies Apple's production environment. Production )
type Option ¶
type Option func(a *api)
func WithCustomBaseURLs ¶
WithCustomBaseURLs - change base url (this option more priority)
func WithCustomHttpClient ¶
WithCustomHttpClient - set your custom http client
type QueryTwoBitsResult ¶
type QueryTwoBitsResult struct { Bit0 bool `json:"bit0"` Bit1 bool `json:"bit1"` LastUpdateTime Time `json:"last_update_time"` }
QueryTwoBitsResult provides a result of query-two-bits method.