Skip to content
dpinsePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lockbox

Encrypt and decrypt files in your browser with a password or a key pair. Nothing is uploaded: lockbox is a static site, and every byte of your file stays on your device. It works offline once loaded.

How it works

  • Password mode: Argon2id (256 MiB, 3 passes) turns the password into a key; the file is encrypted with XChaCha20-Poly1305 in 64 KiB chunks (libsodium secretstream).
  • Key mode: X25519 key exchanges from a fresh per-file key and from the Sender's private key to the Recipient's public key. Decryption only succeeds with the real Sender's public key, so it proves who sent the file, and a Sender's key leaking later doesn't expose files already sent.
  • Tamper detection: every chunk is authenticated and the header is bound to the first chunk. A changed, reordered or truncated file is rejected, and the app shows a broken seal.
  • Large files: encryption runs in a Web Worker and output streams to disk through a service worker, so multi-gigabyte files never sit in memory. Without a service worker (e.g. Firefox private windows) output is held in memory, about 1 GB at most, and saved with a click.
  • Seal number: an 80-bit BLAKE2b fingerprint of the whole encrypted file. If the sender's and recipient's numbers match, the recipient has exactly the file that was sent; nobody, password holders included, can forge a different file with the same number.

The exact byte layout is in docs/format.md; design decisions are in docs/adr/; known gaps are in docs/open-items.md.

Develop

npm install
npm run dev          # local dev server
npm test             # unit tests (format, crypto, keys)
npm run test:e2e     # browser tests (Playwright: Chromium, Firefox, WebKit)
npm run check        # type check
npm run build        # static site in build/

Deploy (AWS S3 + CloudFront)

Infrastructure is Terraform in infra/: a private S3 bucket, CloudFront on the free flat-rate plan with AWS's managed security headers and a rate-limiting firewall, a URL-rewrite function, and a GitHub Actions deploy role (OIDC, no stored keys). The flat-rate plan has no overage charges, so a flood of requests cannot run up a bill; in exchange it does not allow custom response headers, so lockbox gives up Permissions-Policy, Cross-Origin-Opener-Policy and frame-ancestors 'none' (other sites still cannot frame it). To keep those headers instead, delete aws_pricingplanmanager_subscription and restore a custom headers policy. Expected cost for a personal site is about $0–1/month.

One-time setup, with the AWS CLI logged in:

cd infra
cp terraform.tfvars.example terraform.tfvars   # then edit it
terraform init
terraform apply

Sharing an AWS account with other projects? Every lockbox resource is tagged Project=lockbox. There is no budget alert in this Terraform: the flat-rate plan caps CloudFront, so set up billing alerts for the account yourself. If you already deploy from GitHub Actions, set create_github_oidc_provider = false (an account can hold only one GitHub OIDC provider).

The deploy role trusts only the production environment of this repository. In GitHub, Settings → Environments → production, set Deployment branches to main only (and optionally add yourself as a required reviewer), so nothing but reviewed code on main can deploy.

Then in GitHub, Settings → Secrets and variables → Actions → Variables, add:

Variable Value
AWS_REGION us-east-1 (or the region you set)
S3_BUCKET terraform output -raw s3_bucket
CLOUDFRONT_DISTRIBUTION_ID terraform output -raw cloudfront_distribution_id
AWS_DEPLOY_ROLE_ARN terraform output -raw deploy_role_arn

Custom domain (DNS in Cloudflare or elsewhere)

Set domain_name = "lockbox.example.com" in terraform.tfvars, then:

  1. terraform apply -target=aws_acm_certificate.site creates the TLS certificate (in us-east-1, as CloudFront requires).
  2. terraform output certificate_validation_record: add that CNAME in Cloudflare.
  3. terraform apply waits for the certificate to be issued (usually minutes), then attaches the domain to CloudFront.
  4. terraform output site_dns_record: add that CNAME in Cloudflare (a bare domain works too; Cloudflare flattens it).

Set both records to DNS only (grey cloud). Proxying through Cloudflare would put a second CDN, and a second TLS termination, in front of a privacy tool, and can break certificate validation. Share links pick up the new domain automatically.

Every push to main then tests, builds and deploys. The site is at terraform output -raw site_url.

License

GPL-3.0. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages