diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index d8ffa046e9..723a88bdf8 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -326,6 +326,26 @@ declare module "mongoose" { /** How long driver keeps waiting for servers to come back up (default: Number.MAX_VALUE) */ bufferMaxEntries?: number; + /** additional SSL configuration options */ + /** Array of valid certificates either as Buffers or Strings */ + sslCA?: ReadonlyArray; + /** Array of revocation certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) */ + sslCRL?: ReadonlyArray; + /** SSL certificate */ + sslCert?: Buffer | string; + /** SSL private key */ + sslKey?: Buffer | string; + /** SSL Certificate pass phrase */ + sslPass?: Buffer | string; + /** Default: true; Server identity checking during SSL */ + checkServerIdentity?: boolean | Function; + /** String containing the server name requested via TLS SNI. */ + servername?: string; + + /** Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info. */ + ciphers?: string; + ecdhCurve?: string; + // TODO safe?: any; fsync?: any; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 244658ac9b..d6fbe3cd82 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -65,6 +65,25 @@ mongoose.Types.ObjectId; mongoose.Types.Decimal128; mongoose.version.toLowerCase(); +const sslConnections: {[key: string]: mongoose.Connection} = { + basic: mongoose.createConnection(connectUri, {ssl: true}), + customCA: mongoose.createConnection( + connectUri, + { + ssl: true, + sslCA: [new Buffer('ca string')], + sslCRL: [new Buffer('crl buffer')], + sslCert: 'ssl cert', + sslKey: new Buffer('ssl private key'), + sslPass: 'ssl password', + servername: 'localhost', + checkServerIdentity: true, + ciphers: 'ciphers', + ecdhCurve: 'ecdhCurve', + } + ), +}; + /* * section collection.js * http://mongoosejs.com/docs/api.html#collection-js