RecoveryCodes

One-time backup codes, blurred until revealed. Copy or download them in one press; Continue unlocks only after the person confirms they stored them. Auth.

Open playground

Your recovery codes

Each code works once if you lose your device. Keep them somewhere only you can reach.

Reveal the codes to continue.

About

RecoveryCodes is a React component in the Auth category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { RecoveryCodes } from "@ashutoshswamy/smoui" and set codes, onConfirm, filename.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { RecoveryCodes } from "@ashutoshswamy/smoui";

<RecoveryCodes codes={["7k2f-9qxa", "m3vd-81lp", "c9tz-4hre", "w5ns-d20b"]} onConfirm={() => api.enableTwoFactor()} />

Props 3

codes

The codes to show.

string[]
onConfirm

Runs on Continue. A promise shows a busy state.

() => void | Promise<unknown>
filename

Name of the downloaded file. Default recovery-codes.txt.

string