Custom protocol used with the application, e.g., to launch it - signer://listen
.
Defaults to 'signer'
.
Disables using of HMAC in messages and sets requestsOrigin
to *
Make sure you understand the implications on the security!
Defaults to false
.
Origin the server will be asked to trust
Influences generated launch URL that sets trusted origin
Defaults to the current location origin, e.g. 'https://example.com'
if available, '*'
otherwise.
Secret initial nonce used for the communication.
Should be cryptographically secure random 32-bit integer generated separately for each session. You can generate this number on the server side and set it on the session so its reused across navigation. There is no need to configure this unless you know what you are doing.
Defaults to random integer generated on instantiation.
Secret key used for the communication.
Should be cryptographically secure random hex string generated separately for each session. You can generate this key on the server side and set it on the session so its reused across navigation. There is no need to configure this unless you know what you are doing.
Defaults to random 64-char (256-bit) hex string generated on instantiation.
Host of the server - Octosign White Label
Defaults to '127.0.0.1'
Port of the server - Octosign White Label
Influences also the URL generated to launch the application.
Defaults to 37200
Protocol of the server - Octosign White Label
Defaults to 'http'
Document exchanged during the signing.
Document content for signing.
Can be plaintext in the case of XML base64-encoded binary in the case of any format.
Optional ID you can use to identify your document.
Optional legal effect shown to user next to the signing button.
Optional title shown during signing.
Info about the server and its current state.
Current server status.
Version of the Octosign White Label.
Should follow semantic versioning.
Parameters used to create a signature.
Signature format PAdES is usable only with documents of type application/pdf. Format XAdES is usable with XML or with any file type if using an ASiC container.
Octosign White Label API client for the app running in the server mode.
import { apiClient } from '@octosign/client';
const client = apiClient();
// Launch URL that should be used by user to launch the signer application
console.log(client.getLaunchURL());
await client.waitForStatus('READY');
const content = '<?xml version="1.0"?><Document><Title>Lorem Ipsum</Title></Document>';
console.log(await client.sign({ content }));
// => { content: '<?xml version="1.0"?><Document><Title>Lorem Ipsum</Title>...</Document>' }
All further examples use es module and async/await, but the library can be also used as commonjs module and using promises.
var apiClient = require('@octosign/client').apiClient;
var client = apiClient();
console.log(client.getLaunchURL());
client.waitForStatus('READY')
.then(function() {
var content = '<?xml version="1.0"?><Document><Title>Lorem Ipsum</Title></Document>';
return client.sign({ content: content });
})
.then(function(signedDocument) {
console.log(signedDocument);
// => { content: '<?xml version="1.0"?><Document><Title>Lorem Ipsum</Title>...signature...</Document>' }
});
An instance of API client.
Construct custom protocol launch URI that can be opened by user to launch the application.
import { apiClient } from '@octosign/client';
const client = apiClient();
console.log(client.createLaunchURI());
// => signer://listen/37200/https%3A%2F%2Fexample.com/3a2bca8d73c62e75177fa877de283cc0c96cdf3ba08f8eb878a96da93de3d798/260372071
URL that can be opened by the user.
Retrieve server info with its current state.
import { apiClient } from '@octosign/client';
const client = apiClient();
console.log(await client.info());
// => { version: '1.2.3', status: 'READY' }
Info about the server and its current state.
Sign a document.
import { apiClient } from '@octosign/client';
const client = apiClient();
console.log(await client.sign({ content: '<?xml version="1.0"?><Document><Title>Lorem Ipsum</Title></Document>' }));
// => { content: '...signed document...' }
Optional signature parameters.
Optional payload mime type, defaults to 'application/xml'
- plaintext XML. Must reflect document content type so should be changed if content is not a plaintext XML.
Signed document.
Wait for server to be in the requested state.
Repeatedly tries to get server info retrying
import { apiClient } from '@octosign/client';
const client = apiClient();
await client.waitForStatus('READY');
// => { version: '1.2.3', status: 'READY' }
Wanted status of the server.
Timeout in seconds before giving up and rejecting with error.
Delay before making next attempt after failure.
Info about the server and its current state.
Generated using TypeDoc
Client configuration options.