@@ -3,7 +3,7 @@ import ResultObserver from './result-observer.js'
3
3
import { cypherToNative , nativeToCypher } from './cypher-native-binders.js'
4
4
import { shouldRunTest } from './skipped-tests'
5
5
6
- export function NewDriver ( context , data , { writeResponse } ) {
6
+ export function NewDriver ( context , data , wire ) {
7
7
const {
8
8
uri,
9
9
authorizationToken : { data : authToken } ,
@@ -37,17 +37,39 @@ export function NewDriver (context, data, { writeResponse }) {
37
37
? address =>
38
38
new Promise ( ( resolve , reject ) => {
39
39
const id = context . addResolverRequest ( resolve , reject )
40
- writeResponse ( 'ResolverResolutionRequired' , { id, address } )
40
+ wire . writeResponse ( 'ResolverResolutionRequired' , { id, address } )
41
41
} )
42
42
: undefined
43
- const driver = neo4j . driver ( uri , parsedAuthToken , {
43
+ const config = {
44
44
userAgent,
45
45
resolver,
46
46
useBigInt : true ,
47
47
logging : neo4j . logging . console ( process . env . LOG_LEVEL )
48
- } )
48
+ }
49
+ if ( 'encrypted' in data ) {
50
+ config . encrypted = data . encrypted ? 'ENCRYPTION_ON' : 'ENCRYPTION_OFF'
51
+ }
52
+ if ( 'trustedCertificates' in data ) {
53
+ if ( data . trustedCertificates === null ) {
54
+ config . trust = 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'
55
+ } else if ( data . trustedCertificates . length === 0 ) {
56
+ config . trust = 'TRUST_ALL_CERTIFICATES'
57
+ } else {
58
+ config . trust = 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'
59
+ config . trustedCertificates = data . trustedCertificates . map (
60
+ e => '/usr/local/share/custom-ca-certificates/' + e
61
+ )
62
+ }
63
+ }
64
+ let driver
65
+ try {
66
+ driver = neo4j . driver ( uri , parsedAuthToken , config )
67
+ } catch ( err ) {
68
+ wire . writeError ( err )
69
+ return
70
+ }
49
71
const id = context . addDriver ( driver )
50
- writeResponse ( 'Driver' , { id } )
72
+ wire . writeResponse ( 'Driver' , { id } )
51
73
}
52
74
53
75
export function DriverClose ( context , data , wire ) {
@@ -265,6 +287,8 @@ export function GetFeatures (_context, _params, wire) {
265
287
'Feature:Auth:Custom' ,
266
288
'Feature:Auth:Kerberos' ,
267
289
'Feature:Auth:Bearer' ,
290
+ 'Feature:API:SSLConfig' ,
291
+ 'Feature:API:SSLSchemes' ,
268
292
'AuthorizationExpiredTreatment' ,
269
293
'ConfHint:connection.recv_timeout_seconds' ,
270
294
'Feature:Bolt:4.4' ,
0 commit comments