Client for signing documents with the Autogram mobile app.

Long-lived state (integration key pair, GUID, device pairings) belongs to the integration; each document is an independent SignatureRequest.

Constructors

Methods

  • Mobile devices paired with this integration. When non-empty, SignatureRequest.notifyDevices can reach the user without a QR scan.

    Returns Promise<{ deviceId: string; displayName: string; platform: string }[]>

  • URL of a QR code that pairs a device without signing anything.

    Returns Promise<string>

  • Load the persisted integration or register a new one. Idempotent.

    Parameters

    • info: AvmRegistrationInfo

    Returns Promise<void>

  • Upload a document for signing.

    Parameters

    • documentToSign: {
          document: { content: string; filename?: string };
          parameters?: {
              autoLoadEform?: boolean;
              checkPDFACompliance?: boolean;
              container?: "ASiC-E" | "ASiC-S";
              containerXmlns?: "http://data.gov.sk/def/container/xmldatacontainer+xml/1.1";
              digestAlgorithm?: "SHA256" | "SHA384" | "SHA512";
              embedUsedSchemas?: boolean;
              en319132?: boolean;
              identifier?: string;
              infoCanonicalization?:
                  | "INCLUSIVE"
                  | "EXCLUSIVE"
                  | "INCLUSIVE_WITH_COMMENTS"
                  | "EXCLUSIVE_WITH_COMMENTS"
                  | "INCLUSIVE_11"
                  | "INCLUSIVE_11_WITH_COMMENTS";
              keyInfoCanonicalization?: | "INCLUSIVE"
              | "EXCLUSIVE"
              | "INCLUSIVE_WITH_COMMENTS"
              | "EXCLUSIVE_WITH_COMMENTS"
              | "INCLUSIVE_11"
              | "INCLUSIVE_11_WITH_COMMENTS";
              level?: | "XAdES_BASELINE_B"
              | "PAdES_BASELINE_B"
              | "CAdES_BASELINE_B"
              | "XAdES_BASELINE_T"
              | "PAdES_BASELINE_T"
              | "CAdES_BASELINE_T";
              packaging?: "ENVELOPED"
              | "ENVELOPING";
              propertiesCanonicalization?:
                  | "INCLUSIVE"
                  | "EXCLUSIVE"
                  | "INCLUSIVE_WITH_COMMENTS"
                  | "EXCLUSIVE_WITH_COMMENTS"
                  | "INCLUSIVE_11"
                  | "INCLUSIVE_11_WITH_COMMENTS";
              schema?: string;
              schemaIdentifier?: string;
              transformation?: string;
              transformationIdentifier?: string;
              transformationLanguage?: string;
              transformationMediaDestinationTypeDescription?: "XHTML"
              | "HTML"
              | "TXT";
              transformationTargetEnvironment?: string;
          };
          payloadMimeType?: string;
      }
      • document: { content: string; filename?: string }
        • content: string

          Base64 encrypted content of the document

          ZXhhbXBsZSBzdHJpbmcgaW4gYmFzZTY0Cg==
          
        • Optionalfilename?: string

          Filename of the document. payloadMimeType must be provided if empty. Also, if payloadMimeType is empty, filename must be provided and mimetype must be understood from extension.

          sample_document.txt
          
      • Optionalparameters?: {
            autoLoadEform?: boolean;
            checkPDFACompliance?: boolean;
            container?: "ASiC-E" | "ASiC-S";
            containerXmlns?: "http://data.gov.sk/def/container/xmldatacontainer+xml/1.1";
            digestAlgorithm?: "SHA256" | "SHA384" | "SHA512";
            embedUsedSchemas?: boolean;
            en319132?: boolean;
            identifier?: string;
            infoCanonicalization?:
                | "INCLUSIVE"
                | "EXCLUSIVE"
                | "INCLUSIVE_WITH_COMMENTS"
                | "EXCLUSIVE_WITH_COMMENTS"
                | "INCLUSIVE_11"
                | "INCLUSIVE_11_WITH_COMMENTS";
            keyInfoCanonicalization?: | "INCLUSIVE"
            | "EXCLUSIVE"
            | "INCLUSIVE_WITH_COMMENTS"
            | "EXCLUSIVE_WITH_COMMENTS"
            | "INCLUSIVE_11"
            | "INCLUSIVE_11_WITH_COMMENTS";
            level?: | "XAdES_BASELINE_B"
            | "PAdES_BASELINE_B"
            | "CAdES_BASELINE_B"
            | "XAdES_BASELINE_T"
            | "PAdES_BASELINE_T"
            | "CAdES_BASELINE_T";
            packaging?: "ENVELOPED"
            | "ENVELOPING";
            propertiesCanonicalization?:
                | "INCLUSIVE"
                | "EXCLUSIVE"
                | "INCLUSIVE_WITH_COMMENTS"
                | "EXCLUSIVE_WITH_COMMENTS"
                | "INCLUSIVE_11"
                | "INCLUSIVE_11_WITH_COMMENTS";
            schema?: string;
            schemaIdentifier?: string;
            transformation?: string;
            transformationIdentifier?: string;
            transformationLanguage?: string;
            transformationMediaDestinationTypeDescription?: "XHTML"
            | "HTML"
            | "TXT";
            transformationTargetEnvironment?: string;
        }
        • OptionalautoLoadEform?: boolean

          Try to find XSD and XSLT for a given eForm and load them automatically. Useful for visualizing and signing eForms. If true, schema, transformation, conatinerXmlns, container, packaging, and identifier parameters are ignored. If resources are not found, the response is 422. If provided document is an ASiC_E container conatining XML Datacontainer or it is an XML Datacontainer itself, XSLT found is used for visualiztion of signing document. Also, XSD and XSLT hashes are compared with hashes of XSD and XSLT found in XML Data Container EForm. If they differ, the response is 422. If the provided document is an XML document, Autogram will try to parse xmlns from root element and find resources based on its value. If successful, XML Datacontainer with xmls="http://data.gov.sk/def/container/xmldatacontainer+xml/1.1" is created, the document is validated against the XSD and visualized using the XSLT. If XSD validation fails, the response is 422. The XSLT transformation is found based on transformationLanguage (defaults to user preferred), transformationMediaDestinationTypeDescription (default XHTML, then HTML, then TXT), and transformationTargetEnvironment. If multiple transformations meet the criteria, the first one found is used.

          false
          
        • OptionalcheckPDFACompliance?: boolean

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

          false
          
        • Optionalcontainer?: "ASiC-E" | "ASiC-S"

          Type of Advanced Signature Container. Defaults to null - no container.

          ASiC-E
          @enum {string}
        • OptionalcontainerXmlns?: "http://data.gov.sk/def/container/xmldatacontainer+xml/1.1"

          XML namespace for the XML Datacontainer. Specifies if xmldatacontainer should be created from XML. Doesn't create xmldatacontainer if payloadMimeType is application/vnd.gov.sk.xmldatacontainer+xml already. Accepts http://data.gov.sk/def/container/xmldatacontainer+xml/1.1 only. Defaults to null. Is ignored with autoLoadEform true.

          http://data.gov.sk/def/container/xmldatacontainer+xml/1.1
          @enum {string}
        • OptionaldigestAlgorithm?: "SHA256" | "SHA384" | "SHA512"

          Optional algorithm used to calculate digests.

          SHA256
          @enum {string}
        • OptionalembedUsedSchemas?: boolean

          When creating XML Datacontainer, parameter indicates whether to embed XSD and XML or reference them. Practically this should be only used for ORSR EForms in which case (when identifier contains "justice.gov.sk/Forms") this parameter is overridden to true.

          false
          
        • 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
          
        • Optionalidentifier?: string

          Optional identifier of the document template. Required if containerXmlns is http://data.gov.sk/def/container/xmldatacontainer+xml/1.1. Defaults to null. Is ignored with autoLoadEform true.

          https://data.gov.sk/id/egov/eform/App.GeneralAgenda/1.9
          
        • OptionalinfoCanonicalization?:
              | "INCLUSIVE"
              | "EXCLUSIVE"
              | "INCLUSIVE_WITH_COMMENTS"
              | "EXCLUSIVE_WITH_COMMENTS"
              | "INCLUSIVE_11"
              | "INCLUSIVE_11_WITH_COMMENTS"

          Optional info canonicalization method.

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

          Optional key info canonicalization method.

          INCLUSIVE
          @enum {string}
        • Optionallevel?:
              | "XAdES_BASELINE_B"
              | "PAdES_BASELINE_B"
              | "CAdES_BASELINE_B"
              | "XAdES_BASELINE_T"
              | "PAdES_BASELINE_T"
              | "CAdES_BASELINE_T"

          Signature level.

          XAdES_BASELINE_B
          @enum {string}
        • Optionalpackaging?: "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. Is ignored with autoLoadEform true.

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

          Optional properties canonicalization method.

          INCLUSIVE
          @enum {string}
        • Optionalschema?: string

          Optional XML schema used to validate the signing document and to compute digest used in "UsedXSDReference" in "DigestValue" attribute inside created XML Datacontainer. Format (plaintext or base64) is dictated by payloadMimeType. Is ignored with autoLoadEform true.

          <?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="Document"><xs:complexType><xs:sequence><xs:element name="Title" type="xs:string" /></xs:sequence></xs:complexType></xs:element></xs:schema>
          
        • OptionalschemaIdentifier?: string

          Optional identifier of the XML schema. The value is used in "UsedXSDReference" field inside created XML Datacontainer. If provided with autoLoadEform true, Autogram will try to find such schema. Default value is "http://schemas.gov.sk/form///form.xsd".

          http://schemas.gov.sk/form/App.GeneralAgenda/1.9/form.xsd
          
        • Optionaltransformation?: string

          Optional XML transformation used to present the signing document to user and to compute digest used in "UsedPresentationSchemaReference" in "DigestValue" attribute inside created XML Datacontainer. Format (plaintext or base64) is dictated by payloadMimeType. Is ignored with autoLoadEform true.

          <?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match = "/"><h1><xsl:value-of select="/Document/Title"/></h1></xsl:template></xsl:stylesheet>
          
        • OptionaltransformationIdentifier?: string

          Optional identifier of the XML transformation. If provided with autoLoadEform true, Autogram will try to find such transformation. Default value is "http://schemas.gov.sk/form///form.xslt".

          http://schemas.gov.sk/form/App.GeneralAgenda/1.9/form.xslt
          
        • OptionaltransformationLanguage?: string

          Optional language of the XML transformation. If autoLoadEform is true, Autogram will try to find signing XSLT with this language. Otherwise transformation must be provided. Default value is user preferred or "sk".

          sk
          
        • OptionaltransformationMediaDestinationTypeDescription?: "XHTML" | "HTML" | "TXT"

          Optional media destination type description of the XML transformation. If autoLoadEform is true, Autogram will try to find signing XSLT with this type. Otherwise transformation must be provided. Overrides value of the output method in provided or auto-loaded transformation which is used by default.

          HTML
          @enum {string}
        • OptionaltransformationTargetEnvironment?: string

          Optional target environment of the XML transformation. If autoLoadEform is true, Autogram will try to find signing XSLT with this target. Otherwise transformation must be provided. Null and not used by default.

          example-value
          
      • OptionalpayloadMimeType?: string

        MIME type for document content and signature parameters XSLT transformation and XSD schema. Binary files should be encoded using base64, e.g., application/pdf;base64. Text formats like XML can be optionally encoded using base64 or supplied as plain text.

        If omitted, mimetype is decided based on document.filename and content is expected to be in Base64.

        text/plain;base64
        
    • Optionaloptions: { notifyDevices?: boolean }
      • OptionalnotifyDevices?: boolean

        send a push notification to paired devices right away (default true).

    Returns Promise<SignatureRequest>

  • Unpair a device; it stops receiving push notifications from this integration. Idempotent.

    Parameters

    • deviceId: string

    Returns Promise<void>