New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@thru/wallet-store

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thru/wallet-store

Browser-side IndexedDB storage layer for the Thru wallet. Provides typed helpers for persisting accounts, connected dApps, and passkey profiles in a single unified database. Replaces the legacy `@thru/indexed-db-stamper` package.

latest
npmnpm
Version
0.2.7
Version published
Weekly downloads
8
100%
Maintainers
1
Weekly downloads
 
Created
Source

@thru/wallet-store

Browser-side IndexedDB storage layer for the Thru wallet. Provides typed helpers for persisting accounts, connected dApps, and passkey profiles in a single unified database. Replaces the legacy @thru/indexed-db-stamper package.

Installation

pnpm add @thru/wallet-store

Basic Usage

import {
  AccountStorage,
  ConnectedAppsStorage,
  loadPasskeyProfiles,
  savePasskeyProfiles,
} from '@thru/wallet-store';

// Save and retrieve accounts
await AccountStorage.saveAccount({
  index: 0,
  label: 'Main',
  publicKey: '...',
  path: "m/44'/501'/0'/0'",
  createdAt: new Date(),
});
const accounts = await AccountStorage.getAccounts();

// Track connected dApps per account
await ConnectedAppsStorage.upsert({
  accountId: 0,
  appId: 'my-dapp',
  origin: 'https://my-dapp.example',
  metadata: { name: 'My dApp', icon: '...' },
});
const apps = await ConnectedAppsStorage.listByAccount(0);

// Manage passkey profiles
const store = await loadPasskeyProfiles();
if (store) {
  await savePasskeyProfiles(store);
}

Key Capabilities

  • Single shared IndexedDB database (thru-wallet v1) with lazy singleton connection
  • AccountStorage -- CRUD for HD-derived account metadata (does not store private keys)
  • ConnectedAppsStorage -- track which dApps are authorized per account, with upsert and indexed lookups
  • Passkey profiles -- load, save, create, and update WebAuthn passkey profiles with built-in schema migration support
  • Pure in-memory transform helpers (updateProfilePasskey, updatePasskeyLastUsed) that separate mutation from persistence
  • SSR-safe: passkey helpers return null / false when window is undefined

Database Schema

The package opens a single IndexedDB database named thru-wallet at version 1 with three object stores:

StoreKeyIndexesPurpose
accountsindexby-createdHD wallet account metadata
connectedAppsaccountId:appIdby-account, by-updatedAuthorized dApp connections
passkeyProfilesid--WebAuthn passkey profiles and settings

Access the raw database connection when needed:

import { getUnifiedDB } from '@thru/wallet-store';

const db = await getUnifiedDB();

API Reference

AccountStorage

MethodDescription
saveAccount(account)Insert or update an account record
getAccounts()List all accounts sorted by index
getAccount(index)Fetch a single account by its BIP-44 index
updateAccountLabel(index, label)Rename an account
getNextAccountIndex()Return the next unused account index
hasAccounts()Check whether any accounts exist
getAccountCount()Return total account count
clearAccounts()Delete all account records

ConnectedAppsStorage

MethodDescription
upsert(app)Insert or update a connected app record
listByAccount(accountId)List apps for an account, most recently updated first
get(accountId, appId)Fetch a single connection record
remove(accountId, appId)Delete a connection
clear()Delete all connected app records

Passkey Profiles

FunctionDescription
loadPasskeyProfiles()Load all profiles and settings from IndexedDB
savePasskeyProfiles(store)Persist the full profile store (replaces all records)
createDefaultProfileStore()Create an in-memory store with one empty default profile
updateProfilePasskey(store, index, passkey)Pure transform: attach passkey metadata to a profile
updatePasskeyLastUsed(store, index)Pure transform: bump lastUsedAt timestamp

Dependencies

  • idb -- Promise-based IndexedDB wrapper
  • @thru/chain-interfaces -- shared type definitions

FAQs

Package last updated on 12 Mar 2026

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