Skip to content

jsdev-robin/backup-key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backup-key

Generate, encrypt, and decrypt secure recovery codes for 2FA and authentication systems.

Features

  • Generate random backup/recovery codes.
  • Encrypt and decrypt codes with a password.
  • Format codes with hyphens for readability.
  • Built for 2FA, MFA, and secure authentication workflows.

Installation

npm install backup-key
import { recoveryCodes, decryptCodes, formatCode } from 'backup-key';

// Generate encrypted recovery codes
const encryptedCodes = await recoveryCodes(16, 12, 4, 'myStrongPassword');

// Decrypt codes
const decrypted = await decryptCodes(encryptedCodes, 'myStrongPassword');

// Format a code for display
const formatted = formatCode(decrypted[0]);
console.log(formatted); // e.g., ABCD-EFGH-IJKL

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors