@guarani/jose
Version:
Implementation of the RFCs of the JOSE Working Group.
35 lines (34 loc) • 1.39 kB
TypeScript
/// <reference types="node" />
import { SupportedJsonWebEncryptionCompressionAlgorithm } from './types/supported-jsonwebencryption-compression-algorithm';
/**
* Abstract Base Class for the JSON Web Encryption Compression Algorithms.
*
* All JSON Web Encryption Compression Algorithms supported by Guarani **MUST** extend this base class
* and implement its abstract methods.
*/
export declare abstract class JsonWebEncryptionCompressionAlgorithm {
/**
* Name of the JSON Web Encryption Compression Algorithm.
*/
protected readonly algorithm: SupportedJsonWebEncryptionCompressionAlgorithm;
/**
* Instantiates a new JSON Web Encryption Compression Algorithm to Compress and Decompress a Plaintext.
*
* @param algorithm Name of the JSON Web Encryption Compression Algorithm.
*/
constructor(algorithm: SupportedJsonWebEncryptionCompressionAlgorithm);
/**
* Compresses the provided Plaintext before Encryption.
*
* @param plaintext Plaintext to be Compressed.
* @returns Compressed Plaintext.
*/
abstract compress(plaintext: Buffer): Promise<Buffer>;
/**
* Decompresses the provided Compressed Plaintext after Decryption.
*
* @param plaintext Compressed Plaintext to be Decompressed.
* @returns Decompressed Plaintext.
*/
abstract decompress(plaintext: Buffer): Promise<Buffer>;
}