import { Observable } from 'rxjs'; import { IFile, IImportedSignatureVerificationResult, ISignatureRequest, ISignatureVerificationResult } from './data'; import { ICertificate } from './data/certificate'; /** * Represents a cryptographic provider interface for signing, verifying, and retrieving certificates. * @exposedInterface */ export declare abstract class ICryptoProvider { constructor(); /** * Signs a file with a digital signature using the provided certificate. * * @param documentId The documentId, represented as string. * @param actualFile The actualFile for additional information, represented as an IFile. * @param arrayBuffer The file to be signed, represented as an ArrayBuffer. * @param certificate The digital certificate to use for signing, represented as an ArrayBuffer. * @param signatureRequestIds An array of IDs for the signature requests. * @returns An observable that resolves to the digital signature as a string. */ sign(documentId: string, actualFile: IFile, arrayBuffer: ArrayBuffer, certificate: ICertificate, signatureRequestIds: string[]): Observable; /** * Verifies the digital signature of a file. * * @param file - The file data to be verified. This should be the raw binary data of the file. * @param sign - The digital signature to be verified against the file. This should be the raw binary data of the signature. * @param signatureRequest - Description of signature's request. * @returns - An observable that emits the result of the verification process. The result will indicate whether the signature is valid, and may include additional information such as error messages. * * @example const fileData = new ArrayBuffer(1024); const signatureData = new ArrayBuffer(256); verify(fileData, signatureData, signatureRequest).subscribe(result => { if (result.verificationStatus === F.Valid) { console.log("Signature is valid"); } else { console.log(`Signature is invalid: ${result.error}`); } }); */ verify(file: ArrayBuffer, sign: ArrayBuffer, signatureRequest: ISignatureRequest): Observable; /** * Verifies the digital signature that being imported. * * @param file - The file data to be verified. This should be the raw binary data of the file. * @param sign - The digital signature to be verified against the file. This should be the raw binary data of the signature. * @returns - An observable that emits the result of the verification process. The result will indicate whether the signature is valid, and may include additional information such as error messages. * * @example const fileData = new ArrayBuffer(1024); const signatureData = new ArrayBuffer(256); verifyImportedSignature(fileData, signatureData).subscribe(result => { if (result.verificationStatus === F.Valid) { console.log("Signature is valid"); } else { console.log(`Signature is invalid: ${result.error}`); } }); */ verifyImportedSignature(file: ArrayBuffer, sign: ArrayBuffer): Observable; /** * Retrieves a list of digital certificates. * * @returns An observable that resolves to an array of ICertificate objects. */ getCertificates(): Observable; /** Determines whether the cryptoprovider can process the specified algorithm(s). * * @param publicKeyOid public key's oid used to create digital signature. * @returns {boolean} True if the cryptoprovider can process the algorithm(s), false otherwise. * * @example * // When the client tries to determine if this provider can process algorithm * const can = canProcessAlgorithms("1.2.840.113549.1.1.1"); */ canProcessAlgorithms(publicKeyOid: string): boolean; /** Determines whether the cryptoprovider can process signature. The method is needed when the signature is being imported and the signature algorithm is unknown. * * @param signatureFile signature file. * @returns {boolean} True if the cryptoprovider can process the signature, false otherwise. */ canProcessSignature(signatureFile: ArrayBuffer): boolean; }