Server Connect Custom Module (node) Generate 2FA style code

Generate 2FA codes and more with this node server connect extension

Generate 2FA allows for the creating of numeric and alphanumeric codes (inc. option special characters), optional repeats of characters and user definable code length.

Firstly download and install the extension from the NPM repository as per these instructions

Restart Wappler fully and a new icon will be available under "Core Actions"

The interface for this component consists of 3 parameters

image

Name
Firstly name your component, this is the name of the response used in the JSON response from the module

I call it "code2fa"

image

Salt
The salt property defines the characters which will be used to construct the code

For numeric, for example use "0123456789"

Salts may also be alphanumeric such as "ADCDEFG1233456", include special characters such as "ABC123$£&" and can contain mixed case such as "ABCDabcd"

Number of Repeats
This allows the re-use of characters up to the defined limit within the code.
For example a salt of "1234" with repeats set to 2 may return duplicate charaters such as "4124" or even "4411"

Length of Code
This defines the length of the returned code.

image

A sample output using the above settings would be:

{"code2fa":"70709365"}

NOTE: if the code length is set to a length which exceeds the maximum possible characters defined from the salt and repeats then the code will be truncated to the max size possible.

For example a salt of "AB" with 2 repeats max can only produce 4 characters so specifying code length of 6 would simply return a 4 digit code

5 Likes

Thanks Brian!!
:beer:

1 Like

Very useful, great job :beers:

1 Like

Great stuff Brian. This will be very handy indeed.

1 Like