node - update tls getPeerCertificate return value definition

This commit is contained in:
Christian Tellnes
2017-05-12 19:49:42 +02:00
parent 273e397d83
commit dad073b3fd

39
types/node/index.d.ts vendored
View File

@@ -1,6 +1,9 @@
// Type definitions for Node.js v7.x
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>, Parambir Singh <https://github.com/parambirs>
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
// Parambir Singh <https://github.com/parambirs>
// Christian Vaagland Tellnes <https://github.com/tellnes>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -3004,6 +3007,25 @@ declare module "tls" {
CN: string;
}
export interface PeerCertificate {
subject: Certificate;
issuer: Certificate;
subjectaltname: string;
infoAccess: { [index: string]: string[] };
modulus: string;
exponent: string;
valid_from: string;
valid_to: string;
fingerprint: string;
ext_key_usage: string[];
serialNumber: string;
raw: Buffer;
}
export interface DetailedPeerCertificate extends PeerCertificate {
issuerCertificate: DetailedPeerCertificate;
}
export interface CipherNameAndProtocol {
/**
* The cipher name.
@@ -3112,18 +3134,11 @@ declare module "tls" {
* if false only the top certificate without issuer property.
* If the peer does not provide a certificate, it returns null or an empty object.
* @param {boolean} detailed - If true; the full chain with issuer property will be returned.
* @returns {any} - An object representing the peer's certificate.
* @returns {PeerCertificate | DetailedPeerCertificate} - An object representing the peer's certificate.
*/
getPeerCertificate(detailed?: boolean): {
subject: Certificate;
issuerInfo: Certificate;
issuer: Certificate;
raw: any;
valid_from: string;
valid_to: string;
fingerprint: string;
serialNumber: string;
};
getPeerCertificate(detailed: true): DetailedPeerCertificate;
getPeerCertificate(detailed?: false): PeerCertificate;
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate;
/**
* Could be used to speed up handshake establishment when reconnecting to the server.
* @returns {any} - ASN.1 encoded TLS session or undefined if none was negotiated.