micro509 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +123 -6
  2. package/README.md +3 -0
  3. package/dist/crypto/crypto.d.ts +2 -3
  4. package/dist/crypto.d.ts +6 -0
  5. package/dist/der/der.d.ts +14 -4
  6. package/dist/der/der.js +19 -19
  7. package/dist/der.d.ts +26 -2
  8. package/dist/der.js +4 -4
  9. package/dist/index.d.ts +82 -15
  10. package/dist/index.js +19 -19
  11. package/dist/internal/asn1/asn1.d.ts +1 -2
  12. package/dist/internal/asn1/der.d.ts +1 -2
  13. package/dist/internal/asn1/oids.js +71 -353
  14. package/dist/internal/asn1/oids.js.map +1 -1
  15. package/dist/internal/asn1/oids.json.js +357 -0
  16. package/dist/internal/asn1/oids.json.js.map +1 -0
  17. package/dist/internal/crypto/algorithm-names.js +1 -1
  18. package/dist/internal/crypto/pbes2.d.ts +1 -2
  19. package/dist/internal/crypto/pbes2.js +70 -70
  20. package/dist/internal/crypto/prime-ec.js +37 -0
  21. package/dist/internal/crypto/prime-ec.js.map +1 -0
  22. package/dist/internal/crypto/rsa-pss.js +50 -50
  23. package/dist/internal/crypto/sig-verify.d.ts +1 -2
  24. package/dist/internal/crypto/sig-verify.js +60 -60
  25. package/dist/internal/crypto/signing.d.ts +1 -2
  26. package/dist/internal/crypto/signing.js +26 -26
  27. package/dist/internal/jose/json-data.js +108 -0
  28. package/dist/internal/jose/json-data.js.map +1 -0
  29. package/dist/internal/jose/strict-json.d.ts +1 -2
  30. package/dist/internal/shared/dn.d.ts +1 -2
  31. package/dist/internal/shared/dn.js +1 -1
  32. package/dist/internal/shared/ip.d.ts +1 -2
  33. package/dist/internal/verify/name-constraints-engine.js +64 -64
  34. package/dist/internal/verify/policy-engine.js +1 -1
  35. package/dist/internal/verify/verify-path.d.ts +1 -2
  36. package/dist/internal/verify/verify-path.js +19 -19
  37. package/dist/internal/x509/directory-name.js +10 -10
  38. package/dist/internal/x509/extension-errors.d.ts +1 -2
  39. package/dist/internal/x509/extension-registry.js +18 -18
  40. package/dist/internal/x509/general-name-profile.js +9 -9
  41. package/dist/internal/x509/general-name.js +32 -32
  42. package/dist/internal/x509/name-fields.js +1 -1
  43. package/dist/jose/base64url.d.ts +4 -0
  44. package/dist/jose/base64url.js +14 -0
  45. package/dist/jose/base64url.js.map +1 -0
  46. package/dist/jose/errors.d.ts +9 -3
  47. package/dist/jose/errors.js.map +1 -1
  48. package/dist/jose/jwe.d.ts +64 -0
  49. package/dist/jose/jwe.js +188 -0
  50. package/dist/jose/jwe.js.map +1 -0
  51. package/dist/jose/jwks.d.ts +38 -10
  52. package/dist/jose/jwks.js +156 -96
  53. package/dist/jose/jwks.js.map +1 -1
  54. package/dist/jose/jws.d.ts +8 -6
  55. package/dist/jose/jws.js +216 -170
  56. package/dist/jose/jws.js.map +1 -1
  57. package/dist/jose/jwt.d.ts +8 -2
  58. package/dist/jose/jwt.js +98 -98
  59. package/dist/jose/remote-jwks.d.ts +1 -2
  60. package/dist/jose/remote-jwks.js +106 -108
  61. package/dist/jose/remote-jwks.js.map +1 -1
  62. package/dist/jose.d.ts +15 -4
  63. package/dist/jose.js +7 -5
  64. package/dist/kdf/argon2-arithmetic.js +15 -0
  65. package/dist/kdf/argon2-arithmetic.js.map +1 -0
  66. package/dist/kdf/argon2-core.js +486 -0
  67. package/dist/kdf/argon2-core.js.map +1 -0
  68. package/dist/kdf/argon2-memory.js +20 -0
  69. package/dist/kdf/argon2-memory.js.map +1 -0
  70. package/dist/kdf/argon2-portable.js +18 -0
  71. package/dist/kdf/argon2-portable.js.map +1 -0
  72. package/dist/kdf/argon2.d.ts +22 -11
  73. package/dist/kdf/argon2.js +32 -13
  74. package/dist/kdf/argon2.js.map +1 -1
  75. package/dist/kdf.d.ts +6 -0
  76. package/dist/keys/keys.d.ts +31 -6
  77. package/dist/keys/keys.js +315 -233
  78. package/dist/keys/keys.js.map +1 -1
  79. package/dist/keys.d.ts +11 -2
  80. package/dist/keys.js +2 -2
  81. package/dist/pem/pem.d.ts +1 -2
  82. package/dist/pem/pem.js +40 -25
  83. package/dist/pem/pem.js.map +1 -1
  84. package/dist/pem.d.ts +6 -0
  85. package/dist/pkcs/pfx.d.ts +2 -3
  86. package/dist/pkcs/pfx.js +142 -142
  87. package/dist/pkcs/pkcs12-mac.d.ts +1 -2
  88. package/dist/pkcs/pkcs12-mac.js +122 -122
  89. package/dist/pkcs/pkcs7.d.ts +14 -3
  90. package/dist/pkcs/pkcs7.js +268 -248
  91. package/dist/pkcs/pkcs7.js.map +1 -1
  92. package/dist/pkcs.d.ts +10 -1
  93. package/dist/pkcs.js +4 -4
  94. package/dist/result/result.d.ts +1 -2
  95. package/dist/result.d.ts +6 -0
  96. package/dist/revocation/chain.d.ts +2 -3
  97. package/dist/revocation/chain.js +52 -52
  98. package/dist/revocation/crl.d.ts +2 -3
  99. package/dist/revocation/crl.js +319 -319
  100. package/dist/revocation/crl.js.map +1 -1
  101. package/dist/revocation/ocsp.d.ts +2 -3
  102. package/dist/revocation/ocsp.js +395 -395
  103. package/dist/revocation/revocation.d.ts +2 -3
  104. package/dist/revocation/revocation.js +22 -22
  105. package/dist/revocation.d.ts +12 -3
  106. package/dist/revocation.js +4 -4
  107. package/dist/ssh/ssh.d.ts +2 -3
  108. package/dist/ssh/ssh.js +165 -170
  109. package/dist/ssh/ssh.js.map +1 -1
  110. package/dist/ssh/wire.d.ts +1 -2
  111. package/dist/ssh/wire.js +10 -10
  112. package/dist/ssh.d.ts +8 -0
  113. package/dist/verify/identity.d.ts +1 -2
  114. package/dist/verify/identity.js +31 -31
  115. package/dist/verify/name-constraints.d.ts +9 -2
  116. package/dist/verify/policy.d.ts +9 -2
  117. package/dist/verify/verify.d.ts +3 -4
  118. package/dist/verify/verify.js +121 -121
  119. package/dist/verify.d.ts +9 -0
  120. package/dist/x509/certificate.d.ts +4 -5
  121. package/dist/x509/certificate.js +40 -40
  122. package/dist/x509/csr.d.ts +3 -4
  123. package/dist/x509/csr.js +15 -15
  124. package/dist/x509/extensions.d.ts +1 -2
  125. package/dist/x509/extensions.js +165 -165
  126. package/dist/x509/extensions.js.map +1 -1
  127. package/dist/x509/fingerprint.d.ts +1 -2
  128. package/dist/x509/name-text.d.ts +1 -2
  129. package/dist/x509/name.d.ts +1 -2
  130. package/dist/x509/name.js +15 -15
  131. package/dist/x509/parse.d.ts +3 -4
  132. package/dist/x509/parse.js +423 -423
  133. package/dist/x509.d.ts +17 -4
  134. package/dist/x509.js +8 -8
  135. package/package.json +27 -34
  136. package/dist/internal/asn1/oids2.js +0 -75
  137. package/dist/internal/asn1/oids2.js.map +0 -1
