@ignisign/js
v4.1.0
Published
This library facilitates the integration of the Ignisign electronic signature into web-based applications using the `embedded` mode.
Downloads
499
Readme
Integrating Ignisign Signature in Web Applications
This library facilitates the integration of the Ignisign electronic signature into web-based applications using the embedded
mode.
Alternatively, Ignisign can be integrated in a by side
mode, where users are redirected to the Ignisign platform to sign documents via an email link, with Ignisign managing the entire process.
For detailed information on these integration modes, visit Embedded or By-Side Integration.
If you are looking for the NodeJS Backend library, it is available here.
Installation
Install the library using npm:
npm install @ignisign/ignisign-js
An Ignisign account is required, which can be created for free at Ignisign Sign Up.
Examples
Find integration examples here.
Usage
Initializing IgnisignJs Class
To use IgnisignJs, first initialize the class. You will need an appId
and an application environment
:
import { IgnisignJs } from "@ignisign/ignisign-js"
const ignisignJs = new IgnisignJs(appId, appEnv);
Find your appId
and appEnv
in the "API Keys" section of the Ignisign Console. The application environment
is defined as:
enum IGNISIGN_APPLICATION_ENV {
DEVELOPMENT = "DEVELOPMENT",
STAGING = "STAGING",
PRODUCTION = "PRODUCTION",
}
Initializing a Signature Session
To start a signature session, use the initSignatureSession
method of your ignisignJs
instance:
Error Handling
Implement handleSignatureSessionError
to manage errors:
const handleSignatureSessionError = async (
errorCode, errorContext, signerId, signatureRequestId
) : Promise<void> => {
// Error handling logic here
}
handleSignatureSessionError
Params
errorCode
: The error codeerrorContext
: A context that will help you to understand from where the error comes fromsignerId
: The id of the signersignatureRequestId
: The id of the signature request
Finalizing Signatures
For handling the completion of signatures, use handleSignatureSessionFinalized
:
const handleSignatureSessionFinalized = async (
signatureIds, signerId, signatureRequestId
) : Promise<void> => {
// Finalization logic here
}
handleSignatureSessionFinalized
params
signatureIds
: The ids of the signaturessignerId
: The id of the signersignatureRequestId
: The id of the signature requ
Managing Private File Information
For private file info provisioning, implement handlePrivateFileInfoProvisioning
:
const handlePrivateFileInfoProvisioning = async (
documentId, externalDocumentId, signerId, signatureRequestId
): Promise<IgnisignDocument_PrivateFileDto> => {
// Logic to retrieve private file information
}
handlePrivateFileInfoProvisioning
params
documentId
: The id of the document to signexternalDocumentId
: An reference that refers to the document to sign into your application - You have to provide it when you provide the document to IgnisignsignerId
: The id of the signersignatureRequestId
: The id of the signature request
IgnisignPrivateFileDto
fields
fileUrl
: The url of the file to signmimeType
: The mime type of the file to signfileName
: The name of the file to signbearer
: Optional - A bearer token to access the file - if provided, the bearer token will be placed into the Authorization header of the request
Signature Session Initialization Parameters
Define the initialization parameters for the signature session:
const initParams: IgnisignJS_SignatureSession_Initialization_Params = {
htmlElementId : "my-div-signature-request-request-id",
signatureRequestId : "6490205421ac2fXXXXX" ,
signerId : "6490205421ac2fXXXXX",
signatureSessionToken : "6490205421ac2fXXXXXXXXXXXXXXXXXXXXXXXXXXX",
signerAuthSecret : "6490205421ac2fXXXXX" ,
closeOnFinish : true,
sessionCallbacks : {
handleSignatureRequestError,
handleSignatureRequestFinalized,
handlePrivateFileInfoProvisioning,
}
dimensions : {
width: "100%",
height: "500px",
},
displayOptions : {
showTitle : false,
showDescription : false,
darkMode : false,
forceShowDocumentInformations : false
}
}
await ignisignJs.initSignatureSession(initParams);
IgnisignJS_SignatureRequest_Initialization_Params fields informations
htmlElementId
: The id of the html element that will contain the signature request iframesignatureRequestId
: The id of the signature request - this value is provided to your backend by webhook when the signature request is createdsignerId
: The id of the signer - this value is provided to your backend by webhook when the signature request is createdsignatureSessionToken
: The unique token that allows you to access to the signature request for the signer - This value is provided to your backend by webhook when the signature request is createdsignerAuthSecret
: The secret that allows you to authenticate the signer - This value is provided to your backend by webhook when the signer is createdcloseOnFinish
: OPTIONAL - default true - If true, the signature request iframe will be closed automatically in case of finalization or errorsessionCallbacks
: OPTIONAL The callbacks that will be called when the signature request iframe send a message to the parent windowsessionCallbacks.handlePrivateFileInfoProvisioning
:OPTIONAL - This method must be implemented if the signature profile linked to the signature request is configured to use a private files. If you want to close automatically the signature request iframe when the signature request is finalized, you can set the closeOnFinish parameter to true when you call the initSignatureRequest methodsessionCallbacks.handleSignatureRequestError
: RECOMMENDED - This method must be implemented if you want to handle the signature request errors.sessionCallbacks.handleSignatureRequestFinalized
: RECOMMENDED - This method must be implemented if you want to handle the signature request finalization.dimensions
: OPTIONAL - The options that will be used to configure the signature request iframedimensions.width
: default: "100%"dimensions.height
: default "500px"displayOptions
: OPTIONAL - Option taht determinate the content displayed into the signing interfacedisplayOptions.showTitle
: default: false - Show the title of the signature request like in by-side modedisplayOptions.showDescription
: default: false - Show the description of the signature request like in by-side modedisplayOptions.darkMode
: default : "Browser" force the darkMode of the content.displayOptions.forceShowDocumentInformations
: default : false
Refer to the Ignisign documentation for detailed parameter descriptions and additional guidance:
Canceling a Signature Session
To prematurely close a signature session, call cancelSignatureSession
on your ignisignJs
instance:
ignisignJs.cancelSignatureSession();