@@ -14,7 +14,7 @@ const SUPPORTED_TLS = (() => {
14
14
return result ;
15
15
} ) ( ) ;
16
16
17
- export function NewDriver ( context , data , { writeResponse } ) {
17
+ export function NewDriver ( context , data , wire ) {
18
18
const {
19
19
uri,
20
20
authorizationToken : { data : authToken } ,
@@ -48,17 +48,39 @@ export function NewDriver (context, data, { writeResponse }) {
48
48
? address =>
49
49
new Promise ( ( resolve , reject ) => {
50
50
const id = context . addResolverRequest ( resolve , reject )
51
- writeResponse ( 'ResolverResolutionRequired' , { id, address } )
51
+ wire . writeResponse ( 'ResolverResolutionRequired' , { id, address } )
52
52
} )
53
53
: undefined
54
- const driver = neo4j . driver ( uri , parsedAuthToken , {
54
+ const config = {
55
55
userAgent,
56
56
resolver,
57
57
useBigInt : true ,
58
58
logging : neo4j . logging . console ( process . env . LOG_LEVEL )
59
- } )
59
+ }
60
+ if ( 'encrypted' in data ) {
61
+ config . encrypted = data . encrypted ? 'ENCRYPTION_ON' : 'ENCRYPTION_OFF'
62
+ }
63
+ if ( 'trustedCertificates' in data ) {
64
+ if ( data . trustedCertificates === null ) {
65
+ config . trust = 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'
66
+ } else if ( data . trustedCertificates . length === 0 ) {
67
+ config . trust = 'TRUST_ALL_CERTIFICATES'
68
+ } else {
69
+ config . trust = 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'
70
+ config . trustedCertificates = data . trustedCertificates . map (
71
+ e => '/usr/local/share/custom-ca-certificates/' + e
72
+ )
73
+ }
74
+ }
75
+ let driver
76
+ try {
77
+ driver = neo4j . driver ( uri , parsedAuthToken , config )
78
+ } catch ( err ) {
79
+ wire . writeError ( err )
80
+ return
81
+ }
60
82
const id = context . addDriver ( driver )
61
- writeResponse ( 'Driver' , { id } )
83
+ wire . writeResponse ( 'Driver' , { id } )
62
84
}
63
85
64
86
export function DriverClose ( context , data , wire ) {
@@ -276,6 +298,8 @@ export function GetFeatures (_context, _params, wire) {
276
298
'Feature:Auth:Custom' ,
277
299
'Feature:Auth:Kerberos' ,
278
300
'Feature:Auth:Bearer' ,
301
+ 'Feature:API:SSLConfig' ,
302
+ 'Feature:API:SSLSchemes' ,
279
303
'AuthorizationExpiredTreatment' ,
280
304
'ConfHint:connection.recv_timeout_seconds' ,
281
305
'Feature:Impersonation' ,
0 commit comments