Data to be signed for CAdES signatures.
Content of the file to be signed. Provided only for CMS signatures.
Hash of the current document
A promise that resolves to any of these:
ArrayBuffer that contains the signed data in the PKCS#1.5 or PKCS#7 format.SignatureCallbackResponsePkcs7, for when the signature device or service creates signatures in the PKCS#7 format.SignatureCallbackResponseRaw, for when the signature device or service creates signatures in the raw (for instance, PKCS#1.5) format.
The ArrayBuffer return type is deprecated. It's recommended to return either a SignatureCallbackResponsePkcs7 or SignatureCallbackResponseRaw, depending on the signature format.Sign document (Standalone)
instance.signDocument(null, function({ hash, fileContents }) {
return new Promise(function(resolve, reject) {
const PKCS7Container = getPKCS7Container(hash, fileContents);
if (PKCS7Container != null) {
return resolve(PKCS7Container)
}
reject(new Error("Could not retrieve the PKCS7 container."))
})
}).then(function() {
console.log("Document signed!");
})
This callback is called when a document has been prepared for digitally signing by calling
instance.signDocument(). It receives the current document hash, file contents and data to be signed as arguments, and must return aPromiseobject that resolves to any of these types:ArrayBufferthat contains either the signed data or a PKCS7 container that includes it.SignatureCallbackResponsePkcs7that is structured type for when the signature device or service creates signatures in the PKCS#7 format.SignatureCallbackResponseRawthat is structured type for when the signature device or service creates signatures in the raw (for instance, PKCS#1.5) format. If the returnedPromiseobject rejects, the document will not be signed.The provided file contents or the data to be signed can be used as input for the Web Crypto API, or for a signing service of your choice to be signed (hashed and encrypted). The file contents hash is also provided so it can be used it to verify the validity of the contents.
See this guide article for more information on how to digitally sign a document on Standalone.