VERIPDFSDK

VeriPDF API Reference

Complete type and function reference for all VeriPDF packages. The SDK is at version 0.3.0 for @trexolab/verifykit-core (Rust/WASM engine) and 0.2.0 for the remaining packages. For practical usage examples, see the Examples guide.


@trexolab/verifykit-core

The headless PDF signature verification engine. All cryptographic operations run in Rust/WASM with built-in crypto -- no Web Crypto API or external crypto library dependency.

Functions

createVerifier(config?)

Creates a configured verifier instance for repeated use. Initializes the WASM module on first call.

function createVerifier(config?: VeriPdfCoreConfig): Promise<VeriPdfVerifier>

Important: This function is async as of v0.3.0. It returns a Promise<VeriPdfVerifier>, not a synchronous VeriPdfVerifier.

Parameters:

ParameterTypeRequiredDescription
configVeriPdfCoreConfigNoTrust store and plugin configuration

Returns: Promise<VeriPdfVerifier>

Example:

const verifier = await createVerifier({
  trustStore: { certificates: [pemString], mode: 'merge' },
  plugins: [revocationPlugin()],
})
const result = await verifier.verify(buffer, 'doc.pdf')
verifier.dispose()

verifyPdf(input, fileName?)

One-shot verification using default configuration. Initializes the WASM module if not already loaded.

function verifyPdf(input: PdfInput, fileName?: string): Promise<VerificationResult>

Parameters:

ParameterTypeRequiredDescription
inputPdfInputYesPDF data as ArrayBuffer, Uint8Array, File, or URL string
fileNamestringNoDisplay name for the file

Returns: Promise<VerificationResult>

Errors: Rejects the returned promise if the input cannot be parsed as a PDF or if an internal verification operation fails. Never throws synchronously.


extractPdfMetadata(input)

Extracts document metadata and permissions without performing signature verification.

function extractPdfMetadata(input: PdfInput): Promise<{
  metadata: DocumentMetadata
  permissions: DocumentPermissions
}>

Parameters:

ParameterTypeRequiredDescription
inputPdfInputYesPDF data

Returns: Promise<{ metadata: DocumentMetadata; permissions: DocumentPermissions }>


extractSignaturesFromPdf(buffer)

Low-level function that extracts raw signature data from a PDF without verification.

function extractSignaturesFromPdf(buffer: ArrayBuffer): Promise<any[]>

sha256hex(data)

Computes the SHA-256 hash of a byte array and returns it as a hex string.

function sha256hex(data: Uint8Array): Promise<string>

buf2hex(buf)

Converts an ArrayBuffer to a hex string. Requires the WASM module to be initialized.

function buf2hex(buf: ArrayBuffer): string

oidToName(oid)

Maps a dotted OID string to a human-readable algorithm name.

function oidToName(oid: string): string

Examples:

oidToName('1.2.840.113549.1.1.11') // "SHA-256 with RSA"
oidToName('1.2.840.10045.4.3.2')   // "SHA-256 with ECDSA"
oidToName('1.3.101.112')           // "Ed25519"

Supported OIDs:

OIDName
1.2.840.113549.1.1.1RSA
1.2.840.113549.1.1.5SHA-1 with RSA
1.2.840.113549.1.1.10RSA-PSS
1.2.840.113549.1.1.11SHA-256 with RSA
1.2.840.113549.1.1.12SHA-384 with RSA
1.2.840.113549.1.1.13SHA-512 with RSA
1.2.840.10045.2.1EC
1.2.840.10045.4.3.1SHA-1 with ECDSA
1.2.840.10045.4.3.2SHA-256 with ECDSA
1.2.840.10045.4.3.3SHA-384 with ECDSA
1.2.840.10045.4.3.4SHA-512 with ECDSA
1.3.101.112Ed25519
1.3.101.113Ed448
1.3.14.3.2.26SHA-1
2.16.840.1.101.3.4.2.1SHA-256
2.16.840.1.101.3.4.2.2SHA-384
2.16.840.1.101.3.4.2.3SHA-512
1.2.840.113549.2.5MD5
1.2.840.113549.2.2MD2

