Documentation ¶
Index ¶
- type App
- type AuthyUser
- type Client
- func (c *Client) CheckOTPToken(authyUserID int64, token string) (bool, error)
- func (c *Client) CreateUser(au AuthyUser) (int64, error)
- func (c *Client) Get(relPath string, resource interface{}) error
- func (c *Client) GetAppInfo() (*ResponseMessage, error)
- func (c *Client) NewRequest(method, relPath string, body interface{}) (*http.Request, error)
- func (c *Client) Post(relPath string, body interface{}, resource interface{}) error
- func (c *Client) RemoveUser(authyUserID int64) error
- func (c *Client) SendOTP(authyUserID int64) (*ResponseMessage, error)
- func (c *Client) SendOTPWithAction(authyUserID int64, action, actionMessage string) (*ResponseMessage, error)
- func (c *Client) UserStatus(authyUserID int64) (*ResponseMessage, error)
- type ResponseMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthyUser ¶
type AuthyUser struct { Email string `url:"user[email],omitempty"` Cellphone string `url:"user[cellphone]"` CountryCode string `url:"user[country_code]"` SendInstallLink bool `url:"send_install_link_via_sms,omitempty"` }
AuthyUser is for use when creating users with Authy API the new user endpoitn expects at lease the cellphone and country code params
type Client ¶
Client for interacting with the Authy API
func (*Client) CheckOTPToken ¶
CheckOTPToken checks with authy API whether the provided token is valid in order to grant access - response can't use standard response message with this endpoint because it returns "true" rather than true for json values - could write a customer UnmarshalJSON for the struct to clean it up this method is really ugly because the authy API sends back different types for true (string) and false (bool) it currently throws an error on unmarshal instead of denying based on the reading of the response
func (*Client) CreateUser ¶
CreateUser creates a user - must provide cellphone number and country code for request to be processed
func (*Client) Get ¶
Get takes a relative path to which it makes a GET request and returns reads the response data into the resource provided
func (*Client) GetAppInfo ¶
func (c *Client) GetAppInfo() (*ResponseMessage, error)
GetAppInfo gets the app info for the provided API secret
func (*Client) NewRequest ¶
NewRequest creates a new request with the given method, path and marshals the given body into url encoded data
func (*Client) RemoveUser ¶
RemoveUser removes a user from Authy API
func (*Client) SendOTP ¶
func (c *Client) SendOTP(authyUserID int64) (*ResponseMessage, error)
SendOTP triggers a OTP to be sent to the user based on their authy ID requires a user to be already added to authy
func (*Client) SendOTPWithAction ¶
func (c *Client) SendOTPWithAction(authyUserID int64, action, actionMessage string) (*ResponseMessage, error)
SendOTPWithAction triggers a OTP to be sent to the user based with a custom message on their authy ID requires a user to be already added to authy https://www.twilio.com/docs/authy/api/one-time-passwords
func (*Client) UserStatus ¶
func (c *Client) UserStatus(authyUserID int64) (*ResponseMessage, error)
UserStatus requests the current status of the provided user ID in the authy API
type ResponseMessage ¶
type ResponseMessage struct { App authyAppInfo `json:"app"` User user `json:"user"` Status status `json:"status"` Device device `json:"device"` Token string `json:"token"` Message string `json:"message"` Success bool `json:"success"` }
ResponseMessage is the wrapper for the data returned by the authy API