Convert TOTP secrets and sensitive strings to BIP39 mnemonic phrases for secure backup.
Sometimes 2FA can be tricky — if all your devices break at once, and you don’t have a backup, logging in on a new device can be a nightmare.
So why not store the TOTP seed (or a short recovery phrase) on an EAL6+ security card (like OneKey Lite) ? These cards are super tough to damage or lose, and make a solid physical backup.
Losing every device at the same time is rare… but hey, I’ve got a spare EAL6+ card lying around, so why not give it a try?
Install:
pnpm i puranaimport { encryptToMnemonicForTOTP, decryptFromMnemonicForTOTP } from 'purana'
const totpSecret = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' // 32 bytes
const mnemonic = encryptToMnemonicForTOTP(totpSecret)
const recovered = decryptFromMnemonicForTOTP(mnemonic)import { encryptToMnemonic, decryptFromMnemonic } from 'purana'
const secret = 'ABCDEFG'
const mnemonic = encryptToMnemonic(secret)
const recovered = decryptFromMnemonic(mnemonic)MIT