Unknown OIDs are returned as-is.


parseDn(dn)

Formats a distinguished name string by normalizing comma spacing.

function parseDn(dn: string): string

computeUnsignedFields(signatures, detectedFields?)

Returns a list of unsigned signature fields in the document.

function computeUnsignedFields(
  signatures: PdfSignature[],
  detectedFields?: Array<{ fieldName: string; pageNum: number }>,
): UnsignedSigField[]

decompressFlate(data)

Decompresses Flate-encoded data using the DecompressionStream API.

function decompressFlate(data: Uint8Array): Promise<Uint8Array | null>

Returns null if decompression fails.


Trust Store Functions

function setTrustStoreConfig(config: TrustStoreConfig): Promise<void>
function resetTrustStore(): Promise<void>
function ensureTrustStoreReady(): Promise<void>
function getTrustStore(): TrustStore
FunctionDescription
setTrustStoreConfigConfigures the trust store with custom certificates
resetTrustStoreResets the trust store to the default embedded AATL certificates
ensureTrustStoreReadyInitializes the WASM module (and thereby the trust store)
getTrustStoreReturns the current trust store contents

WASM Lifecycle

function initWasm(): Promise<any>
function isWasmReady(): boolean
FunctionDescription
initWasmInitializes the WASM module. Safe to call multiple times (deduplicates).
isWasmReadyReturns true if the WASM module is loaded and ready.

Platform Detection

const isNode: boolean
function ensureCryptoEngine(): Promise<void>
ExportDescription
isNodetrue when running in a Node.js environment
ensureCryptoEngineNo-op in the WASM engine (retained for API compatibility)

Types

PdfInput

All functions that accept PDF data accept these input types:

type PdfInput = ArrayBuffer | Uint8Array | File | string

When a string is provided, it is treated as a URL and fetched via fetch().


VeriPdfCoreConfig

interface VeriPdfCoreConfig {
  trustStore?: TrustStoreConfig
  plugins?: VeriPdfPlugin[]
}

TrustStoreConfig

interface TrustStoreConfig {
  certificates?: string[]       // PEM-encoded root certificates
  mode?: 'merge' | 'replace'   // merge with or replace built-in store (default: 'merge')
  url?: string                  // URL to fetch additional certificates
  refreshInterval?: number      // Refresh interval in ms for URL-based certificates
}

VeriPdfVerifier

interface VeriPdfVerifier {
  verify(input: PdfInput, fileName?: string): Promise<VerificationResult>
  extractMetadata(input: PdfInput): Promise<{
    metadata: DocumentMetadata
    permissions: DocumentPermissions
  }>
  dispose(): void
}

Always call dispose() when finished to release WASM resources.


VerificationResult

interface VerificationResult {
  fileName?: string
  fileSize: number
  fileHash: string              // SHA-256 hex digest of the file
  signatures: PdfSignature[]
  error?: string
}

PdfSignature

interface PdfSignature {
  index: number
  name: string
  fieldName: string
  subFilter: string
  byteRangeCoverage: boolean
  byteRangeCoversWholeFile: boolean
  integrityCheck: SignatureCheckResult
  signatureCheck: SignatureCheckResult
  certificateChainCheck: SignatureCheckResult
  expiryCheck: SignatureCheckResult
  timestampCheck: SignatureCheckResult
  revocationCheck: SignatureCheckResult
  algorithmCheck: SignatureCheckResult
  ekuCheck: SignatureCheckResult
  signerCertificate: CertificateInfo | null
  certificateChain: CertificateInfo[]
  timestamp: TimestampInfo | null
  reason: string
  location: string
  contactInfo: string
  signingTime: Date | null
  overallStatus: VerificationStatus
  overallMessage: string
  mdpPermission: number | null
  isVisible: boolean
  padesLevel: PAdESLevel
  notYetVerified?: boolean
  isDeleted?: boolean
  deletedAtRevision?: number
}

SignatureCheckResult

Each of the 8 verification checks returns this structure:

interface SignatureCheckResult {
  label: string
  status: VerificationStatus
  detail: string
}

VerificationStatus

