Initial commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Development only. Replace every secret before use.
|
||||
POSTGRES_DB=ee2e
|
||||
POSTGRES_USER=ee2e
|
||||
POSTGRES_PASSWORD=CHANGE_ME_LONG_RANDOM
|
||||
DATABASE_URL=postgres://ee2e:CHANGE_ME_LONG_RANDOM@postgres:5432/ee2e?sslmode=disable
|
||||
API_ADDR=:8080
|
||||
SIGNALING_ADDR=:8081
|
||||
JWT_SIGNING_SECRET=CHANGE_ME_AT_LEAST_32_RANDOM_BYTES
|
||||
PUBLIC_BASE_URL=https://calls.example.invalid
|
||||
TURN_REALM=calls.example.invalid
|
||||
TURN_SHARED_SECRET=CHANGE_ME_LONG_RANDOM
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Secrets
|
||||
.env
|
||||
*.pem
|
||||
*.key
|
||||
*.p12
|
||||
*.jks
|
||||
local.properties
|
||||
|
||||
# Go
|
||||
/backend/bin/
|
||||
/backend/vendor/
|
||||
|
||||
# Android / Gradle
|
||||
.gradle/
|
||||
**/build/
|
||||
.idea/
|
||||
*.iml
|
||||
local.properties
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -0,0 +1,17 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 EE2E Phone Calls contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
@@ -0,0 +1,54 @@
|
||||
# EE2E Phone Calls
|
||||
|
||||
Self-hosted, username-based Android-to-Android encrypted voice calling project.
|
||||
|
||||
**Status:** development scaffold / Milestone M0-M1. This is not a working secure calling product. Cryptographic handshake, SFrame media transforms, WebRTC integration, push delivery and production hardening are intentionally not implemented yet.
|
||||
|
||||
## Architecture baseline
|
||||
- Android: Kotlin, Jetpack Compose, Android Keystore, Core-Telecom
|
||||
- Backend: Go HTTP API and WebSocket signaling
|
||||
- Database: PostgreSQL
|
||||
- Media: WebRTC + Opus + SFrame (endpoint-to-endpoint)
|
||||
- Key agreement: audited PQXDH implementation with a compatible ML-KEM suite; do not invent a hybrid protocol
|
||||
- Relay: coturn
|
||||
- Deployment: self-hosted Docker Compose
|
||||
|
||||
## Quick start (development)
|
||||
|
||||
1. Copy `.env.example` to `.env` and change all secrets.
|
||||
2. Start infrastructure: `docker compose --env-file .env -f infrastructure/compose/docker-compose.yml up --build -d`
|
||||
3. Check API health: `curl http://localhost:8080/healthz`
|
||||
4. Check signaling health: `curl http://localhost:8081/healthz`
|
||||
|
||||
The API currently provides only health and a placeholder registration endpoint. Signaling currently accepts WebSocket connections but does not yet implement authenticated call routing. Do not expose this scaffold to the public Internet.
|
||||
|
||||
## Repository layout
|
||||
- `backend/`: Go services
|
||||
- `android/`: native Android starter project
|
||||
- `docs/`: architecture, threat model, protocols and milestones
|
||||
- `infrastructure/`: Docker Compose, coturn and database initialization
|
||||
- `tests/`: planned integration and security test plans
|
||||
|
||||
## Development commands
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
go test ./...
|
||||
go run ./cmd/api
|
||||
```
|
||||
|
||||
Android build (requires Android Studio / Android SDK and a locally installed Gradle):
|
||||
|
||||
```bash
|
||||
cd android
|
||||
gradle assembleDebug
|
||||
```
|
||||
|
||||
## Security rules
|
||||
1. Never send private keys, shared secrets or plaintext audio to the backend.
|
||||
2. Do not mark a call secure until peer identity and media encryption are authenticated.
|
||||
3. Keep signaling and media encryption separate; TLS/DTLS-SRTP alone is not the project's E2EE guarantee.
|
||||
4. Do not implement cryptographic primitives or a custom PQXDH variant.
|
||||
5. Treat all cryptographic integrations as blocked until library selection, interoperability tests and review are complete.
|
||||
|
||||
See `docs/` before implementing protocol or production deployment work.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
# Security policy
|
||||
|
||||
This repository is an early development scaffold and is not suitable for handling sensitive calls.
|
||||
|
||||
## Reporting
|
||||
Do not publish exploitable vulnerabilities in public issue trackers. Until a private security contact is configured, keep deployments local and do not use real credentials or private conversations.
|
||||
|
||||
## Security invariants
|
||||
- Server-side services handle signaling and public key material only.
|
||||
- Private identity keys and call secrets remain on endpoints.
|
||||
- TURN relays opaque encrypted media packets.
|
||||
- Call authentication binds the peer device identity, call ID, negotiated media parameters and transcript.
|
||||
- A failed identity or media-authentication check must fail closed.
|
||||
- Logs must not contain SDP secrets, tokens, prekeys, private keys, media payloads or contact graphs.
|
||||
|
||||
## Release gate
|
||||
A release must not claim E2EE until the complete endpoint-to-endpoint media path, key management, peer authentication, replay protection and server-compromise tests have been independently reviewed.
|
||||
@@ -0,0 +1,27 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.ee2e.app"
|
||||
compileSdk = 35
|
||||
defaultConfig {
|
||||
applicationId = "com.ee2e.app"
|
||||
minSdk = 29
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "0.1.0"
|
||||
}
|
||||
buildFeatures { compose = true }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("androidx.compose:compose-bom:2024.12.01"))
|
||||
implementation("androidx.activity:activity-compose:1.10.0")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<application android:theme="@android:style/Theme.Material.Light.NoActionBar" android:label="EE2E Phone Calls" android:allowBackup="false">
|
||||
<activity android:name=".MainActivity" android:exported="true">
|
||||
<intent-filter><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/></intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ee2e.app
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent { EE2EHome() }
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun EE2EHome() {
|
||||
MaterialTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize().padding(24.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text("EE2E Phone Calls", style = MaterialTheme.typography.headlineMedium)
|
||||
Spacer(Modifier.height(12.dp))
|
||||
Text("Development scaffold · v0.1.0")
|
||||
Spacer(Modifier.height(24.dp))
|
||||
Text("Secure calling is not implemented yet.")
|
||||
Text("Next: device identity and cryptographic proof of concept.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
plugins { id("com.android.application") version "8.7.3" apply false; id("org.jetbrains.kotlin.android") version "2.0.21" apply false; id("org.jetbrains.kotlin.plugin.compose") version "2.0.21" apply false }
|
||||
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
android.useAndroidX=true
|
||||
kotlin.code.style=official
|
||||
@@ -0,0 +1,4 @@
|
||||
pluginManagement { repositories { google(); mavenCentral(); gradlePluginPortal() } }
|
||||
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS); repositories { google(); mavenCentral() } }
|
||||
rootProject.name = "EE2EPhoneCalls"
|
||||
include(":app")
|
||||
@@ -0,0 +1,12 @@
|
||||
FROM golang:1.23-alpine AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum* ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
ARG SERVICE=api
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/service ./cmd/${SERVICE}
|
||||
|
||||
FROM gcr.io/distroless/static-debian12:nonroot
|
||||
COPY --from=build /out/service /service
|
||||
USER nonroot:nonroot
|
||||
ENTRYPOINT ["/service"]
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
.PHONY: test fmt vet
|
||||
test:
|
||||
go test ./...
|
||||
fmt:
|
||||
gofmt -w ./cmd
|
||||
vet:
|
||||
go vet ./...
|
||||
@@ -0,0 +1 @@
|
||||
Run `go mod tidy`, then `go test ./...`. Services are deliberately incomplete placeholders.
|
||||
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"status": "ok", "service": "api"})
|
||||
})
|
||||
// Placeholder only: registration/authentication is not implemented.
|
||||
mux.HandleFunc("POST /api/v1/auth/register", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "registration not implemented", http.StatusNotImplemented)
|
||||
})
|
||||
addr := os.Getenv("API_ADDR")
|
||||
if addr == "" {
|
||||
addr = ":8080"
|
||||
}
|
||||
srv := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
log.Printf("API listening on %s", addr)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHealthEndpoint(t *testing.T) {
|
||||
req := httptest.NewRequest("GET", "/healthz", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) })
|
||||
mux.ServeHTTP(rec, req)
|
||||
if rec.Code != 200 {
|
||||
t.Fatalf("want 200, got %d", rec.Code)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("ok\n"))
|
||||
})
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "key directory not implemented", http.StatusNotImplemented)
|
||||
})
|
||||
srv := &http.Server{Addr: ":8082", Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
log.Printf("keyserver listening on %s", srv.Addr)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("ok\n"))
|
||||
})
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "push dispatcher not implemented", http.StatusNotImplemented)
|
||||
})
|
||||
srv := &http.Server{Addr: ":8083", Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
log.Printf("push service listening on %s", srv.Addr)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write([]byte("ok\n"))
|
||||
})
|
||||
mux.HandleFunc("GET /ws/v1/signaling", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Deliberately disabled until authentication, authorization, message limits,
|
||||
// replay protection and routing are implemented.
|
||||
http.Error(w, "signaling is not enabled in scaffold", http.StatusNotImplemented)
|
||||
})
|
||||
addr := os.Getenv("SIGNALING_ADDR")
|
||||
if addr == "" {
|
||||
addr = ":8081"
|
||||
}
|
||||
srv := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
|
||||
log.Printf("signaling service listening on %s", addr)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module github.com/ee2e-phone-calls/backend
|
||||
|
||||
go 1.23
|
||||
@@ -0,0 +1,29 @@
|
||||
# Architecture
|
||||
|
||||
## Components
|
||||
|
||||
1. Android client owns device identity, private keys, call secrets, media encryption and audio capture/playback.
|
||||
2. Go API handles account registration, device registration and public directory operations.
|
||||
3. Go signaling forwards authenticated, size-limited call setup messages. It is not a media server.
|
||||
4. Key directory distributes public identity/prekey bundles. It cannot create or recover private keys.
|
||||
5. coturn provides STUN/TURN traversal and relays encrypted packets only.
|
||||
6. PostgreSQL stores account/device metadata and public key material.
|
||||
|
||||
## Media security boundary
|
||||
WebRTC DTLS-SRTP protects each transport leg. It is not by itself sufficient for endpoint-to-endpoint confidentiality when a media intermediary terminates a leg. SFrame (RFC 9605) is the intended end-to-end media protection layer. The SFrame key-management protocol and sender authentication must be designed and tested separately.
|
||||
|
||||
## Call flow (target)
|
||||
1. Caller obtains callee public device/prekey bundle.
|
||||
2. Caller validates device identity or presents an explicit unverified warning.
|
||||
3. Endpoints run a maintained PQXDH-compatible handshake and authenticate the transcript.
|
||||
4. Endpoints derive fresh, directional SFrame sender keys using a reviewed key schedule.
|
||||
5. SDP/ICE negotiation is forwarded by signaling.
|
||||
6. Media flows directly or through coturn; SFrame ciphertext is opaque to relays.
|
||||
7. Network changes trigger ICE restart/recovery without reusing key/nonce pairs.
|
||||
|
||||
## Explicit non-goals for MVP
|
||||
- PSTN/SIM voice-call interception or encryption
|
||||
- Group calls and video
|
||||
- Desktop clients
|
||||
- Server-side media recording
|
||||
- Phone-number identity
|
||||
@@ -0,0 +1,24 @@
|
||||
# Cryptography implementation decisions
|
||||
|
||||
## Status: selection gate open
|
||||
|
||||
The target is a maintained Signal-protocol implementation supporting the exact PQXDH suite selected by the project, including ML-KEM where supported by that implementation. Do not assume that a standalone ML-KEM library plus X25519 automatically implements PQXDH.
|
||||
|
||||
Before selecting a dependency, record:
|
||||
- upstream project and exact version/commit
|
||||
- license and maintenance status
|
||||
- supported Android ABIs and API levels
|
||||
- PQXDH version and exact ML-KEM parameter set
|
||||
- wire-format compatibility and test vectors
|
||||
- security audit history
|
||||
- key storage and zeroization behavior
|
||||
- interoperability test results
|
||||
|
||||
## Media
|
||||
Use an RFC 9605-compatible SFrame implementation integrated at the WebRTC encoded-frame boundary. Confirm Android native API support and verify that every audio sender has independently authenticated key material. Do not reuse a symmetric group key as proof of sender identity.
|
||||
|
||||
## Key schedule
|
||||
The final protocol document must define domain-separated derivation for call ID, transcript hash, direction, sender/device ID, epoch and SFrame context. It must define rotation, counter/nonce handling, replay windows, teardown and recovery. This scaffold intentionally contains no cryptographic implementation.
|
||||
|
||||
## Passwords
|
||||
Use a vetted Argon2id implementation with calibrated parameters and per-user salts. Do not use passwords as encryption keys for call media.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Development deployment
|
||||
|
||||
1. Install Docker Engine and Compose plugin.
|
||||
2. Copy `.env.example` to `.env` and set unique secrets.
|
||||
3. Start with `docker compose --env-file .env -f infrastructure/compose/docker-compose.yml up --build -d`.
|
||||
4. Check `curl http://localhost:8080/healthz` and `curl http://localhost:8081/healthz`.
|
||||
5. View logs with `docker compose --env-file .env -f infrastructure/compose/docker-compose.yml logs -f`.
|
||||
|
||||
This Compose file is for local development. It intentionally does not publish coturn relay ports or configure production TLS. Before Internet deployment, configure DNS, TLS, firewall/relay port range, coturn shared-secret authentication, database backups, secret management, monitoring and rate limits. Do not use example credentials in production.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Milestones
|
||||
|
||||
| ID | Goal | Exit criteria |
|
||||
|---|---|---|
|
||||
| M0 | Architecture/library research | Approved threat model; audited crypto and SFrame integration candidates selected |
|
||||
| M1 | Repo and local infrastructure | Go tests pass; Compose health checks pass |
|
||||
| M2 | Accounts and device directory | Registration, authentication, device and public-key APIs tested |
|
||||
| M3 | Android foundation | Compose app builds; registration/login and Keystore identity skeleton work |
|
||||
| M4 | PQ key agreement | Two devices interoperate with selected PQXDH implementation and identity verification |
|
||||
| M5 | Basic WebRTC audio | Two Android devices exchange Opus audio in a test environment |
|
||||
| M6 | SFrame E2EE | Encoded audio encrypted/decrypted at endpoints; relay cannot decrypt |
|
||||
| M7 | Cellular resilience | CGNAT/TURN and network-change test matrix passes |
|
||||
| M8 | Background calling | Core-Telecom and FCM incoming call flow works on supported devices |
|
||||
| M9 | Security validation | MITM, replay, revocation and server-compromise tests pass; review completed |
|
||||
| M10 | Release | Reproducible deployment, documentation and signed Android release |
|
||||
|
||||
Indicative effort for one experienced developer: roughly 15–22 weeks, with cryptographic and Android WebRTC integration uncertainty. This is a planning estimate, not a delivery commitment.
|
||||
|
||||
## Immediate work order
|
||||
1. Verify candidate PQXDH library and Android SFrame encoded-frame support (M0).
|
||||
2. Bring up Go services and PostgreSQL locally (M1).
|
||||
3. Build Android shell and device identity storage skeleton (M3 foundation).
|
||||
4. Implement API and public device directory (M2).
|
||||
5. Only then integrate call setup and media.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Network design
|
||||
|
||||
## Target transports
|
||||
- IPv4 and IPv6
|
||||
- ICE host and server-reflexive candidates
|
||||
- TURN over UDP as preferred relay
|
||||
- TURN over TCP/TLS as restrictive-network fallback
|
||||
- Direct peer connectivity where possible
|
||||
|
||||
## Initial ports
|
||||
- API/signaling HTTPS/WSS: TCP 443 (or 8080/8081 in local development)
|
||||
- STUN/TURN: UDP/TCP 3478
|
||||
- TURN TLS: TCP 5349
|
||||
- TURN relay range: configure a bounded UDP range and open it in the firewall
|
||||
|
||||
Port 443 cannot be shared blindly between HTTPS and TURN-TLS. Use a dedicated IP/listener or explicit routing architecture. TURN credentials must be short-lived and generated using the coturn REST shared-secret mechanism.
|
||||
|
||||
## Recovery
|
||||
Observe Android network callbacks and WebRTC ICE state. On network changes or failed ICE, perform a controlled ICE restart. Preserve the authenticated call session only while its cryptographic state remains valid. Never reset packet counters under an unchanged key; rekey if required by the media protocol.
|
||||
|
||||
## Test matrix
|
||||
LTE/LTE, 5G/5G, Wi-Fi/Wi-Fi, Wi-Fi/LTE, IPv4-only, IPv6-only, dual-stack, CGNAT, UDP blocked, TCP/TLS relay, airplane-mode interruption and handover.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Signaling protocol (draft)
|
||||
|
||||
WebSocket endpoint: `/ws/v1/signaling` over TLS.
|
||||
|
||||
Every message must be authenticated, versioned, size-limited and bound to a call ID and registered device ID. The draft message envelope:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"message_id": "random-unique-id",
|
||||
"call_id": "random-call-id",
|
||||
"sender_device_id": "device-id",
|
||||
"recipient_device_id": "device-id",
|
||||
"type": "CALL_REQUEST",
|
||||
"sent_at": "RFC3339 timestamp",
|
||||
"payload": "base64-encoded authenticated protocol payload"
|
||||
}
|
||||
```
|
||||
|
||||
Initial message types: `CALL_REQUEST`, `CALL_ACCEPT`, `CALL_REJECT`, `CALL_CANCEL`, `CALL_END`, `SDP_OFFER`, `SDP_ANSWER`, `ICE_CANDIDATE`, `KEY_CONFIRMATION`, `KEY_ROTATION`, `PING`, `PONG`.
|
||||
|
||||
This is a draft envelope, not a finalized wire protocol. Before implementation, specify canonical serialization, signature/MAC coverage, replay windows, message ordering, idempotency, maximum payload sizes, device authorization and error behavior. Never trust client-supplied sender IDs without binding them to the authenticated session.
|
||||
@@ -0,0 +1,22 @@
|
||||
# Testing strategy
|
||||
|
||||
## Go
|
||||
- Unit tests for validation and state transitions
|
||||
- API integration tests with disposable PostgreSQL
|
||||
- WebSocket authentication, authorization and replay tests
|
||||
- Fuzz tests for message parsing and size limits
|
||||
|
||||
## Android
|
||||
- Unit tests for repositories and call state machine
|
||||
- Instrumentation tests for Keystore and lifecycle
|
||||
- Device tests for audio routing and background calling
|
||||
|
||||
## Security release gates
|
||||
- Identity substitution and MITM attempts fail closed
|
||||
- Replayed signaling and media packets are rejected
|
||||
- TURN and signaling captures contain no decodable audio
|
||||
- Server/database compromise does not expose media keys
|
||||
- Device revocation blocks subsequent call setup
|
||||
- Key rotation and ICE restart do not reuse key/nonce pairs
|
||||
|
||||
No security claim should be made based only on a successful encrypted packet capture. Verify endpoint authentication and actual decryption boundaries.
|
||||
@@ -0,0 +1,32 @@
|
||||
# Threat model
|
||||
|
||||
## Assets
|
||||
Device identity private keys, prekey private material, call session secrets, SFrame sender keys, microphone audio, account credentials and contact relationships.
|
||||
|
||||
## Adversaries
|
||||
- Malicious or compromised signaling/API server
|
||||
- Compromised TURN relay
|
||||
- Network operator observing traffic metadata
|
||||
- Active network attacker modifying or replaying signaling
|
||||
- Stolen or rooted endpoint
|
||||
- Malicious registered contact
|
||||
|
||||
## Protected properties
|
||||
- Confidentiality and integrity of audio between authenticated endpoints
|
||||
- Authentication of the remote device
|
||||
- Forward secrecy properties provided by the selected audited handshake/session protocol
|
||||
- Replay resistance and device revocation
|
||||
|
||||
## Limitations
|
||||
The mobile operator can observe that the device communicates, timing, IP/network metadata and approximate traffic volume. Endpoint malware, a compromised OS, microphone permissions abuse and social engineering are outside the guarantee of network E2EE. Push providers may observe opaque notification delivery metadata.
|
||||
|
||||
## Required mitigations
|
||||
- QR/safety-number verification
|
||||
- Signed identity/prekey bundles
|
||||
- One-time prekey atomic consumption
|
||||
- Strict transcript binding and replay protection
|
||||
- Directional media keys and nonce uniqueness
|
||||
- Short-lived authenticated TURN credentials
|
||||
- Minimal server logs and retention
|
||||
- Secure local storage and device revocation
|
||||
- Independent cryptographic review before release
|
||||
@@ -0,0 +1,55 @@
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: ../../backend
|
||||
dockerfile: Dockerfile
|
||||
args: { SERVICE: api }
|
||||
environment:
|
||||
API_ADDR: :8080
|
||||
DATABASE_URL: ${DATABASE_URL}
|
||||
ports: ["127.0.0.1:8080:8080"]
|
||||
depends_on:
|
||||
postgres: { condition: service_healthy }
|
||||
restart: unless-stopped
|
||||
|
||||
signaling:
|
||||
build:
|
||||
context: ../../backend
|
||||
dockerfile: Dockerfile
|
||||
args: { SERVICE: signaling }
|
||||
environment: { SIGNALING_ADDR: ":8081" }
|
||||
ports: ["127.0.0.1:8081:8081"]
|
||||
restart: unless-stopped
|
||||
|
||||
keyserver:
|
||||
build:
|
||||
context: ../../backend
|
||||
dockerfile: Dockerfile
|
||||
args: { SERVICE: keyserver }
|
||||
ports: ["127.0.0.1:8082:8082"]
|
||||
restart: unless-stopped
|
||||
|
||||
push:
|
||||
build:
|
||||
context: ../../backend
|
||||
dockerfile: Dockerfile
|
||||
args: { SERVICE: push }
|
||||
ports: ["127.0.0.1:8083:8083"]
|
||||
restart: unless-stopped
|
||||
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-ee2e}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-ee2e}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||||
volumes: ["postgres_data:/var/lib/postgresql/data", "../postgres/init.sql:/docker-entrypoint-initdb.d/001-init.sql:ro"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ee2e} -d ${POSTGRES_DB:-ee2e}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -0,0 +1,11 @@
|
||||
# Example only; configure secrets and firewall before enabling.
|
||||
listening-port=3478
|
||||
tls-listening-port=5349
|
||||
realm=calls.example.invalid
|
||||
use-auth-secret
|
||||
static-auth-secret=REPLACE_WITH_LONG_RANDOM_SECRET
|
||||
no-cli
|
||||
no-multicast-peers
|
||||
no-loopback-peers
|
||||
# Configure external-ip, relay-ip and min-port/max-port for your host.
|
||||
# Do not expose this example configuration as-is.
|
||||
@@ -0,0 +1,24 @@
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id UUID PRIMARY KEY,
|
||||
username VARCHAR(32) NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS devices (
|
||||
id UUID PRIMARY KEY,
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
identity_public_key BYTEA NOT NULL,
|
||||
status TEXT NOT NULL CHECK (status IN ('active','revoked')),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS prekeys (
|
||||
device_id UUID NOT NULL REFERENCES devices(id) ON DELETE CASCADE,
|
||||
key_id BIGINT NOT NULL,
|
||||
key_type TEXT NOT NULL,
|
||||
public_key BYTEA NOT NULL,
|
||||
consumed_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (device_id, key_id, key_type)
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
# Test suites
|
||||
|
||||
Add backend API, signaling protocol, Android instrumentation, cryptographic interoperability, media encryption and network handover tests here. Security acceptance criteria are in `docs/TESTING.md`.
|
||||
Reference in New Issue
Block a user