| 21 | private agent: https.Agent; |
| 22 | |
| 23 | constructor(key: string | Buffer, cert: string | Buffer, ca?: Buffer | string | any[] | any, defaults?: any) { |
| 24 | if (key) { |
| 25 | if (Buffer.isBuffer(key)) { |
| 26 | this.key = key; |
| 27 | } else if (typeof key === 'string') { |
| 28 | this.key = fs.readFileSync(key); |
| 29 | } else { |
| 30 | throw new Error('key should be a buffer or a string!'); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | if (cert) { |
| 35 | if (Buffer.isBuffer(cert)) { |
| 36 | this.cert = cert; |
| 37 | } else if (typeof cert === 'string') { |
| 38 | this.cert = fs.readFileSync(cert); |
| 39 | } else { |
| 40 | throw new Error('cert should be a buffer or a string!'); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | if (ca) { |
| 45 | if (Buffer.isBuffer(ca) || Array.isArray(ca)) { |
| 46 | this.ca = ca; |
| 47 | } else if (typeof ca === 'string') { |
| 48 | this.ca = fs.readFileSync(ca); |
| 49 | } else { |
| 50 | defaults = ca; |
| 51 | this.ca = null; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | this.defaults = {}; |
| 56 | merge(this.defaults, defaults); |
| 57 | |
| 58 | this.agent = null; |
| 59 | } |
| 60 | |
| 61 | public toXML(): string { |
| 62 | return ''; |