Self-hosted end-to-end encrypted screenshot and media sharing
  • JavaScript 97.7%
  • TypeScript 1%
  • C# 0.9%
  • CSS 0.3%
  • PowerShell 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-01 14:33:50 +02:00
client Harden Gyazo import progress persistence 2026-10-01 14:28:15 +02:00
docker Initial BirdieShot import 2026-09-27 08:13:22 +02:00
docs Harden Gyazo import progress persistence 2026-10-01 14:28:15 +02:00
infrastructure Initial BirdieShot import 2026-09-27 08:13:22 +02:00
protocol Initial BirdieShot import 2026-09-27 08:13:22 +02:00
scripts Add safe deployment synchronization 2026-10-01 13:59:02 +02:00
server/BirdieShot.Api Add resumable Gyazo archive importer 2026-10-01 14:15:44 +02:00
tests Preserve Gyazo titles and tag imports 2026-10-01 14:18:05 +02:00
web/viewer Fix library card text overlap 2026-10-01 14:33:50 +02:00
.dockerignore Initial BirdieShot import 2026-09-27 08:13:22 +02:00
.gitattributes Initial BirdieShot import 2026-09-27 08:13:22 +02:00
.gitignore Initial BirdieShot import 2026-09-27 08:13:22 +02:00
BirdieShot.sln Add resumable Gyazo archive importer 2026-10-01 14:15:44 +02:00
global.json Initial BirdieShot import 2026-09-27 08:13:22 +02:00
README.md updated readme 2026-10-01 03:24:30 +02:00
ROADMAP.md Initial BirdieShot import 2026-09-27 08:13:22 +02:00

BirdieShot

Private, self-hosted screenshot and media sharing with end-to-end encryption.

Capture with your preferred tools, organize an encrypted library, and share media through a browser that decrypts it locally.

Features · Architecture · Setup · Deployment · Documentation

About the project

BirdieShot is a self-hosted application for encrypted screenshot and media sharing. A small .NET uploader encrypts a file before it leaves the device, the ASP.NET Core API stores the encrypted object, and a browser viewer decrypts it using the secret in the shared URL fragment.

The project extends that basic sharing flow into an owner library with search, tags, collections, editing, OCR, retention controls, and administration. Its central design challenge is making these features useful while keeping private media and descriptive metadata encrypted on the server.

Capture remains the responsibility of existing tools such as ShareX and Linux screenshot utilities. BirdieShot handles the upload, hosting, organization, and recipient experience that follow a capture.

The encrypted format is documented in the v1 protocol. The application has not undergone an independent cryptographic audit.

Features

  • End-to-end encrypted uploads using AES-256-GCM, HKDF-SHA-256, and a fresh secret and nonce for every capture.
  • Encrypted personal library with grid and list views, local search, filters, favorites, tags, bulk actions, and recoverable trash.
  • Flexible sharing through normal encrypted links, password-protected links, encrypted collection galleries, and optional public Open Graph/Discord embeds.
  • Local-first media tools including image editing, redaction, QR generation, downloads, and self-hosted PaddleOCR—all executed after browser-side decryption.
  • Capture-tool integration for ShareX on Windows and Flameshot, Spectacle, GNOME Screenshot, grim, and maim on Linux.
  • Operational controls for upload tokens, users, quotas, retention, audit events, privacy-safe error records, backups, and storage-integrity checks.
  • Defense in depth with authenticated encryption, strict cookies, rate-limited sign-in, a restrictive Content Security Policy, and no plaintext private-media metadata on the server.

An encrypted workspace for captures

Owners can browse grid or list views, filter by media type and date, search decrypted metadata, mark favorites, manage tags, and use bulk actions. Collections organize related captures into galleries and slideshows. Preview decryption is bounded and lazy so browsing a library does not require rendering every item immediately.

Image editing happens after decryption in the browser. Cropping, rotation, arrows, shapes, text, freehand marks, and blur or pixelation can be saved as a new encrypted upload while preserving the original. Optional OCR extracts text locally and stores searchable results in encrypted metadata.

Sharing modes with different visibility

Mode Intended use Recipient experience
Encrypted link Send one capture directly Open the complete fragment-bearing URL and decrypt in the browser.
Owner library Keep captures organized privately Sign in and unlock the encrypted owner vault.
Password-protected share Add a password to a share Enter the password to unlock the local share manifest.
Collection share Share a group of captures Browse a gallery using its encrypted share information.
Explicit public derivative Enable social previews and embeds Retrieve a separate public copy that preview crawlers can read.

