/// <reference types="node" />
/// <reference types="node" />
import { EventEmitter } from 'events';
import { AnyTdfStream } from './client/tdf-stream.js';
import EntityObject from '../../../lib/src/tdf/EntityObject.js';
import { AttributeSet, KeyInfo, Manifest, Policy, SplitKey, UpsertResponse } from './models/index.js';
import { ZipReader, Chunker } from './utils/index.js';
import { Binary } from './binary.js';
import { AesGcmCipher } from './ciphers/index.js';
import { AuthProvider, AppIdAuthProvider, HttpRequest, Method } from '../../src/auth/auth.js';
import PolicyObject from '../../src/tdf/PolicyObject.js';
type Options = {
    type: string;
    cipher: string;
};
export type RcaParams = {
    pu: string;
    wu: string;
    wk: string;
    al: string;
};
type Metadata = {
    connectOptions: {
        testUrl: string;
    };
    policyObject: PolicyObject;
};
type AddKeyAccess = {
    type: 'wrapped' | 'remote';
    url?: string;
    publicKey: string;
    attributeUrl?: string;
    metadata: Metadata | null;
};
declare class TDF extends EventEmitter {
    policy?: Policy;
    mimeType?: string;
    contentStream?: ReadableStream<Uint8Array>;
    manifest?: Manifest;
    entity?: EntityObject;
    encryptionInformation?: SplitKey;
    htmlTransferUrl?: string;
    authProvider?: AuthProvider | AppIdAuthProvider;
    integrityAlgorithm: string;
    segmentIntegrityAlgorithm: string;
    publicKey: string;
    privateKey: string;
    attributeSet: AttributeSet;
    segmentSizeDefault: number;
    constructor();
    static create(): TDF;
    static createCipher(type: string): AesGcmCipher;
    static generatePolicyUuid(): Promise<string>;
    /**
     *
     * @param {Buffer} payload - This is the payload. It must be a buffer.
     * @param {json} manifest - This is the manifest
     * @param {String} transferUrl
     * @return {Buffer}
     */
    static wrapHtml(payload: Buffer, manifest: Manifest | string, transferUrl: string): Buffer;
    static unwrapHtml(htmlPayload: Buffer | Uint8Array): Uint8Array | Buffer;
    static getPublicKeyFromKeyAccessServer(url: string): Promise<string>;
    static extractPemFromKeyString(keyString: string): Promise<string>;
    static getManifestFromRemoteTDF(url: string): Promise<Manifest>;
    static getPolicyFromRemoteTDF(url: string): Promise<string>;
    setProtocol(): TDF;
    setHtmlTransferUrl(url: string): TDF;
    setAuthProvider(authProvider?: AuthProvider | AppIdAuthProvider): TDF;
    setEncryption(opts: Options): this;
    /**
     * Build a key access object and add it to the list. Can specify either
     * a (url, publicKey) pair (legacy, deprecated) or an attribute URL (future).
     * If all are missing then it attempts to use the default attribute. If that
     * is missing it throws an error.
     * @param  {Object} options
     * @param  {String} options.type - enum representing how the object key is treated
     * @param  {String} options.attributeUrl - URL of the attribute to use for pubKey and kasUrl. Omit to use default.
     * @param  {String} options.url - directly set the KAS URL
     * @param  {String} options.publicKey - directly set the (KAS) public key
     * @param  {String? Object?} options.metadata - Metadata. Appears to be dead code.
     * @return {<TDF>}- this instance
     */
    addKeyAccess({ type, url, publicKey, attributeUrl, metadata }: AddKeyAccess): Promise<this>;
    setPolicy(policy: Policy): this;
    setPublicKey(publicKey: string): this;
    /**
     * Add an entity object. This contains attributes with public key info that
     * is used to make splits and wrap object keys.
     * @param  {Object} entity - EntityObject
     * @return {<TDF>}- this instance
     */
    setEntity(entity: EntityObject): this;
    setPrivateKey(privateKey: string): this;
    setDefaultSegmentSize(segmentSizeDefault: number): this;
    setIntegrityAlgorithm(integrityAlgorithm: string, segmentIntegrityAlgorithm: string): this;
    addContentStream(contentStream: ReadableStream<Uint8Array>, mimeType?: string): this;
    validatePolicyObject(policy: Policy): void;
    _generateManifest(keyInfo: KeyInfo): Promise<Manifest>;
    getSignature(unwrappedKeyBinary: Binary, payloadBinary: Binary, algorithmType: string): Promise<string>;
    sync(): Promise<void>;
    buildRequest(method: Method, url: string, body: unknown): HttpRequest;
    upsert(unsavedManifest: Manifest, ignoreType?: boolean): Promise<UpsertResponse>;
    writeStream(byteLimit: number, isRcaSource: boolean, payloadKey?: Binary): Promise<AnyTdfStream>;
    loadTDFStream(chunker: Chunker): Promise<{
        zipReader: ZipReader;
        centralDirectory: import("./utils/zip-reader").CentralDirectory[];
    }>;
    unwrapKey(manifest: Manifest): Promise<{
        reconstructedKeyBinary: Binary;
        metadata: undefined;
    }>;
    /**
     * readStream
     *
     * @param {Object} chunker - A function object for getting data in a series of typed array objects
     * @param {Stream} outputStream - The writable stream we should put the new bits into
     * @param {Object} rcaParams - Optional field to specify if file is stored on S3
     */
    readStream(chunker: Chunker, rcaParams?: RcaParams): Promise<import("./client/DecoratedReadableStream").DecoratedReadableStream>;
}
export default TDF;
//# sourceMappingURL=tdf.d.ts.map