@pkistudio/asn1resolver
v0.1.3
Published
Local-only explainable ASN.1 definition candidate resolver built on DerEditor.
Readme
ASN.1 Resolver
ASN.1 Resolver is a deterministic, explainable ASN.1 definition candidate resolver. It parses DER, BER, PEM, headerless Base64, and hexadecimal input through DerEditor, compares the local TLV structure with ASN.1 definition corpora, and returns ranked candidates with evidence, diagnostics, ambiguities, and matched paths.
The resolver and its standalone viewer run locally. Document bytes, ASN.1 definitions, candidate reports, and OID lookups are not sent to a remote service.
Current version: 0.1.3
Independence
@pkistudio/dereditor is the only PkiStudio runtime dependency. ASN.1 Resolver
owns its neutral TLV contract, schema model, ASN.1 definition parser, matching
logic, built-in PKI corpus, reports, and Resolver shell. Its document pane mounts
the Viewer exported by DerEditor. It does not depend on
PkiStudioJS, ASN.1 Instance Builder, DerBuilder, a remote OID service, or an AI
model.
Install
npm install @pkistudio/asn1resolverCore API
const resolver = require('@pkistudio/asn1resolver');
async function inspect(input) {
const report = await resolver.createPkiCandidateReport(input, {
profiles: ['components', 'x509'],
includeSubtrees: true,
maxResults: 5
});
console.log(report.roots[0].summary.bestCandidate);
}
inspect('300d06092a864886f70d01010b0500');Use a custom ASN.1 definition corpus with parseAsn1DefinitionCorpus():
const corpus = resolver.parseAsn1DefinitionCorpus(`
Example DEFINITIONS ::= BEGIN
Counter ::= SEQUENCE { value INTEGER }
END
`);
const nodes = await resolver.parseInputToTlvNodes('3003020101', {
format: 'hex'
});
const candidates = resolver.findAsn1Candidates(nodes[0], {
schemaCorpus: corpus
});The practical ASN.1 parser supports module definitions, aliases, primitive
types, SEQUENCE, SET, CHOICE, SEQUENCE OF, SET OF, OPTIONAL,
DEFAULT, and context/application/private/universal EXPLICIT or IMPLICIT
tags. Constraints are accepted and ignored by the structural matcher.
Package exports:
@pkistudio/asn1resolver: Core API.@pkistudio/asn1resolver/core: Core API alias.@pkistudio/asn1resolver/viewer: standalone browser viewer API.@pkistudio/asn1resolver/styles.css: viewer styles.
Local viewer
npm ci
npm test
npm run test:package
node app/server.jsOpen http://localhost:8080/. Files, pasted input, local ASN.1 corpora, and OID
resolution remain on the local machine. The Node.js
service only serves static package files. The viewer favicon uses the PkiStudio
icon published by the installed DerEditor package. The document pane is the
editable DerEditor Viewer, including its Load, Save, Close, Tools, and About
menus. Resolver candidates refresh after DerEditor loads or changes a document.
Corpora and Resolver About are available beside the application name in the top
toolbar. The Corpora dialog manages local definitions through file or clipboard
addition, editing, removal, revert, and JSON load/save actions. The candidate
pane uses a compact expandable tree with definition
alternatives, scores, confidence, and subtree paths. The selected pane presents
evidence, diagnostics, ambiguities, matched paths, and bytes as separate cards.
Drag the pane separators, or focus one and use the arrow, Home, and End keys, to
resize the document, selected-candidate, and local-log areas.
The same local-only viewer is deployed to GitHub Pages. Pages receives only static application assets; selected files and pasted data stay in the browser.
Development
npm test
npm run test:package
npm run check
npm run audit:offline
npm run pack:dry-runSee the architecture notes and the API specification for the ownership and offline boundaries. Release preparation is documented in the release process, with separate npm publishing and GitHub prerequisite guides. Pages packaging and deployment are described in the deployment guide. The current notes are in the v0.1.3 release notes.
License
ASN.1 Resolver is licensed under the MIT License. See LICENSE.
