Adds certificates to the trust list used when verifying signatures (the list only grows); an open document is verified again right away.
Files and bytes are read now (items that cannot be read are skipped with a warning). URLs are kept and downloaded again at every verification (each document load and re-verification),
so certificates changed on the server apply to the next verification; a URL that cannot be downloaded is skipped for that verification with a console error.
The trust list is kept in memory only. To keep certificates the user trusts in the certificate viewer, store them on UI.Events.TRUSTED_CERTIFICATE_ADDED
and pass them here after the viewer loads; certificates added here do not fire that event.
Certificates in PEM or DER form: URLs, Files / Blobs, ArrayBuffers or typed arrays.
A Promise that resolves once the certificates are read and the document is verified again.
await instance.UI.VerificationOptions.addTrustedCertificates(['/certs/root-ca.pem']);
// Keep the certificates the user trusts on your server and trust them again next time
instance.UI.addEventListener(instance.UI.Events.TRUSTED_CERTIFICATE_ADDED, ({ fieldName, certificate }) => {
fetch('/api/trusted-certificates', { method: 'POST', body: certificate });
});
// Certificate URLs are downloaded again on every document load, so newly saved ones are picked up
await instance.UI.VerificationOptions.addTrustedCertificates(['https://example.com/api/trusted-certificates/1.cer']);
UI.VerificationOptions: settings of digital signature verification.