import { RawAccountID } from "../coValues/account.js"; import { AgentID, RawCoID, TransactionID, ActiveSessionID, DeleteSessionID } from "../ids.js"; import { Stringified } from "../jsonStringify.js"; import { JsonValue } from "../jsonValue.js"; import { Transaction } from "../coValueCore/verifiedState.js"; export type SignerSecret = `signerSecret_z${string}`; export type SignerID = `signer_z${string}`; export type Signature = `signature_z${string}`; export type SealerSecret = `sealerSecret_z${string}`; export type SealerID = `sealer_z${string}`; export type Sealed = `sealed_U${string}` & { __type: T; }; export type SealedForGroup = `sealedForGroup_U${string}` & { __type: T; }; export type AgentSecret = `${SealerSecret}/${SignerSecret}`; export declare const textEncoder: import("util").TextEncoder; export declare const textDecoder: import("util").TextDecoder; export declare abstract class CryptoProvider { randomBytes(length: number): Uint8Array; abstract newEd25519SigningKey(): Uint8Array; newRandomSigner(): SignerSecret; abstract getSignerID(secret: SignerSecret): SignerID; abstract sign(secret: SignerSecret, message: JsonValue): Signature; abstract verify(signature: Signature, message: JsonValue, id: SignerID): boolean; abstract newX25519StaticSecret(): Uint8Array; newRandomSealer(): SealerSecret; abstract getSealerID(secret: SealerSecret): SealerID; newRandomAgentSecret(): AgentSecret; agentIdCache: Map; getAgentID(secret: AgentSecret): AgentID; getAgentSignerID(agentId: AgentID): SignerID; getAgentSignerSecret(agentSecret: AgentSecret): SignerSecret; getAgentSealerID(agentId: AgentID): SealerID; getAgentSealerSecret(agentSecret: AgentSecret): SealerSecret; abstract blake3HashOnce(data: Uint8Array): Uint8Array; abstract blake3HashOnceWithContext(data: Uint8Array, { context }: { context: Uint8Array; }): Uint8Array; secureHash(value: JsonValue): Hash; abstract shortHash(value: JsonValue): ShortHash; abstract encrypt(value: T, keySecret: KeySecret, nOnceMaterial: N): Encrypted; abstract decryptRaw(encrypted: Encrypted, keySecret: KeySecret, nOnceMaterial: N): Stringified; decrypt(encrypted: Encrypted, keySecret: KeySecret, nOnceMaterial: N): T | undefined; newRandomKeySecret(): { secret: KeySecret; id: KeyID; }; encryptKeySecret(keys: { toEncrypt: { id: KeyID; secret: KeySecret; }; encrypting: { id: KeyID; secret: KeySecret; }; }): { encryptedID: KeyID; encryptingID: KeyID; encrypted: Encrypted; }; decryptKeySecret(encryptedInfo: { encryptedID: KeyID; encryptingID: KeyID; encrypted: Encrypted; }, sealingSecret: KeySecret): KeySecret | undefined; abstract seal({ message, from, to, nOnceMaterial, }: { message: T; from: SealerSecret; to: SealerID; nOnceMaterial: { in: RawCoID; tx: TransactionID; }; }): Sealed; abstract unseal(sealed: Sealed, sealer: SealerSecret, from: SealerID, nOnceMaterial: { in: RawCoID; tx: TransactionID; }): T | undefined; groupSealerFromReadKey(readKeySecret: KeySecret): { publicKey: SealerID; secret: SealerSecret; }; abstract sealForGroup(args: { message: T; to: SealerID; nOnceMaterial: { in: RawCoID; tx: TransactionID; }; }): SealedForGroup; abstract unsealForGroup(sealed: SealedForGroup, groupSealerSecret: SealerSecret, nOnceMaterial: { in: RawCoID; tx: TransactionID; }): T | undefined; uniquenessForHeader(): `z${string}`; createdNowUnique(): { createdAt: `2${string}`; uniqueness: `z${string}`; }; newRandomSecretSeed(): Uint8Array; agentSecretFromSecretSeed(secretSeed: Uint8Array): AgentSecret; newRandomSessionID(accountID: RawAccountID | AgentID): ActiveSessionID; newDeleteSessionID(accountID: RawAccountID | AgentID): DeleteSessionID; abstract createSessionMap(coID: RawCoID, headerJson: string, maxTxSize?: number, skipVerify?: boolean): SessionMapImpl; } export type Hash = `hash_z${string}`; export type ShortHash = `shortHash_z${string}`; export declare const shortHashLength = 19; export type Encrypted = `encrypted_U${string}` & { __type: T; __nOnceMaterial: N; }; export type KeySecret = `keySecret_z${string}`; export type KeyID = `key_z${string}`; export declare const secretSeedLength = 32; /** * SessionMapImpl - Native implementation of SessionMap * One instance per CoValue, owns all session data including header */ export interface SessionMapImpl { getHeader(): string; addTransactions(sessionId: string, signerId: string | undefined, transactionsJson: string, signature: string, skipVerify: boolean): void; makeNewPrivateTransaction(sessionId: string, signerSecret: string, changesJson: string, keyId: string, keySecret: string, metaJson: string | undefined, madeAt: number): string; makeNewTrustingTransaction(sessionId: string, signerSecret: string, changesJson: string, metaJson: string | undefined, madeAt: number): string; getSessionIds(): string[]; getTransactionCount(sessionId: string): number; getTransaction(sessionId: string, txIndex: number): Transaction | undefined; getSessionTransactions(sessionId: string, fromIndex: number): Transaction[] | undefined; getLastSignature(sessionId: string): string | undefined; getSignatureAfter(sessionId: string, txIndex: number): string | undefined; getLastSignatureCheckpoint(sessionId: string): number | undefined; getKnownState(): { id: string; header: boolean; sessions: Record; }; getKnownStateWithStreaming(): { id: string; header: boolean; sessions: Record; } | undefined; isStreaming(): boolean; setStreamingKnownState(streamingJson: string): void; markAsDeleted(): void; isDeleted(): boolean; decryptTransaction(sessionId: string, txIndex: number, keySecret: string): string | undefined; decryptTransactionMeta(sessionId: string, txIndex: number, keySecret: string): string | undefined; } //# sourceMappingURL=crypto.d.ts.map