Public publishing changes the visibility of that derivative. It is a deliberate feature, not an end-to-end encrypted route for the published copy.

How it works

flowchart LR
    A[Capture tool] --> B[BirdieShot uploader]
    B -->|Encrypt media and metadata| C[Encrypted container]
    C -->|Ciphertext only| D[ASP.NET Core API]
    D --> E[(MariaDB + blob storage)]
    B -->|Share URL with secret in #fragment| F[Recipient]
    F --> G[Browser viewer]
    D -->|Encrypted bytes| G
    G -->|Decrypt locally with Web Crypto| H[Image, GIF, video, or file]
  1. The uploader generates a random 256-bit secret and encrypts the file locally.
  2. The API receives an opaque encrypted container and returns a random capture ID.
  3. The uploader creates a URL such as https://shot.example.com/i/abc123#secret.
  4. URL fragments are not included in HTTP requests, so the server receives the capture ID but not the decryption secret.
  5. The viewer downloads the ciphertext and decrypts it locally with the Web Crypto API.

Signed-in owners get an encrypted library without weakening that boundary. The browser creates an RSA-OAEP vault key pair; upload secrets are wrapped to the owner's public key, and the password-encrypted private key is unlocked only in the browser.

The URL fragment is the part after #. Keeping it out of HTTP requests protects it from ordinary request handling, but the browser executing the viewer still has access to it. This is why the delivered viewer code, browser environment, and origin remain part of the trust model.

The owner vault solves a separate problem: a signed-in owner should be able to open previously uploaded captures without having saved every share URL. Wrapped per-upload secrets give the unlocked browser that capability without storing an unencrypted media key in the database.

Engineering decisions

A versioned contract across two runtimes

The uploader uses .NET cryptography and the viewer uses Web Crypto. Both implement the same versioned encrypted-container format, including authenticated headers, key derivation, and tamper rejection. Cross-runtime test vectors help detect incompatible changes before they make existing uploads unreadable.

Separate media, metadata, and ownership

Media bytes and editable metadata use separate derived keys. Renaming or tagging a capture can therefore update its encrypted metadata without rewriting the media object. RSA-OAEP envelopes connect upload secrets to an owner's browser-generated vault.

This separation also limits server-side features: the server cannot inspect private pixels to create thumbnails, run OCR, or reliably enforce real media types. Those operations belong in trusted clients.

Existing capture tools and a replaceable storage boundary

The uploader accepts paths and standard input, making it usable as a post-capture action or shell pipeline. The API accesses blobs through IBlobStorage; the current filesystem implementation keeps deployment simple while making the storage boundary explicit.

A public derivative has its own lifecycle so social previews can be revoked or expired independently of the encrypted original. Copies already downloaded or cached remain outside the server's control.

Project scope

BirdieShot owns the encrypted hosting, organization, and sharing layer. It deliberately integrates with mature capture software instead of reimplementing operating-system capture features.

In scope Out of scope
Client-side encryption and decryption Screen or audio recording
Encrypted media hosting and library management Region/window capture
Private, protected, collection, and public sharing Global hotkey management
Browser-side editing, redaction, and OCR Tray applications and desktop notifications
Upload integrations for existing capture tools Native installers and automatic client updates
Retention, quotas, backups, and administrative tooling DRM or prevention of recipient-side copying

Public embeds are an explicit exception to the private-media model: publishing creates a separate plaintext derivative so Discord and Open Graph crawlers can render it. The encrypted original is unchanged, and the public copy can be expired or revoked, but content already downloaded or cached cannot be recalled.

Technology

Layer Technology Responsibility
Uploader .NET 10 console application File/stdin input, encryption, upload, clipboard integration
API ASP.NET Core 10 minimal API Authentication, opaque blob storage, sharing, lifecycle, administration
Viewer TypeScript, Vite, Web Crypto Decryption, library UI, editing, search, OCR, galleries
Database MariaDB Accounts and non-secret operational metadata
Storage Filesystem behind IBlobStorage Encrypted originals and optional public derivatives
Delivery Docker, Apache or Caddy Container build, TLS termination, reverse proxying
Tests xUnit, Vitest, Playwright Crypto vectors, API behavior, UI logic, critical browser flows

