/// <reference types="node" />
/// <reference types="node" />
import { S3ClientConfig } from '@aws-sdk/client-s3';
import { AttributeObject, Policy } from '../models/index.js';
import { RcaParams } from '../tdf.js';
import { Binary } from '../binary.js';
import { PemKeyPair } from '../crypto/declarations.js';
import PolicyObject from '../../../src/tdf/PolicyObject.js';
import EntityObject from '../../../src/tdf/EntityObject.js';
export declare const DEFAULT_SEGMENT_SIZE: number;
export type VirtruS3Config = S3ClientConfig & {
    Bucket?: string;
};
export type VirtruCreds = S3ClientConfig['credentials'];
export type FetchCreds = {
    AWSAccessKeyId: string;
    AWSSecretAccessKey: string;
    AWSSessionToken: string;
};
export interface VirtruTempS3Credentials {
    data: {
        bucket: string;
        fields: FetchCreds;
        url: string;
    };
}
interface Scope {
    dissem: string[];
    policyId?: string;
    policyObject?: Policy;
    attributes: AttributeObject[];
}
type Metadata = {
    connectOptions: {
        testUrl: string;
    };
    policyObject: PolicyObject;
};
export interface EncryptParams {
    source: ReadableStream<Uint8Array>;
    opts?: {
        keypair: PemKeyPair;
    };
    output?: NodeJS.WriteStream;
    scope: Scope;
    metadata: Metadata | null;
    keypair?: CryptoKeyPair;
    contentLength?: number;
    offline: boolean;
    windowSize: number;
    asHtml: boolean;
    rcaSource: boolean;
    getPolicyId?: () => EncryptParams['scope']['policyId'];
    mimeType?: string;
    eo?: EntityObject;
    payloadKey?: Binary;
}
/**
 * A builder capable of constructing the necessary parameters object for a
 * {@link Client#encrypt|encrypt} operation. Must be built before use via the {@link EncryptParamsBuilder#build|build()} function.
 */
