UNPKG

@reclaimprotocol/tls

Version:

TLS 1.2/1.3 for any JavaScript Environment

33 lines (32 loc) 1.03 kB
export type PrivateKey = string; export type CertificatePublicKey = { /** * public key in DER format * DER => Uint8Array */ buffer: Uint8Array; algorithm: string; }; export type X509Certificate<T = any> = { internal: T; /** * Checks new Date() is in the validity period * of the certificate, basically outside notBefore and notAfter */ isWithinValidity(): boolean; getSubjectField(key: string): string[]; getAlternativeDNSNames(): string[]; isIssuer(ofCert: X509Certificate<T>): boolean; getPublicKey(): CertificatePublicKey; /** * Get the Authority Information Access extension value, * tells us where to get issuer certificate from */ getAIAExtension(): string | undefined; /** * verify this certificate issued the certificate passed * @param otherCert the supposedly issued certificate to verify * */ verifyIssued(otherCert: X509Certificate<T>): boolean | Promise<boolean>; serialiseToPem(): string; };