import { Client, NanoTDF } from './nanotdf/index.js'; import { TypedArray } from './tdf/index.js'; import { AuthProvider } from './auth/auth.js'; /** * NanoTDF SDK Client * * @example * ``` * import { clientSecretAuthProvider, NanoTDFClient } from '@opentdf/client'; * * const OIDC_ENDPOINT = 'http://localhost:65432/auth/realms/opentdf-demo'; * const KAS_URL = 'http://localhost:65432/api/kas/'; * * const ciphertext = '...'; * const client = new NanoTDFClient( * await clientSecretAuthProvider({ * clientId: 'tdf-client', * clientSecret: '123-456', * oidcOrigin: OIDC_ENDPOINT, * }), * KAS_URL * ); * client.decrypt(ciphertext) * .then(plaintext => { * console.log('Plaintext', plaintext); * }) * .catch(err => { * console.error('Some error occurred', err); * }) */ export declare class NanoTDFClient extends Client { /** * Decrypt ciphertext * * Pass a base64 string, TypedArray, or ArrayBuffer ciphertext and get a promise which resolves plaintext * * @param ciphertext Ciphertext to decrypt */ decrypt(ciphertext: string | TypedArray | ArrayBuffer): Promise; /** * Decrypt ciphertext of the legacy TDF, with the older, smaller i.v. calculation. * * Pass a base64 string, TypedArray, or ArrayBuffer ciphertext and get a promise which resolves plaintext * * @param ciphertext Ciphertext to decrypt */ decryptLegacyTDF(ciphertext: string | TypedArray | ArrayBuffer): Promise; /** * Encrypt data * * Pass a string, TypedArray, or ArrayBuffer data and get a promise which resolves ciphertext * * @param data to decrypt */ encrypt(data: string | TypedArray | ArrayBuffer): Promise; } /** * NanoTDF Dataset SDK Client * * * @example * ``` * import { clientSecretAuthProvider, NanoTDFDatasetClient } from '@opentdf/client'; * * const OIDC_ENDPOINT = 'http://localhost:65432/auth/realms/tdf'; * const KAS_URL = 'http://localhost:65432/api/kas/'; * * const ciphertext = '...'; * const client = new NanoTDFDatasetClient.default( * await clientSecretAuthProvider({ * clientId: 'tdf-client', * clientSecret: '123-456', * exchange: 'client', * oidcOrigin: OIDC_ENDPOINT, * }), * KAS_URL * ); * const plaintext = client.decrypt(ciphertext); * console.log('Plaintext', plaintext); * ``` */ export declare class NanoTDFDatasetClient extends Client { static readonly NTDF_MAX_KEY_ITERATIONS = 8388606; private maxKeyIteration; private keyIterationCount; private cachedEphemeralKey?; private unwrappedKey?; private symmetricKey?; private cachedHeader?; /** * Create new NanoTDF Dataset Client * * The Ephemeral Key Pair can either be provided or will be generate when fetching the entity object. Once set it * cannot be changed. If a new ephemeral key is desired it a new client should be initialized. * There is no performance impact for creating a new client IFF the ephemeral key pair is provided. * * @param clientConfig OIDC client credentials * @param kasUrl Key access service URL * @param ephemeralKeyPair (optional) ephemeral key pair to use * @param maxKeyIterations Max iteration to performe without a key rotation */ constructor(authProvider: AuthProvider, kasUrl: string, maxKeyIterations?: number, ephemeralKeyPair?: Required>); /** * Encrypt data * * Pass a string, TypedArray, or ArrayBuffer data and get a promise which resolves ciphertext * * @param data to decrypt */ encrypt(data: string | TypedArray | ArrayBuffer): Promise; /** * Decrypt ciphertext * * Pass a base64 string, TypedArray, or ArrayBuffer ciphertext and get a promise which resolves plaintext * * @param ciphertext Ciphertext to decrypt */ decrypt(ciphertext: string | TypedArray | ArrayBuffer): Promise; rewrapAndDecrypt(nanotdf: NanoTDF): Promise; generateIV(): Uint8Array; } /** * Authorization for connecting authZ tokens to * remote requests. */ export * as AuthProviders from './auth/providers.js'; export { version, clientType } from './version.js'; //# sourceMappingURL=index.d.ts.map