npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kdbx-wasm

v0.1.5

Published

KDBX password database parser for JavaScript/WebAssembly - Fast and secure KeePass KDBX 4 file parser

Readme

kdbx-wasm

A high-performance KDBX 4 password database parser built with Rust and WebAssembly.

npm version license

Features

  • KDBX 4 — parse, modify, and export .kdbx files
  • Encryption — AES-256-CBC / ChaCha20
  • Key derivation — Argon2d / Argon2id / AES-KDF
  • WebAssembly — Rust-powered, runs in browsers and Node.js
  • REST API — Axum-based HTTP server for non-WASM usage
  • TypeScript — full type definitions included

Project Structure

src/
├── core/           # KDBX format internals
│   ├── types.rs    #   data types (Entry, Group, Header …)
│   ├── crypto.rs   #   AES / ChaCha20 / Argon2 / HMAC
│   ├── header.rs   #   binary header parsing
│   ├── xml.rs      #   XML payload ↔ entries/groups
│   └── parser.rs   #   parse & generate full .kdbx files
├── service/        # Business logic (session, file, entry, group)
├── api/            # Axum REST handlers + DTOs (server target)
├── infrastructure/ # Config loading
├── wasm.rs         # wasm-bindgen bindings (WASM target)
├── error.rs        # Unified error type
├── lib.rs          # Library root
└── main.rs         # Server entry point
js/                 # npm package (wrapper + WASM binary)

Installation

npm install kdbx-wasm

Quick Start — Browser

<script type="module">
  import init, { KdbxDatabase, isKdbxFile, getFileInfo } from 'kdbx-wasm/kdbx_wasm.js';
  await init();

  const resp = await fetch('passwords.kdbx');
  const data = new Uint8Array(await resp.arrayBuffer());

  if (!isKdbxFile(data)) throw new Error('Not a KDBX file');

  const info = getFileInfo(data);
  console.log(info.encryptionAlgorithm, info.kdfAlgorithm);

  const db = new KdbxDatabase(data, 'master-password');
  console.log('Name:', db.metadata.databaseName);

  const entries = db.getEntries();
  entries.forEach(e => console.log(e.title, e.username));

  const results = db.searchEntries('github');
  console.log('Found:', results.length);

  const exported = db.toBytes('new-password');
</script>

Quick Start — Node.js

import { readFileSync, writeFileSync } from 'node:fs';
import { KdbxDatabase, isKdbxFile, getFileInfo } from 'kdbx-wasm';

const data = new Uint8Array(readFileSync('passwords.kdbx'));

console.log('Valid:', isKdbxFile(data));
console.log('Info:', getFileInfo(data));

const db = new KdbxDatabase(data, 'master-password');
// with key file: new KdbxDatabase(data, 'password', keyFileBytes)

console.log(db.metadata.databaseName);
console.log(db.headerInfo.entryCount, 'entries');

for (const g of db.getGroups()) console.log(g.name);
for (const e of db.getEntries()) console.log(e.title, e.username);

const entry = db.getEntry(db.getEntries()[0].uuid);
const byGroup = db.getEntriesByGroup(db.rootGroupUuid);
const found = db.searchEntries('google');

writeFileSync('exported.kdbx', db.toBytes('new-password'));

API

KdbxDatabase

new KdbxDatabase(data: Uint8Array, password?: string, keyFile?: Uint8Array)

| Property | Type | Description | |---|---|---| | metadata | KdbxMetadata | Database name, description, default username | | headerInfo | KdbxHeaderInfo | Encryption algorithm, KDF, entry/group counts | | rootGroupUuid | string | UUID of the root group |

| Method | Returns | Description | |---|---|---| | getEntries() | KdbxEntry[] | All entries | | getEntry(uuid) | KdbxEntry | Single entry by UUID | | getGroups() | KdbxGroup[] | All groups | | getGroup(uuid) | KdbxGroup | Single group by UUID | | getEntriesByGroup(uuid) | KdbxEntry[] | Entries in a group | | searchEntries(query) | KdbxEntry[] | Full-text search (title, username, URL, notes, tags) | | toBytes(password?, keyFile?) | Uint8Array | Export as .kdbx bytes |

Utility Functions

isKdbxFile(data: Uint8Array): boolean
getFileInfo(data: Uint8Array): KdbxFileInfo

Types

interface KdbxEntry {
  uuid: string; groupId: string; title: string;
  username?: string; password: string; url?: string; notes?: string;
  iconId: number; createdAt: string; updatedAt: string; accessedAt: string;
  expiresAt?: string; tags: string[]; customFields: Record<string, string>;
}

interface KdbxGroup {
  uuid: string; name: string; iconId: number; parentId?: string;
  createdAt: string; updatedAt: string; notes?: string;
  childGroups: string[]; entries: string[];
}

interface KdbxMetadata {
  databaseName?: string; databaseDescription?: string;
  defaultUsername?: string; maintenanceHistoryDays: number; color?: string;
}

interface KdbxHeaderInfo {
  version: string;
  encryptionAlgorithm: 'AES-256' | 'ChaCha20';
  kdfAlgorithm: 'Argon2d' | 'Argon2id' | 'AES-KDF';
  kdfParams: { memory?: number; iterations?: number; parallelism?: number; rounds?: number };
  compression: 'None' | 'Gzip';
  entryCount: number; groupCount: number;
}

interface KdbxFileInfo {
  version: string;
  encryptionAlgorithm: 'AES-256' | 'ChaCha20';
  kdfAlgorithm: 'Argon2d' | 'Argon2id' | 'AES-KDF';
  compression: 'None' | 'Gzip';
}

Building from Source

# Prerequisites: Rust, wasm-bindgen-cli
cargo install wasm-bindgen-cli

# Build WASM
.\build-wasm.bat

# Or manually:
cargo build --lib --target wasm32-unknown-unknown --release
wasm-bindgen target\wasm32-unknown-unknown\release\kdbx_wasm.wasm --out-dir js --target web --no-typescript

Browser Compatibility

Chrome 57+ · Firefox 52+ · Safari 11+ · Edge 16+

Security

  • Key derivation via Argon2 / AES-KDF
  • Key file supported alongside or instead of password
  • All crypto runs inside WebAssembly
  • Sensitive data cleared from memory when possible

License

MIT