Skip to content

Repository files navigation

🔐 DockOTP

Open-source OTP management that keeps your secrets under your control. Gizli anahtarlarınızı kendi kontrolünüzde tutan açık kaynak OTP yönetimi.

Docker tabanlı, tamamen lokal çalışan bir TOTP (2FA) yöneticisi. Telefonu elinize almadan, çoklu hesaplarınızın doğrulama kodlarını bilgisayarınızda üretin ve kopyalayın.

License: MIT Release Docker Python Flask Local first

English · Türkçe

DockOTP dashboard

English

DockOTP runs a small TOTP generator inside an isolated Docker container. Your secrets never leave your machine and the panel is reachable only over localhost. It supports multiple accounts, QR-code import, light/dark themes and a Turkish/English interface.

Features

  • 🔑 Multiple accounts — manage all your TOTP secrets in one panel
  • 📷 QR import — upload an image, drag & drop, or scan with your camera (decoded fully in your browser)
  • 📦 Bulk import from Google Authenticator — scan its "Export accounts" QR to import every account at once
  • 🔗 otpauth:// support — paste a link and digits/period/algorithm are detected automatically
  • ⚙️ Manual entry with advanced options (6/7/8 digits · 15/30/60/90/120 s period · SHA1/256/512)
  • 🌗 Light & dark themes with a toggle (preference is remembered)
  • 🌍 Turkish / English interface toggle
  • 📋 One-click copy with a live countdown per account
  • 🙈 Hide codes — a per-account eye toggle masks codes (•••) against shoulder-surfing; the state is remembered
  • 💾 Backup & restore — export everything to a JSON file; import accepts a JSON backup or a QR image (including a Google Authenticator export)
  • 🪟 System-tray apps for Windows — a per-account tray app and a global one listing every account
  • 🔌 JSON API for automation

Screenshots

Dashboard (dark) Add account

Light theme:

DockOTP light theme

Quick start

git clone https://github.com/fatihdagdelenn/dockotp.git
cd dockotp
docker compose up -d --build

Then open http://localhost:8080 and add your first account.

Windows users can instead double-click scripts\install.bat.

The panel binds only to 127.0.0.1, so it is never exposed to your network or the internet.

Adding accounts

Click Add account and use any of these:

  1. QR codeUpload QR code, drag an image onto the box, or Scan with camera. The QR is decoded in your browser and never uploaded anywhere.
  2. otpauth:// link — paste it into the secret field; the label, issuer, digits, period and algorithm are filled automatically.
  3. Manual — type the Base32 secret and, if needed, open Advanced settings to set digits, period and algorithm.

Migrating from Google Authenticator? In the app tap ⋮ → Transfer accounts → Export accounts, pick the accounts and show the QR. Scan or upload that QR in DockOTP and every account is imported in one step.

A TOTP secret is the Base32 key a service shows during 2FA setup (e.g. JBSWY3DPEHPK3PXP), usually under "manual / setup key" next to the QR code.

Themes & language

Top-right of every page you'll find a language button (TR ⇄ EN) and a theme button (light ⇄ dark). Both remember your choice in the browser, and on first visit the app follows your system/browser preferences.

Tray apps (Windows)

Two flavours, both downloadable from the panel:

  • Per-account — the download icon on each card produces a tray app bound to that single account. Left-click copies its code.
  • GlobalDownload tray app in the header produces one tray app that lists all accounts; right-click to pick an account and copy its code.

Run a downloaded script with:

powershell.exe -ExecutionPolicy Bypass -File dockotp-GitHub.ps1

API

Method & path Description
GET /api/accounts All accounts with current codes and remaining seconds
GET /api/otp/<id> A single account's current code
GET /api/otp First account (legacy flat shape)
GET /healthz Health check

Example — GET /api/accounts:

{
  "accounts": [
    { "id": "a1b2c3d4", "label": "alice", "issuer": "GitHub",
      "now": "123456", "prev": "654321", "next": "111222",
      "remaining": 18, "period": 30, "digits": 6 }
  ]
}

Project structure

dockotp/
├── app.py                # Flask app: TOTP logic, routes, tray-script generation
├── templates/
│   ├── panel.html        # Dashboard (multi-account, themes, i18n)
│   └── add.html          # Add-account page (QR, otpauth, manual)
├── static/jsQR.js        # Vendored client-side QR decoder
├── scripts/              # Windows .bat helpers (install/start/stop/uninstall)
├── data/                 # Local volume — your config.json lives here (git-ignored)
├── Dockerfile
└── docker-compose.yml