package/dist/x509.d.ts CHANGED
@@ -1,12 +1,25 @@
1
+ /**
2
+ * Create and inspect certificates, CSRs, names, and extensions.
3
+ *
4
+ * Read existing material with {@linkcode parseCertificatePem}. Issue a
5
+ * certificate with {@linkcode createCertificate}, or generate a key and
6
+ * certificate together with {@linkcode createSelfSignedCertificate}.
7
+ *
8
+ * DER/PEM parsing, encoding, extension decoding, and text rendering return
9
+ * synchronously. Certificate/CSR creation and WebCrypto-backed hashing and key
10
+ * operations return promises and must be awaited.
11
+ *
12
+ * @module micro509/x509
13
+ */
1
14
  import { SignatureProfileInput } from "./internal/crypto/signing.js";
2
15
  import { canonicalDnKey, compareDistinguishedNames, isWithinDirectoryNameSubtree } from "./internal/shared/dn.js";
3
- import { NameAttribute, NameEncoderErrorCode, NameFieldKey, NameInput, NameObject, RelativeDistinguishedNameInput, encodeName, encodeRelativeDistinguishedName } from "./x509/name.js";
16
+ import { CertificateMaterial, CreateCertificateErrorCode, CreateCertificateInput, CreateSelfSignedCertificateBase, CreateSelfSignedCertificateInput, SelfSignedCertificateResult, SelfSignedKeySource, ValidityInput, createCertificate, createSelfSignedCertificate } from "./x509/certificate.js";
4
17
  import { ExtensionEncoderErrorCode } from "./internal/x509/extension-errors.js";
5
18
  import { allOnesMaskForIpAddress, decodeIpAddress, normalizeIpAddress, parseIpAddressToBytes } from "./internal/shared/ip.js";
6
- import { AuthorityInfoAccessMethod, AuthorityInformationAccess, AuthorityInformationAccessInput, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, CpsPolicyQualifierInfo, CustomAuthorityInfoAccessMethod, CustomExtendedKeyUsage, CustomExtension, CustomPolicyQualifierInfo, DisplayTextType, DistributionPoint, DistributionPointName, DistributionPointReason, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, KeyUsage, KnownAuthorityInfoAccessMethod, KnownExtendedKeyUsage, NameConstraintForm, NameConstraints, OversizedDisplayText, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyNoticeReference, PolicyQualifierInfo, SubjectAltName, UnsupportedNameConstraintForm, UserNoticePolicyQualifierInfo, buildCertificateExtensions, buildRequestedExtensions, buildSubjectKeyIdentifier, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeSubjectAltName, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, parseAuthorityInfoAccessMethodOid, parseExtendedKeyUsageOid } from "./x509/extensions.js";
7
- import { DecodedExtensionMap, DecodedExtensionValue, ExtensionDecoder, ExtensionDecoderMap, MatchCertificatePrivateKeyErrorCode, MatchCertificatePrivateKeyFailure, MatchCertificatePrivateKeyFailureResult, MatchCertificatePrivateKeyResult, MatchCertificatePrivateKeySuccess, ParseCertificateChainResult, ParseCertificateErrorCode, ParseCertificateFailure, ParseCertificateResult, ParseCertificateSigningRequestErrorCode, ParseCertificateSigningRequestFailure, ParseCertificateSigningRequestResult, ParseOptions, ParsedCertificate, ParsedCertificateSigningRequest, ParsedDistributionPoint, ParsedDistributionPointName, ParsedExtension, ParsedName, ParsedNameAttribute, ParsedRelativeDistinguishedName, certificateMatchesPrivateKey, decodeExtension, decodeExtensionMap, decodeExtensions, defineExtensionDecoder, defineExtensionDecoderMap, findExtension, getSubjectPublicKey, getSubjectPublicKeyOrThrow, matchCertificatePrivateKey, parseAuthorityInfoAccess, parseAuthorityKeyIdentifier, parseBasicConstraints, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificatePolicies, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseCrlDistributionPoints, parseDistinguishedNameDer, parseExtendedKeyUsage, parseInhibitAnyPolicy, parseKeyUsage, parseNameConstraints, parsePolicyConstraints, parsePolicyMappings, parseSubjectAltNames } from "./x509/parse.js";
8
- import { CertificateMaterial, CreateCertificateErrorCode, CreateCertificateInput, CreateSelfSignedCertificateBase, CreateSelfSignedCertificateInput, SelfSignedCertificateResult, SelfSignedKeySource, ValidityInput, createCertificate, createSelfSignedCertificate } from "./x509/certificate.js";
9
19
  import { CreateCsrInput, CsrMaterial, createCertificateSigningRequest } from "./x509/csr.js";
20
+ import { AuthorityInfoAccessMethod, AuthorityInformationAccess, AuthorityInformationAccessInput, BasicConstraints, CertificateExtensionsInput, CertificatePolicies, CpsPolicyQualifierInfo, CustomAuthorityInfoAccessMethod, CustomExtendedKeyUsage, CustomExtension, CustomPolicyQualifierInfo, DisplayTextType, DistributionPoint, DistributionPointName, DistributionPointReason, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, KeyUsage, KnownAuthorityInfoAccessMethod, KnownExtendedKeyUsage, NameConstraintForm, NameConstraints, OversizedDisplayText, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyInformation, PolicyMapping, PolicyMappings, PolicyNoticeReference, PolicyQualifierInfo, SubjectAltName, UnsupportedNameConstraintForm, UserNoticePolicyQualifierInfo, buildCertificateExtensions, buildRequestedExtensions, buildSubjectKeyIdentifier, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeSubjectAltName, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, parseAuthorityInfoAccessMethodOid, parseExtendedKeyUsageOid } from "./x509/extensions.js";
10
21
  import { CertificateFingerprint, CertificateFingerprintAlgorithm, CertificateFingerprintSource, certificateFingerprint, subjectPublicKeyInfoFingerprint } from "./x509/fingerprint.js";
22
+ import { NameAttribute, NameEncoderErrorCode, NameFieldKey, NameInput, NameObject, RelativeDistinguishedNameInput, encodeName, encodeRelativeDistinguishedName } from "./x509/name.js";
11
23
  import { SubjectAltNameTextOptions, distinguishedNameToString, relativeDistinguishedNameToString, subjectAltNameLabel, subjectAltNameToString } from "./x509/name-text.js";
24
+ import { DecodedExtensionMap, DecodedExtensionValue, ExtensionDecoder, ExtensionDecoderMap, MatchCertificatePrivateKeyErrorCode, MatchCertificatePrivateKeyFailure, MatchCertificatePrivateKeyFailureResult, MatchCertificatePrivateKeyResult, MatchCertificatePrivateKeySuccess, ParseCertificateChainResult, ParseCertificateErrorCode, ParseCertificateFailure, ParseCertificateResult, ParseCertificateSigningRequestErrorCode, ParseCertificateSigningRequestFailure, ParseCertificateSigningRequestResult, ParseOptions, ParsedCertificate, ParsedCertificateSigningRequest, ParsedDistributionPoint, ParsedDistributionPointName, ParsedExtension, ParsedName, ParsedNameAttribute, ParsedRelativeDistinguishedName, certificateMatchesPrivateKey, decodeExtension, decodeExtensionMap, decodeExtensions, defineExtensionDecoder, defineExtensionDecoderMap, findExtension, getSubjectPublicKey, getSubjectPublicKeyOrThrow, matchCertificatePrivateKey, parseAuthorityInfoAccess, parseAuthorityKeyIdentifier, parseBasicConstraints, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificatePolicies, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseCrlDistributionPoints, parseDistinguishedNameDer, parseExtendedKeyUsage, parseInhibitAnyPolicy, parseKeyUsage, parseNameConstraints, parsePolicyConstraints, parsePolicyMappings, parseSubjectAltNames } from "./x509/parse.js";
12
25
  export { type AuthorityInfoAccessMethod, type AuthorityInformationAccess, type AuthorityInformationAccessInput, type BasicConstraints, type CertificateExtensionsInput, type CertificateFingerprint, type CertificateFingerprintAlgorithm, type CertificateFingerprintSource, type CertificateMaterial, type CertificatePolicies, type CpsPolicyQualifierInfo, type CreateCertificateErrorCode, type CreateCertificateInput, type CreateCsrInput, type CreateSelfSignedCertificateBase, type CreateSelfSignedCertificateInput, type CsrMaterial, type CustomAuthorityInfoAccessMethod, type CustomExtendedKeyUsage, type CustomExtension, type CustomPolicyQualifierInfo, type DecodedExtensionMap, type DecodedExtensionValue, type DisplayTextType, type DistributionPoint, type DistributionPointName, type DistributionPointReason, type ExtendedKeyUsage, type ExtensionDecoder, type ExtensionDecoderMap, type ExtensionEncoderErrorCode, type GeneralName, type GeneralSubtree, type InhibitAnyPolicy, type KeyUsage, type KnownAuthorityInfoAccessMethod, type KnownExtendedKeyUsage, type MatchCertificatePrivateKeyErrorCode, type MatchCertificatePrivateKeyFailure, type MatchCertificatePrivateKeyFailureResult, type MatchCertificatePrivateKeyResult, type MatchCertificatePrivateKeySuccess, type NameAttribute, type NameConstraintForm, type NameConstraints, type NameEncoderErrorCode, type NameFieldKey, type NameInput, type NameObject, type OversizedDisplayText, type ParseCertificateChainResult, type ParseCertificateErrorCode, type ParseCertificateFailure, type ParseCertificateResult, type ParseCertificateSigningRequestErrorCode, type ParseCertificateSigningRequestFailure, type ParseCertificateSigningRequestResult, type ParseOptions, type ParsedBitFlags, type ParsedCertificate, type ParsedCertificateSigningRequest, type ParsedDistributionPoint, type ParsedDistributionPointName, type ParsedExtension, type ParsedName, type ParsedNameAttribute, type ParsedNameConstraintForm, type ParsedRelativeDistinguishedName, type PolicyConstraints, type PolicyInformation, type PolicyMapping, type PolicyMappings, type PolicyNoticeReference, type PolicyQualifierInfo, type RelativeDistinguishedNameInput, type SelfSignedCertificateResult, type SelfSignedKeySource, type SignatureProfileInput, type SubjectAltName, type SubjectAltNameTextOptions, type UnsupportedNameConstraintForm, type UserNoticePolicyQualifierInfo, type ValidityInput, allOnesMaskForIpAddress, buildCertificateExtensions, buildRequestedExtensions, canonicalDnKey, certificateFingerprint, certificateMatchesPrivateKey, compareDistinguishedNames, createCertificate, createCertificateSigningRequest, createSelfSignedCertificate, parseAuthorityInfoAccess as decodeAuthorityInfoAccess, parseAuthorityKeyIdentifier as decodeAuthorityKeyIdentifier, parseBasicConstraints as decodeBasicConstraints, parseCertificatePolicies as decodeCertificatePolicies, parseCrlDistributionPoints as decodeCrlDistributionPoints, parseExtendedKeyUsage as decodeExtendedKeyUsage, decodeExtension, decodeExtensionMap, decodeExtensions, parseInhibitAnyPolicy as decodeInhibitAnyPolicy, decodeIpAddress, parseKeyUsage as decodeKeyUsage, parseNameConstraints as decodeNameConstraints, parsePolicyConstraints as decodePolicyConstraints, parsePolicyMappings as decodePolicyMappings, parseSubjectAltNames as decodeSubjectAltNames, defineExtensionDecoder, defineExtensionDecoderMap, distinguishedNameToString, encodeAuthorityInfoAccess, encodeBasicConstraints, encodeCertificatePolicies, encodeCrlDistributionPoints, encodeExtendedKeyUsage, encodeExtension, encodeInhibitAnyPolicy, encodeKeyUsage, encodeName, encodeNameConstraints, encodePolicyConstraints, encodePolicyMappings, encodeRelativeDistinguishedName, encodeSubjectAltName, findExtension, getAuthorityInfoAccessMethodOid, getExtendedKeyUsageOid, getSubjectPublicKey, getSubjectPublicKeyOrThrow, isWithinDirectoryNameSubtree, matchCertificatePrivateKey, normalizeIpAddress, parseAuthorityInfoAccessMethodOid, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseDistinguishedNameDer, parseExtendedKeyUsageOid, parseIpAddressToBytes, relativeDistinguishedNameToString, subjectAltNameLabel, subjectAltNameToString, buildSubjectKeyIdentifier as subjectKeyIdentifier, subjectPublicKeyInfoFingerprint };
