GraffitiTOTPProvider

View Categories

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 #

NameParametersReturn TypeDescription
ConstructorNoneNoneCreates a new instance. Note that the Secret property should be populated at some point in order for the class to function as expected.
Constructorsecret as StringNoneCreates a new instance with the secret pre-set.
Generatetime as DateTime = nilUIntegerGenerates a new code for the time specified. If not time is specified then DateTime.now is used.
GenerateBackupCodescount as Integer = 4Integer()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.
ToQRCodeuser as String
service as String
width as Integer
height as Integer
PictureUses 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.
ToURIuser as String
service as String
StringReturns the OTPAUTH:// URI for the secret plus the parameters. May be used with GraffitiQR to display QR codes for authenticator scanning.
Verifycode as UIntegerBooleanChecks the code to see if it matches with the one generated for the current timeframe, last timeframe, or the next timeframe.

Properties #

NameTypeDefault ValueDescription
SecretString“”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.