88 ListDatabaseInfo ,
99} from "./types.ts" ;
1010import { parse } from "./utils/uri.ts" ;
11- import { AuthContext , ScramAuthPlugin } from "./auth/mod.ts" ;
11+ import { AuthContext , ScramAuthPlugin , X509AuthPlugin } from "./auth/mod.ts" ;
1212import { MongoError } from "./error.ts" ;
1313
1414const DENO_DRIVER_VERSION = "0.0.1" ;
@@ -36,6 +36,16 @@ export class MongoClient {
3636 if ( options . certFile ) {
3737 denoConnectOps . certFile = options . certFile ;
3838 }
39+ if ( options . keyFile ) {
40+ if ( options . keyFilePassword ) {
41+ throw new MongoError (
42+ `Tls keyFilePassword not implemented in Deno driver` ,
43+ ) ;
44+ //TODO, need something like const key = decrypt(options.keyFile) ...
45+ }
46+ throw new MongoError ( `Tls keyFile not implemented in Deno driver` ) ;
47+ //TODO, need Deno.connectTls with something like key or keyFile option.
48+ }
3949 conn = await Deno . connectTls ( denoConnectOps ) ;
4050 } else {
4151 conn = await Deno . connect ( denoConnectOps ) ;
@@ -56,8 +66,12 @@ export class MongoClient {
5666 authPlugin = new ScramAuthPlugin ( "sha256" ) ; //TODO AJUST sha256
5767 } else if ( mechanism === "SCRAM-SHA-1" ) {
5868 authPlugin = new ScramAuthPlugin ( "sha1" ) ;
69+ } else if ( mechanism === "MONGODB-X509" ) {
70+ authPlugin = new X509AuthPlugin ( ) ;
5971 } else {
60- throw new MongoError ( `Auth mechanism not implemented: ${ mechanism } ` ) ;
72+ throw new MongoError (
73+ `Auth mechanism not implemented in Deno driver: ${ mechanism } ` ,
74+ ) ;
6175 }
6276 const request = authPlugin . prepare ( authContext ) ;
6377 authContext . response = await this . #protocol. commandSingle (
0 commit comments