Skip to content

About

Open-source encryption core and offline decryptors of PingVaults, a client-side encrypted crypto inheritance vault with a dead man's switch (PBKDF2/Argon2id + AES-256-GCM).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

pingvaults-crypto

The open-source encryption core of PingVaults, published so anyone can inspect, test and reuse it.

PingVaults is a client-side encrypted vault for crypto inheritance and digital estate planning. You write recovery instructions for your family (where wallets and accounts are, what to do first), they are encrypted in your browser, and a trusted contact receives them only if you stop answering check-in emails. This repository holds the parts that protect the data: the browser encryption, the offline decryptors and the save/fetch routes.

MIT License Tests


Why this exists

PingVaults is a commercial product. Its business logic, UI, and infrastructure are proprietary.

But the encryption layer is different. The core cryptographic operations run in the browser. We publish the relevant core, UI paths, API routes, and offline decryptors here so you can:

  • Inspect the algorithm and its implementation
  • Check the intended save payload for answers or keys
  • Run independent tests with your own inputs
  • Inspect the offline decryptor HTML files

What's in this repo

src/
  crypto.ts                        ← Encryption core (PBKDF2 + AES-256-GCM)
components/
  VaultForm.tsx                    ← User input UI + triggers encryption
  VaultFetch.tsx                   ← Fetch ciphertext from gateways/local backup + triggers decryption
  VaultSave.tsx                    ← Uploads ciphertext through Irys, writes metadata to DB
  VaultEdit.tsx                    ← Decrypt → edit → re-encrypt flow
app/api/vault/
  save/route.ts                    ← Server: validation for the intended ciphertext-only save payload
  fetch/route.ts                   ← Server: what it returns to the client
app/api/ping/
  reset/route.ts                   ← Ping check-in reset endpoint
test/
  vectors.test.ts                  ← Fixed test vectors — independently verifiable
offline/
  decrypt.html                     ← Standalone offline decryptor (English)
  decrypt-zh.html                  ← Standalone offline decryptor (Chinese)

The server-side API routes (save, fetch) are particularly important for auditing:

  • save/route.ts shows what the intended save endpoint accepts and stores
  • fetch/route.ts shows what the server returns — no decryption happens server-side

Storage evidence is also published in components/ArweaveSyncStatus.tsx, app/api/arweave/status/route.ts, and lib/storage-{status,fetch}.ts. The legacy Arweave-named fields and endpoint remain for compatibility. New uploads are written to Arweave through ArDrive Turbo; vaults saved earlier on Irys L1 remain readable from the Irys gateway. The status check reports which network the evidence points to (arweave, irys or unknown): a 44-character ID can only be an Irys L1 ID, so Arweave is not queried for it, and an Irys record with no Arweave record is shown as Irys L1 storage rather than as missing Arweave inclusion. unknown never means lost. components/RecoveryCard.tsx builds the printable recovery card: a QR code and text holding {v, txId, salt, iv, keySchema, keyLanguage} (v2 cards add kdf and rc). It never includes answers, keys, plaintext or ciphertext. The offline decryptors accept this text in "Have a recovery card?" and download the ciphertext from the storage gateways.

lib/turbo.ts signs an ANS-104 data item on the server and posts it to the ArDrive Turbo upload service, which writes it to Arweave. It is used when the deployment sets STORAGE_BACKEND=turbo; the returned ID is only accepted if it matches the ID derived from the item's own signature. A Turbo receipt is shown as "received by Arweave, waiting for a block" until the Arweave index reports a block. Offline exports remain essential; a gateway response does not verify decryption.


Algorithm

Component Implementation
Key derivation PBKDF2-SHA256, 600,000 iterations (OWASP 2023)
Encryption AES-256-GCM (authenticated encryption)
Salt 32 bytes (256-bit), cryptographically random per encryption
IV 12 bytes (96-bit), cryptographically random per encryption
Key structure PBKDF2(normalize(a₀) | normalize(a₁) | … | normalize(aₙ), salt)
Order sensitivity [name, question] ≠ [question, name] — order is part of the key

The implementation uses standard WebCrypto primitives rather than a custom cipher. Security still depends on phrase quality, endpoint integrity, browser code, and correct use.

v2 (October 2026): Argon2id, optional recovery code

v1 vaults stay readable forever through the same code path. v2 is selected by a header stored with the vault and on the recovery card:

Component v2
Answer stretching Ka = Argon2id(P, salt, m = 64 MiB, t = 3, p = 1, 32 bytes) — RFC 9106 second recommended option with one lane, because browser WASM is single-threaded
Key HKDF-SHA256(Ka, salt, "PingVaults v2 std"), or with a recovery code HKDF-SHA256(Ka ‖ UTF8(R), salt, "PingVaults v2 rc")
Recovery code R 125 random bits as 25 Crockford Base32 characters + 3 check characters (first 15 bits of SHA-256("PVRC1" ‖ data)), shown as 7 groups of 4. Generated in the browser, printed on the recovery card, never sent to the server
Header binding AES-GCM additional data = {"v":2,"kdf":{"alg":"argon2id","m":65536,"t":3,"p":1},"rc":…}, so editing the parameters makes decryption fail
Argon2id code hash-wasm 4.12.0 (MIT). The offline decryptors inline dist/argon2.umd.min.js byte-for-byte, SHA-256 dcec617a2e1b700fa132d1583a186cb70611113395e869f2dd6cc82b415d3094

The recovery code protects against offline guessing by anyone who obtains the salt (a database leak, a forwarded contact email) but not by someone who also holds the recovery card. The fixed v2 vectors in test/vectors.test.ts were also decrypted independently with argon2-cffi and Python cryptography.


Data flow

Your answers (browser only)
        │
        ▼
   normalizeInput()          ← trim, lowercase, full→half-width
        │
        ▼
   join with "|" separator
        │
        ▼
   PBKDF2-SHA256              ← 600,000 iterations + random 32-byte salt
        │
        ▼
   AES-256-GCM key
        │
        ▼
   encrypt(plaintext)         ← random 12-byte IV
        │
        ▼
   ciphertext (Base64)        ← sent with public parameters and recovery metadata

Intended vault-save payload: ciphertext, salt, iv, key schema types, question text Intentionally omitted from that payload: answers, derived keys, plaintext

This describes the published code path, not a cryptographic attestation of the complete proprietary deployment. Inspect live network behavior and treat deployment integrity as a separate trust boundary.


Running tests

The September snapshot also publishes lib/auth-policy.ts, lib/request-policy.ts, lib/vault-input.ts and lib/plans.ts so the validation used by the save and reset routes can be inspected. These snapshots are not a standalone deployable backend; database and service integrations remain in the private application. The crypto test suite below does not certify login, cloud permissions, billing, email delivery or provider storage.

npm install
npm test

The test suite includes:

  • normalizeInput behavior with fixed inputs → expected outputs
  • validateSelections edge cases
  • deriveKeyFingerprint stability (changing algorithm = test failure = breaking existing vaults)
  • Encrypt/decrypt round-trips with correct and incorrect answers
  • AES-GCM authentication tag verification (tampered ciphertext fails)
  • Answer order sensitivity verification

Offline decryptors

The offline/ directory contains standalone HTML files that:

  • Implement the same algorithm as src/crypto.ts
  • Load nothing from a CDN; v2 support inlines the hash-wasm Argon2 build shown above
  • Can work offline from exported ciphertext; the optional TxID retrieval button makes requests to Irys or Arweave gateways
  • Can be saved and used even if pingvaults.com is unreachable

Download the appropriate file and open it in any browser:


Verifying the live site uses this code

The live site at pingvaults.com/verify publishes:

  1. Build-time SHA-256 hashes of this file and other critical source files
  2. A batch verification script you can run locally: pbpaste | bash
  3. JS bundle hashing steps that can record and compare delivered chunks, but cannot prove unpublished application source
  4. A live CSP header inspector showing which origins the page's JS is allowed to contact

Security notes

  • Key uniqueness: Each encryption generates a fresh random salt and IV. Two encryptions of the same plaintext with the same answers produce different ciphertext.
  • Authentication: AES-GCM includes a 128-bit authentication tag. Tampered ciphertext will always fail decryption — no silent corruption.
  • Normalization transparency: Input normalization rules are fully documented and tested. Users are shown exactly how their answers will be processed before they commit.
  • Order sensitivity: The sequence of key fields is intentional and part of the key. It is stored as recovery metadata and should not be treated as additional entropy.
  • Phrase quality: PBKDF2 raises the cost of each guess but cannot make names, dates, phone digits, or other predictable values secure. Use a unique, randomly generated recovery phrase as the primary secret.
  • Assurance status: The published artifacts have not completed an independent security audit or penetration test as of September 3, 2026.

License

MIT — use freely for any purpose, including commercial. Attribution appreciated but not required.


Main product

PingVaults: client-side encrypted recovery instructions with inactivity-based contact delivery (a dead man's switch for crypto and digital accounts).

Guides for families

Free, sourced guides maintained by PingVaults, each checked against the platforms' own help pages:

About

Open-source encryption core and offline decryptors of PingVaults, a client-side encrypted crypto inheritance vault with a dead man's switch (PBKDF2/Argon2id + AES-256-GCM).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages