API index
Every documented primitive, grouped by namespace page — 349 primitives. Generated from the same source comments that build the rest of this site.
Constants
| Primitive | Since | Status |
|---|---|---|
C.TIME.days(n) -> milliseconds | 0.1.0 | stable |
C.BYTES.mib(n) -> bytes | 0.1.0 | stable |
Errors
| Primitive | Since | Status |
|---|---|---|
new PkiError(message, code) | 0.1.0 | stable |
pki.errors.defineClass(name, opts?) -> constructor | 0.1.0 | stable |
ASN.1 / DER
| Primitive | Since | Status |
|---|---|---|
pki.asn1.decode(bytes, opts?) -> node | 0.1.0 | stable |
pki.asn1.read.oid(node) -> "1.2.840.113549.1.1.11" | 0.1.15 | stable |
pki.asn1.encode(classBits, constructed, tagNumber, content) -> Buffer | 0.1.0 | stable |
pki.asn1.build.sequence([ ...tlvBuffers ]) -> Buffer | 0.1.0 | stable |
CBOR (deterministic)
| Primitive | Since | Status |
|---|---|---|
pki.cbor.decode(bytes, opts?) -> node | 0.1.27 | stable |
pki.cbor.read.uint(node) -> 0n | 0.1.27 | stable |
pki.cbor.read.nint(node) -> -1n | 0.1.27 | stable |
pki.cbor.read.int(node) -> -1n | 0.1.27 | stable |
pki.cbor.read.byteString(node) -> Buffer | 0.1.27 | stable |
pki.cbor.read.textString(node) -> "text" | 0.1.27 | stable |
pki.cbor.read.array(node) -> [node, ...] | 0.1.27 | stable |
pki.cbor.read.map(node) -> [[keyNode, valueNode], ...] | 0.1.27 | stable |
pki.cbor.read.mapGet(node, key) -> valueNode | null | 0.2.20 | stable |
pki.cbor.read.boolean(node) -> false | 0.1.27 | stable |
pki.cbor.read.nullValue(node) -> null | 0.1.27 | stable |
pki.cbor.read.undefinedValue(node) -> undefined | 0.1.27 | stable |
pki.cbor.read.float(node) -> 1.5 | 0.1.27 | stable |
pki.cbor.read.biguint(node) -> 18446744073709551616n | 0.1.27 | stable |
pki.cbor.read.time(node) -> Date | 0.1.27 | stable |
pki.cbor.read.oid(node) -> "2.5.4.3" | 0.1.27 | stable |
Object Identifiers
| Primitive | Since | Status |
|---|---|---|
pki.oid.name(dotted) -> string | undefined | 0.1.0 | stable |
pki.oid.register(dotted, name) -> void | 0.1.0 | stable |
pki.oid.registerFamily(base, members) -> void | 0.1.2 | stable |
pki.oid.paramsMustBeAbsent(dotted) -> boolean | 0.1.21 | stable |
WebCrypto
| Primitive | Since | Status |
|---|---|---|
new pki.webcrypto.CryptoKey(type, extractable, algorithm, usages, handle) | 0.1.0 | stable |
await pki.webcrypto.subtle.exportKey(format, key) | 0.1.0 | stable |
pki.webcrypto.getRandomValues(typedArray) / pki.webcrypto.subtle | 0.1.0 | stable |
CMC
| Primitive | Since | Status |
|---|---|---|
pki.cmc.verify(response, sent?) -> Promise<verdict> | 0.4.16 | stable |
pki.cmc.build(spec, signer, opts?) -> Promise<Buffer|string> | 0.4.16 | stable |
pki.schema.cmc.parsePkiData(der, caps?) -> parsed | 0.4.16 | stable |
pki.schema.cmc.parsePkiResponse(der, caps?) -> parsed | 0.4.16 | stable |
pki.schema.cmc.parse(input, caps?) -> parsed | 0.4.16 | stable |
Possession statements
| Primitive | Since | Status |
|---|---|---|
pki.possession.parse(value) -> { signer, certificate } | 0.8.44 | stable |
pki.possession.verifyRequest(request, opts) -> Promise<verdict> | 0.8.44 | stable |
PKCS#11 URI
| Primitive | Since | Status |
|---|---|---|
pki.pkcs11.parseUri(uri) -> parsed | 0.8.7 | stable |
pki.pkcs11.formatUri(record) -> string | 0.8.7 | stable |
CMS DigestedData
| Primitive | Since | Status |
|---|---|---|
pki.cms.digest(content, opts?) -> Promise<Buffer|string> | 0.8.1 | stable |
pki.cms.verifyDigest(input, opts?) -> Promise<verdict> | 0.8.1 | stable |
Service identity (RFC 9525)
| Primitive | Since | Status |
|---|---|---|
pki.identity.match(cert, references, opts?) -> verdict | 0.8.8 | stable |
Certification path validation (RFC 5280 6)
Trust-store ingestion
| Primitive | Since | Status |
|---|---|---|
pki.trust.parseCertdata(text) -> { anchors } | 0.2.0 | stable |
pki.trust.parseCcadbCsv(text) -> { anchors } | 0.2.0 | stable |
pki.trust.anchor(entry, opts?) -> trustAnchor | 0.2.0 | stable |
pki.trust.parseTrustAnchorList(input, opts?) -> { anchors } | 0.8.13 | stable |
pki.trust.discoversBundles(platform) -> boolean | 0.8.15 | stable |
pki.trust.systemAnchors(opts?) -> { anchors, source, path, skipped } | 0.8.15 | stable |
JOSE (JWS / JWK)
| Primitive | Since | Status |
|---|---|---|
pki.jose.base64url.encode(bytes) -> string | 0.1.25 | stable |
pki.jose.base64url.decode(text) -> Buffer | 0.1.25 | stable |
pki.jose.parseJson(input) -> value | 0.1.25 | stable |
pki.jose.assertPublicJwk(jwk) -> jwk | 0.1.25 | stable |
pki.jose.verify(jws, opts) -> Promise<{ header, payload, keySource }> | 0.1.25 | stable |
pki.jose.sign(opts) -> Promise<{ protected, payload, signature }> | 0.1.25 | stable |
pki.jose.thumbprint(jwk) -> Promise<string> | 0.1.25 | stable |
pki.jose.sigAlgs() -> Array<{alg,kty,crv,hash,saltLength}> | 0.5.3 | stable |
ACME
HPKE
Composite ML-KEM
| Primitive | Since | Status |
|---|---|---|
pki.kem.decapsulate(privateKey, ciphertext) -> Promise<Buffer> | 0.6.6 | stable |
pki.kem.encapsulate(publicKey) -> Promise<{ sharedSecret: Buffer, ciphertext: Buffer }> | 0.6.6 | stable |
Transport
| Primitive | Since | Status |
|---|---|---|
pki.transport.https(defaults?) -> transport | 0.3.16 | stable |
pki.transport.peerChain(request, defaults?) -> Promise<channel> | 0.8.32 | stable |
OCSP
Schema
| Primitive | Since | Status |
|---|---|---|
pki.schema.all() -> string[] | 0.1.7 | stable |
pki.schema.parse(input, caps?) -> parsed | 0.1.7 | stable |
pki.schema.detectFormat(input) -> string | null | 0.3.8 | stable |
pki.schema.pem.decodeBundle(text, opts) -> [{ index, offset, label, der }] | 0.8.8 | stable |
pki.schema.pem.encodeBundle(objects) -> string | 0.8.8 | stable |
Schema engine
| Primitive | Since | Status |
|---|---|---|
pki.schema.engine.walk(schema, node, ctx) -> value | 0.1.7 | stable |
pki.schema.engine.encode(schema, value, ctx) -> Buffer | 0.1.17 | stable |
pki.schema.engine.embeddedDer(schema, bytes, ctx, opts?) -> value | 0.1.18 | stable |
C509
| Primitive | Since | Status |
|---|---|---|
pki.schema.c509.parse(bytes, caps?) -> { certificateType, serialNumber, serialNumberHex, ... } | 0.2.30 | stable |
pki.schema.c509.encode(input[, opts]) -> Buffer | 0.3.4 | stable |
X.509
| Primitive | Since | Status |
|---|---|---|
pki.schema.x509.pemDecode(text, label?) -> Buffer | 0.1.7 | stable |
pki.schema.x509.pemEncode(der, label) -> string | 0.1.7 | stable |
pki.schema.x509.parse(input, caps?) -> certificate | 0.1.7 | stable |
pki.schema.x509.decodeExtensions(certOrBytes, opts?) -> rows | 0.8.11 | stable |
pki.schema.x509.decodeExtension(ext, opts?) -> row | 0.8.11 | stable |
pki.x509.sign(spec, issuer, opts?) -> Promise<Buffer|string> | 0.3.0 | stable |
pki.x509.randomSerial() -> BigInt | 0.7.12 | stable |
pki.x509.extension(name, value, opts?) -> Buffer | 0.7.33 | stable |
pki.x509.parseDn(dn) -> { rdns, dn, bytes } | 0.8.2 | stable |
PKCS#8
| Primitive | Since | Status |
|---|---|---|
pki.schema.pkcs8.parse(input, caps?) -> privateKey | 0.1.9 | stable |
pki.schema.pkcs8.parseEncrypted(input, caps?) -> encrypted | 0.1.9 | stable |
pki.schema.pkcs8.pemDecode(text, label?) -> Buffer | 0.1.9 | stable |
pki.schema.pkcs8.pemEncode(der, label?) -> string | 0.1.9 | stable |
PKCS#1
| Primitive | Since | Status |
|---|---|---|
pki.schema.pkcs1.parse(input, opts) -> key | 0.8.8 | stable |
pki.schema.pkcs1.parsePublic(input, opts) -> key | 0.8.8 | stable |
pki.schema.pkcs1.encode(key) -> Buffer | 0.8.8 | stable |
pki.schema.pkcs1.encodePublic(key) -> Buffer | 0.8.8 | stable |
SEC1
| Primitive | Since | Status |
|---|---|---|
pki.schema.sec1.parse(input, opts) -> key | 0.8.8 | stable |
pki.schema.sec1.encode(key) -> Buffer | 0.8.8 | stable |
TSP
| Primitive | Since | Status |
|---|---|---|
pki.schema.tsp.parseRequest(input, caps?) -> timeStampReq | 0.2.19 | stable |
pki.schema.tsp.parseTstInfo(input, caps?) -> tstInfo | 0.1.13 | stable |
pki.schema.tsp.parse(input, caps?) -> timeStampResp | 0.1.13 | stable |
pki.schema.tsp.parseToken(input, caps?) -> tstInfo | 0.1.13 | stable |
pki.schema.tsp.pemDecode(text, label?) -> Buffer | 0.1.13 | stable |
pki.schema.tsp.pemEncode(der, label) -> string | 0.1.23 | stable |
pki.tsp.sign(messageImprint, tsa, opts) -> Promise<Buffer|string> | 0.2.15 | stable |
pki.tsp.request(messageImprint, opts) -> Buffer|string | 0.2.19 | stable |
pki.tsp.parseRequest(input) -> timeStampReq | 0.2.19 | stable |
pki.tsp.response(token, opts) -> Buffer|string | 0.2.19 | stable |
pki.tsp.parseResponse(input) -> timeStampResp | 0.2.19 | stable |
pki.tsp.verify(token, data, opts) -> Promise<result> | 0.2.19 | stable |
Trust anchors
| Primitive | Since | Status |
|---|---|---|
pki.schema.trustanchor.parse(input, caps?) -> trustAnchorList | 0.8.13 | stable |
pki.schema.trustanchor.parseInfo(input, caps?) -> trustAnchorInfo | 0.8.13 | stable |
pki.schema.trustanchor.pemDecode(text, label?) -> Buffer | 0.8.13 | stable |
pki.schema.trustanchor.pemEncode(der, label?) -> string | 0.8.13 | stable |
S/MIME (ESS)
CSR Attributes
| Primitive | Since | Status |
|---|---|---|
pki.schema.csrattrs.parse(der, caps?) -> { items } | 0.1.24 | stable |
EST
SCEP
Stateful hash-based
| Primitive | Since | Status |
|---|---|---|
pki.shbs.verify(publicKey, message, signature) -> boolean | 0.2.1 | stable |
pki.shbs.verifyLms(publicKey, message, signature) -> boolean | 0.2.1 | stable |
Attribute certificates
Certificate management protocol messages
| Primitive | Since | Status |
|---|---|---|
pki.cmp.build(message, opts?) -> Promise<Buffer|string> | 0.3.5 | stable |
pki.cmp.transfer(url, message, opts?) -> Promise<{ response, responseBytes, status, contentType, tls }> | 0.3.19 | stable |
pki.cmp.wellKnownUrl(base, opts?) -> string | 0.3.19 | stable |
pki.schema.cmp.parse(input, caps?) -> pkiMessage | 0.1.19 | stable |
pki.schema.cmp.pemDecode(text, label?) -> Buffer | 0.1.19 | stable |
pki.schema.cmp.pemEncode(der, label?) -> string | 0.1.19 | stable |
CRLs
Certificate request messages
Certification requests
Keys
PKCS#12
Related certificates
Alternative signatures
| Primitive | Since | Status |
|---|---|---|
pki.altSig.signedData(structure) -> Buffer | 0.8.43 | stable |
pki.altSig.subjectAltPublicKey(certificate) -> Buffer | 0.8.43 | stable |
pki.altSig.verify(structure, issuerAltPublicKey, opts?) -> Promise<boolean> | 0.8.43 | stable |
Sigstore
| Primitive | Since | Status |
|---|---|---|
pki.sigstore.pae(payloadType, payloadBytes) -> Buffer | 0.2.3 | stable |
pki.sigstore.parseBundle(input) -> bundle | 0.2.3 | stable |
pki.sigstore.verifyBundle(bundle, opts) -> Promise<result> | 0.2.3 | stable |
Inspect
| Primitive | Since | Status |
|---|---|---|
pki.inspect.certificate(input) -> string | 0.2.4 | stable |
pki.inspect.crl(input) -> string | 0.3.8 | stable |
pki.inspect.csr(input) -> string | 0.3.8 | stable |
pki.inspect.cms(input) -> string | 0.3.8 | stable |
pki.inspect.pkcs8(input) -> string | 0.8.29 | stable |
pki.inspect.pkcs12(input) -> string | 0.8.29 | stable |
pki.inspect.crmf(input) -> string | 0.8.29 | stable |
pki.inspect.cmp(input) -> string | 0.8.29 | stable |
pki.inspect.csrattrs(input) -> string | 0.8.29 | stable |
pki.inspect.trustanchor(input) -> string | 0.8.29 | stable |
pki.inspect.ocspRequest(input) -> string | 0.8.29 | stable |
pki.inspect.ocspResponse(input) -> string | 0.8.29 | stable |
pki.inspect.tsp(input) -> string | 0.8.29 | stable |
pki.inspect.attrcert(input) -> string | 0.8.29 | stable |
pki.inspect.asn1(input, opts?) -> string | 0.8.31 | stable |
pki.inspect.any(input) -> string | 0.3.8 | stable |
Lint
| Primitive | Since | Status |
|---|---|---|
pki.lint.certificate(input, opts?) -> LintReport | 0.2.10 | stable |
pki.lint.crl(pem | der | parsed, opts?) -> LintReport | 0.7.9 | stable |
pki.lint.csr(pem | der | parsed, opts?) -> LintReport | 0.8.16 | stable |
pki.lint.ocsp(pem | der | parsed, opts?) -> LintReport | 0.7.26 | stable |
pki.lint.cms(pem | der | parsed, opts?) -> LintReport | 0.8.26 | stable |
pki.lint.tsp(pem | der, opts?) -> LintReport | 0.8.26 | stable |
pki.lint.attrcert(pem | der, opts?) -> LintReport | 0.8.26 | stable |
pki.lint.rules(profile?, artifact?) -> [{id, severity, source, citation}] | 0.2.10 | stable |
pki.lint.profiles() -> [string] | 0.2.10 | stable |
CT
TLS
Merkle
| Primitive | Since | Status |
|---|---|---|
pki.merkle.leafHash(entry) -> Buffer | 0.1.28 | stable |
pki.merkle.nodeHash(left, right) -> Buffer | 0.1.28 | stable |
pki.merkle.emptyRootHash() -> Buffer | 0.1.28 | stable |
pki.merkle.verifyInclusion(opts) -> boolean | 0.1.28 | stable |
pki.merkle.verifyConsistency(opts) -> boolean | 0.1.28 | stable |
pki.merkle.root(leafHashes) -> Buffer | 0.8.34 | stable |
pki.merkle.inclusionProof(opts) -> Buffer[] | 0.8.34 | stable |
pki.merkle.consistencyProof(opts) -> Buffer[] | 0.8.34 | stable |
Tlog
TUF
| Primitive | Since | Status |
|---|---|---|
pki.tuf.canonicalJson(value) -> Buffer | 0.8.41 | stable |
pki.tuf.keyId(key) -> string | 0.8.41 | stable |
pki.tuf.parseMetadata(input) -> { type, specVersion, version, expires, signed, signatures, signedBytes } | 0.8.41 | stable |
pki.tuf.checkExpiry(metadata, now) -> true | 0.8.41 | stable |
pki.tuf.verifySignatures(opts) -> Promise<{ verified, keyIds, threshold }> | 0.8.41 | stable |
pki.tuf.updateRoot(opts) -> Promise<{ root, version, updated, walked }> | 0.8.41 | stable |
Trust anchor lists
| Primitive | Since | Status |
|---|---|---|
pki.trustanchor.build(spec, opts?) -> Buffer | string | 0.8.13 | stable |