Skip to content

Instantly share code, notes, and snippets.

View flourigh's full-sized avatar
🎯
Focusing

Roberto Monteiro flourigh

🎯
Focusing
View GitHub Profile
@flourigh
flourigh / Authenticator.js
Created July 18, 2024 17:11 — forked from Explosion-Scratch/Authenticator.js
Generates an authenticator token based on a secret key. (Usually given in the QR code that apps have you scan)
async function getToken(key, options) {
let { default: JsSHA } = await import(
"https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/jssha.js"
);
options = {
period: 30,
algorithm: "SHA-1",
digits: 6,
timestamp: Date.now(),
...options,