1- import net from 'node:net' ;
1+ import type net from 'node:net' ;
22
33import { getLogger } from '../../../lib/logger.js' ;
44import {
55 PlistUID ,
66 createBinaryPlist ,
77 parseBinaryPlist ,
88} from '../../../lib/plist/index.js' ;
9- import type { PlistDictionary } from '../../../lib/types.js' ;
9+ import type {
10+ PlistDictionary ,
11+ SendMessageOptions ,
12+ } from '../../../lib/types.js' ;
1013import { ServiceConnection } from '../../../service-connection.js' ;
11- import { BaseService , type Service } from '../base-service.js' ;
14+ import { BaseService , type Service , stripSSL } from '../base-service.js' ;
1215import { ChannelFragmenter } from './channel-fragmenter.js' ;
1316import { Channel } from './channel.js' ;
1417import { DTXMessage , DTX_CONSTANTS , MessageAux } from './dtx-message.js' ;
@@ -68,7 +71,7 @@ export class DVTSecureSocketProxyService extends BaseService {
6871 // DVT uses DTX binary protocol, connect without plist-based RSDCheckin
6972 this . connection = await this . startLockdownWithoutCheckin ( service ) ;
7073 this . socket = this . connection . getSocket ( ) ;
71- this . stripSSL ( this . socket ) ;
74+ stripSSL ( this . socket ) ;
7275
7376 await this . performHandshake ( ) ;
7477 }
@@ -101,7 +104,7 @@ export class DVTSecureSocketProxyService extends BaseService {
101104 args . appendInt ( channelCode ) ;
102105 args . appendObj ( identifier ) ;
103106
104- await this . sendMessage ( 0 , '_requestChannelWithCode:identifier:' , args ) ;
107+ await this . sendMessage ( 0 , '_requestChannelWithCode:identifier:' , { args } ) ;
105108
106109 const [ ret ] = await this . recvPlist ( ) ;
107110
@@ -119,15 +122,14 @@ export class DVTSecureSocketProxyService extends BaseService {
119122 * Send a DTX message on a channel
120123 * @param channel The channel code
121124 * @param selector The ObjectiveC method selector
122- * @param args Optional message arguments
123- * @param expectsReply Whether a reply is expected
125+ * @param options Optional message options
124126 */
125127 async sendMessage (
126128 channel : number ,
127129 selector : string | null = null ,
128- args : MessageAux | null = null ,
129- expectsReply : boolean = true ,
130+ options : SendMessageOptions = { } ,
130131 ) : Promise < void > {
132+ const { args = null , expectsReply = true } = options ;
131133 if ( ! this . socket ) {
132134 throw new Error ( 'Not connected to DVT service' ) ;
133135 }
@@ -269,8 +271,7 @@ export class DVTSecureSocketProxyService extends BaseService {
269271 await this . sendMessage (
270272 DVTSecureSocketProxyService . BROADCAST_CHANNEL ,
271273 '_channelCanceled:' ,
272- args ,
273- false ,
274+ { args, expectsReply : false } ,
274275 ) ;
275276 } catch ( error ) {
276277 log . debug ( 'Error sending channel canceled message:' , error ) ;
@@ -298,7 +299,10 @@ export class DVTSecureSocketProxyService extends BaseService {
298299 'com.apple.private.DTXBlockCompression' : 0 ,
299300 'com.apple.private.DTXConnection' : 1 ,
300301 } ) ;
301- await this . sendMessage ( 0 , '_notifyOfPublishedCapabilities:' , args , false ) ;
302+ await this . sendMessage ( 0 , '_notifyOfPublishedCapabilities:' , {
303+ args,
304+ expectsReply : false ,
305+ } ) ;
302306
303307 const [ retData , aux ] = await this . recvMessage ( ) ;
304308 const ret = retData ? parseBinaryPlist ( retData ) : null ;
0 commit comments