<!doctypehtml><html><meta charset=UTF-8><link rel=icon href=data:><meta content="width=device-width"name=viewport><title>TOTP</title><style>*{background:#000;color:#555;font:1.1em mono;text-align:center;border:0;outline:0}body{margin:10vw}</style><input id=s placeholder=secret><p id=t><p id=e><p id=n><script>let b=s=>[...s.toUpperCase()].reduce((n,c)=>n+('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.indexOf(c)>>>0).toString(2).padStart(5,0),'').match(/.{1,4}/g).reduce((h,n)=>h+parseInt(n,2).toString(16),''),g=async(s,t=Date.now())=>{let h=await crypto.subtle.sign('HMAC',await crypto.subtle.importKey('raw',Uint8Array.from(b(s).match(/.{2}/g).map(x=>parseInt(x,16))),{name:'HMAC',hash:'SHA-1'},!1,['sign']),Uint8Array.from(((t/3e4)|0).toString(16).padStart(16,0).match(/.{2}/g).map(x=>parseInt(x,16)))),d=new Uint8Array(h),o=d[19]&15,v=(d[o]&127)<<24|(d[o+1]&255)<<16|(d[o+2]&255)<<8|d[o+3]&255;return(v+'').slice(-6)};setInterval(async()=>{t.textContent=s.value?await g(s.value):'_';e.textContent=30-Date.now()/1e3%30|0;n.textContent='Next: '+(s.value?await g(s.value,Date.now()+3e4):'_')},1e3)</script></body></html>
This is a very simple TOTP Generator that can generate correctly TOTP code and next TOTP code, no third-lib no php, based on browser crypto api, just save this html file, you can self-hosting in your github/codeberg/cloudflare page or use in local
i found this code in some repo in codeberg, and i think this is better than Aegis or Ente Auth, because this is so small and you can easy to self-hosting, and manual to input the TOTP Secret Key to generate TOTP Code
the only drawback is that it cant save the Secret Key, you need manual to stroage every Secret Key to some file or other something, for me i stroage all Secret Key in a file over in Veracrypt container, so that’s okay for most people i think