01 Purpose & scope
What this service is, and — just as deliberately — what it refuses to be.
Every DrezTek app authenticates its own users today, independently, with no shared identifier between them. DrezTek Identity introduces exactly one new fact: an immutable dt_user_id that a person's separate app accounts can be explicitly linked to. It resolves who this is across the ecosystem. It does not resolve how they logged in — that stays with each app, unchanged, for the life of this phase.
In scope
- Canonical, immutable
dt_user_idminting - Explicit, consented per-app account links
- Unlink and revoke, as distinct operations
- Full audit trail of every relationship change
- An event & query surface DIL can trust
- Own schema, own migrations, own API
Out of scope — DrezTek Auth phase
- Password / credential storage
- Sessions, MFA, passkeys, recovery
- OAuth / OIDC provider role
- "Sign in with Naro" as literal SSO
- Cross-app single sign-on
- Canonical identity merging (reserved, not built)
Identity and Auth are named separately on purpose. They will end up on the same platform, but nothing requires them to ship together — and bundling them is how this phase quietly turns into rebuilding login for every app.
02 Principles
Five rules the rest of this document exists to enforce.
Identity ≠ authentication
DrezTek Identity resolves a canonical person. It never sees a password. Each app keeps authenticating its own users exactly as it does today.
Links are explicit, never inferred
Two accounts sharing an email is not proof of one person. Every link requires an affirmative, logged decision by the account holder — no silent matching.
Unlink ≠ delete
Disconnecting an app from a DrezTek Identity revokes its participation in that relationship. It does not, by itself, destroy anything that app created.
Every relationship change is audited
Link, confirm, unlink, revoke, merge — each writes an immutable event. Nothing about a person's cross-app identity changes silently.
Shared infrastructure, not shared ownership
This service may run on the same Postgres cluster and the same box as Naro for convenience. It never runs as a module of Naro, or of any other app.
03 Data model
Three tables. No table stores a credential.
dt_identity — the canonical person
| Field | Type | Notes |
|---|---|---|
| dt_user_id | uuid, pk | Immutable once minted. Never reassigned, never reused. |
| status | enum | active · suspended · deleted |
| created_at | timestamptz | — |
| updated_at | timestamptz | — |
dt_identity_link — a linked app account
| Field | Type | Notes |
|---|---|---|
| link_id | uuid, pk | — |
| dt_user_id | uuid, fk | → dt_identity |
| app | text | naro · appnizer · … |
| subject_id | text | Opaque — that app's own internal user/account id. Never interpreted by this service. |
| link_status | enum | pending · confirmed · unlinked · revoked |
| linked_via | text | How the link was established, e.g. user_consent |
| created_at / confirmed_at / ended_at | timestamptz | ended_at set on unlink or revoke |
primary_auth_subject field — dropped in favor of the app / subject_id pair above, so no single app is ever implied to be the authoritative login for a person. Each app resolves its own authenticated user, then presents that subject here.dt_identity_link_event — the audit log
| Field | Type | Notes |
|---|---|---|
| event_id | uuid, pk | — |
| dt_user_id | uuid, fk | — |
| link_id | uuid, fk, nullable | Null for identity-level events (e.g. a future merge) |
| event_type | text | See Section 6 — event types |
| actor | text | user · app:<name> · admin |
| metadata | jsonb | Event-specific detail |
| created_at | timestamptz | Append-only, never edited |
04 Link lifecycle
Every link passes through the same four states — no shortcuts, no silent transitions.
Neither terminal state deletes data — see Section 7 for what each one actually triggers.
What each state means
| State | Meaning | DIL should treat as |
|---|---|---|
| pending | Link proposed, awaiting the account holder's confirmation. | Not yet active — ignore |
| confirmed | Active. The account is authoritatively linked to this dt_user_id. | Authoritative |
| unlinked | The user disconnected the app themselves. | Revoke access; re-evaluate that app's records per their own deletion_policy |
| revoked | Disconnected by an admin or security action, not the user. | Same downstream effect as unlinked — distinct only in who acted, for audit purposes |
05 API surface (v0)
Called by DrezTek apps' own backends — never directly by a browser. The consent screen lives in the calling app; this service only ever records the outcome.
| Method | Path | Purpose |
|---|---|---|
| POST | /identity/accounts | Mint a new dt_user_id |
| GET | /identity/{dt_user_id} | Resolve identity status |
| POST | /identity/{dt_user_id}/links | Propose a link (app + subject_id) → pending |
| POST | /identity/links/{link_id}/confirm | Record explicit consent → confirmed |
| POST | /identity/links/{link_id}/unlink | User-initiated disconnect → unlinked |
| POST | /identity/links/{link_id}/revoke | Admin/security disconnect → revoked |
| GET | /identity/resolve?app=&subject_id= | Given an authenticated app subject, return its dt_user_id (or 404 — no link) |
| GET | /identity/{dt_user_id}/links/{app} | Current truth for one app — never trust a cached assumption |
The resolve flow, end to end
User signs into Naro. Naro authenticates them exactly as it does today — nothing changes here.
Naro calls GET /identity/resolve?app=naro&subject_id=… with its own authenticated subject.
DrezTek Identity returns the dt_user_id — or 404 if this account has never been linked.
Naro passes that dt_user_id to DIL as the owner on any record it creates.
Appnizer, Vibr, and every future app repeat the same four steps independently — none of them ever reference another app's login.
Calling application authentication (v0)
DrezTek Identity requires every calling application to authenticate with an application-specific bearer credential. The authenticated application identity is authoritative for request scoping; callers may not claim or act as another application in link, confirm, resolve, unlink, or revoke operations. Cross-app impersonation attempts must be rejected and audited. This mechanism is intentionally transitional and may later be replaced by stronger service authentication — signed client credentials, mTLS, platform-issued service tokens — without changing the identity-link contract above it.
06 Events & queries
The one hard requirement this phase owes to DIL: a signal it can actually trust.
Step 0 does not define what DIL does when a link changes — that belongs to DIL's own contract. It only guarantees the signal exists, in two forms:
Event types
| Event | Fires when |
|---|---|
| identity.link.created | A link is proposed (state → pending) |
| identity.link.confirmed | The account holder consents (state → confirmed) |
| identity.link.unlinked | The user disconnects the app themselves |
| identity.link.revoked | An admin or security action forces a disconnect |
| identity.account.deleted | A dt_identity itself is deleted |
| identity.canonical.merged | Reserved. No merge implementation ships in v0 — see Section 7. |
Query surface
For a consumer that would rather ask than listen — poll a cursor, or check one link directly:
# events since a cursor GET /identity/events?since=<cursor> # current truth for one app's link GET /identity/{dt_user_id}/links/appnizer → "active" | "revoked" | "pending" | "missing"
07 Conflict rules (v0 — conservative)
Where this gets genuinely hard, v0 chooses safety over completeness.
One (app, subject_id) pair may be linked to at most one dt_user_id at a time. Everything below follows from that.
- Linking an account already
confirmedelsewhere is rejected outright — no automatic merge, no silent reassignment. The caller learns only that a conflict exists, not the other identity's details. - Moving a link to a different
dt_user_idrequires an explicit unlink, then a fresh link with its own consent step. There is no direct "move" operation. - Combining two real, separate
dt_user_ids into one is not implemented in v0. Theidentity.canonical.mergedevent type is reserved now so the audit format never has to change — but no merge logic, and no API for it, ships here.
08 Deployment & ownership
Runs initially in the same Postgres cluster — and possibly the same Hetzner process — as Naro, for convenience only. Ownership is enforced at the schema boundary, not by physical separation:
PostgreSQL ├── schema: dreztek_identity ← this service. own migration chain. ├── schema: naro └── schema: dil ← Step A, later
Naro's migrations never touch dreztek_identity tables. This service's migrations never touch Naro's. That rule matters more than where the process happens to run.
09 Open questions
Named so they can't be quietly assumed away later.
- Merge design. How two canonical identities actually combine — including whether it's ever reversible — once a real case demands it.
- Proof of consent. Is being signed into two apps in the same browser session sufficient proof for a link, or does confirming one require re-authenticating, or a stronger signal?
- DIL's reactions. This document guarantees the unlink/revoke signal exists — what DIL actually does with it (retain, orphan, transfer to user control, delete) is Step A's decision entirely.
- Relationship to DrezTek Auth. When that phase exists, does it subsume this service's link table, or sit beside it and simply add real credentials to the same
dt_user_id?