Skip to content

Embedding

dweller long gone edited this page May 23, 2026 · 1 revision

Embedding

The standalone viewer can be mounted in a browser page or Webview host through @pkistudio/asn1defsifter/app.

import { initAsn1DefinitionSifter } from '@pkistudio/asn1defsifter/app';
import '@pkistudio/asn1defsifter/styles.css';

const app = initAsn1DefinitionSifter({
  mount: '#app',
  theme: 'dark'
});

await app.loadHex('300d06092a864886f70d01010b0500', 'algorithm-identifier.hex');

App Options

Important options include:

  • mount: selector or element where the app should render.
  • theme: light or dark.
  • viewer.oidResolver: custom OID resolver or resolver callback for the embedded PkiStudioJS viewer.
  • viewer.newWindowUrl: URL used when PkiStudioJS opens selected DER in a standalone viewer tab.

App Instance

The initializer returns an app instance with:

  • report: current candidate report or null.
  • sourceName: current source name or null.
  • loadBytes(bytes, sourceName?).
  • loadHex(hex, sourceName?).
  • close().

Host Responsibilities

The viewer is browser-first and host-neutral. Hosts remain responsible for:

  • choosing where to mount the app,
  • serving index.html and viewer.html if needed,
  • wiring Webview lifecycle outside the package,
  • deciding whether to persist input or copied report JSON,
  • configuring any host-specific file access or dialogs.

The reusable resolver core does not depend on DOM, VS Code APIs, or host file systems.

When to Use Core APIs Instead

Use the Core API directly when you need a headless workflow:

  • batch analysis,
  • serverless browser logic,
  • VS Code extension commands,
  • AI agent tools,
  • tests or smoke checks.

Use the browser app when users need a visible PkiStudioJS-backed inspection surface.

Clone this wiki locally