Repository layout

BirdieShot/
├── client/BirdieShot.Uploader/   # Cross-platform encrypted uploader
├── server/BirdieShot.Api/        # ASP.NET Core API and compiled viewer host
├── web/viewer/                    # TypeScript/Vite viewer and owner library
├── tests/                         # xUnit integration and cryptography tests
├── protocol/                      # Versioned encrypted-container specification
├── docs/                          # Platform integration guides
├── docker/                        # Container build and Apache example
└── scripts/                       # Backup, verification, and diagnostics

Getting started

Prerequisites

The commands below use PowerShell. Linux users can use the equivalent shell syntax and follow the Linux integration guide for uploader installation.

1. Obtain the source and build the viewer

Clone your repository into a local working directory, then build from its root:

git clone <your-repository-url> BirdieShot
cd BirdieShot
cd web/viewer
npm ci
npm run build
cd ../..

The Vite build writes the viewer directly to server/BirdieShot.Api/wwwroot so the API can serve the complete application.

2. Create a development database

Create a database and a dedicated local user. For example, from the MariaDB client:

CREATE DATABASE birdieshot CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'birdieshot'@'localhost' IDENTIFIED BY 'birdieshot-dev';
GRANT ALL PRIVILEGES ON birdieshot.* TO 'birdieshot'@'localhost';
FLUSH PRIVILEGES;

BirdieShot creates and updates its tables on startup. The database itself and a user with access to it must already exist.

3. Configure and run the API

Trust the ASP.NET Core development certificate, then override the machine-specific storage and database defaults for this terminal:

dotnet dev-certs https --trust

$env:ConnectionStrings__Database = "Server=localhost;Port=3306;Database=birdieshot;User ID=birdieshot;Password=birdieshot-dev;SslMode=Disabled"
$env:Storage__Path = "$PWD\.data"
$env:PublicBaseUrl = "https://localhost:7238"

dotnet run --project server/BirdieShot.Api --launch-profile https

Open https://localhost:7238 and sign in with the development-only credentials:

Username: admin
Password: birdieshot-local-development

The first sign-in creates the encrypted owner vault. Do this before the first upload. Never reuse the bundled development credentials in a deployed instance.

4. Configure and try the uploader

Keep the API running, open a second terminal at the repository root, and create %APPDATA%\BirdieShot\config.json (including its parent directory if needed):

{
  "Server": "https://localhost:7238",
  "ApiToken": "local-development-token-change-me",
  "ExpirationHours": null
}

Upload a file:

dotnet run --project client/BirdieShot.Uploader -- "C:\path\to\capture.png" --clipboard

The uploader prints the encrypted sharing URL and, with --clipboard, copies it to the clipboard. Keep the complete URL—including the #fragment—because the fragment contains the decryption secret.

Configuration

API settings and deployment variables

ASP.NET Core reads application settings and environment overrides. Double underscores represent nested settings; for example, Storage__Path overrides Storage:Path. Docker Compose translates its BIRDIESHOT_* variables into those API settings.

