@hiveio/metamask-snap
v1.6.0
Published
Hive wallet extension allowing you to sign transactions using keys derived from your Metamask wallet
Keywords
Readme
Hive Wallet MetaMask Snap
A MetaMask Snap that enables secure Hive blockchain interactions directly through your MetaMask wallet. This Snap allows you to sign Hive transactions using keys derived from your MetaMask wallet's seed phrase.
Features
- Derive Hive keys from MetaMask wallet
- Sign Hive transactions securely
- Encode / decode buffer using derived Hive keys
- No private key exposure
Security Considerations
Required Permissions
This Snap requires the following permissions:
snap_getBip44Entropy: For deriving Hive keys from MetaMask seed phraseendowment:rpc: For Snap communication with dAppssnap_dialog: For user confirmation when signing transactions or encrypting/decrypting bufferendowment:webassembly: For WebAssembly support in our Hive libraries: Wax and Beekeeper
All permissions are used with the principle of least privilege. No private keys are stored in memory or exposed to the client.
Security Notes
- Keys are derived only when needed and immediately cleared from memory after usage
- No network requests are made
- Input validation is performed on all transaction data
- No sensitive data is stored in browser storage
Architecture
├── src/ # Source code
│ ├── assets/ # Snap assets, e.g. icons
│ ├── hive/ # Hive libraries configuration functions
│ ├── index.ts # Main Snap entry point
│ ├── rpc.ts # RPC method types
│ ├── snap/ # RPC method handlers code
│ └── priviledged-apis/ # Only part in Snap's code where we use Bip44 entropy functionsDevelopment Setup
Prerequisites
- Node.js >= 20.18.1
- pnpm = 10.0.0
- MetaMask Flask
- ⚠️ You cannot have other versions of MetaMask installed
Installation
# Clone the repository and its submodules
git clone --recurse-submodules https://gitlab.syncad.com/hive/metamask-snap.git
# Install dependencies
pnpm install --ignore-scripts --frozen-lockfile
# Start development server
pnpm startBuilding
# Build the Snap
pnpm build
# Lint the project
pnpm lint
# Run tests
pnpm testRunning
- Install MetaMask Flask
- Run
pnpm start - Connect to the Snap, either:
- See the demo site and use our official Snap distribution
- Host your own version of the dApp and use
local:http://localhost:8080
- Install Snap using dApp
- Approve the requested permissions
- Use the Snap to sign Hive transactions, encrypt/decrypt buffers and retrieve your underlying public keys
[!TIP] Here is a quick showcase of how to install and use this Snap with the official dApp: https://www.youtube.com/watch?v=zKT1GXO6G-0
Contributing
Contributions are welcome! Please follow these steps:
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
Development Guidelines
- Follow TypeScript strict mode guidelines
- Ensure all tests pass
- Add tests for new features
- Update documentation as needed
- Ensure snapper passes:
pnpm prebuild
