cloudservices/types/x509.d.ts

51 lines
1.4 KiB
TypeScript
Raw Normal View History

declare module '@ghaiklor/x509' {
namespace Certificate {
interface Issuer {
countryName: string,
stateOrProvinceName: string,
localityName: string,
organizationName: string,
commonName: string
}
interface Subject {
countryName: string,
postalCode: string,
stateOrProvinceName: string,
localityName: string,
streetAddress: string,
organizationName: string,
organizationalUnitName: string,
commonName: string
}
interface Extensions {
keyUsage: string,
authorityInformationAccess: string,
certificatePolicies: string,
basicConstraints: string,
cRLDistributionPoints: string,
subjectAlternativeName: string,
extendedKeyUsage: string,
authorityKeyIdentifier: string,
subjectKeyIdentifier: string,
cTPrecertificateSCTs: string
}
}
interface FullCertificate {
version: number,
subject: Certificate.Subject,
issuer: Certificate.Issuer,
serial: number,
notBefore: Date,
notAfter: Date,
subjectHash: string,
signatureAlgorithm: string,
publicKey: { algorithm: string };
altNames: string[]
extensions: Certificate.Extensions
}
function getAltNames(cert: string): string[];
function getIssuer(cert: string): Certificate.Issuer;
function getSubject(cert: string): Certificate.Subject;
function parseCert(cert: string): FullCertificate
}