import { initialize, initializeSync, Blake3Hasher } from "cojson-core-wasm"; import { RawCoID, TransactionID } from "../ids.js"; import { Stringified } from "../jsonStringify.js"; import { JsonValue } from "../jsonValue.js"; import { CryptoProvider, Encrypted, KeySecret, Sealed, SealedForGroup, SealerID, SealerSecret, SessionMapImpl, ShortHash, Signature, SignerID, SignerSecret } from "./crypto.js"; type Blake3State = Blake3Hasher; /** * Initializes the WasmCrypto module. This function can be used to initialize the WasmCrypto module in a worker or a browser. * if you are using SSR and you want to initialize WASM crypto asynchronously you can use this function. * @returns A promise that resolves when the WasmCrypto module is successfully initialized. */ export declare function initWasmCrypto(): Promise; /** * WebAssembly implementation of the CryptoProvider interface using cojson-core-wasm. * This provides the primary implementation using WebAssembly for optimal performance, offering: * - Signing/verifying (Ed25519) * - Encryption/decryption (XSalsa20) * - Sealing/unsealing (X25519 + XSalsa20-Poly1305) * - Hashing (BLAKE3) */ export declare class WasmCrypto extends CryptoProvider { protected constructor(); static setInit(value: typeof initialize): void; static setInitSync(value: typeof initializeSync): void; static createSync(): WasmCrypto; static create(): Promise; blake3HashOnce(data: Uint8Array): Uint8Array; blake3HashOnceWithContext(data: Uint8Array, { context }: { context: Uint8Array; }): Uint8Array; shortHash(value: JsonValue): ShortHash; newEd25519SigningKey(): Uint8Array; getSignerID(secret: SignerSecret): SignerID; sign(secret: SignerSecret, message: JsonValue): Signature; verify(signature: Signature, message: JsonValue, id: SignerID): boolean; newX25519StaticSecret(): Uint8Array; getSealerID(secret: SealerSecret): SealerID; encrypt(value: T, keySecret: KeySecret, nOnceMaterial: N): Encrypted; decryptRaw(encrypted: Encrypted, keySecret: KeySecret, nOnceMaterial: N): Stringified; seal({ message, from, to, nOnceMaterial, }: { message: T; from: SealerSecret; to: SealerID; nOnceMaterial: { in: RawCoID; tx: TransactionID; }; }): Sealed; unseal(sealed: Sealed, sealer: SealerSecret, from: SealerID, nOnceMaterial: { in: RawCoID; tx: TransactionID; }): T | undefined; sealForGroup({ message, to, nOnceMaterial, }: { message: T; to: SealerID; nOnceMaterial: { in: RawCoID; tx: TransactionID; }; }): SealedForGroup; unsealForGroup(sealed: SealedForGroup, groupSealerSecret: SealerSecret, nOnceMaterial: { in: RawCoID; tx: TransactionID; }): T | undefined; createSessionMap(coID: RawCoID, headerJson: string, maxTxSize?: number, skipVerify?: boolean): SessionMapImpl; } export {}; //# sourceMappingURL=WasmCrypto.d.ts.map