declare class EncryptParamsBuilder {
    private _params;
    constructor(params?: Partial<EncryptParams>);
    setContentLength(contentLength: number): void;
    withContentLength(contentLength: number): this;
    getStreamSource(): EncryptParams['source'] | undefined;
    /**
     * Specify the content to encrypt, in stream form.
     * @param {Readable} readStream - a Readable Stream to encrypt.
     */
    setStreamSource(readStream: ReadableStream<Uint8Array>): void;
    /**
     * Specify the content to encrypt, in stream form. Returns this object for method chaining.
     * @param {Readable} readStream - a Readable Stream to encrypt.
     * @return {EncryptParamsBuilder} - this object.
     */
    withStreamSource(readStream: ReadableStream<Uint8Array>): EncryptParamsBuilder;
    /**
     * Specify the remote content to encrypt in stream form.
     * withRemoteStore() has not been implemented because setRemoteStore() is async so withRemoteStore() can't be chained with a build() call.
     * @param {string} fileName - the name of the remote file to write TDF ciphertext to.
     * @param {S3ClientConfig} [config] - the object containing remote storage configuration.
     * <br>A detailed spec for the interface can be found [here]{@link https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html}
     * @param {string} [credentialURL] - the url to request remote storage credentials from.
     * <br>Credentials can be generated using [GetFederationToken]{@link https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html}
     * @return {EncryptParamsBuilder} - this object.
     */
    setRemoteStore(fileName: string, config: VirtruS3Config, credentialURL: string): Promise<EncryptParams | DecryptParams>;
    /**
     * Specify the content to encrypt, in string form.
     * @param {string} string - a string to encrypt.
     */
    setStringSource(string: string): void;
    /**
     * Specify the content to encrypt, in string form. Returns this object for method chaining.
     * @param {string} string - a string to encrypt.
     * @return {EncryptParamsBuilder} - this object.
     */
    withStringSource(string: string): EncryptParamsBuilder;
    /**
     * Specify the content to encrypt, in buffer form.
     * @param {Buffer} buf - a buffer to encrypt.
     */
    setBufferSource(buf: Buffer): void;
    /**
     * Specify the content to encrypt, in buffer form. Returns this object for method chaining.
     * @param {Buffer} buf - a buffer to encrypt
     * @return {EncryptParamsBuilder} - this object.
     */
    withBufferSource(buf: Buffer): this;
    /**
     * Specify the content to encrypt using an ArrayBuffer reference, which must have already
     * loaded the file content. Using the below linked example, e.target.result is the ArrayBuffer.
     * <br/><br/>
     * Example: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onload
     *
     * @param {ArrayBuffer} arraybuffer - the array buffer containing the file to encrypt.
     * @return {EncryptParamsBuilder} - this object
     */
    setArrayBufferSource(arraybuffer: ArrayBuffer): void;
    /**
     * Specify the content to encrypt using an ArrayBuffer reference. Returns this object for method chaining.
     *
     * @param  {ArrayBuffer} arraybuffer - the ArrayBuffer used to load file content from a browser
     * @return {EncryptParamsBuilder} - this object.
     */
    withArrayBufferSource(arraybuffer: ArrayBuffer): EncryptParamsBuilder;
    getAttributes(): EncryptParams['scope']['attributes'];
    /**
     * @param {{ attribute: string }[]} attributes URI of the form `<authority namespace>/attr/<name>/value/<value>`
     */
    setAttributes(attributes: EncryptParams['scope']['attributes']): void;
    /**
     * @param {Object} attributes
     * @param {String} attributes.attribute URI of the form `<authority namespace>/attr/<name>/value/<value>`
     * @returns {EncryptParamsBuilder} with attributes set
     */
    withAttributes(attributes: EncryptParams['scope']['attributes']): EncryptParamsBuilder;
    /**
     * Get the users configured to access (decrypt) the encrypted data.
     * @return {array} - array of users (e.g., email addresses).
     */
    getUsersWithAccess(): EncryptParams['scope']['dissem'];
    /**
     * Specify the full list of users configured to access (decrypt) the encrypted data.
     * @param {array} users - varargs or array of users (e.g., email addresses).
     */
    setUsersWithAccess(users: string[]): void;
    /**
     * Specify the full list of users configured to access (decrypt) the encrypted data. Returns this object for method chaining.
     * <br/><br/>
     * @param {array} users - varargs or array of users (e.g., email addresses).
     * @return {EncryptParamsBuilder} - this object.
     */
    withUsersWithAccess(users: string[]): EncryptParamsBuilder;
    /**
     * Get the metadata (arbitrary key-value pairs) to be associated with the encrypted blob.
     * </br></br>
     * This metadata is encrypted alongside the content and stored in the TDF ciphertext.
     * @return {object} - object containing metadata as key-value pairs.
     */
    getMetadata(): EncryptParams['metadata'];
    /**
     * Specify the metadata (arbitrary key-value pairs) to be associated with the encrypted blob.
     * </br></br>
     * This metadata is encrypted alongside the content and stored in the TDF ciphertext.
     * @param {object} metadata - object containing metadata as key-value pairs.
     */
    setMetadata(metadata: EncryptParams['metadata']): void;
    /**
     * Specify the metadata (arbitrary key-value pairs) to be associated with the encrypted blob.
     * Returns this object for method chaining.
     * </br></br>
     * This metadata is encrypted alongside the content and stored in the TDF ciphertext.
     * @param {object} metadata - object containing metadata as key-value pairs.
     * @return {EncryptParamsBuilder} - this object.
     */
    withMetadata(metadata: EncryptParams['metadata']): this;
    getPolicyId(): string | undefined;
    setPolicyId(policyId: string): void;
    withPolicyId(policyId: string): EncryptParamsBuilder;
    isOnline(): boolean;
    setOnline(): void;
    setOffline(): void;
    withOffline(): EncryptParamsBuilder;
    withOnline(): EncryptParamsBuilder;
    /**
     * Get the size of the sliding window to use when writing out the encrypted ciphertext.
     * Used to bound the memory used by the client for large files.
     * <br/><br/>
     * This window will match the "segment size" defined in the
     * <a href="https://github.com/virtru/tdf3-spec">TDF spec</a>, so a larger window
     * will result in more compact ciphertext.
     * @return {number} The sliding window size, in bytes (1MB by default).
     */
    getStreamWindowSize(): number | undefined;
    /**
     * Set the size of the sliding window to use when writing out the encrypted ciphertext.
     * Used to bound the memory used by the client for large files.
     * <br/><br/>
     * This window will match the "segment size" defined in the
     * <a href="https://github.com/virtru/tdf3-spec">TDF spec</a>, so a larger window
     * will result in more compact ciphertext.
     * @param {number} numBytes sliding window size, in bytes (1MB by default).
     */
    setStreamWindowSize(numBytes: number): void;
    /**
     * Set the size of the sliding window to use when writing out the encrypted ciphertext.
     * Used to bound the memory used by the client for large files. Returns this object for method chaining.
     * <br/><br/>
     * This window will match the "segment size" defined in the
     * <a href="https://github.com/virtru/tdf3-spec">TDF spec</a>, so a larger window
     * will result in more compact ciphertext.
     * @param {number} numBytes sliding window size, in bytes (1MB by default).
     * @return {EncryptParamsBuilder} - this object.
     */
    withStreamWindowSize(numBytes: number): EncryptParamsBuilder;
    /**
     * Whether the encrypted data should be formatted using html. This allows authorized users to
     * double click and read using the Virtru Secure Reader, at the cost of reduced space efficiency.
     * <br/><br/>
     * This is enabled by default.
     * @return {boolean} true if the encrypted data will be in html format.
     */
    hasHtmlFormat(): boolean;
    /**
     * Specify that the encrypted data should be formatted using html. This allows authorized users to
     * double click and read using the Virtru Secure Reader, at the cost of reduced space efficiency.
     * <br/><br/>
     * This is enabled by default.
     */
    setHtmlFormat(): void;
    /**
     * Specify that the encrypted data should be formatted using html. This allows authorized users to
     * double click and read using the Virtru Secure Reader, at the cost of reduced space efficiency.
     * Returns this object for method chaining.
     * <br/><br/>
     * This is enabled by default.
     * @return {EncryptParamsBuilder} - this object.
     */
    withHtmlFormat(): EncryptParamsBuilder;
    /**
     * Whether the encrypted data should be formatted using zip. This is more space efficient than html,
     * but authorized users must leverage the Virtru SDK to decrypt.
     * <br/><br/>
     * This is disabled by default (html is enabled by default).
     * @return {boolean} true if the encrypted data will be in zip format.
     */
    hasZipFormat(): boolean;
    /**
     * Whether the encrypted data should be formatted using zip. This is more space efficient than html,
     * but authorized users must leverage the Virtru SDK to decrypt.
     * <br/><br/>
     * This is disabled by default (html is enabled by default).
     */
    setZipFormat(): void;
    /**
     * Whether the encrypted data should be formatted using zip. This is more space efficient than html,
     * but authorized users must leverage the Virtru SDK to decrypt. Returns this object for method chaining.
     * <br/><br/>
     * This is disabled by default (html is enabled by default).
     * @return {EncryptParamsBuilder} - this object.
     */
    withZipFormat(): EncryptParamsBuilder;
    /**
     * @param isRcaSource{boolean}
     */
    setRcaSource(isRcaSource: boolean): void;
    withRcaSource(): EncryptParamsBuilder;
    /**
     * Gets the (consumer provided) mime type of the file to be protected
     */
    getMimeType(): string | undefined;
    /**
     * Sets the mime type of the underlying file.
     * @param {string} mimeType - the content type string to be applied during decrypt
     * @return {EncryptParamsBuilder} - this object.
     */
    setMimeType(mimeType: string): void;
    /**
     * Sets the mime type of the underlying file.
     * @param {string} mimeType - the content type string to be applied during decrypt
     * @return {EncryptParamsBuilder} - this object.
     */
    withMimeType(mimeType: string): EncryptParamsBuilder;
    _deepCopy(_params: EncryptParams): Readonly<{
        getPolicyId: () => string | undefined;
        source: ReadableStream<Uint8Array>;
        opts?: {
            keypair: PemKeyPair;
        } | undefined;
        output?: NodeJS.WriteStream | undefined;
        scope: Scope;
        metadata: Metadata | null;
        keypair?: CryptoKeyPair | undefined;
        contentLength?: number | undefined;
        offline: boolean;
        windowSize: number;
        asHtml: boolean;
        rcaSource: boolean;
        mimeType?: string | undefined;
        eo?: EntityObject | undefined;
        payloadKey?: Binary | undefined;
    }>;
    /**
     * Generate a parameters object in the form expected by <code>{@link EncryptParamsBuilder#build|build()}</code>.
     * <br/><br/>
     * Creates a deep copy to prevent tricky call-by-reference and async execution bugs.
     */
    build(): Readonly<EncryptParams>;
}
export type DecryptSource = null | {
    type: 'buffer';
    location: Buffer;
} | {
    type: 'remote';
    location: string;
} | {
    type: 'stream';
    location: ReadableStream<Uint8Array>;
} | {
    type: 'file-browser' | 'file-node';
    location: string;
};
export type DecryptParams = {
    source: DecryptSource;
    opts?: {
        keypair: PemKeyPair;
    };
    rcaSource?: RcaParams;
    eo?: EntityObject;
} & Pick<EncryptParams, 'contentLength' | 'keypair'>;
/**
 * A builder capable of constructing the necessary parameters object for a
 * <code>{@link Client#decrypt|decrypt}</code> operation. Must be built using the <code>{@link DecryptParamsBuilder#build|build()}</code> function.
 * <br/><br/>
 * Decrypt does not currently allow for setting a {@link EncryptParamsBuilder#getStreamWindowSize|stream window size}. Support for this configuration will be added in the near future.
 * <br/><br/>
 * Example usage:
 * <pre>
 // Configure the parameters to decrypt a local file.
 const decryptParams = new Virtru.DecryptParamsBuilder()
 .withFileSource("encrypted.html")
 .build();

 // Run the decrypt and write the result to stdout (node-style).
 (await client.decrypt(decryptParams)).pipe(process.stdout);
 </pre>
 */
