Table of Contents
Preview #
About #
GraffitiTOTPProvider is a class that supports the creation and validation of time-based one time passcodes.
Enumerations #
This class exposes no enumerations.
Constants #
This class exposes no constants.
Events #
This class exposes no events.
Methods #
Name | Parameters | Return Type | Description |
---|---|---|---|
Constructor | None | None | Creates a new instance. Note that the Secret property should be populated at some point in order for the class to function as expected. |
Constructor | secret as String | None | Creates a new instance with the secret pre-set. |
Generate | time as DateTime = nil | UInteger | Generates a new code for the time specified. If not time is specified then DateTime.now is used. |
GenerateBackupCodes | count as Integer = 4 | Integer() | Generates a set of backup codes. These should be stored somewhere with user data so that they can be compared if validation fails when the user enters a failing code. |
ToQRCode | user as String service as String width as Integer height as Integer | Picture | Uses Xojo’s built-in Barcode.Image functionality to generate a QR code that the user can scan to add the TOTP credentials to their authenticator app. This does not currently function on Xojo Web as Barcode.Image is not supported, but will require no future changes once it is. |
ToURI | user as String service as String | String | Returns the OTPAUTH:// URI for the secret plus the parameters. May be used with GraffitiQR to display QR codes for authenticator scanning. |
Verify | code as UInteger | Boolean | Checks the code to see if it matches with the one generated for the current timeframe, last timeframe, or the next timeframe. |
Properties #
Name | Type | Default Value | Description |
---|---|---|---|
Secret | String | “” | Secret string used for generation and validation. This should be unique to each user, and will need to be stored to use for verification later. |
Examples #
This class currently has no examples.