Tearleads

trusted_user_identity_pins Client SQLite table

Durable pins for user identity bundles.

Declared in packages/client-sdk/src/data/sqlite/schema/trustedUserIdentityPinSchema.ts

Description

The first validated identity accepted for a user in a configured API trust domain is inserted once. Later observations must match every suite, public key, and fingerprint exactly; the persistence adapter never changes those columns. firstSeenAt records when the local trust decision was made and is likewise immutable. provenance (self, link, or observed) records how the pin was established; only self and link admit a user, and it only rises. A table without it is an obsolete local database.

Indexes:

  • (identityTrustDomain, userId) is the primary key and scopes a user pin to the host-configured API authority that supplied it.
  • (identityTrustDomain, signingKeyFingerprint) binds the reverse identity mapping durably, including across session recreation. There is no migration for a table that already violates it. Earlier builds pinned a registration's user id before the server confirmed it, so a device that ran one may hold two users on one key; deployments are greenfield, and such a device clears its local data, which recreates this table empty. A device that used an environment before a reset does the same (see docs/developer/operations/greenfield-reset.md).

Columns

  • identity_trust_domaintext
    • not null

    API authority the pin belongs to: its canonical URL (origin and path, no trailing slash).

  • user_idtext
    • not null

    Id of the pinned user.

  • format_versioninteger
    • not null

    Pin format version, always 1; any other value reads as corrupt.

  • signing_suitetext
    • not null

    Signing algorithm of the identity, always ML-DSA-87.

  • signing_public_keytext
    • not null

    The user's signing public key, base64.

  • signing_key_fingerprinttext
    • not null

    Hex SHA-256 of the signing public key's bytes.

  • encapsulation_suitetext
    • not null

    Key encapsulation algorithm of the identity, always ML-KEM-1024.

  • encapsulation_public_keytext
    • not null

    The user's encapsulation public key, base64.

  • encapsulation_key_fingerprinttext
    • not null

    Hex SHA-256 of the encapsulation public key's bytes.

  • first_seen_attext
    • not null

    ISO-8601 time the identity was first accepted. It never changes.

  • provenancetext
    • not null
    • one of self, link, observed

    How the pin was established: self (the user's own local keys), link (an independently exchanged identity link), or observed (the first server answer for a user already named by signed state). It only rises, from observed to link to self.

Keys and constraints

  • Primary key(identity_trust_domain, user_id)

Indexes

  • trusted_user_identity_pins_domain_signing_fingerprint_idx(identity_trust_domain, signing_key_fingerprint)
    • unique

DDL

The statements the client runs to create this table and its indexes.

CREATE TABLE IF NOT EXISTS "trusted_user_identity_pins" (
  "identity_trust_domain" TEXT NOT NULL,
  "user_id" TEXT NOT NULL,
  "format_version" INTEGER NOT NULL,
  "signing_suite" TEXT NOT NULL,
  "signing_public_key" TEXT NOT NULL,
  "signing_key_fingerprint" TEXT NOT NULL,
  "encapsulation_suite" TEXT NOT NULL,
  "encapsulation_public_key" TEXT NOT NULL,
  "encapsulation_key_fingerprint" TEXT NOT NULL,
  "first_seen_at" TEXT NOT NULL,
  "provenance" TEXT NOT NULL,
  PRIMARY KEY ("identity_trust_domain", "user_id")
);

CREATE UNIQUE INDEX IF NOT EXISTS "trusted_user_identity_pins_domain_signing_fingerprint_idx" ON "trusted_user_identity_pins" ("identity_trust_domain", "signing_key_fingerprint");