From 82d830edf259324033553d897564000ae82a6354 Mon Sep 17 00:00:00 2001 From: RulerOfCakes Date: Thu, 1 Aug 2024 11:46:12 +0000 Subject: [PATCH] crypto: add isValid field to the X509Certificate API Added the `isValid` field, which checks the certificate's validity based on the current time. --- doc/api/crypto.md | 6 ++++++ lib/internal/crypto/x509.js | 10 ++++++++++ src/crypto/crypto_common.cc | 12 ++++++++++++ src/crypto/crypto_common.h | 5 +++++ src/crypto/crypto_x509.cc | 5 +++++ src/crypto/crypto_x509.h | 1 + test/parallel/test-crypto-x509.js | 1 + 7 files changed, 40 insertions(+) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 435d5d495609b3..d5cdb1e773a258 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2855,6 +2855,12 @@ added: v15.6.0 Returns the PEM-encoded certificate. +### `x509.isValid` + +* Type: {boolean} + +Returns `true` if the certificate is valid based on the current time. + ### `x509.validFrom`