package/dist/x509.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { allOnesMaskForIpAddress as e, decodeIpAddress as t, normalizeIpAddress as n, parseIpAddressToBytes as r } from "./internal/shared/ip.js";
2
2
  import { canonicalDnKey as i, compareDistinguishedNames as a, isWithinDirectoryNameSubtree as o } from "./internal/shared/dn.js";
3
- import { encodeName as s, encodeRelativeDistinguishedName as c } from "./x509/name.js";
4
- import { buildCertificateExtensions as l, buildRequestedExtensions as u, buildSubjectKeyIdentifier as d, encodeAuthorityInfoAccess as f, encodeBasicConstraints as p, encodeCertificatePolicies as m, encodeCrlDistributionPoints as h, encodeExtendedKeyUsage as g, encodeExtension as _, encodeInhibitAnyPolicy as v, encodeKeyUsage as y, encodeNameConstraints as b, encodePolicyConstraints as x, encodePolicyMappings as S, encodeSubjectAltName as C, getAuthorityInfoAccessMethodOid as w, getExtendedKeyUsageOid as T, parseAuthorityInfoAccessMethodOid as E, parseExtendedKeyUsageOid as D } from "./x509/extensions.js";
5
- import { certificateMatchesPrivateKey as O, decodeExtension as k, decodeExtensionMap as A, decodeExtensions as j, defineExtensionDecoder as M, defineExtensionDecoderMap as N, findExtension as P, getSubjectPublicKey as F, getSubjectPublicKeyOrThrow as I, matchCertificatePrivateKey as L, parseAuthorityInfoAccess as R, parseAuthorityKeyIdentifier as z, parseBasicConstraints as B, parseCertificateChainPem as V, parseCertificateChainPemOrThrow as H, parseCertificateDer as U, parseCertificateDerOrThrow as W, parseCertificateFromSource as G, parseCertificatePem as K, parseCertificatePemOrThrow as q, parseCertificatePolicies as J, parseCertificateSigningRequestDer as Y, parseCertificateSigningRequestDerOrThrow as X, parseCertificateSigningRequestPem as Z, parseCertificateSigningRequestPemOrThrow as Q, parseCertificatesFromSource as $, parseCrlDistributionPoints as ee, parseDistinguishedNameDer as te, parseExtendedKeyUsage as ne, parseInhibitAnyPolicy as re, parseKeyUsage as ie, parseNameConstraints as ae, parsePolicyConstraints as oe, parsePolicyMappings as se, parseSubjectAltNames as ce } from "./x509/parse.js";
6
- import { createCertificate as le, createSelfSignedCertificate as ue } from "./x509/certificate.js";
7
- import { createCertificateSigningRequest as de } from "./x509/csr.js";
8
- import { certificateFingerprint as fe, subjectPublicKeyInfoFingerprint as pe } from "./x509/fingerprint.js";
9
- import { distinguishedNameToString as me, relativeDistinguishedNameToString as he, subjectAltNameLabel as ge, subjectAltNameToString as _e } from "./x509/name-text.js";
10
- export { e as allOnesMaskForIpAddress, l as buildCertificateExtensions, u as buildRequestedExtensions, i as canonicalDnKey, fe as certificateFingerprint, O as certificateMatchesPrivateKey, a as compareDistinguishedNames, le as createCertificate, de as createCertificateSigningRequest, ue as createSelfSignedCertificate, R as decodeAuthorityInfoAccess, z as decodeAuthorityKeyIdentifier, B as decodeBasicConstraints, J as decodeCertificatePolicies, ee as decodeCrlDistributionPoints, ne as decodeExtendedKeyUsage, k as decodeExtension, A as decodeExtensionMap, j as decodeExtensions, re as decodeInhibitAnyPolicy, t as decodeIpAddress, ie as decodeKeyUsage, ae as decodeNameConstraints, oe as decodePolicyConstraints, se as decodePolicyMappings, ce as decodeSubjectAltNames, M as defineExtensionDecoder, N as defineExtensionDecoderMap, me as distinguishedNameToString, f as encodeAuthorityInfoAccess, p as encodeBasicConstraints, m as encodeCertificatePolicies, h as encodeCrlDistributionPoints, g as encodeExtendedKeyUsage, _ as encodeExtension, v as encodeInhibitAnyPolicy, y as encodeKeyUsage, s as encodeName, b as encodeNameConstraints, x as encodePolicyConstraints, S as encodePolicyMappings, c as encodeRelativeDistinguishedName, C as encodeSubjectAltName, P as findExtension, w as getAuthorityInfoAccessMethodOid, T as getExtendedKeyUsageOid, F as getSubjectPublicKey, I as getSubjectPublicKeyOrThrow, o as isWithinDirectoryNameSubtree, L as matchCertificatePrivateKey, n as normalizeIpAddress, E as parseAuthorityInfoAccessMethodOid, V as parseCertificateChainPem, H as parseCertificateChainPemOrThrow, U as parseCertificateDer, W as parseCertificateDerOrThrow, G as parseCertificateFromSource, K as parseCertificatePem, q as parseCertificatePemOrThrow, Y as parseCertificateSigningRequestDer, X as parseCertificateSigningRequestDerOrThrow, Z as parseCertificateSigningRequestPem, Q as parseCertificateSigningRequestPemOrThrow, $ as parseCertificatesFromSource, te as parseDistinguishedNameDer, D as parseExtendedKeyUsageOid, r as parseIpAddressToBytes, he as relativeDistinguishedNameToString, ge as subjectAltNameLabel, _e as subjectAltNameToString, d as subjectKeyIdentifier, pe as subjectPublicKeyInfoFingerprint };
3
+ import { createCertificate as s, createSelfSignedCertificate as c } from "./x509/certificate.js";
4
+ import { createCertificateSigningRequest as l } from "./x509/csr.js";
5
+ import { buildCertificateExtensions as u, buildRequestedExtensions as d, buildSubjectKeyIdentifier as f, encodeAuthorityInfoAccess as p, encodeBasicConstraints as m, encodeCertificatePolicies as h, encodeCrlDistributionPoints as g, encodeExtendedKeyUsage as _, encodeExtension as v, encodeInhibitAnyPolicy as y, encodeKeyUsage as b, encodeNameConstraints as x, encodePolicyConstraints as S, encodePolicyMappings as C, encodeSubjectAltName as w, getAuthorityInfoAccessMethodOid as T, getExtendedKeyUsageOid as E, parseAuthorityInfoAccessMethodOid as D, parseExtendedKeyUsageOid as O } from "./x509/extensions.js";
6
+ import { certificateFingerprint as k, subjectPublicKeyInfoFingerprint as A } from "./x509/fingerprint.js";
7
+ import { encodeName as j, encodeRelativeDistinguishedName as M } from "./x509/name.js";
8
+ import { distinguishedNameToString as N, relativeDistinguishedNameToString as P, subjectAltNameLabel as F, subjectAltNameToString as I } from "./x509/name-text.js";
9
+ import { certificateMatchesPrivateKey as L, decodeExtension as R, decodeExtensionMap as z, decodeExtensions as B, defineExtensionDecoder as V, defineExtensionDecoderMap as H, findExtension as U, getSubjectPublicKey as W, getSubjectPublicKeyOrThrow as G, matchCertificatePrivateKey as K, parseAuthorityInfoAccess as q, parseAuthorityKeyIdentifier as J, parseBasicConstraints as Y, parseCertificateChainPem as X, parseCertificateChainPemOrThrow as Z, parseCertificateDer as Q, parseCertificateDerOrThrow as $, parseCertificateFromSource as ee, parseCertificatePem as te, parseCertificatePemOrThrow as ne, parseCertificatePolicies as re, parseCertificateSigningRequestDer as ie, parseCertificateSigningRequestDerOrThrow as ae, parseCertificateSigningRequestPem as oe, parseCertificateSigningRequestPemOrThrow as se, parseCertificatesFromSource as ce, parseCrlDistributionPoints as le, parseDistinguishedNameDer as ue, parseExtendedKeyUsage as de, parseInhibitAnyPolicy as fe, parseKeyUsage as pe, parseNameConstraints as me, parsePolicyConstraints as he, parsePolicyMappings as ge, parseSubjectAltNames as _e } from "./x509/parse.js";
10
+ export { e as allOnesMaskForIpAddress, u as buildCertificateExtensions, d as buildRequestedExtensions, i as canonicalDnKey, k as certificateFingerprint, L as certificateMatchesPrivateKey, a as compareDistinguishedNames, s as createCertificate, l as createCertificateSigningRequest, c as createSelfSignedCertificate, q as decodeAuthorityInfoAccess, J as decodeAuthorityKeyIdentifier, Y as decodeBasicConstraints, re as decodeCertificatePolicies, le as decodeCrlDistributionPoints, de as decodeExtendedKeyUsage, R as decodeExtension, z as decodeExtensionMap, B as decodeExtensions, fe as decodeInhibitAnyPolicy, t as decodeIpAddress, pe as decodeKeyUsage, me as decodeNameConstraints, he as decodePolicyConstraints, ge as decodePolicyMappings, _e as decodeSubjectAltNames, V as defineExtensionDecoder, H as defineExtensionDecoderMap, N as distinguishedNameToString, p as encodeAuthorityInfoAccess, m as encodeBasicConstraints, h as encodeCertificatePolicies, g as encodeCrlDistributionPoints, _ as encodeExtendedKeyUsage, v as encodeExtension, y as encodeInhibitAnyPolicy, b as encodeKeyUsage, j as encodeName, x as encodeNameConstraints, S as encodePolicyConstraints, C as encodePolicyMappings, M as encodeRelativeDistinguishedName, w as encodeSubjectAltName, U as findExtension, T as getAuthorityInfoAccessMethodOid, E as getExtendedKeyUsageOid, W as getSubjectPublicKey, G as getSubjectPublicKeyOrThrow, o as isWithinDirectoryNameSubtree, K as matchCertificatePrivateKey, n as normalizeIpAddress, D as parseAuthorityInfoAccessMethodOid, X as parseCertificateChainPem, Z as parseCertificateChainPemOrThrow, Q as parseCertificateDer, $ as parseCertificateDerOrThrow, ee as parseCertificateFromSource, te as parseCertificatePem, ne as parseCertificatePemOrThrow, ie as parseCertificateSigningRequestDer, ae as parseCertificateSigningRequestDerOrThrow, oe as parseCertificateSigningRequestPem, se as parseCertificateSigningRequestPemOrThrow, ce as parseCertificatesFromSource, ue as parseDistinguishedNameDer, O as parseExtendedKeyUsageOid, r as parseIpAddressToBytes, P as relativeDistinguishedNameToString, F as subjectAltNameLabel, I as subjectAltNameToString, f as subjectKeyIdentifier, A as subjectPublicKeyInfoFingerprint };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micro509",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "The zero-dependency TypeScript PKI toolkit for real certificate workflows.",
5
5
  "keywords": ["x509", "certificate", "csr", "pem", "der", "jwk", "importmapify"],
