Skip to content

Architecture

dweller long gone edited this page May 26, 2026 · 2 revisions

Architecture

ASN.1 Definition Sifter sits between PkiStudioJS and ASN.1 Instance Builder.

PkiStudioJS
  DER/TLV parsing, primitive decoding, editing, and viewer behavior

ASN.1 Instance Builder
  ASN.1 definition parsing and schema model

ASN.1 Definition Sifter
  DER/TLV fragment -> ranked ASN.1 definition candidates

Core Boundary

The resolver core lives under src/core/ and owns:

  • neutral TLV types,
  • feature extraction,
  • schema corpus handling,
  • matching and scoring,
  • diagnostics and ambiguity representation,
  • annotated tree types.

It should stay UI-independent and host-neutral.

Adapter Boundary

Dependency-specific conversion belongs under src/adapters/:

  • PkiStudioJS parsing and TLV conversion.
  • ASN.1 Instance Builder schema parsing and schema model conversion.

This keeps external dependencies at the boundary instead of leaking them into every core helper.

Report Layer

The report layer wraps core operations into JSON-friendly shapes for apps and agents:

  • parse input,
  • create root reports,
  • aggregate diagnostics and ambiguities,
  • optionally traverse subtrees,
  • identify document hypotheses,
  • apply PKI context filtering where appropriate.

PKI Corpus

The built-in PKI corpus lives under src/corpus/ and src/profiles/.

Starting with 0.1.5, src/corpus/pki-components.ts consumes the shared pkiComponentDefinition exported by @pkistudio/asn1instancebuilder instead of maintaining a duplicate inline PkiComponents ASN.1 definition. ASN.1 Definition Sifter still exposes pkiComponentDefinition and createPkiComponentCorpus() from its own API surface for compatibility.

It is intentionally focused on common PKI fragments rather than every ASN.1 definition in the world.

Browser App

The app lives in src/app.ts and uses public package APIs. It owns DOM rendering, embedded PkiStudioJS viewer integration, splitters, selected-candidate details, copy JSON, and the API log.

The app should not become a dependency of the resolver core.

Why Results Are Ranked

DER preserves tags, lengths, and encoded values, but it does not preserve:

  • field names,
  • type names,
  • module names,
  • comments,
  • most schema-level semantic intent.

Therefore many distinct ASN.1 definitions can share the same DER shape. The package treats uncertainty as a first-class result through candidate lists, evidence, diagnostics, and ambiguity notes.

Clone this wiki locally