r/WeirdSideProjects • u/arveliussolutions • 20h ago
We just open-sourced a zero-dependency TypeScript verifier for Telegram Mini App initData (HMAC-SHA256 + 6 tests).
Most Telegram Mini App tutorials use a simple === hash check and skip replay timestamps or positive user ID checks.
So I extracted our standalone TypeScript verifyInitData helper + 6 native node --test unit tests into a small open-source repo for anyone building Telegram Mini Apps on Node.js.
Checks included:
• WebAppData HMAC-SHA256 key derivation.
• crypto.timingSafeEqual comparison.
• Replay timestamp window (-60s to 3600s).
• Positive integer user.id validation.
GitHub (free code + tests):
https://github.com/Arvelius-Agency/telegram-initdata-guard-ts
Happy to answer any questions about Telegram Mini App authentication or replay protection.