import { AnyRawCoValue } from "../coValue.js"; import { CryptoProvider, Encrypted, KeyID, KeySecret, Signature, SignerID } from "../crypto/crypto.js"; import { RawCoID, SessionID, TransactionID } from "../ids.js"; import { Stringified } from "../jsonStringify.js"; import { JsonObject, JsonValue } from "../jsonValue.js"; import { PermissionsDef as RulesetDef } from "../permissions.js"; import { NewContentMessage } from "../sync.js"; import { ControlledAccountOrAgent } from "../coValues/account.js"; import { CoValueKnownState, KnownStateSessions } from "../knownState.js"; export type CoValueHeader = { type: AnyRawCoValue["type"]; ruleset: RulesetDef; meta: JsonObject | null; } & CoValueUniqueness; export type CoValueUniqueness = { uniqueness: Uniqueness; createdAt?: `2${string}` | null; }; export type Uniqueness = string | boolean | null | undefined | { [key: string]: string; }; export type PrivateTransaction = { privacy: "private"; madeAt: number; keyUsed: KeyID; encryptedChanges: Encrypted; meta?: Encrypted; }; export type TrustingTransaction = { privacy: "trusting"; madeAt: number; changes: Stringified; meta?: Stringified; }; export type Transaction = PrivateTransaction | TrustingTransaction; export type SessionLog = { signerID?: SignerID; transactions: Transaction[]; lastSignature: Signature | undefined; signatureAfter: { [txIdx: number]: Signature | undefined; }; sessionID: SessionID; }; export declare class VerifiedState { readonly id: RawCoID; readonly crypto: CryptoProvider; readonly header: CoValueHeader; private readonly impl; lastAccessed: number | undefined; branchSourceId?: RawCoID; branchName?: string; private isDeleted; private sessionLogCache; private sessionLogCacheValid; private cachedKnownState; private cachedKnownStateWithStreaming; constructor(id: RawCoID, crypto: CryptoProvider, header: CoValueHeader, streamingKnownState?: KnownStateSessions, skipVerify?: boolean); private invalidateCache; private invalidateKnownStateCache; /** * Update the session log cache directly when adding transactions. * This avoids round-trips to Rust on subsequent reads. */ private updateSessionLogCache; /** * Update the signatureAfter map with the latest checkpoint signature. * Used when updating cache incrementally. */ private updateLastCheckpointSignature; /** * Build the signatureAfter map for a session by iterating through all checkpoints. * Used when building a fresh SessionLog from Rust data. */ private buildSignatureAfterMap; private getSessionLog; markAsDeleted(): void; tryAddTransactions(sessionID: SessionID, signerID: SignerID | undefined, newTransactions: Transaction[], newSignature: Signature, skipVerify?: boolean): void; makeNewTrustingTransaction(sessionID: SessionID, signerAgent: ControlledAccountOrAgent, changes: JsonValue[], meta: JsonObject | undefined, madeAt: number): { signature: Signature; transaction: Transaction; }; makeNewPrivateTransaction(sessionID: SessionID, signerAgent: ControlledAccountOrAgent, changes: JsonValue[], keyID: KeyID, keySecret: KeySecret, meta: JsonObject | undefined, madeAt: number): { signature: Signature; transaction: Transaction; }; setStreamingKnownState(streamingKnownState: KnownStateSessions): void; getSession(sessionID: SessionID): SessionLog | undefined; getTransactionsCount(sessionID: SessionID): number | undefined; get sessionCount(): number; getSessions(): Map; sessionEntries(): IterableIterator<[SessionID, SessionLog]>; newContentSince(knownState: CoValueKnownState | undefined): NewContentMessage[] | undefined; knownState(): CoValueKnownState; knownStateWithStreaming(): CoValueKnownState; isStreaming(): boolean; decryptTransaction(sessionID: SessionID, txIndex: number, keySecret: KeySecret): JsonValue[] | undefined; decryptTransactionMeta(sessionID: SessionID, txIndex: number, keySecret: KeySecret): JsonObject | undefined; } //# sourceMappingURL=verifiedState.d.ts.map