import { newClient } from '@cipherstash/jseql-ffi'; import { LockContext } from './identify/index.js'; export { Context, CtsRegions, CtsToken, GetLockContextResponse, IdentifyOptions, LockContextOptions } from './identify/index.js'; type EncryptPayload = string | null; type EncryptedPayload = { c: string; } | null; type BulkEncryptPayload = { plaintext: string; id: string; }[]; type BulkEncryptedData = { c: string; id: string; }[] | null; type BulkDecryptedData = ({ plaintext: string; id: string; } | null)[] | null; type EncryptOptions = { column: string; table: string; }; type Client = Awaited> | undefined; declare class EncryptOperation implements PromiseLike { private client; private plaintext; private column; private table; constructor(client: Client, plaintext: EncryptPayload, opts: EncryptOptions); withLockContext(lockContext: LockContext): EncryptOperationWithLockContext; /** Implement the PromiseLike interface so `await` works. */ then(onfulfilled?: ((value: EncryptedPayload) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; /** Actual encryption logic, deferred until `then()` is called. */ private execute; getOperation(): { client: Client; plaintext: EncryptPayload; column: string; table: string; }; } declare class EncryptOperationWithLockContext implements PromiseLike { private operation; private lockContext; constructor(operation: EncryptOperation, lockContext: LockContext); then(onfulfilled?: ((value: EncryptedPayload) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; } declare class DecryptOperation implements PromiseLike { private client; private encryptedPayload; constructor(client: Client, encryptedPayload: EncryptedPayload); withLockContext(lockContext: LockContext): DecryptOperationWithLockContext; then(onfulfilled?: ((value: string | null) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; getOperation(): { client: Client; encryptedPayload: EncryptedPayload; }; } declare class DecryptOperationWithLockContext implements PromiseLike { private operation; private lockContext; constructor(operation: DecryptOperation, lockContext: LockContext); then(onfulfilled?: ((value: string | null) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; } declare class BulkEncryptOperation implements PromiseLike { private client; private plaintexts; private column; private table; constructor(client: Client, plaintexts: BulkEncryptPayload, opts: EncryptOptions); withLockContext(lockContext: LockContext): BulkEncryptOperationWithLockContext; then(onfulfilled?: ((value: BulkEncryptedData) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; getOperation(): { client: Client; plaintexts: BulkEncryptPayload; column: string; table: string; }; } declare class BulkEncryptOperationWithLockContext implements PromiseLike { private operation; private lockContext; constructor(operation: BulkEncryptOperation, lockContext: LockContext); then(onfulfilled?: ((value: BulkEncryptedData) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; } declare class BulkDecryptOperation implements PromiseLike { private client; private encryptedPayloads; constructor(client: Client, encryptedPayloads: BulkEncryptedData); withLockContext(lockContext: LockContext): BulkDecryptOperationWithLockContext; then(onfulfilled?: ((value: BulkDecryptedData) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; getOperation(): { client: Client; encryptedPayloads: BulkEncryptedData; }; } declare class BulkDecryptOperationWithLockContext implements PromiseLike { private operation; private lockContext; constructor(operation: BulkDecryptOperation, lockContext: LockContext); then(onfulfilled?: ((value: BulkDecryptedData) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Promise; private execute; } declare class EqlClient { private client; private workspaceId; constructor(); init(): Promise; /** * Encryption - returns a thenable object. * Usage: * await eqlClient.encrypt(plaintext, { column, table }) * await eqlClient.encrypt(plaintext, { column, table }).withLockContext(lockContext) */ encrypt(plaintext: EncryptPayload, opts: EncryptOptions): EncryptOperation; /** * Decryption - returns a thenable object. * Usage: * await eqlClient.decrypt(encryptedPayload) * await eqlClient.decrypt(encryptedPayload).withLockContext(lockContext) */ decrypt(encryptedPayload: EncryptedPayload): DecryptOperation; /** * Bulk Encrypt - returns a thenable object. * Usage: * await eqlClient.bulkEncrypt([{ plaintext, id }, ...], { column, table }) * await eqlClient * .bulkEncrypt([{ plaintext, id }, ...], { column, table }) * .withLockContext(lockContext) */ bulkEncrypt(plaintexts: BulkEncryptPayload, opts: EncryptOptions): BulkEncryptOperation; /** * Bulk Decrypt - returns a thenable object. * Usage: * await eqlClient.bulkDecrypt(encryptedPayloads) * await eqlClient.bulkDecrypt(encryptedPayloads).withLockContext(lockContext) */ bulkDecrypt(encryptedPayloads: BulkEncryptedData): BulkDecryptOperation; /** e.g., debugging or environment info */ clientInfo(): { workspaceId: string | undefined; }; } /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ type SchemaVersion = number; type Kind = 'pt'; type Table = string; type Column = string; type Plaintext = string; /** * Specifies that the plaintext should be encrypted for a specific query operation. If null, source encryption and encryption for all indexes will be performed. */ type ForQuery = 'match' | 'ore' | 'unique' | 'ste_vec' | 'ejson_path'; /** * The EQL plaintext JSON payload sent by a client (such as an application) to CipherStash Proxy. */ interface CsPlaintextV1Schema { v: SchemaVersion; k: Kind; i: Ident; p: Plaintext; q?: ForQuery; [k: string]: unknown; } interface Ident { t: Table; c: Column; [k: string]: unknown; } type CreateEqlPayload = { plaintext: Plaintext; table: Table; column: Column; schemaVersion?: SchemaVersion; queryType?: ForQuery | null; }; type Result = { failure?: boolean; error?: Error; plaintext?: Plaintext; }; declare const createEqlPayload: ({ plaintext, table, column, schemaVersion, queryType, }: CreateEqlPayload) => CsPlaintextV1Schema; declare const getPlaintext: (payload: CsPlaintextV1Schema) => Result; declare const eql: () => Promise; export { type Column, type CreateEqlPayload, type CsPlaintextV1Schema, EqlClient, type ForQuery, type Ident, type Kind, LockContext, type Plaintext, type Result, type SchemaVersion, type Table, createEqlPayload, eql, getPlaintext };