type VerificationStatus = 'valid' | 'invalid' | 'warning' | 'unknown' | 'pending'
ValueMeaning
validCheck passed
invalidCheck failed -- signature is broken, certificate untrusted, or document tampered
warningMinor issue -- no timestamp, weak algorithm, etc.
unknownCould not determine -- missing data or not checked
pendingVerification in progress

PAdESLevel

type PAdESLevel = 'B-B' | 'B-T' | 'B-LT' | 'B-LTA'
LevelDescription
B-BBasic signature (CMS signed data)
B-TWith trusted timestamp
B-LTWith long-term validation data (embedded CRL/OCSP)
B-LTAWith archive timestamp for long-term archival

CertificateInfo

interface CertificateInfo {
  subject: string
  issuer: string
  serialNumber: string
  notBefore: Date
  notAfter: Date
  isExpired: boolean
  isCA: boolean
  subjectAltNames: string[]
  fingerprint: string               // SHA-256 fingerprint
  sha1Fingerprint?: string
  keyAlgorithm: string
  signatureAlgorithm: string
  keySize?: number
  keyUsage?: string[]
  extKeyUsage?: string[]
  subjectKeyId?: string
  authorityKeyId?: string
  crlDistributionPoints?: string[]
  ocspUrls?: string[]
  caIssuersUrls?: string[]
  policies?: string[]
  rawDer?: ArrayBuffer              // Raw DER-encoded certificate bytes
}

TimestampInfo

interface TimestampInfo {
  time: Date
  tsaName: string
  hashAlgorithm: string
  verified: boolean
  tsaCertificates?: CertificateInfo[]
}

DocumentMetadata

interface DocumentMetadata {
  title: string
  author: string
  subject: string
  keywords: string
  creator: string
  producer: string
  creationDate: Date | null
  modDate: Date | null
  pdfVersion: string
  pageCount: number
}

DocumentPermissions

interface DocumentPermissions {
  encrypted: boolean
  encryptionMethod: string
  permissionFlags: number | null
  printing: 'allowed' | 'low-res' | 'not-allowed'
  modification: boolean
  copying: boolean
  annotations: boolean
  formFilling: boolean
  accessibility: boolean
  assembly: boolean
}

UnsignedSigField

interface UnsignedSigField {
  fieldName: string
  pageNum: number
}

VeriPdfPlugin

The core plugin interface for extending the verification engine:

interface VeriPdfPlugin {
  name: string
  setup?: (ctx: PluginContext) => void | Promise<void>
  trustStore?: TrustStoreConfig
  revocation?: {
    checkCRL?: (cert: CertificateInfo, urls: string[]) => Promise<RevocationCheckResult>
    checkOCSP?: (cert: CertificateInfo, issuer: CertificateInfo, urls: string[]) => Promise<RevocationCheckResult>
  }
  inputResolver?: (input: PdfInput) => Promise<ArrayBuffer | null>
}
PropertyDescription
nameUnique identifier for the plugin
setupCalled during verifier initialization
trustStoreAdditional trust store certificates to merge or replace
revocation.checkCRLOnline CRL checking callback
revocation.checkOCSPOnline OCSP checking callback
inputResolverCustom input resolver (e.g., fetch from cloud storage)

PluginContext

interface PluginContext {
  config: VeriPdfCoreConfig
}

RevocationCheckResult

interface RevocationCheckResult {
  status: 'revoked' | 'revokedAfterSigning' | 'revokedNoTimestamp' | 'good' | 'unknown'
  revocationDate?: Date
  reason?: string
  source?: string
}

TrustStore

interface TrustStore {
  roots: ArrayBuffer[]
  intermediates: ArrayBuffer[]
  all: ArrayBuffer[]
}

@trexolab/verifykit-react

React PDF viewer with plugin-based architecture. Depends on @trexolab/verifykit-core and pdfjs-dist 5.5.207.

Provider

VeriPdfProvider

Context provider that initializes the WASM engine, sets the theme, and configures verification defaults.

<VeriPdfProvider config={config}>
  {children}
</VeriPdfProvider>

Props:

