Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wallet-manager

Secure wallet management utilities with encrypted private key and mnemonic storage.

Features

  • AES-256-CBC encryption compatible with OpenSSL
  • HD wallet generation with encrypted mnemonic storage
  • Private key encryption for secure .env storage
  • Password-protected decryption using hidden input (getpass)

Installation

npm install

CLI Usage

Encrypt a private key

node wallet_manager.mjs encrypt-private-key
# Enter private key to encrypt (hidden): [paste your key]
# Enter encryption password: [hidden]
# Enter password again: [hidden]

Encrypt arbitrary text

node wallet_manager.mjs encrypt-text
# Enter text to encrypt (hidden): [type/paste]
# Enter encryption password: [hidden]
# Enter password again: [hidden]

Decrypt text

node wallet_manager.mjs decrypt-text <encrypted_text> <salt_base64>
# Enter the decryption password: [hidden]

Generate HD wallet

node wallet_manager.mjs make-hdwallet [derivation_index]
# Enter the password: [hidden]
# Enter the password again: [hidden]

Library Usage

import { 
    encrypt_text, 
    decrypt_text, 
    decrypt_mnemonic, 
    decrypt_private_key,
    make_hd_wallet 
} from './wallet_manager.mjs';

// Encrypt text
const { salt, encrypted_text } = await encrypt_text('secret', 'password');

// Decrypt text
const decrypted = await decrypt_text(encrypted_text, 'password', Buffer.from(salt, 'base64'));

// Decrypt private key with password prompt
const privateKey = await decrypt_private_key({ salt, encrypted_text });

// Decrypt mnemonic with password prompt
const mnemonic = await decrypt_mnemonic({ salt, encrypted_text });

Environment Variables

Store encrypted keys in your .env:

ENCRYPTED_PRIVATE_KEY='{"salt":"...","encrypted_text":"..."}'
ENCRYPTED_WALLET='{"salt":"...","encrypted_text":"..."}'

License

ISC

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages