[Extension] Encrypt/decrypt contact blob (AES-256-GCM)

Open
#2,834 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@piyalbasu is already working on this.

Since Jun 7, 2026.

Assessment

This issue has not been assessed yet.

Description

Implement client-side encryption of the contacts blob on the extension. Completes the auth + crypto plumbing (alongside #2769 auth keypair and #2770 JWT generation) before any contacts UI.

Derive the contacts encryption key via HMAC-SHA256(seedBytes, "freighter-contacts-key") — domain-separated from the auth keypair. Encrypt/decrypt the contacts-list JSON with AES-256-GCM. Wire shape: {"contactCipher": "<base64>"} — base64-encode ciphertext (nonce ‖ tag ‖ body) on write, base64-decode then decrypt on read.

See Cross-Platform Contact Sync design doc — Phase 2 § Contact blob encrypt/decrypt + FR-6.3/6.4/6.5 of the FE spec.

Acceptance:

  • Round-trip: same seed + JSON → encrypt → base64 → PUT → GET → base64-decode → decrypt → identical JSON.
  • Fresh 96-bit nonce per write.
  • Wrong-seed decryption fails with a clear, distinct error (not garbage output, not a silent empty blob).
  • Empty contactCipher (new user) decodes to an empty contacts blob without error.
  • Key cached in memory for the session only; never persisted.
Dominant language
TypeScript
Stars
122
Forks
62
Avg merge
4d 19h
Merged PRs (30d)
41

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/freighter

All issues in stellar/freighter

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.