Methods

  • Signs one or more documents. The result keeps every signer and the MIME type of the signed artifact.

    Pass an array to sign multiple documents together into a single ASiC_E container with one signature ("spoločná autorizácia dokumentov"). This needs the Autogram desktop app 2.8.0 or newer, so the method chooser is skipped; on mobile devices it fails with not-supported.

    Callers holding legacy POST /sign-shaped input (level, XDC fields in the parameters, payloadMimeType) can convert it with fromLegacySignArgs() / fromLegacySignatureParameters().

    Parameters

    • documents: DocumentToSign | DocumentToSign[]

      document(s) to sign, each with its own mimeType/encoding and optional xdcParameters

    • Optionalparameters: {
          checkPDFACompliance?: boolean;
          checkPDFEmbeddedAttachments?: boolean;
          container?: null | "ASiC_E";
          digestAlgorithm?: null | "SHA256" | "SHA384" | "SHA512";
          form?: null | "XAdES" | "PAdES" | "CAdES";
          infoCanonicalization?:
              | null
              | "INCLUSIVE"
              | "EXCLUSIVE"
              | "INCLUSIVE_WITH_COMMENTS"
              | "EXCLUSIVE_WITH_COMMENTS"
              | "INCLUSIVE_11"
              | "INCLUSIVE_11_WITH_COMMENTS";
          keyInfoCanonicalization?: | null
          | "INCLUSIVE"
          | "EXCLUSIVE"
          | "INCLUSIVE_WITH_COMMENTS"
          | "EXCLUSIVE_WITH_COMMENTS"
          | "INCLUSIVE_11"
          | "INCLUSIVE_11_WITH_COMMENTS";
          packaging?: null
          | "ENVELOPED"
          | "ENVELOPING";
          profile?: null | "BASELINE_B" | "BASELINE_T";
          propertiesCanonicalization?:
              | null
              | "INCLUSIVE"
              | "EXCLUSIVE"
              | "INCLUSIVE_WITH_COMMENTS"
              | "EXCLUSIVE_WITH_COMMENTS"
              | "INCLUSIVE_11"
              | "INCLUSIVE_11_WITH_COMMENTS";
      } & { en319132?: boolean; requireQualifiedCertificate?: boolean }

      how to sign (form, profile, container, …)

      • OptionalcheckPDFACompliance?: boolean

        Check for PDF/A compliance and show warning if not compliant.

        false
        
      • OptionalcheckPDFEmbeddedAttachments?: boolean

        Check for attachments embedded inside PDF file and show warning if any are found.

        false
        
      • Optionalcontainer?: null | "ASiC_E"

        Optional container type that should be used to place the file with signature to. Defaults to null. For a document with xdcParameters.autoLoadEform=true, this value can be overridden by the resolved eForm requirements.

        ASiC_E
        @enum {string}
      • OptionaldigestAlgorithm?: null | "SHA256" | "SHA384" | "SHA512"

        Optional algorithm used to calculate digests.

        SHA256
        @enum {string}
      • Optionalform?: null | "XAdES" | "PAdES" | "CAdES"

        Signature format. Format PAdES is usable only with documents of type application/pdf. Format XAdES is usable with XML or with any file type if using an ASiC container. Format is not required when signing already signed documents - PAdES or ASiC-E.

        XAdES
        @enum {string}
      • OptionalinfoCanonicalization?:
            | null
            | "INCLUSIVE"
            | "EXCLUSIVE"
            | "INCLUSIVE_WITH_COMMENTS"
            | "EXCLUSIVE_WITH_COMMENTS"
            | "INCLUSIVE_11"
            | "INCLUSIVE_11_WITH_COMMENTS"

        Optional info canonicalization method.

        INCLUSIVE
        @enum {string}
      • OptionalkeyInfoCanonicalization?:
            | null
            | "INCLUSIVE"
            | "EXCLUSIVE"
            | "INCLUSIVE_WITH_COMMENTS"
            | "EXCLUSIVE_WITH_COMMENTS"
            | "INCLUSIVE_11"
            | "INCLUSIVE_11_WITH_COMMENTS"

        Optional key info canonicalization method.

        INCLUSIVE
        @enum {string}
      • Optionalpackaging?: null | "ENVELOPED" | "ENVELOPING"

        Optional form of packaging used with XML. ENVELOPED adds the signature as a child of the root element while ENVELOPING wraps the XML in a new element. Only applies to XAdES signatures. Must be ENVELOPING when used without ASiC container and with non XML documents. For a document with xdcParameters.autoLoadEform=true, this value can be overridden by the resolved eForm requirements.

        ENVELOPED
        @enum {string}
      • Optionalprofile?: null | "BASELINE_B" | "BASELINE_T"

        Signature profile. If null, the BASELINE_B profile is used by default.

        BASELINE_B
        @enum {string}
      • OptionalpropertiesCanonicalization?:
            | null
            | "INCLUSIVE"
            | "EXCLUSIVE"
            | "INCLUSIVE_WITH_COMMENTS"
            | "EXCLUSIVE_WITH_COMMENTS"
            | "INCLUSIVE_11"
            | "INCLUSIVE_11_WITH_COMMENTS"

        Optional properties canonicalization method.

        INCLUSIVE
        @enum {string}
      • Optionalen319132?: boolean

        Optional flag to control whether the signature should be made according to ETSI EN 319132 for XAdES and ETSI EN 319122 for CAdES and PAdES.

        false
        
      • OptionalrequireQualifiedCertificate?: boolean

        Require the signing certificate to be qualified.

        false
        
    • Optionaloptions: ClientSignOptions

    Returns Promise<SignedDocumentResult>

    AutogramError — always carries a machine-readable code; classify with AutogramError.is() rather than instanceof. Codes that can surface here:

    • user-cancelled — the user actively cancelled the signing flow
    • aborted — the operation was aborted programmatically (dialog closed, AbortSignal, page close)
    • timeout — the signing operation did not finish in time
    • app-not-installed — the Autogram desktop app could not be launched
    • app-version-too-low — the desktop app is too old for the request (multiple documents, v1-only checks)
    • not-supported — the chosen signing method cannot fulfil the request (multiple documents on a mobile device, v1-only checks with Autogram v mobile)
    • connection-failed — a network request to a signing backend failed
    • protocol-error — an unexpected response shape or bridge failure
    • server-error — a signing backend reported an error
    • unknown — anything that cannot be classified more precisely