/*! * Copyright (c) 2019-2020 Digital Bazaar, Inc. All rights reserved. */ import type { IHMAC, IKeyAgreementKey, IKeyResolver, IRecipientTemplate, ISigner } from '@interop/data-integrity-core'; import { EdvClient } from './EdvClient.js'; export declare class EdvDocument { id?: string; recipients: IRecipientTemplate[]; keyResolver?: IKeyResolver; keyAgreementKey?: IKeyAgreementKey; hmac?: IHMAC; capability: any; invocationSigner?: ISigner; client: EdvClient; /** * Creates a new instance of a EdvDocument. * * @param {object} options - The options to use. * @param {string} [options.id] - The ID of the document; this is * only necessary if the capability's `invocationTarget` is not for the * document itself (but is for the entire EDV). * @param {Array} [options.recipients=[]] - An array of additional recipients * for the encrypted content. * @param {Function} [options.keyResolver] - A default function that * returns a Promise that resolves a key ID to a DH public key. * @param {object} [options.keyAgreementKey] - A KeyAgreementKey API for * deriving KEKs for wrapping/unwrapping content encryption keys. * @param {object} [options.hmac] - An HMAC API for blinding indexable * attributes. * @param {object} [options.capability] - The OCAP-LD authorization * capability to use to authorize the invocation of EdvClient methods. * @param {object} options.invocationSigner - An API for signing * a capability invocation. * @param {string} [options.cipherVersion='recommended'] - Sets the cipher * version to either "recommended" or "fips". * @param {EdvClient} [options.client] - An EdvClient to use. * * @returns {EdvDocument} The new EdvDocument instance. */ constructor({ id, capability, invocationSigner, recipients, keyResolver, keyAgreementKey, hmac, cipherVersion, client }: any); /** * Retrieves and decrypts this document from its EDV. * * @returns {Promise} - Resolves to the decrypted document. */ read(): Promise; /** * @typedef ReadableStream * Gets a `ReadableStream` to read the chunked data associated with a * document. * * @param {object} options - The options to use. * @param {object} options.doc - The decrypted document to get a stream for; * call `read()` to get this. * * @returns {Promise} - Resolves to a `ReadableStream` to read * the chunked data from. */ getStream({ doc }: any): Promise>; /** * Encrypts and updates this document in its EDV. * * @param {object} options - The options to use. * @param {object} options.doc - The unencrypted document to update/insert. * @param {ReadableStream} [options.stream] - A WHATWG Readable stream to read * from to associate chunked data with this document. * @param {number} [options.chunkSize] - The size, in bytes, of the chunks to * break the incoming stream data into. * @param {Array} [options.recipients=[]] - An array of additional recipients * for the encrypted content. * @param {Function} options.keyResolver - A function that returns a Promise * that resolves a key ID to a DH public key. * * @returns {Promise} - Resolves to the inserted document. */ write({ doc, stream, chunkSize, recipients, keyResolver, additionalProtectedParams, chunkedAad }: any): Promise; /** * Deletes this document from the EDV. * * @param {object} options - The options to use. * @param {object} options.doc - The unencrypted document to update/insert. * @param {Array} [options.recipients=[]] - An array of additional recipients * for the encrypted content. * @param {Function} options.keyResolver - A function that returns a Promise * that resolves a key ID to a DH public key. * * @returns {Promise} - Resolves to `true` when the document is * deleted. */ delete({ doc, recipients, keyResolver }?: any): Promise; } //# sourceMappingURL=EdvDocument.d.ts.map