4 ms·
It’s definitely a fairly trivial implementation, here’s one of a few dozen lines of (not very clean) Swift: https://github.com/JustAman62/ovault/blob/7ee38b7e5c
by deltaknight 2y ago
It’s definitely a fairly trivial implementation, here’s one of a few dozen lines of (not very clean) Swift: https://github.com/JustAman62/ovault/blob/7ee38b7e5c2666cd34994343d8dd9d322c372f6f/Models/Otp%2BOTP.swift#L30 https://github.com/JustAman62/ovault/blob/7ee38b7e5c2666cd34...
The simplicity of the implementation makes a test suite even more valuable, as it’s really quite hard to figure out if your implementation is correct.
- edent 2y agoAs part of writing the test suite, I also wrote an implementation in JavaScript. It uses the Web Crypto API rather than external libraries. https://shkspr.mobi/blog/2025/03/using-the-web-crypto-api-to-generate-totp-codes-in-javascript-without-3rd-party-libraries/ https://shkspr.mobi/blog/2025/03/using-the-web-crypto-api-to...