This repository has been archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtls.js
129 lines (110 loc) · 3.41 KB
/
tls.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Copyright 2012 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Definitions for node's tls module. Depends on the stream module.
* @see http://nodejs.org/api/tls.html
* @see https://github.com/joyent/node/blob/master/lib/tls.js
* @externs
* @author Daniel Wirtz <[email protected]>
*/
/**
BEGIN_NODE_INCLUDE
var tls = require('tls');
END_NODE_INCLUDE
*/
/**
* @type {Object.<string,*>}
*/
var tls = {};
/**
* @typedef {{pfx: (string|buffer.Buffer), key: (string|buffer.Buffer), passphrase: string, cert: (string|buffer.Buffer), ca: Array.<string|buffer.Buffer>, crl: (string|Array.<string>), ciphers: string, honorCipherOrder: boolean, requestCert: boolean, rejectUnauthorized: boolean, NPNProtocols: (Array|buffer.Buffer), SNICallback: function(string), sessionIdContext: string}}
*/
tls.CreateOptions;
/**
*
* @param {tls.CreateOptions} options
* @param {function(...)=} secureConnectionListener
* @return {tls.Server}
*/
tls.createServer = function(options, secureConnectionListener) {};
/**
* @typedef {{host: string, port: number, socket: *, pfx: (string|buffer.Buffer), key: (string|buffer.Buffer), passphrase: string, cert: (string|buffer.Buffer), ca: Array.<string>, rejectUnauthorized: boolean, NPNProtocols: Array.<string|buffer.Buffer>, servername: string}}
*/
tls.ConnectOptions;
/**
*
* @param {number|tls.ConnectOptions} port
* @param {(string|tls.ConnectOptions|function(...))=} host
* @param {(tls.ConnectOptions|function(...))=} options
* @param {function(...)=} callback
*/
tls.connect = function(port, host, options, callback) {};
/**
* @param {crypto.Credentials=} credentials
* @param {boolean=} isServer
* @param {boolean=} requestCert
* @param {boolean=} rejectUnauthorized
* @return {tls.SecurePair}
*/
tls.createSecurePair = function(credentials, isServer, requestCert, rejectUnauthorized) {};
/**
* @constructor
* @extends events.EventEmitter
*/
tls.SecurePair = function() {};
/**
* @constructor
* @extends net.Server
*/
tls.Server = function() {};
/**
* @param {string} hostname
* @param {string|buffer.Buffer} credentials
*/
tls.Server.prototype.addContext = function(hostname, credentials) {};
/**
* @constructor
* @extends stream.Duplex
*/
tls.CleartextStream = function() {};
/**
* @type {boolean}
*/
tls.CleartextStream.prototype.authorized;
/**
* @type {?string}
*/
tls.CleartextStream.prototype.authorizationError;
/**
* @return {Object.<string,(string|Object.<string,string>)>}
*/
tls.CleartextStream.prototype.getPeerCertificate = function() {};
/**
* @return {{name: string, version: string}}
*/
tls.CleartextStream.prototype.getCipher = function() {};
/**
* @return {{port: number, family: string, address: string}}
*/
tls.CleartextStream.prototype.address = function() {};
/**
* @type {string}
*/
tls.CleartextStream.prototype.remoteAddress;
/**
* @type {number}
*/
tls.CleartextStream.prototype.remotePort;