PropTypeRequiredDescription
configVeriPdfConfigNoProvider configuration
childrenReactNodeYesChild components

VeriPdfConfig

interface VeriPdfConfig {
  trustStore?: TrustStoreConfig
  plugins?: VeriPdfPlugin[]
  theme?: ThemeConfig
  worker?: WorkerConfig
  locale?: string
  translations?: Partial<TranslationStrings>
}
 
interface ThemeConfig {
  mode?: 'light' | 'dark' | 'system'
  overrides?: Record<string, string>  // CSS variable overrides
}
 
interface WorkerConfig {
  src?: string  // Explicit PDF.js worker URL
}

Hooks

useVerification()

Main verification state hook. Must be used inside a VeriPdfProvider.

function useVerification(): VerificationState
 
interface VerificationState {
  load(input: PdfInput, fileName?: string): Promise<VerificationResult>
  reset(): void
  fileBuffer: ArrayBuffer | null
  fileName: string
  signatures: PdfSignature[]
  unsignedFields: UnsignedSigField[]
  status: VerificationStatus | null
  result: VerificationResult | null
  metadata: DocumentMetadata | null
  permissions: DocumentPermissions | null
  isLoading: boolean
  error: string | null
}

useVeriPdfConfig()

Accesses the provider configuration and theme setter.

function useVeriPdfConfig(): {
  config: VeriPdfConfig
  setThemeMode(mode: 'light' | 'dark'): void
}

useViewerStore(selector)

Subscribes to the viewer store with a selector. Re-renders only when the selected value changes.

function useViewerStore<T>(selector: (state: ViewerStoreState) => T): T

useViewerStoreKey(key)

Subscribes to a single key in the viewer store.

function useViewerStoreKey<K extends keyof ViewerStoreState>(key: K): ViewerStoreState[K]

useViewerStoreUpdate()

Returns a function to dispatch partial state updates to the viewer store.

function useViewerStoreUpdate(): (partial: Partial<ViewerStoreState>) => void

useStore()

Returns the raw ViewerStore instance for advanced use (batch updates, direct subscriptions).

function useStore(): ViewerStore

useContainerSize(ref)

Responsive breakpoint hook that reports the container dimensions.

function useContainerSize(ref: React.RefObject<HTMLElement>): { width: number; height: number }

usePinchZoom(ref, onZoom)

Touch pinch-zoom gesture handler.

function usePinchZoom(
  ref: React.RefObject<HTMLElement>,
  onZoom: (scaleDelta: number) => void,
): void

Viewer Components

Viewer

The primary plugin-based PDF viewer component.

<Viewer
  ref={viewerRef}
  fileBuffer={buffer}
  fileName="document.pdf"
  plugins={[layout.plugin]}
  onOpenFile={handleFile}
  initialState={{ signatures, verificationStatus }}
  onDocumentLoaded={(doc) => console.log(doc.numPages)}
/>

Props:

PropTypeRequiredDescription
fileBufferArrayBufferNoPDF file data
fileNamestringNoDisplay file name
pluginsViewerPlugin[]NoArray of viewer plugins
onOpenFile(file: File) => voidNoFile open callback
initialStatePartial<ViewerStoreState>NoInitial store state (signatures, status)
onDocumentLoaded(doc) => voidNoCalled when the PDF document loads
signaturesPdfSignature[]NoSignature data for direct binding
unsignedFieldsUnsignedSigField[]NoUnsigned field data
verificationStatusVerificationStatusNoOverall verification status

Ref (ViewerHandle):

interface ViewerHandle {
  getStore(): ViewerStore | null
}

CoreViewer

Lower-level viewer component without the Viewer wrapper. For advanced use cases where you need direct control over the plugin host.


PageRenderer

Renders a single PDF page (canvas, text layer, annotations). Used internally by CoreViewer.


WelcomeScreen

A drop-target screen for when no file is loaded.

<WelcomeScreen
  onOpenFile={(file: File) => { ... }}
  title="My PDF Viewer"
  subtitle="Drag and drop a PDF here"
/>

Props:

