Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TOTP ¶
type TOTP struct { Digits int // Number of digits for code. Defaults to 6. Period int // Number of seconds for each code. Defaults to 30. // contains filtered or unexported fields }
Time-based One Time Password
func (*TOTP) FromNow ¶
Return the Time Based One Time Password for the time-period that is Now + the given periods. This is useful if you want to provide some flexibility around the acceptance of codes. For instance, you might want to accept a code that is valid in the current period (FromNow(0)), or that was valid in the previous period (FromNow(-1)) or that will be valid in the next period (FromNow(1)). This means that every code is therefore valid for 3 * totp.Period.
func (*TOTP) QRCodeData ¶
Return the data to be contained in a QR Code for this TOTP with the given label.
func (*TOTP) QRCodeGoogleChartsUrl ¶
Return a URL to generate a QRCode on Google Charts for the TOTP, with the given label and width (and height equal to width).