declare class DecryptParamsBuilder {
    private _params;
    constructor(to_copy?: DecryptParams);
    setContentLength(contentLength: number): void;
    withContentLength(contentLength: number): this;
    getStreamSource(): DecryptSource;
    /**
     * Set the TDF ciphertext to decrypt, in buffer form.
     * @param {Buffer} buffer - a buffer to decrypt.
     */
    setBufferSource(buffer: Buffer): void;
    /**
     * Set the TDF ciphertext to decrypt, in buffer form. Returns this object for method chaining.
     * @param {Buffer} buffer - a buffer to decrypt.
     * @return {DecryptParamsBuilder} - this object.
     */
    withBufferSource(buffer: Buffer): DecryptParamsBuilder;
    /**
     * Specify the TDF ciphertext to decrypt, from an http(s) URL.
     * TODO: add support for TDF.html encoding
     * @param {string} url - a url pointing to a tdf3 file
     */
    setUrlSource(url: string): void;
    /**
     * Specify the TDF ciphertext to decrypt, as a URL.
     * @param {string} url - a tdf3 remote URL.
     * @return {DecryptParamsBuilder} - this object.
     */
    withUrlSource(url: string): DecryptParamsBuilder;
    /**
     * Specify the TDF ciphertext to decrypt, in stream form.
     * @param {Readable} stream - a Readable stream to decrypt.
     */
    setStreamSource(stream: ReadableStream<Uint8Array>): void;
    /**
     * Specify the TDF ciphertext to decrypt, in stream form. Returns this object for method chaining.
     * @param {Readable} stream - a Readable stream to decrypt.
     * @return {DecryptParamsBuilder} - this object.
     */
    withStreamSource(stream: ReadableStream<Uint8Array>): this;
    /**
     * Specify the remote content to decrypt in stream form.
     * withRemoteStore() has not been implemented because setRemoteStore() is async so withRemoteStore() can't be chained with a build() call.
     * @param {string} fileName - the name of the remote file to write TDF ciphertext to.
     * @param {S3ClientConfig} [config] - the object containing remote storage configuration.
     * <br>A detailed spec for the interface can be found [here]{@link https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html}
     * @param {string} [credentialURL] - the url to request remote storage credentials from.
     * <br>Credentials can be generated using [GetFederationToken]{@link https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html}
     * @return {DecryptParamsBuilder} - this object.
     */
    setRemoteStore(fileName: string, config: VirtruS3Config, credentialURL: string): Promise<DecryptParams | EncryptParams>;
    /**
     * Specify the TDF ciphertext to decrypt, in string form.
     * @param {string} string - a string to decrypt.
     */
    setStringSource(string: string): void;
    /**
     * Specify the TDF ciphertext to decrypt, in string form. Returns this object for method chaining.
     * @param {string} string - a string to decrypt.
     * @return {DecryptParamsBuilder} - this object.
     */
    withStringSource(string: string): DecryptParamsBuilder;
    /**
     * Specify a reference to a local file with the TDF ciphertext to decrypt.
     * Only works with node.
     * @param {string} filepath - the path of the local file to decrypt.
     */
    setFileSource(filepath: string): void;
    /**
     * Specify a reference to a local file with the TDF ciphertext to decrypt. Only works with node.
     * Returns this object for method chaining.
     * @param {string} filepath - the path of the local file to decrypt.
     * @return {DecryptParamsBuilder} - this object.
     */
    withFileSource(filepath: string): DecryptParamsBuilder;
    /**
     * Specify the content to decrypt using an ArrayBuffer reference, which must have already
     * loaded the file content. Using the below linked example, e.target.result is the ArrayBuffer
     * <br/><br/>
     * Example: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/onload
     *
     * @param {ArrayBuffer} arraybuffer - the array buffer containing the file to decrypt.
     * @return {DecryptParamsBuilder} - this object
     */
    setArrayBufferSource(arraybuffer: ArrayBuffer): void;
    /**
     * Specify the content to decrypt using an ArrayBuffer reference. Returns this object for method chaining.
     *
     * @param  {ArrayBuffer} arraybuffer - the ArrayBuffer used to load file content from a browser
     * @return {DecryptParamsBuilder} - this object.
     */
    withArrayBufferSource(arraybuffer: ArrayBuffer): DecryptParamsBuilder;
    /**
     * @param rcaParams
     */
    setRcaSource(rcaParams: RcaParams): void;
    /**
     * Use it with .withStreamSource
     * @param rcaParams
     * @returns {DecryptParamsBuilder}
     */
    withRcaSource(rcaParams: RcaParams): DecryptParamsBuilder;
    _deepCopy(_params: DecryptParams): Readonly<{
        source: DecryptSource;
        opts?: {
            keypair: PemKeyPair;
        } | undefined;
        rcaSource?: RcaParams | undefined;
        eo?: EntityObject | undefined;
        keypair?: CryptoKeyPair | undefined;
        contentLength?: number | undefined;
    }>;
    /**
     * Generate a parameters object in the form expected by <code>{@link Client#decrypt|decrypt}</code>.
     * <br/><br/>
     * Creates a deep copy to prevent tricky call-by-reference and async execution bugs.
     */
    build(): Readonly<DecryptParams>;
}
export { DecryptParamsBuilder, EncryptParamsBuilder };
//# sourceMappingURL=builders.d.ts.map