6
6
  "homepage": "https://micro509.kjanat.dev",
@@ -85,11 +85,12 @@
85
85
  "jsdelivr": "./dist/index.js",
86
86
  "types": "./dist/index.d.ts",
87
87
  "files": ["dist", "CHANGELOG.md"],
88
- "workspaces": ["packages/*", "site/.vitepress", "tsc/*"],
88
+ "workspaces": ["packages/*", "site/.vitepress"],
89
89
  "scripts": {
90
90
  "bd": "tsdown -F micro509",
91
+ "bench:argon2": "node bench/argon2/benchmark.ts",
91
92
  "build": "tsdown -F micro509",
92
- "build:tsc": "tsdown -F @kjanat/tsc-bridge -F @kjanat/tsc-compat -F @kjanat/tsc-protocol -F @kjanat/tsc-vue-mapper -F @kjanat/tsc-wasm",
93
+ "build:argon2": "run @micro509/tsdown-plugin-argon2:build",
93
94
  "build:watch": "tsdown --watch",
94
95
  "check": "run -pK check:biome check:deno typecheck",
95
96
  "check:biome": "biome check",
@@ -101,9 +102,9 @@
101
102
  "dev": "run -pK build:watch micro509-site:dev",
102
103
  "docs:build": "run -q deno:doc --html --output=.denodocs $(jq -r '.exports | .[]? // .' jsr.json) 2>/dev/null",
103
104
  "docs:lint": "run -q deno:doc --lint $(jq -r '.exports | .[]? // .' jsr.json)",
104
- "fmt": "dprint fmt",
105
- "fmt:autofix": "dprint fmt --allow-no-files --diff --excludes .github",
106
- "format": "run -q fmt",
105
+ "fmt": "kfmt",
106
+ "fmt:autofix": "kfmt --allow-no-files --diff --excludes .github",
107
+ "format": "kfmt",
107
108
  "itu": "bun scripts/fetch-spec.bun.ts itu",
108
109
  "lint": "run -qq lint:biome",
109
110
  "lint:biome": "biome lint",
@@ -111,10 +112,10 @@
111
112
  "lint:fix": "biome check --fix",
112
113
  "ms": "bun scripts/fetch-spec.bun.ts ms",
113
114
  "playwright:chromium": "npx playwright install --with-deps chromium",
114
- "prepare": "{ [ -z \"${WORKERS_CI:-}\" ] || ls -l node_modules/.bin/run; } && if [ -n \"${WORKERS_CI:-}\" ]; then run -s @kjanat/tsc-bridge:fetch && tsdown -F @kjanat/tsc-protocol -F @kjanat/tsc-bridge; else run -sq @kjanat/tsc-bridge:build @kjanat/tsc-wasm:build @kjanat/tsc-compat:build && run -s build:tsc; fi && run -s deno:importsmap deno:cache",
115
+ "prepare": "run -s deno:importsmap deno:cache",
115
116
  "prepublishOnly": "[ -n \"${GITHUB_ACTIONS:-}\" ] || { printf '%s\\n' 'manual npm publish blocked; use release workflow for provenance' >&2; exit 1; }",
116
117
  "publish:jsr": "[ -n \"${GITHUB_ACTIONS:-}\" ] || { printf '%s\\n' 'manual JSR publish blocked; use release workflow' >&2; exit 1; }; BIN=\"${BIN:-bun}\"; $BIN x jsr publish",
117
- "publish:pkgprnew": "BIN=\"${BIN:-bun}\"; $BIN x pkg-pr-new publish --packageManager=bun --bun --template './examples/vite' --template './examples/tsc-compat' . ./tsc/protocol ./tsc/bridge ./tsc/wasm ./tsc/compat ./tsc/vue-mapper",
118
+ "publish:pkgprnew": "BIN=\"${BIN:-bun}\"; $BIN x pkg-pr-new publish --packageManager=bun --bun --template './examples/vite' .",
118
119
  "rfc": "bun scripts/fetch-spec.bun.ts rfc",
119
120
  "site:build": "node scripts/site-build.mjs",
120
121
  "site:import-maps": "deno run --allow-read --allow-net --allow-write --allow-run scripts/site-import-maps.deno.ts",
@@ -128,8 +129,10 @@
128
129
  "spec": "bun scripts/spec/main.ts",
129
130
  "test": "BIN=\"${BIN:-bun}\"; AGENT=\"${AGENT:-1}\" $BIN test --concurrent",
130
131
  "test:35433": "PR=\"35433\"; (command -v \"bun-${PR}\" >/dev/null || bunx bun-pr \"${PR}\") && BIN=\"bun-${PR}\" bun --silent run test",
132
+ "test:argon2:oracle": "run -s build:argon2 && bun test test/argon2-oracle.test.ts && node --test test/native/argon2-module.test.mjs test/native/argon2-memory.node.mjs",
131
133
  "test:coverage": "run -q test --coverage",
132
- "test:coverage:native": "node --experimental-test-coverage --test-coverage-include=src/kdf/argon2.ts --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/native.lcov --test test/native/argon2.node.mjs",
134
+ "test:coverage:native": "mkdir -p coverage && node --experimental-test-coverage --test-coverage-include='src/kdf/*.ts' --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/native.lcov --test test/native/argon2.node.mjs",
135
+ "test:coverage:portable": "mkdir -p coverage && node --experimental-test-coverage --test-coverage-include='src/kdf/*.ts' --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/portable.lcov --test test/native/argon2-availability.node.mjs",
133
136
  "test:differential": "BIN=\"${BIN:-bun}\"; $BIN test test/differential.test.ts test/differential-fuzz.test.ts",
134
137
  "test:pkits": "BIN=\"${BIN:-bun}\"; $BIN test test/pkits.test.ts",
135
138
  "test:watch": "BIN=\"${BIN:-bun}\"; $BIN run test --watch",
@@ -148,10 +151,10 @@
148
151
  "@dprint/biome": "catalog:dprint",
149
152
  "@dprint/formatter": "catalog:dprint",
150
153
  "@dprint/json": "catalog:dprint",
151
- "@dprint/markdown": "catalog:dprint",
152
- "@dprint/typescript": "catalog:dprint",
153
154
  "@gorhill/ubo-core": "0.1.30",
154
- "@kjanat/tsc-bridge": "workspace:*",
155
+ "@kjanat/fmt": "catalog:",
156
+ "@kjanat/tsc-bridge": "catalog:typebridge",
157
+ "@kprint/kprint": "catalog:",
155
158
  "@micro509/doc-render": "workspace:*",
156
159
  "@tsconfig/node24": "catalog:ts",
157
160
  "@types/bun": "catalog:ts",
@@ -159,16 +162,12 @@
159
162
  "@types/node": "catalog:ts",
160
163
  "biome": "catalog:",
161
164
  "deno": "catalog:deno",
162
- "dprint": "catalog:",
163
- "dprint-plugin-malva": "catalog:dprint",
164
- "dprint-plugin-markup": "catalog:dprint",
165
- "dprint-plugin-yaml": "catalog:dprint",
166
165
  "dreamcli": "npm:@kjanat/dreamcli@^5.0.0",
167
166
  "importmapify": "catalog:deno",
168
167
  "jose": "^6.2.13",
168
+ "jose-v5": "npm:jose@5",
169
169
  "playwright": "^1.63.0",
170
170
  "publint": "catalog:build",
171
- "rolldown-plugin-wasm": "catalog:build",
172
171
  "runner-run": "catalog:",
173
172
  "tombi": "catalog:",
174
173
  "tsdown": "catalog:build",
@@ -206,13 +205,14 @@
206
205
  ]
