Schema
The schema family: a declarative ASN.1 structure-schema engine and the per-format parsers built on it. Every format (X.509 certificates, CRLs, PKCS#10 certification requests, and — as they land — CMS / PKCS#8) is a member that COMPOSES the shared engine and the shared PKIX sub-schemas (AlgorithmIdentifier, Name, Extension), so a structural rule — bounds-checked positional reads, optional / tagged field ordering, SET-OF uniqueness, fail-closed typed errors — is defined once in the engine and no format can reintroduce the class of bug it prevents.
parse is the orchestrator: hand it DER (or PEM) and it detects which format the bytes encode and routes to that member's parser. Each member is also reachable directly (pki.schema.x509.parse, pki.schema.crl.parse), and all() enumerates the registered formats.
pki.schema.all
since 0.1.7 experimental
pki.schema.all() -> string[]
The names of every registered format, in detection order.
Example
pki.schema.all(); // → ["pkcs8", "csr", "crl", "x509"]
References
- spec RFC 5280
pki.schema.parse
since 0.1.7 experimental
pki.schema.parse(input) -> parsed
Detect which PKI format input (a DER Buffer or a PEM string) encodes and route to that format's parser, returning the same structured object the format's own parse returns. Throws SchemaError("schema/unknown-format") when the bytes match no registered format; the underlying decode / structural errors of the matched format propagate unchanged.
Example
var parsed = pki.schema.parse(der); // cert → the pki.schema.x509 shape
References
- spec RFC 5280