@@ -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 } ,
@@ -14,17 +14,39 @@ export function NewDriver (context, data, { writeResponse }) {
14
14
? address =>
15
15
new Promise ( ( resolve , reject ) => {
16
16
const id = context . addResolverRequest ( resolve , reject )
17
- writeResponse ( 'ResolverResolutionRequired' , { id, address } )
17
+ wire . writeResponse ( 'ResolverResolutionRequired' , { id, address } )
18
18
} )
19
19
: undefined
20
- const driver = neo4j . driver ( uri , authToken , {
20
+ const config = {
21
21
userAgent,
22
22
resolver,
23
23
useBigInt : true ,
24
24
logging : neo4j . logging . console ( process . env . LOG_LEVEL )
25
- } )
25
+ }
26
+ if ( 'encrypted' in data ) {
27
+ config . encrypted = data . encrypted ? 'ENCRYPTION_ON' : 'ENCRYPTION_OFF'
28
+ }
29
+ if ( 'trustedCertificates' in data ) {
30
+ if ( data . trustedCertificates === null ) {
31
+ config . trust = 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES'
32
+ } else if ( data . trustedCertificates . length === 0 ) {
33
+ config . trust = 'TRUST_ALL_CERTIFICATES'
34
+ } else {
35
+ config . trust = 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'
36
+ config . trustedCertificates = data . trustedCertificates . map (
37
+ e => '/usr/local/share/custom-ca-certificates/' + e
38
+ )
39
+ }
40
+ }
41
+ let driver
42
+ try {
43
+ driver = neo4j . driver ( uri , authToken , config )
44
+ } catch ( err ) {
45
+ wire . writeError ( err )
46
+ return
47
+ }
26
48
const id = context . addDriver ( driver )
27
- writeResponse ( 'Driver' , { id } )
49
+ wire . writeResponse ( 'Driver' , { id } )
28
50
}
29
51
30
52
export function DriverClose ( context , data , wire ) {
@@ -238,6 +260,8 @@ export function StartTest (_, { testName }, wire) {
238
260
export function GetFeatures ( _context , _params , wire ) {
239
261
wire . writeResponse ( 'FeatureList' , {
240
262
features : [
263
+ 'Feature:API:SSLConfig' ,
264
+ 'Feature:API:SSLSchemes' ,
241
265
'AuthorizationExpiredTreatment' ,
242
266
'ConfHint:connection.recv_timeout_seconds'
243
267
]
0 commit comments