/** * A validated tenant identifier. * * Nominal by construction: structurally a `string`, but the phantom brand makes * it unassignable from an arbitrary string. Assignment the other way * (`TenantId` → `string`) stays legal on purpose, so composition code can pass * it as a SQL parameter or key prefix without a cast. */ export type TenantId = string & { readonly __byokTenantId: unique symbol; }; /** * Upper bound on tenant id length. Not a security boundary — a bound so a * pathological id cannot become an unbounded key prefix inside a store. */ export declare const TENANT_ID_MAX_LENGTH = 200; /** * Separator for flat composite keys. `NUL` cannot appear in a tenant id that a * control plane can express in a URL, a header, or a SQL identifier, and * {@link tenantId} rejects it outright — so a composite key is never ambiguous * between `(a, bc)` and `(ab, c)`. */ export declare const TENANT_KEY_SEPARATOR = "\0"; /** * The single mint point for {@link TenantId}. * * Fail-closed: empty, whitespace-padded, over-long, non-string, or * `NUL`-bearing values are rejected rather than normalized. Normalizing here * would create a second source of truth for "which tenant is this", because the * control plane that issued the id would then disagree with the SDK about its * canonical form. * * @throws {ByokCoreError} code `tenant_id_invalid`. */ export declare function tenantId(value: string): TenantId; /** * Non-throwing form of {@link tenantId}, for surfaces that must answer "is this * a tenant id?" without building an error (route matching, log redaction). * Accepts exactly what {@link tenantId} accepts, never more. */ export declare function isTenantId(value: unknown): value is TenantId; /** * Composite key helper for compositions that need a flat key space (in-memory * maps, KV namespaces). SQL compositions use a tenant-prefixed composite * primary key instead — §12.6.2 layer 3 forbids a bare device/task index * regardless of which representation a composition picks. */ export declare function tenantKey(tenant: TenantId, ...parts: readonly string[]): string;