UNPKG

autogram-sdk

Version:
99 lines (92 loc) 3.13 kB
import { AutogramDocument, SignatureParameters, SignResponseBody } from './autogram-api/index.js'; import { a as AutogramVMobileIntegrationInterfaceStateful } from './apiClient-C7OYvkhl.js'; import * as lit_html from 'lit-html'; import * as lit from 'lit'; import { LitElement } from 'lit'; import 'zod'; declare enum SigningMethod { reader = 0, mobile = 1 } declare enum Screens { choice = 0, signReader = 1, signMobile = 2 } declare class AutogramRoot extends LitElement { static styles: lit.CSSResult; screen: Screens; qrCodeUrl: string | null; abortController: AbortController | null; render(): lit_html.TemplateResult<1>; closeEventHander: () => void; connectedCallback(): void; disconnectedCallback(): void; startSigning(): Promise<SigningMethod>; desktopSigning(abortController: AbortController): void; showQRCode(url: string, abortController: AbortController): void; show(): void; hide(): void; reset(): void; addFonts(): void; } /** * @module with-ui * This module is special because it usees custom elements * and when you try registering them outside of content script you will get an error */ type SignedObject = SignResponseBody; /** * CombinedClient combines desktop and mobile signing methods with UI to choose between them */ declare class CombinedClient { private client; private clientMobileIntegration; private ui; private signatureIndex; private signerIdentificationListeners; private resetSignRequestCallback?; /** * @param avmChannel - Autogram V Mobile Integration channel * @param resetSignRequestCallback - Callback to reset sign request */ private constructor(); /** * We have to use async factory function because we have to wait for the UI to be created * */ static init(avmChannel?: AutogramVMobileIntegrationInterfaceStateful, resetSignRequestCallback?: () => void): Promise<CombinedClient>; setResetSignRequestCallback(callback: () => void): void; private _sign; /** * * @param document document to sign * @param signatureParameters how to sign the document * @param payloadMimeType mime type of the input document * @param decodeBase64 if false the content will be (stay) base64 encoded, if true we will decode it * @returns */ sign(document: AutogramDocument, signatureParameters: SignatureParameters, payloadMimeType: string, decodeBase64?: boolean): Promise<{ content: string; signedBy: string; issuedBy: string; }>; private launchDesktop; private getSignatureDesktop; private getSignatureMobile; /** * reset sign request, so callbacks and signature index are reset */ resetSignRequest(): void; /** * * @returns signature index (incremented after each signature) */ getSignatureIndex(): number; } /** * * @returns true if the browser is Safari (heuristic based on navigator.userAgent) */ declare function isSafari(): boolean; export { AutogramRoot, CombinedClient, type SignedObject, isSafari };