PropTypeRequiredDescription
onOpenFile(file: File) => voidYesCalled when a file is dropped or selected
titlestringNoHeading text
subtitlestringNoSubheading text

PdfViewer (Legacy)

The original monolithic viewer component. Still supported for backward compatibility but not recommended for new projects. Use Viewer with the plugin system instead.


Signature Components

ComponentDescription
SignatureListPanelPanel listing all signatures with status icons
SignaturePropertiesModalModal with full signature details and certificate chain
SignatureDetailsTabTab content showing signature properties
ValidityChecklistChecklist of all 8 verification checks
SignatureStatusIconStatus icon (checkmark, cross, warning)
DocumentMessageBarColored status bar displayed above the viewer
VerificationFloaterFloating verification badge

Certificate Components

ComponentDescription
CertificateViewerInteractive certificate chain viewer

UI Primitives

ComponentDescription
TooltipTooltip component with flicker-free positioning
Dialog, DialogOverlay, DialogContent, DialogTitle, DialogHeader, DialogCloseRadix-based accessible dialog
ViewerDialog, ViewerDialogOverlay, ViewerDialogContent, ViewerDialogTitleViewer-scoped dialog variant
DocumentPropertiesModalDocument properties display
KeyboardShortcutHelpKeyboard shortcuts reference panel
PdfViewerErrorBoundaryError boundary for the viewer

UI Helpers

Status Helpers

const STATUS_LABEL: Record<VerificationStatus, string>
const STATUS_COLOR: Record<VerificationStatus, string>
const STATUS_BG: Record<VerificationStatus, string>
const STATUS_STRIPE: Record<VerificationStatus, string>
const STATUS_CFG: Record<VerificationStatus, StatusCfg>
const AVATAR_RING: Record<VerificationStatus, string>
const PANEL_STRIPE: Record<VerificationStatus, string>
 
function statusTextColor(status: VerificationStatus): string
function getStatusSentence(status: VerificationStatus): string
function getInvalidSub(sig: PdfSignature): string
function getPillLabel(status: VerificationStatus): string
function getInitials(name: string): string
function overallStatus(signatures: PdfSignature[]): VerificationStatus

Check Builders

function buildChecks(sig: PdfSignature): CheckItem[]
function buildMiniChecks(sig: PdfSignature): MiniCheckItem[]
function buildSummaryLines(sig: PdfSignature): SummaryLine[]
function isLtvEnabled(sig: PdfSignature): boolean

Certificate Utilities

function getCN(dn: string): string     // Extract Common Name
function getO(dn: string): string      // Extract Organization
function getField(dn: string, field: string): string

Date Formatters

function fmtDateLong(date: Date): string     // "March 15, 2026, 2:30:00 PM"
function fmtDateShort(date: Date): string    // "Mar 15, 2026"
function fmtDateCompact(date: Date): string  // "2026-03-15"
function fmtDatePanel(date: Date): string    // Panel-optimized format

Download Utilities

function uint8ToBase64(bytes: Uint8Array): string
function downloadBlob(blob: Blob, filename: string): void
function exportCertAsPem(cert: CertificateInfo): string
function exportCertAsDer(cert: CertificateInfo): Uint8Array
function safeName(name: string): string

Appearance Swapping

function swapSignatureAppearances(buffer: ArrayBuffer, signatures: PdfSignature[]): Promise<ArrayBuffer>
function hasAcro6Appearances(buffer: ArrayBuffer): Promise<boolean>

i18n

function t(key: string): string
function setLocale(locale: string): void
function getLocale(): string
function registerLocale(locale: string, translations: TranslationStrings): void
function getAvailableLocales(): string[]

Store Actions

Shared helpers for plugins and menus:

function downloadPdf(store: ViewerStore): void
function rotateCW(store: ViewerStore): void
function rotateCCW(store: ViewerStore): void
function toggleFullscreen(store: ViewerStore): void

Worker Utilities

function getWorkerUrl(config?: WorkerConfig): Promise<string>
function resolveWorkerUrl(config?: WorkerConfig): string
function createPolyfillWorkerUrl(url: string): string
function revokeWorkerBlobUrls(): void

