Tearleads

principal_key_envelope_archive Client SQLite table

Encrypted key candidates survive disposable progress reclamation.

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

Columns

  • organization_idtext
    • not null

    Organization of the principal history the envelopes came from.

  • principal_typetext
    • not null

    Managed principal kind: group or organization.

  • principal_idtext
    • not null

    Managed principal id.

  • key_fingerprinttext
    • not null

    Hex SHA-256 fingerprint of the principal key the envelopes wrap; candidate lookups match on it.

  • versioninteger
    • not null

    Policy version of the head that supplied the envelopes. A candidate from an older version never replaces a newer one.

  • envelopes_jsontext
    • not null

    JSON of that head's currentMemberEnvelopes: principalType, principalId, epoch, stateHash, and envelopes, the principal secret key wrapped to each member key. Read as a candidate when unwrapping the principal key with this fingerprint.

Keys and constraints

  • Primary key(organization_id, principal_type, principal_id, key_fingerprint)

Indexes

  • principal_key_envelope_archive_fingerprint_idx(key_fingerprint, version)

    DDL

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

    CREATE TABLE IF NOT EXISTS "principal_key_envelope_archive" (
      "organization_id" TEXT NOT NULL,
      "principal_type" TEXT NOT NULL,
      "principal_id" TEXT NOT NULL,
      "key_fingerprint" TEXT NOT NULL,
      "version" INTEGER NOT NULL,
      "envelopes_json" TEXT NOT NULL,
      PRIMARY KEY ("organization_id", "principal_type", "principal_id", "key_fingerprint")
    );
    
    CREATE INDEX IF NOT EXISTS "principal_key_envelope_archive_fingerprint_idx" ON "principal_key_envelope_archive" ("key_fingerprint", "version");