Variable Description Default
BIRDIESHOT_PUBLIC_URL Public HTTPS origin used in generated links and previews https://shot.birdie.codes
BIRDIESHOT_API_TOKEN Bootstrap uploader credential Required
BIRDIESHOT_OWNER_ID Owner shared by bootstrap admin and token owner
BIRDIESHOT_ADMIN_USERNAME Bootstrap administrator username admin
BIRDIESHOT_ADMIN_PASSWORD Bootstrap administrator password Required
BIRDIESHOT_STORAGE_PATH Host path for persistent blobs and data-protection keys M:/BirdieShot
BIRDIESHOT_BACKUP_PATH Host path containing backup snapshots M:/BirdieShot-Backups
BIRDIESHOT_MAX_BYTES Maximum encrypted upload size 26214400 (25 MiB)
BIRDIESHOT_QUOTA_BYTES Per-owner storage quota; 0 disables it 0
BIRDIESHOT_DEFAULT_EXPIRATION_DAYS Default capture retention; 0 means no expiry 0
BIRDIESHOT_ALLOWED_MEDIA_TYPES Advisory client policy such as image/*,video/mp4 Unrestricted

See docker/.env.example for the complete deployment configuration.

Note

BIRDIESHOT_ALLOWED_MEDIA_TYPES is enforced by official clients, not by the API. Because private originals are encrypted before upload, the server cannot inspect their real media type; a modified client can bypass this policy.

Uploader configuration and capture integrations

BirdieShot.Uploader <path|-> [--name <filename>] [--clipboard] [--config <path>] [--expires <hours|never>]
Option Purpose
<path> Upload a file from disk.
- Read capture bytes from standard input.
--name <filename> Set the encrypted filename and help determine the media type for stdin input.
--clipboard Copy the resulting URL using the platform clipboard integration.
--config <path> Use a non-default uploader configuration file.
--expires <hours|never> Override retention for this upload. Accepted hours are 1–87600.

Configuration can also be supplied with BIRDIESHOT_SERVER, BIRDIESHOT_API_TOKEN, and optional BIRDIESHOT_EXPIRATION_HOURS. The server and token variables must be set together, and environment variables take precedence over the JSON file.

Publish a standalone uploader

Windows x64:

dotnet publish client/BirdieShot.Uploader -p:PublishProfile=win-x64 -o dist/BirdieShot.Uploader

Linux x64:

dotnet publish client/BirdieShot.Uploader -p:PublishProfile=linux-x64 -o "$HOME/.local/lib/birdieshot"

For ShareX, configure an external action with the published executable and arguments "$input" --clipboard, then enable Save image to file and Perform actions. See BirdieShot on Linux for stdin-based commands that avoid unencrypted temporary files where the capture tool permits it.

Development and verification

Run the .NET and viewer unit suites:

dotnet test BirdieShot.sln

cd web/viewer
npm ci
npm test

From the same web/viewer directory, install Playwright's Chromium runtime and run the critical browser flows:

npx playwright install chromium
npm run test:e2e

The test suite covers cross-platform encryption vectors, tamper rejection, owner key wrapping, authenticated library operations, quotas and retention, protected and public sharing, storage safety, and browser accessibility flows.

The Playwright configuration starts a Vite server on 127.0.0.1:4173, and the current critical-flow tests mock API responses. They verify browser behavior and accessibility, but do not prove that a deployed database, uploader, proxy, and API work together.

For a real smoke test, initialize an owner vault, upload a harmless image with the CLI, open the full sharing URL in another browser session, and compare the downloaded original. Then confirm it appears in the owner library and exercise the intended sharing mode.

The viewer build writes directly into the API's wwwroot and clears that output directory. Build from a development checkout or as part of a controlled release. Running Vite alone does not configure an API proxy; use the compiled viewer served by ASP.NET Core for the documented integrated local setup.

Deployment

The included Compose configuration builds the viewer and API into one container. It intentionally connects to an existing MariaDB instance instead of starting a database container.

Copy-Item docker/.env.example docker/.env

Before starting it:

  1. Replace the database password, API token, and admin password in docker/.env with long, unique values.
  2. Set BIRDIESHOT_PUBLIC_URL to the externally reachable HTTPS origin.
  3. Set storage and backup paths to durable host locations.
  4. Ensure MariaDB is reachable with the configured TLS mode and is attached to the external Docker network named shared-database.

Then run:

cd docker
docker compose up --build -d

The container listens on 127.0.0.1:3006 for a local reverse proxy. An Apache reverse-proxy example is included. Another proxy can be used if it forwards to the same local API port and terminates TLS. GET /healthz returns 200 only when the database is reachable.

After deployment, sign in once to initialize the owner vault, create a named upload token from the Tokens panel, configure the uploader, and verify an encrypted round trip before placing the service into regular use.

Release and service boundaries

The Docker build compiles the TypeScript viewer and publishes the .NET API into one runtime image. The application container uses an existing MariaDB service through the external shared-database network; that database and network must be provisioned before Compose starts the app.

Keep the storage mount writable by the container user. The backup mount is read-only to the application, while the host backup scripts manage snapshot creation separately. Database availability is reflected by /healthz, but that endpoint does not validate viewer assets, client-side decryption, OCR models, or a complete upload round trip.

Data and recovery

BirdieShot backups must keep the database and blob storage from the same point in time. The database contains encrypted owner-vault material and wrapped upload keys, so copying ciphertext alone is not a complete backup.

The Windows-oriented scripts in scripts/ support scheduled snapshots, non-destructive restore drills, and read-only storage diagnosis:

# Create a snapshot
powershell -ExecutionPolicy Bypass -File scripts/backup.ps1

# Verify the newest completed snapshot in an isolated MariaDB container
powershell -ExecutionPolicy Bypass -File scripts/verify-backup.ps1

# Compare live database records with blob storage without modifying either
powershell -ExecutionPolicy Bypass -File scripts/diagnose-storage.ps1

Review and adapt the scripts' paths and MariaDB assumptions before using them outside the original Windows/Docker deployment. A successful restore drill is the only reliable proof that a backup is usable.

What must survive a release

Data Why it matters
MariaDB records Accounts, upload records, owner vault material, wrapped secrets, shares, and lifecycle state.
Blob storage Encrypted originals and any explicitly published public derivatives.
Data-protection keys Continuity of server-protected application state across container replacement.
Deployment settings Database access, public origin, bootstrap settings, storage locations, and operational policy.
Complete private share URLs Access to uploads through their original fragment secrets, including legacy uploads without owner envelopes.

A database dump cannot recreate missing ciphertext, and ciphertext alone cannot rebuild the owner library. Coordinate database and file snapshots, then rehearse restore into an isolated environment before relying on the backup.

Security and privacy

What the server can see

  • Random capture and share identifiers
  • Encrypted object sizes and timestamps
  • Account, quota, retention, transfer, and lifecycle data needed to operate the service
  • Explicitly published public derivatives and their public Open Graph metadata

What remains encrypted for private captures

  • Original media bytes
  • Filename and media type
  • Title, tags, favorites, and OCR text
  • Collection names and descriptions; encrypted share manifests protect their payloads
  • Per-capture decryption secrets

Private containers use AES-256-GCM with an authenticated header. HKDF-SHA-256 derives purpose-specific keys, and malformed headers or modified ciphertext are rejected. Password-protected shares derive a local manifest key with PBKDF2-SHA-256; the password and derived key are not sent to the server.

The durable byte-level format is documented in protocol/encryption-v1.md.

Collection membership in the private library still exposes opaque upload identifiers to the server, as described in the protocol. End-to-end encryption hides the protected content; it does not hide every relationship or operational fact.

The login password is submitted to the API for authentication. The protocol's narrower guarantee is that plaintext vault private keys and unwrapped upload secrets are not submitted. Share passwords derive their manifest key locally. A malicious server capable of replacing viewer JavaScript is outside the protection offered by honest-client encryption.

Current limitations

  • Anyone who has a complete encrypted link has its decryption secret and can save or forward the content.

  • Revocation prevents future retrieval from this server; it cannot delete copies already downloaded by a recipient.

  • Disabling public downloads is a convenience control, not DRM.

  • Traffic analysis can still reveal timing, encrypted sizes, request patterns, and the service's network location.

  • Browser extensions, a compromised client, a compromised origin, or malicious replacement JavaScript can access content after decryption.

  • The application has not undergone an external security audit.

  • The current storage provider uses a filesystem. Shared storage and multi-instance coordination need additional deployment design.

  • Private-media type restrictions are advisory client policy because the server receives ciphertext.

  • Browser editing and OCR depend on client resources and the presence of the self-hosted worker/model assets.

  • Legacy uploads without an owner key envelope require their original complete share link for decryption.

  • Native capture, global hotkeys, installers, and automatic client updates remain outside the project's scope.

Troubleshooting

Symptom What to check
API startup or health check fails Confirm MariaDB exists, credentials have table permissions, and the configured TLS mode matches the database.
Local HTTPS requests fail Trust the ASP.NET development certificate and use the launch profile's https://localhost:7238 origin.
Upload succeeds but a link cannot decrypt Preserve the complete #fragment; a URL without it does not contain the media secret.
Uploads do not appear in the owner library Initialize the owner's vault before uploading and align the token owner with the signed-in account.
The page is missing or shows an older viewer Rebuild web/viewer and deploy the resulting API wwwroot together with the server.
OCR fails to initialize Check the browser console and local worker, WASM, and model requests. The prebuild step copies runtime assets into static/ocr.
Compose cannot find its database network Provision the external shared-database network and attach the database service.
Container uploads fail with filesystem errors Verify the durable storage mount and permissions for the image's application user.

Further documentation