ViewerStore

A lightweight pub-sub reactive store that drives the viewer state.

function createViewerStore(initial?: Partial<ViewerStoreState>): ViewerStore
 
interface ViewerStore {
  get<K extends keyof ViewerStoreState>(key: K): ViewerStoreState[K]
  update(partial: Partial<ViewerStoreState>): void
  subscribe<K extends keyof ViewerStoreState>(
    key: K,
    listener: (newVal: ViewerStoreState[K], oldVal: ViewerStoreState[K]) => void,
  ): () => void
  batch(fn: () => void): void
}

State shape:

CategoryKeys
Documentdocument, fileBuffer, fileName, loadState, errorMessage
NavigationcurrentPage, totalPages
Zoomscale, fitMode
Rotationrotation
LayoutscrollMode, spreadMode, cursorTool
ThemethemeMode
FullscreenisFullscreen
Verificationsignatures, unsignedFields, verificationStatus
UI panelssidebarOpen, sidebarTab, sigPanelOpen, findOpen
PasswordpasswordNeeded, passwordError

Plugin System

ViewerPlugin Interface

interface ViewerPlugin {
  name: string
  dependencies?: string[]
  composedPlugins?: ViewerPlugin[]
 
  // Lifecycle hooks
  install?(ctx: PluginContext): void
  onDocumentLoad?(e: DocumentLoadEvent): void
  onDocumentUnload?(): void
  onPageChange?(e: PageChangeEvent): void
  onZoomChange?(e: ZoomChangeEvent): void
  onRotationChange?(e: RotationChangeEvent): void
  destroy?(): void
 
  // UI contributions
  renderToolbarSlot?: Partial<ToolbarSlots>
  sidebarTabs?: SidebarTabDefinition[]
  renderOverlay?: (props: OverlayRenderProps) => React.ReactNode
  renderRightPanel?: (props: RightPanelRenderProps) => React.ReactNode
  renderPageOverlay?: (props: PageOverlayRenderProps) => React.ReactNode
}

PluginContext (Viewer)

interface PluginContext {
  store: ViewerStore
  getDocument(): PDFDocumentProxy | null
  scrollToPage(pageNum: number): void
  getScrollContainer(): HTMLElement | null
  getViewerContainer(): HTMLElement | null
  registerShortcut(shortcut: KeyboardShortcut): () => void
  t(key: string): string
}

Plugin Host Utilities

function resolvePlugins(plugins: ViewerPlugin[]): ViewerPlugin[]
function collectToolbarSlots(plugins: ViewerPlugin[]): ToolbarSlots
function collectSidebarTabs(plugins: ViewerPlugin[]): SidebarTabDefinition[]

Individual Plugins

defaultLayoutPlugin(options?)

Meta-plugin composing all 22+ plugins into a batteries-included experience.

function defaultLayoutPlugin(options?: DefaultLayoutPluginOptions): DefaultLayoutPluginResult

Options:

interface DefaultLayoutPluginOptions {
  disable?: {
    search?: boolean
    print?: boolean
    download?: boolean
    fullscreen?: boolean
    theme?: boolean
    rotation?: boolean
    selection?: boolean
    sidebar?: boolean
    signatures?: boolean
    highlights?: boolean
    openFile?: boolean
    properties?: boolean
    shortcuts?: boolean
    contextMenu?: boolean
  }
  toolbar?: ToolbarPluginOptions
}

Result:

interface DefaultLayoutPluginResult {
  plugin: ViewerPlugin
  zoom: ZoomPluginApi
  navigation: PageNavigationPluginApi
  rotation: RotationPluginApi
  search: SearchPluginApi
  print: PrintPluginApi
  download: DownloadPluginApi
  theme: ThemePluginApi
  fullscreen: FullscreenPluginApi
  selection: SelectionPluginApi
  scrollMode: ScrollModePluginApi
  spreadMode: SpreadModePluginApi
  signature: SignaturePluginApi
  sidebar: SidebarPluginApi
}

Individual Plugin APIs

