Readme

What is this for?

To get a list of all the SSL certificates that have been issued for a particular domain.

Usage

import { getCertificates } from "https://esm.town/v/agmm/sslCertificates"; const results = await getCertificates("agmm.xyz"); console.log(results)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export type Certificate = {
issuer_ca_id: number;
issuer_name: string;
common_name: string;
name_value: string;
id: number;
entry_timestamp: string;
not_before: string;
not_after: string;
serial_number: string;
result_count: number;
};
export async function getCertificates(domain: string) {
const url = `https://crt.sh/json?q=${domain}`;
const response = await fetch(url);
const certificates: Certificate[] = await response.json();
const domains = [...new Set(certificates.map(el => el.common_name))];
return { domains, certificates };
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 28, 2024