Security & threat model

DockOTP is built for personal, single-machine use.

  • The container binds only to 127.0.0.1 — not your LAN, not the internet.
  • Secrets stay on your machine in data/config.json, written with 600 permissions.
  • State-changing requests (/add, /delete, /reset) are protected against cross-site (CSRF) requests via a same-origin check, since the panel has no login.

Be aware (honest threat model):

  • ⚠️ Secrets are currently stored in plaintext in config.json. Anyone with read access to that file can read them. Keep it on a machine with full-disk encryption.
  • ⚠️ The panel has no authentication. Another local user or process can reach localhost:8080. Be careful on shared machines.

Both points are on the roadmap (PIN-based, encrypted-at-rest secrets). For high-security or corporate use, prefer a hardware MFA solution.

Container management

Action Windows Linux / macOS
Install scripts\install.bat docker compose up -d --build
Start scripts\start.bat docker compose up -d
Stop scripts\stop.bat docker compose stop
Remove scripts\uninstall.bat docker compose down
Logs docker compose logs -f

Roadmap

  • PIN/password lock with encrypted-at-rest secrets
  • QR export (move a secret back to your phone)
  • Linux/macOS tray / menu-bar app
  • Published image on Docker Hub / GHCR + CI

Contributing

Issues and pull requests are welcome at the project repository.

License

Released under the MIT license.


Türkçe

DockOTP, izole bir Docker container içinde küçük bir TOTP üreticisi çalıştırır. Gizli anahtarlarınız makinenizden çıkmaz ve panele yalnızca localhost üzerinden erişilir. Çoklu hesap, QR ile içe aktarma, açık/koyu tema ve Türkçe/İngilizce arayüz destekler.

Özellikler

  • 🔑 Çoklu hesap — tüm TOTP secret'larınızı tek panelde yönetin
  • 📷 QR ile içe aktarma — görsel yükleyin, sürükleyip bırakın ya da kamerayla tarayın (QR tamamen tarayıcıda çözülür)
  • 📦 Google Authenticator'dan toplu içe aktarma — "Hesapları dışa aktar" QR'ını okutarak tüm hesapları tek seferde alın
  • 🔗 otpauth:// desteği — bağlantıyı yapıştırın, hane/periyot/algoritma otomatik algılanır
  • ⚙️ Gelişmiş seçeneklerle elle giriş (6/7/8 hane · 15/30/60/90/120 sn · SHA1/256/512)
  • 🌗 Açık & koyu tema geçişi (tercih hatırlanır)
  • 🌍 Türkçe / İngilizce arayüz
  • 📋 Hesap başına canlı geri sayımla tek tık kopyalama
  • 🙈 Kodları gizleme — hesap başına göz düğmesi kodu (•••) maskeler (omuz üstünden bakanlara karşı); durum hatırlanır
  • 💾 Yedekle & geri yükle — her şeyi JSON dosyasına aktarın; içe aktarma JSON yedeği veya QR görseli kabul eder (Google Authenticator dışa aktarımı dahil)
  • 🪟 Windows için sistem tepsisi uygulamaları — hesaba özel ve tüm hesapları listeleyen global sürüm
  • 🔌 Otomasyon için JSON API

Ekran görüntüleri

Panel (koyu) Hesap ekleme

Açık tema:

DockOTP açık tema

Hızlı başlangıç

git clone https://github.com/fatihdagdelenn/dockotp.git
cd dockotp
docker compose up -d --build

Ardından http://localhost:8080 adresini açıp ilk hesabınızı ekleyin.

Windows kullanıcıları scripts\install.bat dosyasına çift tıklayabilir.

Panel yalnızca 127.0.0.1'e bağlanır; ağınıza veya internete asla açılmaz.

Hesap ekleme

Hesap ekle'ye tıklayın ve şu yollardan birini kullanın:

  1. QR kodQR kod yükle, görseli kutuya sürükleyin ya da Kamera ile tara. QR tarayıcıda çözülür, hiçbir yere gönderilmez.
  2. otpauth:// bağlantısı — secret alanına yapıştırın; etiket, issuer, hane, periyot ve algoritma otomatik dolar.
  3. Elle — Base32 secret'i yazın; gerekiyorsa Gelişmiş ayarlar'dan hane/periyot/algoritma seçin.

