← DrezTek Home
Step 0 — Foundation Spec Draft v0

DrezTek Identity

The canonical, cross-ecosystem person identifier every DrezTek app can link to — without becoming an authentication service. This contract exists so DIL, and everything built after it, has a real dt_user_id to key on instead of a placeholder.

Owner — Identity Service (new, own boundary) Depends on — nothing Depended on by — DIL (Step A)

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_id minting
  • 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.

01

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.

02

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.

03

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.

04

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.

05

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

FieldTypeNotes
dt_user_iduuid, pkImmutable once minted. Never reassigned, never reused.
statusenumactive · suspended · deleted
created_attimestamptz—
updated_attimestamptz—

dt_identity_link — a linked app account

FieldTypeNotes
link_iduuid, pk—
dt_user_iduuid, fk→ dt_identity
apptextnaro · appnizer · …
subject_idtextOpaque — that app's own internal user/account id. Never interpreted by this service.
link_statusenumpending · confirmed · unlinked · revoked
linked_viatextHow the link was established, e.g. user_consent
created_at / confirmed_at / ended_attimestamptzended_at set on unlink or revoke
Replaces an earlier field name. An initial draft used a single 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

FieldTypeNotes
event_iduuid, pk—
dt_user_iduuid, fk—
link_iduuid, fk, nullableNull for identity-level events (e.g. a future merge)
event_typetextSee Section 6 — event types
actortextuser · app:<name> · admin
metadatajsonbEvent-specific detail
created_attimestamptzAppend-only, never edited

04 Link lifecycle

Every link passes through the same four states — no shortcuts, no silent transitions.

pending confirmed unlinked revoked consent user unlinks admin / security

Neither terminal state deletes data — see Section 7 for what each one actually triggers.

What each state means

StateMeaningDIL should treat as
pendingLink proposed, awaiting the account holder's confirmation.Not yet active — ignore
confirmedActive. The account is authoritatively linked to this dt_user_id.Authoritative
unlinkedThe user disconnected the app themselves.Revoke access; re-evaluate that app's records per their own deletion_policy
revokedDisconnected 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.

MethodPathPurpose
POST/identity/accountsMint a new dt_user_id
GET/identity/{dt_user_id}Resolve identity status
POST/identity/{dt_user_id}/linksPropose a link (app + subject_id) → pending
POST/identity/links/{link_id}/confirmRecord explicit consent → confirmed
POST/identity/links/{link_id}/unlinkUser-initiated disconnect → unlinked
POST/identity/links/{link_id}/revokeAdmin/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

1
naro

User signs into Naro. Naro authenticates them exactly as it does today — nothing changes here.

2
naro → identity

Naro calls GET /identity/resolve?app=naro&subject_id=… with its own authenticated subject.

3
identity

DrezTek Identity returns the dt_user_id — or 404 if this account has never been linked.

4
naro → dil

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.

authenticated caller ≠ user identity. The bearer token proves this request came from Appnizer. The link flow proves, separately, that this Appnizer subject is linked to this DrezTek user. Those two facts must never collapse into one concept — the token establishes which app is speaking; only a confirmed link establishes which person it's speaking for.

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

EventFires when
identity.link.createdA link is proposed (state → pending)
identity.link.confirmedThe account holder consents (state → confirmed)
identity.link.unlinkedThe user disconnects the app themselves
identity.link.revokedAn admin or security action forces a disconnect
identity.account.deletedA dt_identity itself is deleted
identity.canonical.mergedReserved. 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"
A polling table is deliberately the v0 mechanism, not a webhook/push system — DIL doesn't exist as a real consumer yet, and building push infrastructure for a consumer that isn't there yet is exactly the kind of scope creep this whole phase is trying to avoid.

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 confirmed elsewhere 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_id requires 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. The identity.canonical.merged event type is reserved now so the audit format never has to change — but no merge logic, and no API for it, ships here.
Deliberately unresolved, not overlooked. A real merge needs its own design pass — what happens to two identities' separate DIL records when they become one, whether it's reversible, what proof beyond "signed into both" is required. Rejecting the conflict case outright is what makes it safe to defer.

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?