/// <reference types="node" />
import { Nullable, Optional } from '@guarani/types';
import { SupportedJsonWebKeyAlgorithm } from '../../jwk/algorithms/types/supported-jsonwebkey-algorithm';
import { JsonWebKey } from '../../jwk/jsonwebkey';
import { SupportedJsonWebSignatureAlgorithm } from './types/supported-jsonwebsignature-algorithm';
/**
 * Abstract Base Class for {@link https://www.rfc-editor.org/rfc/rfc7518.html#section-3 RFC 7518 Section 3}.
 *
 * All JSON Web Signature Algorithms supported by Guarani **MUST** extend this base class
 * and implement its abstract methods.
 */
export declare abstract class JsonWebSignatureAlgorithm {
    /**
     * Type of JSON Web Key supported by this JSON Web Signature Algorithm.
     */
    protected readonly keyType?: Optional<SupportedJsonWebKeyAlgorithm>;
    /**
     * Hash Algorithm used to Sign and Verify the Messages.
     */
    protected readonly hash: Nullable<string>;
    /**
     * Name of the JSON Web Signature Algorithm.
     */
    protected readonly algorithm: SupportedJsonWebSignatureAlgorithm;
    /**
     * Instantiates a new JSON Web Signature Algorithm to Sign and Verify the Messages.
     *
     * @param hash Hash Algorithm used to Sign and Verify the Messages.
     * @param algorithm Name of the JSON Web Signature Algorithm.
     * @param keyType Type of JSON Web Key supported by this JSON Web Signature Algorithm.
     */
    constructor(hash: Nullable<string>, algorithm: SupportedJsonWebSignatureAlgorithm, keyType?: Optional<SupportedJsonWebKeyAlgorithm>);
    /**
     * Signs a Message with the provided JSON Web Key.
     *
     * @param message Message to be Signed.
     * @param key JSON Web Key used to Sign the provided Message.
     * @returns Resulting Signature of the provided Message.
     */
    abstract sign(message: Buffer, key?: Optional<JsonWebKey>): Promise<Buffer>;
    /**
     * Checks if the provided Signature matches the provided Message based on the provided JSON Web Key.
     *
     * @param signature Signature to be matched against the provided Message.
     * @param message Message to be matched against the provided Signature.
     * @param key JSON Web Key used to verify the Signature and Message.
     */
    abstract verify(signature: Buffer, message: Buffer, key?: Optional<JsonWebKey>): Promise<void>;
    /**
     * Checks if the provided JSON Web Key can be used by the requesting JSON Web Signature Algorithm.
     *
     * @param key JSON Web Key to be checked.
     * @throws {InvalidJsonWebKeyException} The provided JSON Web Key is invalid.
     */
    protected validateJsonWebKey(key: JsonWebKey): void;
}
