import type { DataEncodedRecordsWriteMessage } from '../types/records-types.js';
import type { GeneralJws } from '../types/jws-types.js';
import type { MessageSigner } from '../types/signer.js';
import type { AuthorizationModel, Descriptor, GenericMessage, GenericSignaturePayload } from '../types/message-types.js';
type PermissionGrantInvocation = {
    permissionGrantId?: string;
    permissionGrantIds?: string[];
};
type ValidateSignatureStructureOptions = {
    /**
     * Permission grant invocations are bound to the author signature payload.
     * Owner signatures only prove owner retention/consent and do not repeat
     * the author's grant invocation fields.
     */
    validatePermissionGrantInvocation?: boolean;
};
/**
 * A class containing utility methods for working with DWN messages.
 */
export declare class Message {
    /**
     * Gets the DID of the author of the given message.
     */
    static getAuthor(message: GenericMessage): string | undefined;
    /**
     * Validates the given message against the corresponding JSON schema.
     * @throws {Error} if fails validation.
     */
    static validateJsonSchema(rawMessage: any): void;
    /**
     * Gets the DID of the signer of the given message, returns `undefined` if message is not signed.
     */
    static getSigner(message: GenericMessage): string | undefined;
    /**
     * Gets the CID of the given message.
     */
    static getCid(message: GenericMessage): Promise<string>;
    /**
     * Compares message CID in lexicographical order according to the spec.
     * @returns 1 if `a` is larger than `b`; -1 if `a` is smaller/older than `b`; 0 otherwise (same message)
     */
    static compareCid(a: GenericMessage, b: GenericMessage): Promise<number>;
    /**
     * Creates the `authorization` property to be included in a DWN message.
     * @param signer Message signer.
     * @returns {AuthorizationModel} used as an `authorization` property.
     */
    static createAuthorization(input: {
        descriptor: Descriptor;
        signer: MessageSigner;
        delegatedGrant?: DataEncodedRecordsWriteMessage;
        permissionGrantId?: string;
        permissionGrantIds?: string[];
        protocolRole?: string;
    }): Promise<AuthorizationModel>;
    /**
     * Creates a generic signature from the given DWN message descriptor by including `descriptorCid` as the required property in the signature payload.
     * NOTE: there is an opportunity to consolidate RecordsWrite.createSignerSignature() wth this method
     */
    static createSignature(descriptor: Descriptor, signer: MessageSigner, additionalPayloadProperties?: {
        delegatedGrantId?: string;
        permissionGrantId?: string;
        permissionGrantIds?: string[];
        protocolRole?: string;
    }): Promise<GeneralJws>;
    /**
     * Normalizes permission grant invocation before it is written into a descriptor
     * and signed payload.
     *
     * Direct operation messages use `permissionGrantId`; Messages operations use
     * canonicalized `permissionGrantIds` so a request can invoke a grant set.
     */
    static normalizePermissionGrantInvocation(input: PermissionGrantInvocation): PermissionGrantInvocation;
    /**
     * Returns the permission grant ID carried by a direct operation signature payload.
     */
    static getPermissionGrantId(signaturePayload: GenericSignaturePayload): string | undefined;
    /**
     * Returns all permission grant IDs invoked by a signature payload.
     *
     * Direct Records/Protocols operations carry a single `permissionGrantId`.
     * Messages operations carry `permissionGrantIds`. Generic cleanup and
     * revocation code uses this helper across both wire shapes.
     */
    static getPermissionGrantIds(signaturePayload: GenericSignaturePayload): string[];
    /**
     * @returns newest message in the array. `undefined` if given array is empty.
     */
    static getNewestMessage(messages: GenericMessage[]): Promise<GenericMessage | undefined>;
    /**
     * @returns oldest message in the array. `undefined` if given array is empty.
     */
    static getOldestMessage(messages: GenericMessage[]): Promise<GenericMessage | undefined>;
    /**
     * Checks if first message is newer than second message.
     * @returns `true` if `a` is newer than `b`; `false` otherwise
     */
    static isNewer(a: GenericMessage, b: GenericMessage): Promise<boolean>;
    /**
     * Checks if first message is older than second message.
     * @returns `true` if `a` is older than `b`; `false` otherwise
     */
    static isOlder(a: GenericMessage, b: GenericMessage): Promise<boolean>;
    /**
     * See if the given message is signed by an author-delegate.
     */
    static isSignedByAuthorDelegate(message: GenericMessage): boolean;
    /**
     * See if the given message is signed by an owner-delegate.
     */
    static isSignedByOwnerDelegate(message: GenericMessage): boolean;
    /**
     * Compares the `messageTimestamp` of the given messages with a fallback to message CID according to the spec.
     * @returns 1 if `a` is larger/newer than `b`; -1 if `a` is smaller/older than `b`; 0 otherwise (same age)
     */
    static compareMessageTimestamp(a: GenericMessage, b: GenericMessage): Promise<number>;
    /**
     * Validates the structural integrity of the message signature given:
     * 1. The message signature must contain exactly 1 signature
     * 2. Passes JSON schema validation
     * 3. The `descriptorCid` property matches the CID of the message descriptor
     * NOTE: signature is NOT verified.
     * @param payloadJsonSchemaKey The key to look up the JSON schema referenced in `compile-validators.js` and perform payload schema validation on.
     * @param options Additional structural validation controls.
     * @returns the parsed JSON payload object if validation succeeds.
     */
    static validateSignatureStructure(messageSignature: GeneralJws, messageDescriptor: Descriptor, payloadJsonSchemaKey?: string, options?: ValidateSignatureStructureOptions): Promise<GenericSignaturePayload>;
    private static normalizePermissionGrantIds;
    private static validatePermissionGrantInvocationCanonical;
    private static validatePermissionGrantInvocationMatchesPayload;
    private static areStringArraysEqual;
}
export {};
//# sourceMappingURL=message.d.ts.map