Constants
Version-stable constant namespace for the toolkit. Scale values are FUNCTIONS, not pre-baked discrete numbers:
C.TIME.days(30) reads at the call site and computes at boot, so a caller never hand-writes 30 * 24 * 60 * 60 * 1000 (a raw-literal the codebase gate refuses) and a reviewer never has to decode it.
Every scale helper is config-time / entry-point validation: it THROWS ConstantsError on a non-finite or negative argument, so an operator catches the typo at boot rather than shipping a silently-wrong window.
pki.C.TIME
since 0.1.0 stable
C.TIME.days(n) -> milliseconds
Duration helpers. Each returns an integer count of milliseconds so the value drops straight into setTimeout, a validity window, or an OCSP nextUpdate computation. Composing reads naturally: C.TIME.days(365) for a one-year certificate lifetime.
Example
var oneYear = pki.C.TIME.days(365);
// -> 31536000000
References
- spec
internal (design: functional time-scale helpers)
pki.C.BYTES
since 0.1.0 stable
C.BYTES.mib(n) -> bytes
Binary-magnitude size helpers. Each returns an integer byte count for codec limits (max DER input, max PEM block) so a size bound reads as C.BYTES.mib(16) instead of 16 * 1024 * 1024.
Example
var cap = pki.C.BYTES.mib(16);
// -> 16777216
References
- spec
IEC 80000-13