Skip to main content
X509Certificate.prototype.checkEmail - crypto - Node documentation
method X509Certificate.prototype.checkEmail

Usage in Deno

import { X509Certificate } from "node:crypto";
X509Certificate.prototype.checkEmail(
email: string,
options?: Pick<X509CheckOptions, "subject">,
): string | undefined

Checks whether the certificate matches the given email address.

If the 'subject' option is undefined or set to 'default', the certificate subject is only considered if the subject alternative name extension either does not exist or does not contain any email addresses.

If the 'subject' option is set to 'always' and if the subject alternative name extension either does not exist or does not contain a matching email address, the certificate subject is considered.

If the 'subject' option is set to 'never', the certificate subject is never considered, even if the certificate contains no subject alternative names.

Parameters

email: string
optional
options: Pick<X509CheckOptions, "subject">

Return Type

string | undefined

Returns email if the certificate matches, undefined if it does not.