Tearleads

users API Postgres table

Registered human users and their long-lived public key material.

Declared in packages/api-shared/src/schema/users.ts

Description

A user row is created during user registration. The access workflows load this table to verify signatures, encrypt user-recipient envelopes, and resolve the user's default personal organization/root container context. Private keys never live in this table; only public keys and fingerprints are stored.

Billing is per-organization (organization_billing), not per-user; this table carries no account/trial lifecycle state.

Indexes:

  • users_fingerprint_unique enforces one signing key fingerprint per user and gives auth challenge verification an indexed fingerprint lookup. The root identity listing's fingerprint-prefix filter is a range scan of the same index.
  • users_created_at_id_idx backs the root identity listing's keyset pagination (newest registrations first).
  • users_default_organization_id_idx bounds personal-owner lookups during reserved organization group policy commits.

Columns

  • iduuid
    • primary key
    • not null
    • default gen_random_uuid()

    Stable server-side user id.

  • fingerprinttext
    • not null
    • unique

    Unique signing key fingerprint used by authentication and signature verification.

  • signing_public_keytext
    • not null

    Public signing key bytes, base64 encoded.

  • encapsulation_public_keytext
    • not null

    Public KEM/encapsulation key bytes, base64 encoded. Writers use this when wrapping material directly to the user.

  • encapsulation_key_fingerprinttext
    • not null

    Fingerprint of encapsulationPublicKey. Recipient-envelope verification compares submitted fingerprints to this value.

  • default_organization_iduuid
    • not null

    Personal/default organization created during registration and used as the user's initial organization boundary.

  • registration_source_ip_addresstext
    • nullable

    Best-effort source IP observed on the registration request. It is nullable when registration is created outside an HTTP request or no usable client IP metadata is available.

  • suspended_attimestamp
    • nullable

    When a platform operator suspended the account; null while it is in good standing. A suspended identity's challenge signatures are refused at POST /auth/verify, so its devices cannot sign back in, and the suspension sweeps every live session. Set and cleared only through the /root/identities/{userId}/suspension routes, which refuse root targets (administrators of the operator organization; see operatorOrganization).

  • last_active_attimestamp
    • nullable

    Most recent authenticated request timestamp, written on the session middleware's throttled activity path (about once a minute per session). Nullable until the user's first authenticated request after registration.

  • created_attimestamp
    • not null
    • default now()

    Server-side registration timestamp.

Indexes

  • users_created_at_id_idx(created_at, id)
    • users_default_organization_id_idx(default_organization_id)

      Referenced by