207
206
  },
208
207
  "volta": {
209
- "node": "26.12.1",
210
- "npm": "12.2.1"
208
+ "node": "26.13.1",
209
+ "npm": "12.2.2"
211
210
  },
212
211
  "catalog": {
213
212
  "@kjanat/dreamcli": "npm:@kjanat/dreamcli@^5.0.0",
213
+ "@kjanat/fmt": "^0.62.0",
214
+ "@kprint/kprint": "^0.62.0",
214
215
  "biome": "npm:@biomejs/biome@^2.5.14",
215
- "dprint": "^0.64.0",
216
216
  "runner-run": "^0.28.0",
217
217
  "tombi": "^1.5.10",
218
218
  "vue": "^3.5.43"
@@ -222,7 +222,6 @@
222
222
  "@arethetypeswrong/core": "^0.18.4",
223
223
  "publint": "^0.3.24",
224
224
  "tsdown": "^0.23.0",
225
- "rolldown-plugin-wasm": "^0.3.2",
226
225
  "unplugin-unused": "^0.6.0"
227
226
  },
228
227
  "cloudflare": {
@@ -238,12 +237,7 @@
238
237
  "dprint": {
239
238
  "@dprint/biome": "^0.15.0",
240
239
  "@dprint/formatter": "^0.6.0",
241
- "@dprint/json": "^0.25.0",
242
- "@dprint/markdown": "^0.28.0",
243
- "@dprint/typescript": "^0.96.1",
244
- "dprint-plugin-malva": "^0.16.0",
245
- "dprint-plugin-markup": "^0.27.5",
246
- "dprint-plugin-yaml": "^0.6.0"
240
+ "@dprint/json": "^0.26.0"
247
241
  },
248
242
  "site": {
249
243
  "markdown-it-task-lists": "^2.1.1",
@@ -258,16 +252,15 @@
258
252
  "@types/bun": "^1.4.2",
259
253
  "@types/deno": "^2.7.0",
260
254
  "@types/node": "^26.6.3",
261
- "@volar/typescript": "2.4.30",
262
- "@vue/language-core": "^3.3.11",
263
- "@vue/tsconfig": "^0.9.1",
264
- "typescript": "npm:typescript@>=6,<7",
265
- "typescript-6": "npm:@typescript/typescript6@^6",
266
- "typescript-7": "npm:typescript@>=7"
255
+ "@vue/tsconfig": "^0.9.1"
267
256
  },
268
257
  "ts7": {
269
258
  "typescript": "npm:typescript@7.1.0-dev.20261024.1"
259
+ },
260
+ "typebridge": {
261
+ "@kjanat/tsc-bridge": "^0.0.0",
262
+ "@kjanat/tsc-vue-mapper": "^0.0.0"
270
263
  }
271
264
  },