Plugin FactoryAPI TypeKey Methods
zoomPlugin()ZoomPluginApizoomIn(), zoomOut(), zoomTo(scale), setFitMode(mode)
pageNavigationPlugin()PageNavigationPluginApigoToPage(n), goToNextPage(), goToPreviousPage(), goToFirstPage(), goToLastPage()
rotationPlugin()RotationPluginApirotateCW(), rotateCCW()
searchPlugin()SearchPluginApiopen(), close()
printPlugin()PrintPluginApiprint()
downloadPlugin()DownloadPluginApidownload()
themePlugin()ThemePluginApitoggleTheme(), setTheme(mode), getTheme()
fullscreenPlugin()FullscreenPluginApienterFullscreen(), exitFullscreen(), toggleFullscreen()
selectionPlugin()SelectionPluginApisetCursorTool(tool)
scrollModePlugin()ScrollModePluginApisetScrollMode(mode)
spreadModePlugin()SpreadModePluginApisetSpreadMode(mode)
signaturePlugin()SignaturePluginApiopenPanel(), closePanel(), togglePanel()
sidebarPlugin()SidebarPluginApitoggle(tab?), open(tab), close()

Plugins without a public API (UI-only contributions):

Plugin FactoryDescription
toolbarPlugin()Toolbar with slot system
thumbnailPlugin()Thumbnail sidebar tab
bookmarkPlugin()Bookmark/outline sidebar tab
attachmentPlugin()Attachment sidebar tab
highlightPlugin()Text highlighting
openFilePlugin()File open and drag-drop
propertiesPlugin()Document properties modal
shortcutHelpPlugin()Keyboard shortcuts help panel
contextMenuPlugin()Right-click context menu
moreMenuPlugin()Overflow menu for toolbar items

Toolbar Components

import { Toolbar, ToolbarButton, ToolbarDivider } from '@trexolab/verifykit-react'
ComponentDescription
ToolbarToolbar container with 3-section grid layout
ToolbarButtonStandard toolbar button primitive
ToolbarDividerVisual divider between toolbar groups

@trexolab/verifykit-vanilla

Zero-build PDF viewer for vanilla JavaScript, CDN, and non-React environments. Bundles React 19 internally.

VeriPdf.create(container, options?)

Creates a viewer instance on a DOM element.

function create(container: HTMLElement, options?: VeriPdfOptions): VeriPdfInstance

Also available as VeriPdf.create() (UMD global) or import { create } from '@trexolab/verifykit-vanilla' (ESM).

Parameters:

ParameterTypeRequiredDescription
containerHTMLElementYesThe DOM element to mount the viewer in
optionsVeriPdfOptionsNoConfiguration options

Throws: If container is not a valid HTMLElement.


VeriPdfOptions

interface VeriPdfOptions {
  theme?: { mode?: 'light' | 'dark' | 'system'; overrides?: Record<string, string> }
  workerSrc?: string
  features?: VeriPdfFeatures
  trustStore?: TrustStoreConfig
  plugins?: VeriPdfPlugin[]
  locale?: string
  translations?: Partial<TranslationStrings>
  onVerified?: (result: VerificationResult) => void
  onError?: (error: string) => void
  onDocumentLoaded?: (info: { pageCount: number; fileName: string }) => void
  onPageChange?: (page: number) => void
  onZoomChange?: (scale: number) => void
  onThemeChange?: (mode: 'light' | 'dark') => void
}

VeriPdfFeatures

interface VeriPdfFeatures {
  search?: boolean       // default: true
  print?: boolean        // default: true
  download?: boolean     // default: false
  signatures?: boolean   // default: true
  thumbnails?: boolean   // default: true
  fullscreen?: boolean   // default: true
  themeToggle?: boolean  // default: true
  openFile?: boolean     // default: false
  rotation?: boolean     // default: true
  contextMenu?: boolean  // default: true
  properties?: boolean   // default: true
  shortcuts?: boolean    // default: true
  highlights?: boolean   // default: true
}

VeriPdfInstance

The object returned by VeriPdf.create():

Document Methods

MethodSignatureDescription
load(input: PdfInput, fileName?: string) => Promise<VerificationResult>Load and verify a PDF
destroy() => voidDestroy the viewer and clean up all resources

