For developers
Protocol v1 between a web application and TintaSign on the user's computer.
Signing flow
GET /v1/hellotells you whether TintaSign is running, its version and which key sources it sees.POST /v1/certificatesreturns the signing certificates. On a new site's first call the user allows, once, that the site sees the list.- Your server builds the signed attributes (PDF) or the canonical
SignedInfo(XML) from the document and the chosen certificate. POST /v1/signopens the TintaSign window. The user confirms, enters the PIN and TintaSign returns the signature.- Your server embeds the signature in the document and stores it.
JavaScript example
const H = 'https://127.0.0.1:52710';
const post = (path, body) => fetch(H + path, {
method: 'POST', headers: { 'content-type': 'application/json' },
body: JSON.stringify(body) }).then(r => r.json());
// is TintaSign running: version, key sources, features
const hello = await fetch(H + '/v1/hello').then(r => r.json());
// certificate list (or let the user pick in the TintaSign window via /v1/choose)
const list = await post('/v1/certificates', { purpose: 'signature' });
const cert = list.certificates[0];
// your server builds the signed attributes and the document fingerprint
const p = await myServer.prepare(docId, cert.certificate);
const r = await post('/v1/sign', { certificateId: cert.id,
toBeSigned: p.signedAttributes, hashAlgorithm: 'sha256',
documentLabel: 'Contract.pdf', documentSha256: p.documentSha256,
requestId: p.id });
// server embeds the signature in the PDF
await myServer.complete(docId, r.signature);Protocol v1
TintaSign listens on https://127.0.0.1:52710, or on 52711 or 52712 if the port is taken. Every request must carry an Origin header from an HTTPS page. The request body is at most 64 KB.
| Call | Body | Response |
|---|---|---|
GET /v1/hello | – | protocol, helperVersion, os, routes, features, originPaired |
POST /v1/pair | – | { paired }. The user confirms a new site. Needed only when the allowed-sites list is switched on. |
POST /v1/certificates | purpose, issuers, keyUsage | { certificates: [ { id, subject, issuer, notAfter, qualified, certificate, chain } ] } |
POST /v1/choose | documentLabel, documentSha256, issuers | The user picks a certificate in the TintaSign window. Returns the chosen certificate. |
POST /v1/sign | certificateId, toBeSigned, hashAlgorithm, documentLabel, documentSha256, requestId | { signature, signatureAlgorithm }. With items it signs several documents with one confirmation. With format: "xmldsig" it signs XML. |
POST /v1/result | sessionId, outcome, message | The server's outcome (e.g. a revoked certificate) is shown in the TintaSign window. |
Allowed sites
- Requests are accepted from HTTPS pages only.
- By default any HTTPS site may ask for a signature. The user confirms each signature in the window and a new site needs the user's permission before its first certificate list.
- A site the user refuses can no longer use TintaSign until it is removed in the Allowed sites menu.
- For managed computers:
allowListEnabled: trueand anallowedOriginslist inconfig.json. Sites outside the list then getnot_paireduntil the user confirms them through/v1/pair.
Errors
An error comes back as { error }:
cancelledthe user cancelleddevice_missingthe card or token is no longer connectednot_pairedthe site is not allowedinvalid_requestthe request is not a document signature or the fingerprint is wrongbusyanother TintaSign window is already opennot_supportedthis version does not support the feature
Settings
The file config.json in the TintaSign data folder (Windows %LOCALAPPDATA%\WGSignHelper).
allowListEnabled, allowedOrigins | allowed-sites list |
pkcs11ExtraModules | additional PKCS#11 modules |
windowsStoreEnabled, pkcs11Enabled, nssEnabled | switch individual key sources on or off |
signingKeyUsage | nonRepudiation (default) or digitalSignatureOrNonRepudiation |
ports | ports it listens on |
Starting from the page
The installer registers the tintasign://start link. When /v1/hello does not answer, the page shows a button that opens TintaSign.