Service Worker-based wallet implementation for browser environments.

This wallet uses a service worker as a backend to handle wallet logic, providing secure key storage and transaction signing in web applications. The service worker runs in a separate thread and can persist data between browser sessions.

// Create and initialize the service worker wallet
const serviceWorker = await setupServiceWorker("/service-worker.js");
const wallet = new ServiceWorkerWallet(serviceWorker);
await wallet.init({
privateKey: 'your_private_key_hex',
arkServerUrl: 'https://ark.example.com'
});

// Use like any other wallet
const address = await wallet.getAddress();
const balance = await wallet.getBalance();

Implements

Constructors

Properties

serviceWorker: ServiceWorker

Methods

  • Parameters

    • config: Omit<WalletConfig, "identity"> & { privateKey: string }
    • failIfInitialized: boolean = false

    Returns Promise<void>