Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HTTPClient *http.Client = nil
Package variable used to override the http client used for communication with Yubico. If nil the standard http.Client will be used - if overriding you need to ensure the transport options are set.
Functions ¶
Types ¶
type YubiAuth ¶
type YubiAuth struct {
// contains filtered or unexported fields
}
func NewYubiAuth ¶
Create a yubiAuth instance with given API-id and API-key. Returns an error when the key could not be base64 decoded. To use yubigo with the Yubico Web Service (default api servers), create an API id+key here: https://upgrade.yubico.com/getapikey/ Debugging is disabled. For debugging: use NewYubiAuthDebug(..)
func NewYubiAuthDebug ¶
Create a yubiAuth instance for given API-id and API-key. Has third parameter `debug`. When debug is true this YubiAuth instance will spam the console with logging messages. Returns an error when the key could not be base64 decoded. To use yubigo with the Yubico Web Service (default api servers), create an API id+key here: https://upgrade.yubico.com/getapikey/
func (*YubiAuth) GetApiServerList ¶
Retrieve the the ist of servers that are being used for verification.
func (*YubiAuth) HttpsVerifyCertificate ¶
Enable or disable https certificate verification Disable this at your own risk.
func (*YubiAuth) SetApiServerList ¶
Use this method to specify a list of servers for verification. Each server string should contain host + path. Example: "api.yubico.com/wsapi/2.0/verify".
func (*YubiAuth) Verify ¶
func (ya *YubiAuth) Verify(otp string) (yr *YubiResponse, ok bool, err error)
The verify method calls the API with given OTP and returns if the OTP is valid or not. This method will return an error if something unexpected happens If no error was returned, the returned 'ok bool' indicates if the OTP is valid if the 'ok bool' is true, additional informtion can be found in the returned YubiResponse object
type YubiResponse ¶
type YubiResponse struct {
// contains filtered or unexported fields
}
Contains details about yubikey OTP verification.
func (*YubiResponse) GetRequestQuery ¶
func (yr *YubiResponse) GetRequestQuery() string
Get the requestQuery that was used during verification.
func (*YubiResponse) GetResultParameter ¶
func (yr *YubiResponse) GetResultParameter(key string) (value string)
Retrieve a parameter from the api's response
func (*YubiResponse) IsValidOTP ¶
func (yr *YubiResponse) IsValidOTP() bool
Returns wether the verification was successful