272
- "trustedDependencies": ["deno", "dprint", "esbuild", "sharp", "workerd"]
265
+ "trustedDependencies": ["deno", "@kprint/kprint", "@kjanat/fmt", "esbuild", "sharp", "workerd"]
273
266
  }
@@ -1,75 +0,0 @@
1
- import e from "./oids.js";
2
- // src/internal/asn1/oids.ts
3
- /**
4
- * Centralized ASN.1 object identifier registry referenced by create, parse,
5
- * verify, and container modules.
6
- *
7
- * All OIDs are dotted-decimal string constants keyed by their common short name.
8
- *
9
- * @module
10
- */
11
- function joinOidPrefix(e, t) {
12
- return e === "" ? t : `${e}.${t}`;
13
- }
14
- function isOidNode(e) {
15
- return typeof e == "object" && !!e && "arc" in e;
16
- }
17
- function hasOidName(e, t) {
18
- return Object.hasOwn(e, t);
19
- }
20
- function addOidNode(e, t, n) {
21
- let r = joinOidPrefix(n, t.arc);
22
- if (t.oids !== void 0) for (let [n, i] of Object.entries(t.oids)) {
23
- let t = joinOidPrefix(r, i);
24
- if (hasOidName(e, n)) {
25
- let r = e[n];
26
- throw TypeError(`Duplicate OID name "${n}" at ${t}; already assigned to ${r}`);
27
- }
28
- e[n] = t;
29
- }
30
- t.children !== void 0 && addOidTree(e, t.children, r);
31
- }
32
- function addOidTree(e, t, n) {
33
- for (let r of Object.values(t)) addOidNode(e, r, n);
34
- }
35
- function addOidDocument(e, t) {
36
- for (let n of Object.values(t)) isOidNode(n) && addOidNode(e, n, "");
37
- }
38
- function collectOidNamesFromNode(e, t) {
39
- if (t.oids !== void 0) for (let n of Object.keys(t.oids)) e.add(n);
40
- if (t.children !== void 0) for (let n of Object.values(t.children)) collectOidNamesFromNode(e, n);
41
- }
42
- function collectOidNamesFromDocument(e) {
43
- let t = /* @__PURE__ */ new Set();
44
- for (let n of Object.values(e)) isOidNode(n) && collectOidNamesFromNode(t, n);
45
- return [...t];
46
- }
47
- function isOidRegistry(e, t) {
48
- for (let n of t) if (!hasOidName(e, n)) return !1;
49
- return !0;
50
- }
51
- function flattenOidTree(e) {
52
- let t = Object.create(null);
53
- addOidDocument(t, e);
54
- let n = collectOidNamesFromDocument(e);
55
- if (!isOidRegistry(t, n)) {
56
- let e = n.filter((e) => !hasOidName(t, e));
57
- throw TypeError(`Incomplete OID registry; missing ${e.join(", ")}`);
58
- }
59
- return t;
60
- }
61
- /**
62
- * Dotted-decimal OID constants.
63
- *
64
- * Includes:
65
- * - EKU purposes,
66
- * - PKCS algorithms,
67
- * - PKIX access methods,
68
- * - X.500 attributes,
69
- * - X.509v3 extensions, and
70
- * - hash algorithms.
71
- */
72
- const t = flattenOidTree(e);
73
- export { t as OIDS, e as OID_GROUP_SPECS };
74
-
75
- //# sourceMappingURL=oids2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oids2.js","names":["OID_GROUP_SPECS","oids_default","basePrefix","arc","value","oids","name","prefix","node","path","existingPath","tree","document","child","names","missingNames","OIDS"],"sources":["../../../src/internal/asn1/oids.ts"],"sourcesContent":["/**\n * Centralized ASN.1 object identifier registry referenced by create, parse,\n * verify, and container modules.\n *\n * All OIDs are dotted-decimal string constants keyed by their common short name.\n *\n * @module\n */\n\nimport OID_GROUP_SPECS from './oids.json' with { type: 'json' };\n\ntype OidLeaves = { readonly [name: string]: string };\ntype OidNode = {\n\treadonly arc: string;\n\treadonly oids?: OidLeaves;\n\treadonly children?: OidTree;\n};\ntype OidTree = { readonly [name: string]: OidNode };\ntype OidMap = { readonly [name: string]: string };\ntype MutableOidMap = { [name: string]: string };\ndeclare const oidNameBrand: unique symbol;\ntype OidValue<Name extends string, Value extends string> = Value & {\n\treadonly [oidNameBrand]?: Name;\n};\ntype JoinOidPrefix<Base extends string, Arc extends string> = Base extends ''\n\t? Arc\n\t: `${Base}.${Arc}`;\ntype OidsFromLeaves<Prefix extends string, Leaves extends OidLeaves> = {\n\treadonly [Name in keyof Leaves]: OidValue<Name & string, `${Prefix}.${Leaves[Name]}`>;\n};\ntype UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (\n\tvalue: infer Intersection,\n) => void\n\t? Intersection\n\t: never;\ntype OidsFromNode<Node extends OidNode, Base extends string = ''> = Node extends {\n\treadonly arc: infer Arc extends string;\n}\n\t? (Node extends { readonly oids: infer Leaves extends OidLeaves }\n\t\t\t? OidsFromLeaves<JoinOidPrefix<Base, Arc>, Leaves>\n\t\t\t: unknown) &\n\t\t\t(Node extends { readonly children: infer Children extends OidTree }\n\t\t\t\t? OidsFromTree<Children, JoinOidPrefix<Base, Arc>>\n\t\t\t\t: unknown)\n\t: never;\ntype OidsFromTree<Tree extends OidTree, Base extends string = ''> = UnionToIntersection<\n\tOidsFromNode<Tree[keyof Tree], Base>\n>;\ntype OidDocumentRoots<Document> = Omit<Document, '$schema'>;\ntype OidRegistry = OidsFromTree<OidDocumentRoots<typeof OID_GROUP_SPECS>>;\n\nfunction joinOidPrefix(basePrefix: string, arc: string): string {\n\tif (basePrefix === '') {\n\t\treturn arc;\n\t}\n\n\treturn `${basePrefix}.${arc}`;\n}\n\nfunction isOidNode(value: unknown): value is OidNode {\n\treturn typeof value === 'object' && value !== null && 'arc' in value;\n}\n\nfunction hasOidName(oids: OidMap, name: string): boolean {\n\treturn Object.hasOwn(oids, name);\n}\n\nfunction addOidNode(oids: MutableOidMap, node: OidNode, basePrefix: string): void {\n\tconst prefix = joinOidPrefix(basePrefix, node.arc);\n\n\tif (node.oids !== undefined) {\n\t\tfor (const [name, arc] of Object.entries(node.oids)) {\n\t\t\tconst path = joinOidPrefix(prefix, arc);\n\t\t\tif (hasOidName(oids, name)) {\n\t\t\t\tconst existingPath = oids[name];\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`Duplicate OID name \"${name}\" at ${path}; already assigned to ${existingPath}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\toids[name] = path;\n\t\t}\n\t}\n\n\tif (node.children !== undefined) {\n\t\taddOidTree(oids, node.children, prefix);\n\t}\n}\n\nfunction addOidTree(oids: MutableOidMap, tree: OidTree, basePrefix: string): void {\n\tfor (const node of Object.values(tree)) {\n\t\taddOidNode(oids, node, basePrefix);\n\t}\n}\n\nfunction addOidDocument(oids: MutableOidMap, document: typeof OID_GROUP_SPECS): void {\n\tfor (const value of Object.values(document)) {\n\t\tif (isOidNode(value)) {\n\t\t\taddOidNode(oids, value, '');\n\t\t}\n\t}\n}\n\nfunction collectOidNamesFromNode(names: Set<string>, node: OidNode): void {\n\tif (node.oids !== undefined) {\n\t\tfor (const name of Object.keys(node.oids)) {\n\t\t\tnames.add(name);\n\t\t}\n\t}\n\n\tif (node.children !== undefined) {\n\t\tfor (const child of Object.values(node.children)) {\n\t\t\tcollectOidNamesFromNode(names, child);\n\t\t}\n\t}\n}\n\nfunction collectOidNamesFromDocument(document: typeof OID_GROUP_SPECS): readonly string[] {\n\tconst names = new Set<string>();\n\tfor (const value of Object.values(document)) {\n\t\tif (isOidNode(value)) {\n\t\t\tcollectOidNamesFromNode(names, value);\n\t\t}\n\t}\n\treturn [...names];\n}\n\nfunction isOidRegistry(oids: OidMap, names: readonly string[]): oids is OidRegistry {\n\tfor (const name of names) {\n\t\tif (!hasOidName(oids, name)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction flattenOidTree(tree: typeof OID_GROUP_SPECS): OidRegistry {\n\tconst oids: MutableOidMap = Object.create(null);\n\taddOidDocument(oids, tree);\n\tconst names = collectOidNamesFromDocument(tree);\n\tif (!isOidRegistry(oids, names)) {\n\t\tconst missingNames = names.filter((name) => !hasOidName(oids, name));\n\t\tthrow new TypeError(`Incomplete OID registry; missing ${missingNames.join(', ')}`);\n\t}\n\treturn oids;\n}\n\n/**\n * Dotted-decimal OID constants.\n *\n * Includes:\n * - EKU purposes,\n * - PKCS algorithms,\n * - PKIX access methods,\n * - X.500 attributes,\n * - X.509v3 extensions, and\n * - hash algorithms.\n */\nconst OIDS: OidRegistry = flattenOidTree(OID_GROUP_SPECS);\n\nexport { OID_GROUP_SPECS, OIDS };\n"],"mappings":";;;;;;;;;;AAmDA,SAAS,cAAc,GAAoB,GAAqB;CAK/D,OAJIE,MAAe,KACXC,IAGD,GAAGD,EAAW,GAAGC;AACzB;AAEA,SAAS,UAAU,GAAkC;CACpD,OAAO,OAAOC,KAAU,cAAYA,KAAkB,SAASA;AAChE;AAEA,SAAS,WAAW,GAAc,GAAuB;CACxD,OAAO,OAAO,OAAOC,GAAMC,CAAI;AAChC;AAEA,SAAS,WAAW,GAAqB,GAAe,GAA0B;CACjF,IAAMC,IAAS,cAAcL,GAAYM,EAAK,GAAG;CAEjD,IAAIA,EAAK,SAAS,KAAA,GACjB,KAAK,IAAM,CAACF,GAAMH,MAAQ,OAAO,QAAQK,EAAK,IAAI,GAAG;EACpD,IAAMC,IAAO,cAAcF,GAAQJ,CAAG;EACtC,IAAI,WAAWE,GAAMC,CAAI,GAAG;GAC3B,IAAMI,IAAeL,EAAKC;GAC1B,MAAU,UACT,uBAAuBA,EAAK,OAAOG,EAAK,wBAAwBC,GACjE;EACD;EACA,EAAKJ,KAAQG;CACd;CAGD,AAAID,EAAK,aAAa,KAAA,KACrB,WAAWH,GAAMG,EAAK,UAAUD,CAAM;AAExC;AAEA,SAAS,WAAW,GAAqB,GAAe,GAA0B;CACjF,KAAK,IAAMC,KAAQ,OAAO,OAAOG,CAAI,GACpC,WAAWN,GAAMG,GAAMN,CAAU;AAEnC;AAEA,SAAS,eAAe,GAAqB,GAAwC;CACpF,KAAK,IAAME,KAAS,OAAO,OAAOQ,CAAQ,GACzC,AAAI,UAAUR,CAAK,KAClB,WAAWC,GAAMD,GAAO,EAAE;AAG7B;AAEA,SAAS,wBAAwB,GAAoB,GAAqB;CACzE,IAAII,EAAK,SAAS,KAAA,GACjB,KAAK,IAAMF,KAAQ,OAAO,KAAKE,EAAK,IAAI,GACvC,EAAM,IAAIF,CAAI;CAIhB,IAAIE,EAAK,aAAa,KAAA,GACrB,KAAK,IAAMK,KAAS,OAAO,OAAOL,EAAK,QAAQ,GAC9C,wBAAwBM,GAAOD,CAAK;AAGvC;AAEA,SAAS,4BAA4B,GAAqD;CACzF,IAAMC,oBAAQ,IAAI,IAAY;CAC9B,KAAK,IAAMV,KAAS,OAAO,OAAOQ,CAAQ,GACzC,AAAI,UAAUR,CAAK,KAClB,wBAAwBU,GAAOV,CAAK;CAGtC,OAAO,CAAC,GAAGU,CAAK;AACjB;AAEA,SAAS,cAAc,GAAc,GAA+C;CACnF,KAAK,IAAMR,KAAQQ,GAClB,IAAI,CAAC,WAAWT,GAAMC,CAAI,GACzB,OAAO;CAGT,OAAO;AACR;AAEA,SAAS,eAAe,GAA2C;CAClE,IAAMD,IAAsB,OAAO,OAAO,IAAI;CAC9C,eAAeA,GAAMM,CAAI;CACzB,IAAMG,IAAQ,4BAA4BH,CAAI;CAC9C,IAAI,CAAC,cAAcN,GAAMS,CAAK,GAAG;EAChC,IAAMC,IAAeD,EAAM,QAAQ,MAAS,CAAC,WAAWT,GAAMC,CAAI,CAAC;EACnE,MAAU,UAAU,oCAAoCS,EAAa,KAAK,IAAI,GAAG;CAClF;CACA,OAAOV;AACR;;;;;;;;;;;;AAaA,MAAMW,IAAoB,eAAehB,CAAe"}