import { Schema } from 'effect'; import { ByteArray, Hex } from 'viem'; import { Bytes32 } from '../binary.js'; export type Encryptor = (plaintext: PlaintextWithContextOf) => Promise>; export type Decryptor = (ciphertext: CiphertextOf) => Promise>; export declare const supportedFheTypes: { readonly euint64: 5; readonly euint160: 7; readonly euint256: 8; readonly ebool: 0; }; export declare const SupportedFheTypeName: Schema.SchemaClass<"ebool" | "euint64" | "euint160" | "euint256", "ebool" | "euint64" | "euint160" | "euint256", never>; export type SupportedFheTypeName = typeof SupportedFheTypeName.Type; export declare const SupportedFheType: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>; export type SupportedFheType = typeof SupportedFheType.Type; export declare const encryptionSchemes: { readonly ecies: 1; }; export declare function getEncryptionSchemeName(scheme: number): string; export type EncryptionSchemes = typeof encryptionSchemes; export type EciesScheme = EncryptionSchemes['ecies']; export declare const EncryptionScheme: Schema.Literal<[1]>; export type EncryptionScheme = typeof EncryptionScheme.Type; type DistType = P extends any ? P & { scheme: S; type: T; } : never; export declare const Ciphertext: Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>; value: Schema.TemplateLiteral<`0x${string}`>; }>; export type Ciphertext = typeof Ciphertext.Type; export type CiphertextOf = DistType; export declare const CiphertextWithContext: Schema.Struct<{ ciphertext: Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>; value: Schema.TemplateLiteral<`0x${string}`>; }>; context: Schema.Struct<{ hostChainId: typeof Schema.BigInt; aclAddress: Schema.TemplateLiteral<`0x${string}`>; userAddress: Schema.TemplateLiteral<`0x${string}`>; contractAddress: Schema.TemplateLiteral<`0x${string}`>; }>; }>; export type CiphertextWithContext = typeof CiphertextWithContext.Type; export type CiphertextWithContextOf = CiphertextWithContext & { ciphertext: CiphertextOf; }; export declare const EncryptResult: Schema.Struct<{ ciphertext: Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>; value: Schema.TemplateLiteral<`0x${string}`>; }>; context: Schema.Struct<{ hostChainId: typeof Schema.BigInt; aclAddress: Schema.TemplateLiteral<`0x${string}`>; userAddress: Schema.TemplateLiteral<`0x${string}`>; contractAddress: Schema.TemplateLiteral<`0x${string}`>; }>; prehandle: Schema.brand, Schema.Schema>]>, Schema.TemplateLiteral<`0x${string}`>, never>>, "Bytes32">; handle: Schema.brand, Schema.Schema>]>, Schema.TemplateLiteral<`0x${string}`>, never>>, "Bytes32">; }>; export type EncryptResult = typeof EncryptResult.Type; export type EncryptResultOf = EncryptResult & { ciphertext: CiphertextOf; }; export declare const Plaintext: Schema.Union<[Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.Literal<[5, 7, 8]>; value: typeof Schema.BigInt; }>, Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.Literal<[0]>; value: typeof Schema.Boolean; }>]>; export type Plaintext = typeof Plaintext.Type; export type PlaintextOf = DistType; export declare const PlaintextWithContext: Schema.Struct<{ plaintext: Schema.Union<[Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.Literal<[5, 7, 8]>; value: typeof Schema.BigInt; }>, Schema.Struct<{ scheme: Schema.Literal<[1]>; type: Schema.Literal<[0]>; value: typeof Schema.Boolean; }>]>; context: Schema.Struct<{ hostChainId: typeof Schema.BigInt; aclAddress: Schema.TemplateLiteral<`0x${string}`>; userAddress: Schema.TemplateLiteral<`0x${string}`>; contractAddress: Schema.TemplateLiteral<`0x${string}`>; }>; }>; export type PlaintextWithContext = typeof PlaintextWithContext.Type; export type PlaintextWithContextOf = PlaintextWithContext & { plaintext: PlaintextOf; }; export declare function bigintToPlaintext(scheme: S, type: T, bigPt: bigint): PlaintextOf; export declare function decodeCiphertextInput(input: ByteArray | Hex): { handle: Hex; ciphertext: Hex; }; export declare function encodeCiphertextInput(handle: Hex, ciphertext: Hex): Hex; export declare function plaintextToBigint(plaintext: Plaintext): bigint; export declare function plaintextToBytes32(plaintext: Plaintext): Bytes32; export declare function plaintextToBytes(plaintext: Plaintext): Buffer; export declare function bytes32ToPlaintext(plaintext: Bytes32, scheme: EncryptionScheme, type: SupportedFheType): Plaintext; export declare function bytesToPlaintext(plaintext: Uint8Array, scheme: EncryptionScheme, type: SupportedFheType): Plaintext; export {};