Lifecycle and product sessions
An authenticated session must not remain sufficient authority after a relevant account restriction, revocation, or deletion. A product integrates current Identity lifecycle state while retaining its own application permissions and final-effect checks.
Store the product projection
The Node SDK supplies a reference SQLite store and lifecycle consumer. Use a new, dedicated product-owned database in an owner-only directory. Do not point it at the Identity database or an existing application database.
import {
IdentityServiceClient,
IdentityConsumer,
SQLiteIdentityConsumerStore,
} from '@tracecove/identity';
const client = await IdentityServiceClient.connect(serviceConfiguration);
const store = new SQLiteIdentityConsumerStore(
'/absolute/private/product/identity-consumer.sqlite',
{ profile: client.profile() }
);
const consumer = new IdentityConsumer({
client, store, freshnessMs: 120000
});
await consumer.registerSubject(canonicalProductSubject);
await consumer.syncOnce();The directory must already exist with restrictive ownership and permissions. The product subject is a verified canonical connection, not a browser-supplied identifier. The SQLite store is a reference adapter, not a distributed production datastore, encryption promise, or complete backup policy.
Recheck session authority
await consumer.assertSession({
productSubject: canonicalProductSubject,
authTime: validatedAuthenticationTime,
sessionReference: validatedSessionReference,
securityEpoch: epochCapturedAtAdmission,
});Check current membership, product permissions and session lifetime as well. A successful assertSession is an observation at that instant; it is not an atomic transaction with a later business effect. Your product's accepted storage/transaction design must revalidate the relevant authority at the exact effect and preserve durable fences through interruption and restart.
Apply events durably
The consumer tracks complete snapshots, semantic revocation floors, an event inbox, cursor and pending acknowledgements. Historical or reordered events must not downgrade current authority. A missing or incomplete snapshot is not an empty revocation list.
Persist the event outcome and pending acknowledgement durably. An unknown remote outcome can follow a committed operation. Preserve the original idempotency key and body; reconcile explicitly rather than automatically repeating a mutation with a new key.
Outages and recovery
Stale, unavailable, incomplete or invalid Identity authority must not silently authorize effects. A service dependency failure is distinct from invalid user authentication; it does not by itself mean a person's cookie should be revoked. Preserve enough product state to recover under the same accepted session policy after current complete authority returns.
Workers applications need their own durable adapter and request ownership. The Node transaction facade is not a D1 batch transaction. See Workers and errors.
Public preview 0.7.0-preview.1 · Not production ready · Status and releases