0.1.1 • Published 5 years ago
sealninja-sdk v0.1.1
Sealninja JavaScript SDK
Document Sealing as a Service
Installation
npm install --save sealninja-sdk
Configuration
Create a sealninja object by using new Sealninja({ apiKey, [certificate, privateKey] })
. The arguments are:
- apiKey - your Sealninja API key
- certificate - (optional) your certificate when using mutual TLS
- privateKey - (optional) your private key when using mutual TLS
import Sealninja from 'sealninja-sdk';
const sealninja = new Sealninja({
apiKey: YOUR_API_KEY,
});
Seal document
To seal a document, use .seal(file, [details, [filename]])
. The arguments are:
- file - either string with file path or Buffer object
- details - (optional) data object to be included in the seal
- filename - (optional) filename in case file is provided as Buffer object
This function returns the sealed document as a Buffer object.
// seal a document
const sealedDocument = await sealninja.seal('path/to/invoice.pdf');
// seal a document with additional details in the seal
const sealedDocumentWithDetails = await sealninja.seal('path/to/invoice.pdf', { "seller": "John", "price": 100 });
// seal a document form a buffer
const sealedDocumentFromBuffer = await sealninja.seal(documentBuffer, null, 'test.xml');
Verify document
To verify a document, use .verify(file, [filename])
. The arguments are:
- file - either string with file path or Buffer object
- filename - (optional) filename in case file is provided as Buffer object
This function returns the seal of the document, when it could be verified.
// verify a document
const seal = await sealninja.verify('path/to/invoice.pdf');
// verify a document form a buffer
const sealFromBuffer = await sealninja.verify(documentBuffer, 'test.xml');
Documentation
More information on Sealninja can be found in the Sealninja documentation.
License
MIT