Skip to content

Instantly share code, notes, and snippets.

Working from home

Ruben Carrascal krrskl

Working from home
View GitHub Profile
hcastillaq / vscode.json
Last active Jan 15, 2020
vscode config con operator mono
View vscode.json
"editor.fontFamily": "Operator Mono SSm Lig Light",
"terminal.integrated.fontFamily": "'Operator Mono SSm Lig Light'",
"editor.fontWeight": "normal",
"editor.fontLigatures": true,
"editor.fontSize": 14.5,
"editor.tabSize": 2,
"editor.tabCompletion": "on",
"workbench.colorTheme": "Monokai",
theanam / otpverify.js
Last active Jan 21, 2021
OTP verification without database, full sample source code
View otpverify.js
const otpGenerator = require("otp-generator");
const crypto = require("crypto");
const key = "verysecretkey"; // Key for cryptograpy. Keep it secret
function createNewOTP(phone){
// Generate a 6 digit numeric OTP
const otp = otpGenerator.generate(6, {alphabets: false, upperCase: false, specialChars: false});
const ttl = 5 * 60 * 1000; //5 Minutes in miliseconds
const expires = + ttl; //timestamp to 5 minutes in the future
const data = `${phone}.${otp}.${expires}`; // phone.otp.expiry_timestamp