What does this certificate-name check print?

from TLS connections
Node 24 intermediate 4 min

What does this certificate-name check print?

JavaScript
import { checkServerIdentity } from "node:tls";

const cert = {
  subjectaltname: "DNS:api.internal, DNS:*.svc.internal",
};

for (const host of ["api.internal", "orders.svc.internal", "bad.internal"]) {
  const error = checkServerIdentity(host, cert);
  console.log(`${host}: ${error?.code ?? "ok"}`);
}
Open in playground
Report an error