@request-seal/core API
    Preparing search index...

    Function sign

    • Sign a lossless HTTP message with explicit components and caller-owned custody.

      Appends one Signature-Input and one Signature field occurrence and returns a new branded Message. The input message is never modified, and existing signatures stay.

      Parameters

      • message: unknown

        A branded Message from Message.request, Message.response, or Message.create.

      • spec: unknown

        A generated spec with label, components, algorithm, and expiresIn, plus optional created, nonce, alg, keyid, tag (or the same choices nested under parameters), digest, and fieldSchemas; or an exact-input spec with only label, signatureInput, and algorithm.

      • signer: unknown

        A KeyHandle for the same algorithm, or a Signer callback.

      • options: unknown = {}

        Generated specs accept clock, nonce, signingTimeout, and context; exact-input specs accept fieldSchemas, signingTimeout, and context. signingTimeout is 1 through 300,000 milliseconds (default 5,000).

      Returns Promise<
          Result<
              Readonly<
                  {
                      authority: string
                      | null;
                      body: Body;
                      fields: readonly Readonly<
                          {
                              name: string;
                              provenance: "caller"
                              | "http1"
                              | "http2"
                              | "http3";
                              section: "headers" | "trailers";
                              value: Uint8Array;
                          },
                      >[];
                      kind: "request"
                      | "response";
                      method: string | null;
                      rawTarget: string | null;
                      relatedRequest:
                          | (
                              Readonly<{ kind: "request" | "response"; method: string | null; rawTarget: string | null; targetForm: "origin" | "absolute" | "authority" | "asterisk" | null; scheme: string | null; authority: string | null; ... 5 more ...; transport: Readonly<...>; }>
                          )
                          | null;
                      scheme: string
                      | null;
                      status: number | null;
                      targetForm: "origin" | "absolute" | "authority" | "asterisk" | null;
                      trailers:
                          | "unavailable"
                          | readonly Readonly<
                              {
                                  name: string;
                                  provenance: "caller"
                                  | "http1"
                                  | "http2"
                                  | "http3";
                                  section: "headers" | "trailers";
                                  value: Uint8Array;
                              },
                          >[]
                          | "pending";
                      transport: TransportFacts;
                  },
              >,
          >,
      >

      ok(message), or a core error such as input.invalid_options, fields.label_in_use, input.signer_algorithm_mismatch, crypto.signing_failed, or crypto.signer_failed.