@@ -17,7 +17,7 @@ const SUPPORTED_TLS = (() => {
1717 return [ ] ;
1818} ) ( ) ;
1919
20- export function NewDriver ( context , data , { writeResponse } ) {
20+ export function NewDriver ( context , data , wire ) {
2121 const {
2222 uri,
2323 authorizationToken : { data : authToken } ,
@@ -51,17 +51,39 @@ export function NewDriver (context, data, { writeResponse }) {
5151 ? address =>
5252 new Promise ( ( resolve , reject ) => {
5353 const id = context . addResolverRequest ( resolve , reject )
54- writeResponse ( 'ResolverResolutionRequired' , { id, address } )
54+ wire . writeResponse ( 'ResolverResolutionRequired' , { id, address } )
5555 } )
5656 : undefined
57- const driver = neo4j . driver ( uri , parsedAuthToken , {
57+ const config = {
5858 userAgent,
5959 resolver,
6060 useBigInt : true ,
6161 logging : neo4j . logging . console ( process . env . LOG_LEVEL )
62- } )
62+ }
63+ if ( 'encrypted' in data ) {
64+ config . encrypted = data . encrypted ? 'ENCRYPTION_ON' : 'ENCRYPTION_OFF'
65+ }
66+ if ( 'trustedCertificates' in data ) {
67+ if ( data . trustedCertificates === null ) {
68+ config . trust = 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'
69+ } else if ( data . trustedCertificates . length === 0 ) {
70+ config . trust = 'TRUST_ALL_CERTIFICATES'
71+ } else {
72+ config . trust = 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'
73+ config . trustedCertificates = data . trustedCertificates . map (
74+ e => '/usr/local/share/custom-ca-certificates/' + e
75+ )
76+ }
77+ }
78+ let driver
79+ try {
80+ driver = neo4j . driver ( uri , parsedAuthToken , config )
81+ } catch ( err ) {
82+ wire . writeError ( err )
83+ return
84+ }
6385 const id = context . addDriver ( driver )
64- writeResponse ( 'Driver' , { id } )
86+ wire . writeResponse ( 'Driver' , { id } )
6587}
6688
6789export function DriverClose ( context , data , wire ) {
@@ -293,6 +315,8 @@ export function GetFeatures (_context, _params, wire) {
293315 'Feature:Auth:Custom' ,
294316 'Feature:Auth:Kerberos' ,
295317 'Feature:Auth:Bearer' ,
318+ 'Feature:API:SSLConfig' ,
319+ 'Feature:API:SSLSchemes' ,
296320 'AuthorizationExpiredTreatment' ,
297321 'ConfHint:connection.recv_timeout_seconds' ,
298322 'Feature:Impersonation' ,
0 commit comments