15 lines
1.6 KiB
Markdown
15 lines
1.6 KiB
Markdown
## API scaffold
|
|
|
|
The API service currently provides:
|
|
|
|
- `POST /api/v1/auth/register` and `POST /api/v1/auth/login` for username/password accounts. Passwords are stored as Argon2id hashes; successful calls return an opaque 30-day bearer token whose SHA-256 digest is stored in PostgreSQL.
|
|
- `POST /api/v1/auth/logout` to revoke the current session.
|
|
- `POST /api/v1/devices/challenges`, followed by `POST /api/v1/devices`, to register an active device after proof of possession of an ECDSA P-256 signing key.
|
|
- `GET /api/v1/directory/{username}/devices` to return active public device keys, and `DELETE /api/v1/devices/{deviceID}` for the owning account to revoke a device.
|
|
|
|
Device registration currently accepts only the Android foundation's `ecdsa-p256-sha256-v1` public key. The client signs `ee2e-device-registration-v1\0 || challenge_id || \0 || challenge_bytes` with ECDSA/SHA-256; challenge IDs expire after five minutes and are one use. The key format is classical and provisional; it does not implement PQXDH, signed prekey bundles, or the final directory protocol. No private keys are accepted or stored. API registration does not establish a verified peer identity or make calls secure. Rate limiting, account recovery, TLS deployment, and operational security remain incomplete.
|
|
|
|
The API applies its additive database migration at startup. PostgreSQL must first have the base tables from `infrastructure/postgres/init.sql`. Use the `DATABASE_URL` environment variable; do not log or commit connection strings or bearer tokens.
|
|
|
|
Run `go test ./...` to execute the backend tests. Service and account functionality remains a development scaffold.
|