import { Result } from "neverthrow"; import { Parameters } from "structured-headers"; import { HttpHeaders } from "../common"; import { CreateSignatureHeaderError } from "../errors"; export declare enum AlgorithmTypes { "rsa-pss-sha512" = "rsa-pss-sha512", "rsa-v1_5-sha256" = "rsa-v1_5-sha256", "hmac-sha256" = "hmac-sha256", "ecdsa-p256-sha256" = "ecdsa-p256-sha256", "ecdsa-p384-sha384" = "ecdsa-p384-sha384", ed25519 = "ed25519" } export declare type CreateSignatureHeaderOptions = { readonly signer: { /** * The key id used for creating the signature. This will be added to the signature string and used in verification */ readonly keyid: string; /** * The function for signing the data with the specified algorithm */ readonly sign: (data: Uint8Array) => Promise; }; /** * Full url of the request including query parameters */ readonly url: string; /** * The HTTP request method of the request */ readonly method: string; /** * Optional field to identify this signature. This will be added to the signature and signature-input fields, and helps to distinguish * when multiple signatures are present. If omitted, this will default to 'sigx' where x is the lowest int not used in another signature id. */ readonly signatureId?: string; /** * Headers and their values to include in the signing * The keys of these headers will be appended to the signature string for verification */ readonly httpHeaders: HttpHeaders; /** * The body of the request */ readonly body?: Record | string; /** * An optional expiry param as an Integer UNIX timestamp value, to indicate to the verifier a time after which this signature should no longer be trusted. * Sub- second precision is not supported. */ readonly expires?: number; /** * An optional unique value generated for this signature as a String value. */ readonly nonce?: string; /** * An optional application specific tag parameter to provide additional context for the signature */ readonly tag?: string; /** * The HTTP message signature algorithm from the HTTP Message Signature Algorithm Registry, as a String value. */ readonly alg?: AlgorithmTypes; /** * An optional list of field names to cover in the signature. If omitted, a default list is used. */ readonly coveredFields?: [string, Parameters][]; }; /** * Creates a signature header to be appended as a header on a request * A digest header will be returned if a body was included. This also needs to be appended to the request headers. * @see https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12#section-4 */ export declare const createSignatureHeader: (options: CreateSignatureHeaderOptions) => Promise>;