How can I create a 4-digit key in Wappler

How can I create a 4-digit key in Wappler

Please provide more details about what are you trying to do.

View this

Use UUID with a substring()

1 Like

Install 🚀 RunJS 1.3.2

Run:

return Math.floor(1000 + Math.random() * 9000);

1 Like

I will be releasing a node wappler server connect extension to do this tomorrow allowing for numeric or alphanumeric codes (inc special characters) and user defined code length.

2 Likes

I use the following, taken from the TIMESTAMP, adjust the substr(0, 4) bit to change the character count:
(TIMESTAMP).sha256("some-random-string-fjDFef ghw5^^48&&*dDSe").substr(0, 4)

2FA code generator for node

1 Like