Integrate Beekeeper in-browser wallet for secure transaction signing
The Beekeeper signer provides integration with the Beekeeper in-browser wallet, enabling secure key management and transaction signing within your web application.
Beekeeper is a lightweight, in-browser wallet that stores encrypted keys locally. It provides session-based key management, allowing users to sign transactions without exposing private keys to your application.
import beekeeperFactory from "@hiveio/beekeeper";const bk = await beekeeperFactory();// Create a new session with a unique saltconst session = bk.createSession("unique-session-salt");// Create or open a walletconst { wallet } = await session.createWallet("my-wallet");// Import keysconst postingKey = await wallet.importKey("5J...");const activeKey = await wallet.importKey("5K...");// List all public keys in the walletconst keys = await wallet.getPublicKeys();
The Beekeeper provider handles transaction signing:
const provider = BeekeeperProvider.for(wallet, "username", "active", chain);// The provider automatically signs with the appropriate keyawait provider.signTransaction(tx);// You can also manually specify a public keyawait provider.signTransaction(tx, publicKey);