/** * Persistence helpers for the per-user visibility flag * (`_meta/visibility/`). Mirrors the bypass-AES pattern used * by `_meta/policy` — the visibility document is plain JSON, the * envelope's `_iv` field is left empty. * * Stored alongside the keyring file rather than inside the encrypted * user envelope (`_users/`) because: * * - `UserEnvelope.data` is opaque-to-hub by contract — hub does not * introspect or reserve any keys inside it. Adding `hidden` there * would violate that contract. * - `listUsersWithEnvelopes` filters by the flag, and the filter must * work even when decryption fails (legacy keyrings predating the * envelope feature, or a corrupted envelope). * * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/plaintext-bypass.md — every `_iv: ''` write site * * @module */ import type { NoydbStore } from '../../kernel/types.js'; import type { UserVisibility } from './types.js'; /** Prefix for per-user visibility records inside `_meta`. */ export declare const VISIBILITY_RECORD_PREFIX = "visibility/"; /** Compose the `_meta` record id for a keyring's visibility doc. */ export declare function visibilityRecordId(keyringId: string): string; /** * Read the visibility flag for `keyringId`. Returns `undefined` when no * document has been persisted — callers treat that as the default-visible * case (`{ hidden: false }`). */ export declare function readUserVisibility(store: NoydbStore, vault: string, keyringId: string): Promise; /** * Persist the visibility flag for `keyringId` at * `_meta/visibility/`. Idempotent — call on every * `vault.user.setMyVisibility()` invocation. Own-only at the caller * site; this primitive does not enforce keyring ownership. */ export declare function persistUserVisibility(store: NoydbStore, vault: string, keyringId: string, visibility: UserVisibility): Promise; /** * Delete the visibility flag for `keyringId`. Called from `revoke()` * alongside `deleteUserEnvelope` so the sidecar does not leak to a * re-granted principal with the same `userId`. Idempotent — the store's * `delete()` is already a no-op when the record is absent. */ export declare function deleteUserVisibility(store: NoydbStore, vault: string, keyringId: string): Promise;