Socket
Book a DemoInstallSign in
Socket

@dogeuni-org/keyring

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dogeuni-org/keyring

Multi-chain wallet management SDK for DogeUni ecosystem

latest
Source
npmnpm
Version
1.0.12
Version published
Maintainers
3
Created
Source

DogeUni Keyring SDK

A powerful multi-chain wallet SDK that supports generating, recovering, and managing wallets for multiple blockchain networks.

Supported Networks

  • Bitcoin (BTC)
  • Dogecoin (DOGE)
  • PEP (PEP)
  • ClassZZ (CZZ)
  • EthereumFair (ETHF)
  • DogeOS (DOGEOS)

Key Features

  • Mnemonic Generation & Validation - Supports BIP39 standard
  • Multi-Network Wallet Generation - Generate wallets for multiple networks with one click
  • Network Configuration - Configure which networks to enable for wallet generation
  • Private Key Recovery - Recover wallets from private keys, WIF format, and encrypted JSON
  • Address Validation - Validate various blockchain address formats
  • Data Encryption - AES encryption for sensitive data protection
  • Message Signing - Support for Ethereum-like network message signing
  • Security Validation - Password strength and mnemonic strength validation

Installation

npm install @dogeuni-org/keyring

Quick Start

Basic Usage

import { DogeUniKeyring } from "@dogeuni-org/keyring";

// Create Keyring instance
const keyring = new DogeUniKeyring();

// Generate new mnemonic
const mnemonic = keyring.generateMnemonic();
console.log("Mnemonic:", mnemonic);

// Generate wallets for different networks
const bitcoinWallet = keyring.recoverWallet({
  mnemonic,
  network: "bitcoin",
  index: 0,
});

const dogecoinWallet = keyring.recoverWallet({
  mnemonic,
  network: "dogecoin",
  index: 0,
});

console.log("Bitcoin address:", bitcoinWallet.address);
console.log("Dogecoin address:", dogecoinWallet.address);

Network Configuration

import { MultiWalletManager } from "@dogeuni-org/keyring";
import { NetworkType } from "@dogeuni-org/keyring";

// Create wallet manager with specific networks enabled
const enabledNetworks: NetworkType[] = ["bitcoin", "dogecoin", "ethereum"];
const walletManager = new MultiWalletManager(
  undefined, // no initial wallets
  "my-password", // password
  enabledNetworks // only enable specified networks
);

// Check which networks are enabled
console.log("Enabled networks:", walletManager.getEnabledNetworks());

// Add a new network
walletManager.addEnabledNetwork("pepe");

// Remove a network
walletManager.removeEnabledNetwork("ethereum");

// Check if a network is enabled
console.log("Bitcoin enabled:", walletManager.isNetworkEnabled("bitcoin"));

// Reset to all supported networks
walletManager.resetNetworks();

Recover Wallet from Private Key

// Recover from private key
const wallet = keyring.recoverFromPrivateKey(
  "your-private-key-here",
  "bitcoin"
);

// Recover from WIF format
const wifWallet = keyring.recoverFromWIF("your-wif-private-key", "dogecoin");

Generate Multiple Addresses

// Generate 10 Bitcoin addresses
const wallets = keyring.generateMultipleWallets(mnemonic, "bitcoin", 10);

wallets.forEach((wallet, index) => {
  console.log(`Address ${index + 1}: ${wallet.address}`);
});

Ethereum-like Wallet Features

// Sign message
const message = "Hello from DogeUni!";
const signature = keyring.signMessage(
  message,
  wallet.privateKey,
  "ethereumfair"
);

// Verify signature
const recoveredAddress = keyring.verifyMessage(
  message,
  signature,
  "ethereumfair"
);

Encrypt Wallet

// Create encrypted wallet
const encryptedWallet = await keyring.createEncryptedWallet(
  wallet.privateKey,
  "your-password",
  "ethereumfair"
);

// Recover from encrypted wallet
const decryptedWallet = await keyring.recoverFromEncryptedJson(
  encryptedWallet,
  "your-password",
  "ethereumfair"
);

API Reference

DogeUniKeyring Class

Constructor

new DogeUniKeyring();

Methods

generateMnemonic(strength?: number): string

Generate a new mnemonic phrase

  • strength: Entropy bits (128, 160, 192, 224, 256), defaults to 256
validateMnemonic(mnemonic: string): boolean

Validate if a mnemonic is valid

mnemonicToSeed(mnemonic: string, password?: string): string

Generate seed from mnemonic

generateWallet(options: KeyringOptions): WalletInfo

Generate a new wallet (automatically generates mnemonic)

recoverWallet(options: RecoveryOptions): WalletInfo

Recover wallet from mnemonic

recoverFromPrivateKey(privateKey: string, network: SupportedNetwork): WalletInfo