Theme

MethodSignatureDescription
setTheme(mode: 'light' | 'dark' | 'system') => voidChange the theme
MethodSignatureDescription
goToPage(page: number) => voidNavigate to a specific page
goToPreviousPage() => voidGo to the previous page
goToNextPage() => voidGo to the next page
goToFirstPage() => voidGo to the first page
goToLastPage() => voidGo to the last page
getCurrentPage() => numberGet the current page number
getPageCount() => numberGet the total page count

Zoom

MethodSignatureDescription
zoomIn() => voidIncrease zoom level
zoomOut() => voidDecrease zoom level
zoomTo(scale: number) => voidSet zoom to a specific scale
setFitMode(mode: 'none' | 'width' | 'page') => voidSet the fit mode
getZoom() => numberGet the current zoom scale

Rotation

MethodSignatureDescription
rotateCW() => voidRotate clockwise 90 degrees
rotateCCW() => voidRotate counter-clockwise 90 degrees
getRotation() => numberGet the current rotation in degrees
MethodSignatureDescription
openSearch() => voidOpen the search bar
closeSearch() => voidClose the search bar
MethodSignatureDescription
print() => voidPrint the document
download() => voidDownload the document

Fullscreen

MethodSignatureDescription
enterFullscreen() => voidEnter fullscreen mode
exitFullscreen() => voidExit fullscreen mode
toggleFullscreen() => voidToggle fullscreen mode

Signature Panel

MethodSignatureDescription
openSignaturePanel() => voidOpen the signature panel
closeSignaturePanel() => voidClose the signature panel

Events

MethodSignatureDescription
on(event: string, handler: (...args: unknown[]) => void) => () => voidSubscribe to events; returns an unsubscribe function

Supported events:

EventPayloadDescription
pageChangenumberCurrent page changed
zoomChangenumberZoom scale changed
themeChange'light' | 'dark'Theme mode changed
rotationChangenumberRotation changed
fullscreenChangebooleanFullscreen state changed
documentLoaded{ pageCount: number; fileName: string }Document finished loading
verifiedVerificationResultVerification completed
errorstringError occurred

State

MethodSignatureDescription
getVerificationResult() => VerificationResult | nullGet the last verification result
getSignatures() => PdfSignature[]Get the current signature list

@trexolab/verifykit-plugin-revocation

Online CRL and OCSP revocation checking plugin for @trexolab/verifykit-core.

revocationPlugin(options?)

Creates a revocation checking plugin.

function revocationPlugin(options?: RevocationPluginOptions): VeriPdfPlugin

Options:

interface RevocationPluginOptions {
  timeout?: number       // Request timeout in ms (default: 10000)
  crl?: boolean          // Enable CRL checking (default: true)
  ocsp?: boolean         // Enable OCSP checking (default: true)
  maxCrlSize?: number    // Maximum CRL download size in bytes (default: 10 MB)
}

Usage with createVerifier():

import { createVerifier } from '@trexolab/verifykit-core'
import { revocationPlugin } from '@trexolab/verifykit-plugin-revocation'
 
const verifier = await createVerifier({
  plugins: [revocationPlugin({ timeout: 15_000 })],
})

Usage with vanilla API:

import { create } from '@trexolab/verifykit-vanilla'
import { revocationPlugin } from '@trexolab/verifykit-plugin-revocation'
 
const viewer = create(container, {
  plugins: [revocationPlugin()],
})

Behavior:

Without the plugin, revocationCheck.status is "unknown" with a detail like "Not checked (offline)." With the plugin installed, the engine performs live CRL and OCSP lookups for each signer certificate:

  1. OCSP is attempted first (if ocsp is true and the certificate has OCSP URLs).
  2. CRL is attempted as a fallback (if crl is true and the certificate has CRL distribution points).
  3. If both methods fail or are disabled, the check remains "unknown".

The plugin respects the signing timestamp: if a certificate was revoked after the signing time (and the signature has a valid timestamp), the status is "revokedAfterSigning" which resolves as "valid" -- the signature was valid at the time it was created.