Google Authenticator'dan mı geçiyorsun? Uygulamada ⋮ → Hesapları aktar → Hesapları dışa aktar'a dokun, hesapları seçip QR'ı göster. Bu QR'ı DockOTP'de okut ya da yükle; tüm hesaplar tek adımda içe aktarılır.

TOTP secret, bir servisin 2FA kurulumunda gösterdiği Base32 anahtardır (ör. JBSWY3DPEHPK3PXP); genelde QR kodun yanındaki "manuel / setup key" seçeneğinde bulunur.

Tema ve dil

Her sayfanın sağ üstünde bir dil düğmesi (TR ⇄ EN) ve bir tema düğmesi (açık ⇄ koyu) vardır. İkisi de tercihinizi tarayıcıda saklar; ilk açılışta uygulama sistem/tarayıcı tercihinizi izler.

Tray uygulamaları (Windows)

İki tür, ikisi de panelden indirilir:

  • Hesaba özel — her karttaki indirme ikonu, yalnızca o hesaba bağlı bir tray uygulaması üretir. Sol tık kodunu kopyalar.
  • Global — başlıktaki Tray app indir, tüm hesapları listeleyen tek bir tray uygulaması üretir; sağ tıkla hesabı seçip kodunu kopyalarsınız.

İndirilen scripti çalıştırmak için:

powershell.exe -ExecutionPolicy Bypass -File dockotp-GitHub.ps1

API

Yöntem ve yol Açıklama
GET /api/accounts Tüm hesaplar, güncel kodları ve kalan süreleriyle
GET /api/otp/<id> Tek bir hesabın güncel kodu
GET /api/otp İlk hesap (eski düz format)
GET /healthz Sağlık kontrolü

Örnek — GET /api/accounts:

{
  "accounts": [
    { "id": "a1b2c3d4", "label": "alice", "issuer": "GitHub",
      "now": "123456", "prev": "654321", "next": "111222",
      "remaining": 18, "period": 30, "digits": 6 }
  ]
}

Proje yapısı

dockotp/
├── app.py                # Flask uygulaması: TOTP mantığı, route'lar, tray script üretimi
├── templates/
│   ├── panel.html        # Panel (çoklu hesap, tema, i18n)
│   └── add.html          # Hesap ekleme sayfası (QR, otpauth, elle)
├── static/jsQR.js        # Gömülü, tarayıcı tarafı QR çözücü
├── scripts/              # Windows .bat yardımcıları (install/start/stop/uninstall)
├── data/                 # Lokal volume — config.json burada (git'e girmez)
├── Dockerfile
└── docker-compose.yml

Güvenlik ve tehdit modeli

DockOTP kişisel, tek makinelik kullanım için tasarlanmıştır.

  • Container yalnızca 127.0.0.1'e bağlanır — ne LAN'a ne internete.
  • Secret'lar makinenizde data/config.json içinde, 600 izinleriyle saklanır.
  • Panelde giriş olmadığından, state değiştiren istekler (/add, /delete, /reset) aynı-köken kontrolüyle siteler arası (CSRF) isteklere karşı korunur.

Bilmeniz gerekenler (dürüst tehdit modeli):

  • ⚠️ Secret'lar şu an config.json içinde düz metin tutulur. Dosyayı okuyabilen herkes görebilir. Disk şifrelemesi olan bir makinede tutun.
  • ⚠️ Panelde kimlik doğrulama yoktur. Makinedeki başka bir kullanıcı/işlem localhost:8080'e erişebilir. Paylaşımlı makinelerde dikkatli olun.

İki nokta da yol haritasında (PIN tabanlı, şifreli saklama). Yüksek güvenlik gereken ortamlarda donanım tabanlı bir MFA çözümü tercih edin.

Container yönetimi

İşlem Windows Linux / macOS
Kur scripts\install.bat docker compose up -d --build
Başlat scripts\start.bat docker compose up -d
Durdur scripts\stop.bat docker compose stop
Kaldır scripts\uninstall.bat docker compose down
Loglar docker compose logs -f

Yol haritası

  • PIN/parola kilidi ve şifreli (at-rest) secret saklama
  • QR dışa aktarma (secret'i telefona geri taşıma)
  • Linux/macOS tray / menü-çubuğu uygulaması
  • Docker Hub / GHCR'de yayınlanmış imaj + CI

Katkıda bulunma

Issue ve pull request'ler için proje deposu.

Lisans

MIT lisansı ile dağıtılmaktadır.

About

Docker tabanlı lokal TOTP üretici.

Topics

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages