A Twilio code (and TOTP for Bubbl staff) opens a session. Redfly issues 15-minute Ed25519-signed PASETO tokens and publishes revocations and telemetry over Pulsar.
Sign-in flow
POST /v1/auth/codewith{phone}: Redfly normalizes the number to E.164, applies rate limits, generates a 6-digit code, stores its HMAC and sends it through Twilio.POST /v1/auth/verifywith{phone, code}: the code is valid for 10 minutes and allows 5 wrong attempts.- If the user holds a Bubbl staff role, Redfly requires
POST /v1/auth/totpbefore issuing a session. - Redfly creates a sign-in session (12 h idle, 30 days at most) and returns a refresh cookie and a PASETO.
Tokens and keys
- Format: PASETO v4.public, signed with Ed25519, valid for 15 minutes.
- Claims:
sub,sid,ten,app,iat,exp,jti. - Refresh:
POST /v1/auth/refreshwith the session cookie returns a new PASETO. GET /v1/auth/keyspublishes the current and previous Ed25519 public keys with key ids. Apps and the WordPress plugin cache them and refetch on an unknown key id.- The signing key path (
REDFLY_AUTH_KEY_PATH) holds the current key plus the previous one during rotation.
Revocation
Signing out, an admin revocation or a suspension publishes {scope: token|session|user, id, revoked_before, exp} to persistent://odssbc/redfly/revocations, keyed by user id. Each app holds a deny-list in SeaWave until each entry’s exp.
Device app passwords
POST /v1/auth/app-passwordsrequires a full sign-in and returns a random secret once.- Only an Argon2id hash is stored. Each password has a name and is scoped to
sync:devices. - Bubbl verifies DAV Basic credentials through
POST /v1/auth/app-passwords/verify(service-to-service mTLS) and caches the result briefly. DELETE /v1/auth/app-passwords/{id}revokes a password.
Authorization
The Shiro realm RedflyTokenRealm verifies the PASETO and loads roles from user_role.
| Role | Permissions |
|---|---|
platform-admin | All permissions, across all tenants |
tenant-admin | db:*:read, db:*:write, telemetry:read and users:write, within the user’s own tenants |
operator | telemetry:read, across all tenants |
user | No db:* permissions |
/v1/db/{entity} requires db:<entity>:read (GET) or db:<entity>:write (PUT). Results are limited to the caller’s tenants, apart from platform-admin.
REST interfaces
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /v1/auth/code | none, rate-limited | Send a sign-in code |
| POST | /v1/auth/verify | none, rate-limited | Verify the code, then start a session or ask for TOTP |
| POST | /v1/auth/totp | pending session | Second factor for Bubbl staff |
| POST | /v1/auth/totp/enroll | session | Enroll TOTP (returns provisioning URI once) |
| POST | /v1/auth/refresh | session cookie | Issue a new PASETO |
| POST | /v1/auth/logout | session | End the session and publish a revocation |
| GET | /v1/auth/keys | none | Current and previous Ed25519 public keys |
| POST/GET/DELETE | /v1/auth/app-passwords[/{id}] | session | Manage device app passwords |
| POST | /v1/auth/app-passwords/verify | service mTLS | Bubbl DAV credential check |
| POST | /v1/telemetry | PASETO or WP site client secret | Validate events and publish them to Pulsar |
| GET/PUT | /v1/db/{entity} | PASETO plus db:<entity>:* | Master-database access |
| POST | /v1/sync/bubbl | service mTLS (FairFeather) | Apply outbox entries idempotently |
| POST | /v1/notify/sms | service mTLS (Bubbl, Caulight) | Send an SMS to a user from a named template |
Data layer
Keyspace redfly, using NetworkTopologyStrategy {<dc>: 3} and LOCAL_QUORUM. The CQL is written by hand and is not generated.
| Table | Holds |
|---|---|
users, users_by_phone | User id (UUIDv7), E.164 phone, display name, status; phone lookup written with LWT |
tenants, tenants_by_app_key | Tenants across apps (bubbl or caulight) |
tenant_members, user_role | Tenant membership and platform roles |
sign_in_codes | Code HMAC, attempts and expiry (TTL 600) |
code_send_counts | Per-phone and per-IP send counts (TTL 3600) |
sessions | Sign-in sessions with last-seen, expiry, revocation, user agent and IP hash |
totp_credentials | Encrypted TOTP secret and wrapped key id |
app_passwords | Name, Argon2id hash, created and last-used times |
bubbl_records | Copies of Bubbl records as JSON, encrypted fields left as ciphertext |
outbox_receipts | Idempotent delivery records |
audits | Actor, action, entity and record id per day |
schema_history | Applied CQL and Kotlin data-migration steps |
Messaging and telemetry
- Publishes
persistent://odssbc/redfly/revocations, keyed by user id. - Publishes
persistent://odssbc/redfly/telemetry, keyed by tenant id. - Telemetry events follow a fixed schema:
event_id(UUIDv7),ts,app,app_version,tenant_id,user_hash,session_hash,name,level,duration_msandattrs(at most 32 keys, 256 characters each). - A
user_hashmust be 64 hex characters (HMAC-SHA256 of the Redfly user id with a rotating per-tenant salt).
Ports
| Port | Bind | Purpose |
|---|---|---|
| 8443 | pod IP | HTTPS REST API and health |
| 7000 | pod IP, TLS | Cassandra internode traffic |
| 9042 | 127.0.0.1 | CQL native (app → embedded Cassandra) |
| 2181 | 127.0.0.1 | SunLink ZooKeeper protocol (Curator) |
| 7480 | pod IP, mTLS | SunLink Raft ring between replicas |
| 6379 | 127.0.0.1 | SeaWave RESP (Spring Session, deny-list) |
| 7481 | pod IP, mTLS | SeaWave peer replication |
Key environment variables
| Variable | Purpose |
|---|---|
REDFLY_CASSANDRA_DATA_DIR, _DC, _SEEDS | Embedded Cassandra data directory, datacenter and seed pods |
REDFLY_AUTH_KEY_PATH | Ed25519 signing keys for PASETO |
REDFLY_AUTH_TTL_SECONDS | Token lifetime, default 900 |
REDFLY_SESSION_IDLE_SECONDS / _MAX_SECONDS | Session limits, default 43200 and 2592000 |
REDFLY_TWILIO_ACCOUNT_SID, _AUTH_TOKEN_FILE, _FROM | Twilio account, mounted token and sender |
REDFLY_OPENBAO_ADDR, _TRANSIT_KEY | OpenBao Transit for the wrapped data key |
REDFLY_SUNLINK_CLUSTER | SunLink peers |
REDFLY_PULSAR_SERVICE_URL | Pulsar broker (pulsar+ssl://) |
REDFLY_SHIRO_CONFIG | Shiro configuration file path |