@@ -76,8 +76,7 @@ await TryInvoke(
7676 async ( ) =>
7777 {
7878 await WaitForConnection ( ) ;
79- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . ClearAlerts , _appState . PrivateKey ) ;
80- await Connection . InvokeAsync < Result > ( nameof ( IViewerHub . ClearAlert ) , signedDto ) ;
79+ await Connection . InvokeAsync < Result > ( nameof ( IViewerHub . ClearAlert ) ) ;
8180 } ) ;
8281 }
8382
@@ -86,7 +85,10 @@ public async Task CloseStreamingSession(string streamerConnectionId)
8685 await TryInvoke (
8786 async ( ) =>
8887 {
89- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . CloseStreamingSession , _appState . PrivateKey ) ;
88+ await WaitForConnection ( ) ;
89+ var dto = new CloseStreamingSessionRequestDto ( ) ;
90+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . CloseStreamingSession , _appState . PrivateKey ) ;
91+
9092 await Connection . InvokeAsync ( nameof ( IViewerHub . SendSignedDtoToStreamer ) , streamerConnectionId , signedDto ) ;
9193 } ) ;
9294 }
@@ -120,8 +122,8 @@ public async Task<Result<AgentAppSettings>> GetAgentAppSettings(string agentConn
120122 return await TryInvoke (
121123 async ( ) =>
122124 {
123- var request = _keyProvider . CreateRandomSignedDto ( DtoType . GetAgentAppSettings , _appState . PrivateKey ) ;
124- var signedDto = _keyProvider . CreateSignedDto ( request , DtoType . TerminalSessionRequest , _appState . PrivateKey ) ;
125+ var dto = new GetAgentAppSettingsDto ( ) ;
126+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . GetAgentAppSettings , _appState . PrivateKey ) ;
125127 return await Connection . InvokeAsync < Result < AgentAppSettings > > ( nameof ( IViewerHub . GetAgentAppSettings ) , agentConnectionId , signedDto ) ;
126128 } ,
127129 ( ) => Result . Fail < AgentAppSettings > ( "Failed to get agent settings" ) ) ;
@@ -177,7 +179,8 @@ public async Task<Result<WindowsSession[]>> GetWindowsSessions(DeviceDto device)
177179 {
178180 try
179181 {
180- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . WindowsSessions , _appState . PrivateKey ) ;
182+ var dto = new GetWindowsSessionsDto ( ) ;
183+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . GetWindowsSessions , _appState . PrivateKey ) ;
181184 var sessions = await Connection . InvokeAsync < WindowsSession [ ] > ( nameof ( IViewerHub . GetWindowsSessions ) , device . ConnectionId , signedDto ) ;
182185 return Result . Ok ( sessions ) ;
183186 }
@@ -192,7 +195,8 @@ public async Task InvokeCtrlAltDel(string deviceId)
192195 {
193196 await TryInvoke ( async ( ) =>
194197 {
195- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . InvokeCtrlAltDel , _appState . PrivateKey ) ;
198+ var dto = new InvokeCtrlAltDelRequestDto ( ) ;
199+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . InvokeCtrlAltDel , _appState . PrivateKey ) ;
196200 await Connection . InvokeAsync ( nameof ( IViewerHub . SendSignedDtoToAgent ) , deviceId , signedDto ) ;
197201 } ) ;
198202 }
@@ -328,7 +332,8 @@ public async Task SendAgentUpdateTrigger(DeviceDto device)
328332 {
329333 await TryInvoke ( async ( ) =>
330334 {
331- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . AgentUpdateTrigger , _appState . PrivateKey ) ;
335+ var dto = new TriggerAgentUpdateDto ( ) ;
336+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . TriggerAgentUpdate , _appState . PrivateKey ) ;
332337 await Connection . InvokeAsync ( nameof ( IViewerHub . SendSignedDtoToAgent ) , device . Id , signedDto ) ;
333338 } ) ;
334339 }
@@ -375,7 +380,8 @@ await TryInvoke(
375380 async ( ) =>
376381 {
377382 await WaitForConnection ( ) ;
378- var signedDto = _keyProvider . CreateRandomSignedDto ( DtoType . ResetKeyboardState , _appState . PrivateKey ) ;
383+ var dto = new ResetKeyboardStateDto ( ) ;
384+ var signedDto = _keyProvider . CreateSignedDto ( dto , DtoType . ResetKeyboardState , _appState . PrivateKey ) ;
379385 await Connection . InvokeAsync ( nameof ( IViewerHub . SendSignedDtoToStreamer ) , streamerConnectionId , signedDto ) ;
380386 } ) ;
381387 }
0 commit comments