Recover wallet from private key

recoverFromWIF(wif: string, network: SupportedNetwork): WalletInfo

Recover wallet from WIF format private key

generateMultipleWallets(mnemonic: string, network: SupportedNetwork, count: number, derivationPath?: string): WalletInfo[]

Generate multiple wallet addresses

validateAddress(address: string, network: SupportedNetwork): boolean

Validate address format

signMessage(message: string, privateKey: string, network: SupportedNetwork): string

Sign message (only supports Ethereum-like networks)

verifyMessage(message: string, signature: string, network: SupportedNetwork): string

Verify message signature

createEncryptedWallet(privateKey: string, password: string, network: SupportedNetwork): Promise

Create encrypted wallet

recoverFromEncryptedJson(encryptedJson: string, password: string, network: SupportedNetwork): Promise

Recover wallet from encrypted JSON

Type Definitions

type SupportedNetwork =
  | "bitcoin"
  | "dogecoin"
  | "pepe"
  | "classzz"
  | "ethereumfair"
  | "dogeos";

interface WalletInfo {
  address: string;
  privateKey: string;
  publicKey: string;
  network: SupportedNetwork;
  derivationPath?: string;
}

interface KeyringOptions {
  network: SupportedNetwork;
  derivationPath?: string;
  password?: string;
}

interface RecoveryOptions {
  mnemonic: string;
  network: SupportedNetwork;
  derivationPath?: string;
  password?: string;
  index?: number;
}

Derivation Paths

The SDK uses standard BIP44 derivation paths:

  • Bitcoin: m/44'/0'/0'/0/0
  • Dogecoin: m/44'/3'/0'/0/0
  • PEP/ClassZZ/EthereumFair/DogeOS: m/44'/60'/0'/0/0

Security Considerations

  • Private Key Security: Never hardcode private keys in client-side code
  • Mnemonic Backup: Securely backup mnemonics and never store them in the cloud
  • Password Strength: Use strong passwords to protect encrypted wallets
  • Environment Security: Generate and use wallets in secure environments

Bundle Optimization

This SDK includes advanced bundle optimization features:

Build Commands

# Standard build
npm run build

# Optimized build
npm run build:optimized

# Production build (maximum compression)
npm run build:prod

# Test different build configurations
npm run build:test

# Analyze Gzip compression
node scripts/gzip-compress.js

Bundle Sizes

  • Standard Build: ~4.1MB
  • Optimized Build: ~3.2MB (22% reduction)
  • Production Build: ~2.8MB (32% reduction)
  • Gzip Compressed: ~0.8MB (80% reduction)

Optimization Features

  • Advanced Terser Configuration: Multiple compression passes with aggressive optimizations
  • Code Splitting: Intelligent chunking by functionality (crypto, blockchain, utils)
  • Tree Shaking: Remove unused code and dependencies
  • Gzip Compression: Built-in compression analysis and optimization

Development

Prerequisites

  • Node.js >= 16.0.0
  • npm >= 8.0.0

Setup

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Type checking
npm run type-check

# Linting
npm run lint

Build Options

# Development build (readable code)
npm run build

# Optimized build (balanced size and debugging)
npm run build:optimized

# Production build (maximum compression)
npm run build:prod

# Test all build configurations
npm run build:test

Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Browser Compatibility

The SDK is built for modern browsers and includes necessary polyfills:

  • Target: ES2020
  • Browsers: > 1% market share, last 2 versions
  • Polyfills: Node.js modules (crypto, buffer, stream, etc.)

Examples

Check the demo/ directory for complete examples:

  • KeyringTest.tsx - Basic usage example
  • MultiWalletTest.tsx - Advanced multi-wallet functionality

Run the demo:

cd demo
npm install
npm run dev

Performance

Bundle Optimization

The SDK implements several optimization strategies:

  • Code Splitting: Separate chunks for crypto, blockchain, and utility functions
  • Tree Shaking: Remove unused code during build
  • Minification: Advanced Terser configuration for maximum compression
  • Gzip Compression: Built-in compression analysis

Expected Performance

  • Initial Load: 32% smaller bundle size
  • Caching: Better cache efficiency with code splitting
  • Runtime: Optimized for modern JavaScript engines

Contributing

We welcome contributions! Please see our contributing guidelines:

  • Fork the repository
  • Create a feature branch
  • Make your changes
  • Add tests for new functionality
  • Ensure all tests pass
  • Submit a pull request

License

MIT License - see LICENSE file for details.

Support

If you encounter any issues or have questions:

Roadmap

  • Support for more blockchain networks
  • Hardware wallet integration
  • Advanced encryption features
  • WebAssembly optimizations
  • React Native optimizations

Changelog

See CHANGELOG.md for version history and updates.

Keywords

wallet

FAQs

Package last updated on 30 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts