mass-expo-wallet
v0.6.2
Published
An expo module for private key management
Maintainers
Readme
mass-expo-wallet
A secure Expo module for private key management and cryptocurrency wallet operations.
Features
- 🔐 Secure private key generation and storage
- 🌟 Mnemonic phrase support (BIP39)
- 📱 Native iOS and Android implementation
- ☁️ Cloud backup support
- iCloud backup (iOS)
- Google Drive backup (Android)
- 🔑 Hardware-backed security when available
- 🎯 TypeScript support with full type definitions
- 🔄 Cross-platform compatible encryption
Compatibility
- ✅ Expo SDK 52+ (latest)
- ✅ React Native 0.76+
- ✅ Expo SDK 50+ (previous versions)
- 🍎 iOS 15.1+
- 🤖 Android API 21+
Installation
npm install mass-expo-wallet
# or
yarn add mass-expo-walletExpo Configuration
Add the module to your app.json or app.config.js:
{
"expo": {
"plugins": ["mass-expo-wallet"]
}
}Quick Start
import { createWallet, getWallets, addWalletAccount, signHash, backupWalletToCloud } from "mass-expo-wallet";
// Create a new wallet with mnemonic
const wallet = createWallet();
console.log("Wallet ID:", wallet.id);
// Get all wallets
const wallets = getWallets();
// Add an account with derivation path
const account = addWalletAccount(wallet.id, "m/44'/60'/0'/0/0");
// Sign a transaction hash
const signature = signHash(account.id, "0x1234...");
// Cloud Backup
if (Platform.OS === "android") {
// Android: Request Google Drive sign-in first
await requestGoogleDriveSignIn();
}
// Backup to cloud (iCloud on iOS, Google Drive on Android)
const success = await backupWalletToCloud("My Wallet", wallet.id, "password123");Cloud Backup
iOS (iCloud)
Automatic integration with iCloud Drive. Backups are stored in the app's iCloud container.
Android (Google Drive)
Requires Google Sign-In. Backups are stored in a dedicated folder in the user's Google Drive.
Setup for Android:
- Configure OAuth 2.0 in Google Cloud Console
- Enable Google Drive API
- See ANDROID_BACKUP_GUIDE.md for detailed setup instructions
import { requestGoogleDriveSignIn, isCloudStorageAvailable } from "mass-expo-wallet";
// Check if authenticated
if (!isCloudStorageAvailable() && Platform.OS === "android") {
await requestGoogleDriveSignIn();
}
// Create backup
await backupWalletToCloud("My Wallet", walletId, "securePassword");
// Fetch backups
const subscription = fetchWalletBackups((backup) => {
console.log("Found backup:", backup.walletId);
});
// Restore backup
await restoreWalletFromCloudStorage(walletId, "securePassword");For complete Android setup instructions, see ANDROID_BACKUP_GUIDE.md.
Documentation
- Android Backup Setup Guide - Complete guide for Google Drive integration
Development & Release
Releasing a New Version
This package uses an automated release script (scripts/release.sh) to streamline the publishing process.
Quick Release
# For minor version bump (e.g., 0.5.2 → 0.6.0)
yarn release minor
# For patch version bump (e.g., 0.5.2 → 0.5.3)
yarn release patch
# For major version bump (e.g., 0.5.2 → 1.0.0)
yarn release major
# Or set a specific version
yarn release 1.2.3This single command will automatically:
- Verify you're on the correct branch and logged into npm
- Check that your working directory is clean
- Bump the version in
package.json - Create a git commit with message "Release vX.X.X"
- Create a git tag (e.g.,
v0.6.0) - Push commits to the remote branch
- Push the git tag to GitHub
- Publish the package to npm
Complete Release Process
# Ensure you're on main with latest changes
git checkout main && git pull
# Release in one command
yarn release minorAvailable Scripts
yarn release [major|minor|patch|<version>]- Complete release: bump version, commit, tag, push, and publish to npm./scripts/release.sh [version]- Direct script usage (same as yarn release)
Script Features
The release script includes:
- ✅ Branch verification (warns if not on main)
- ✅ Working directory clean check
- ✅ npm authentication check
- ✅ Automatic version bumping
- ✅ Git commit creation with custom message
- ✅ Git tag creation (format:
v0.6.0) - ✅ Automatic push to remote (commits and tags)
- ✅ npm publish with automatic build
- ✅ Colored output and progress indicators
- ✅ Release summary with GitHub release link
Note: The package is automatically built during publishing via the
prepublishOnlyhook, so you don't need to runyarn buildmanually.
Pre-Release Checklist
Before running the release command:
- [ ] Tests passing (
yarn test) - [ ] No linting errors (
yarn lint) - [ ] Documentation updated
- [ ] All changes committed (script will verify)
- [ ] Logged into npm (script will verify)
License
MIT License - see LICENSE file for details.
