Skip to content

Convert TOTP secrets and sensitive strings to BIP39 mnemonic phrases for secure backup

License

xn-sakina/purana

Repository files navigation

Purana

Convert TOTP secrets and sensitive strings to BIP39 mnemonic phrases for secure backup.

Motivation

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?

Usage

Install:

  pnpm i purana

TOTP strings (32 bytes)

import { encryptToMnemonicForTOTP, decryptFromMnemonicForTOTP } from 'purana'

const totpSecret = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567' // 32 bytes
const mnemonic = encryptToMnemonicForTOTP(totpSecret)

const recovered = decryptFromMnemonicForTOTP(mnemonic)

Sensitive strings (Less than 32 bytes)

import { encryptToMnemonic, decryptFromMnemonic } from 'purana'

const secret = 'ABCDEFG'
const mnemonic = encryptToMnemonic(secret)

const recovered = decryptFromMnemonic(mnemonic)

License

MIT

About

Convert TOTP secrets and sensitive strings to BIP39 mnemonic phrases for secure backup

Resources

License

Stars

Watchers

Forks

Releases

No releases published