@vereign/lib-seal
v1.0.6
Published
A library that exposes the functionality of seal extraction and iframes embedding
Downloads
2,482
Readme
Seal Library
Seal Library is an integration tool for reading sealed emails and using Iframe API to verify them.
Installation
Set up authentication to the company NPM account
$ yarn add @vereign/lib-seal @vereign/lib-mime @vereign/lib-png
@vereign/lib-mime
and@vereign/lib-png
are required peer dependencies
Development and publishing
- Set up authentication to the company NPM account using
publish
token or login vianpm login
/yarn login
npm publish
/yarn publish
Development of the Iframe API
Any change in the Iframe API
and its errors must be reflected in Public Iframe API documentation
Development of the SealService
Changes related to the:
Seal template
must be reflected in Seal in Email documentationSeal metadata
must be reflected in Seal Metadata documentationSeal ID
andSeal URL
must be reflected in glossary
API
SealService API
SealService provides a function to extract seals from mime.
It depends on @vereign/lib-mime
functionality of parsing the forwarded and replied parts of the MIME.
At the moment, it supports only Outlook and Gmail emails.
To support other email platforms, relevant adjustments have to be applied to the @vereign/lib-mime
import { SealService } from "@vereign/lib-seal"
// Obtain MIME of the email
const mime = "...";
const {
sealId,
sealUrl,
publicKey
} = await SealService.extractSealFromMime(mime)
// Proceed with the loading of the Iframe API
Iframe API
Load iframe API to perform sealing and sending of the email
import { IframeAPI } from "@vereign/lib-seal";
// Concept of the iframe Url explained here
// https://code.vereign.com/seal/documentation/-/tree/master/apis/iframe#iframe-url
iframeUrl = "https://seal-integrator.com/vframe";
const iframeAPI = await IframeAPI.loadAPI(iframeUrl);
// Integrator story related to sealing and sending explained here
// https://code.vereign.com/seal/building-blocks/iframe#sender-create-seal-send-a-message-via-outlook-add-inchrome-extension-and-publish-sender-status
await iframeAPI.destroy();
Load iframe API of sender to perform verification of the email
import { IframeAPI, StatusApiError, MimeVerificationError, SealApiError, SealService } from "@vereign/lib-seal"
// Obtain MIME of the email
const mime = "...";
const { sealUrl } = await SealService.extractSealFromMime(mime)
const senderIframeAPI = IframeAPI.loadAPIForSeal(sealUrl);
// Integrator story related to verification explained here
// https://code.vereign.com/seal/building-blocks/iframe#recipient-read-and-verify-email-publish-receipt-record
await senderIframeAPI.destroy()