@@ -70,13 +70,13 @@ const getCrypto = async () => {
7070export const processData = async ( aesKey : string , polledData : PolledData ) : Promise < Data [ ] > => {
7171 const { data } = polledData ;
7272 let parsedData : Data [ ] = [ ] ;
73-
73+
7474 if ( data && data . length > 0 ) {
7575 const crypto = await getCrypto ( ) ;
7676 const decryptedData : string [ ] = data . map ( ( item ) => {
7777 const iv = Buffer . from ( item , 'base64' ) . slice ( 0 , 16 ) ;
7878 const key = Buffer . from ( aesKey , 'base64' ) ;
79- const decipher = crypto . createDecipheriv ( 'aes-256-cfb ' , key , iv ) ;
79+ const decipher = crypto . createDecipheriv ( 'aes-256-ctr ' , key , iv ) ;
8080 let mystr : string = decipher . update ( Buffer . from ( item , 'base64' ) . slice ( 16 ) ) . toString ( ) ;
8181 mystr += decipher . final ( 'utf8' ) ;
8282 return mystr ;
@@ -97,7 +97,7 @@ export const handleResponseExport = (item: Data): void => {
9797
9898export const handleDataExport = ( ) : void => {
9999 if ( typeof window === 'undefined' ) return ;
100-
100+
101101 const values : Record < string , string > = { } ;
102102 for ( let i = 0 ; i < localStorage . length ; i ++ ) {
103103 const key = localStorage . key ( i ) ;
@@ -108,7 +108,7 @@ export const handleDataExport = (): void => {
108108 }
109109 }
110110 }
111-
111+
112112 const fileName = `${ format ( Date . now ( ) , 'yyyy-MM-dd_hh:mm' ) } .json` ;
113113 downloadData ( JSON . stringify ( values ) , fileName ) ;
114114} ;
@@ -144,7 +144,7 @@ export const deregister = (
144144 headers,
145145 referrerPolicy : 'no-referrer' ,
146146 body : JSON . stringify ( registerFetcherOptions ) ,
147- } ) . catch ( ( ) => { } ) ;
147+ } ) . catch ( ( ) => { } ) ;
148148} ;
149149
150150export const register = (
@@ -157,18 +157,18 @@ export const register = (
157157 const { pub, priv, correlation, secret } = generateRegistrationParams (
158158 currentData . correlationIdLength
159159 ) ;
160-
160+
161161 const registerFetcherOptions = reregister
162162 ? {
163- 'public-key' : btoa ( currentData . publicKey ) ,
164- 'secret-key' : currentData . secretKey ,
165- 'correlation-id' : currentData . correlationId ,
166- }
163+ 'public-key' : btoa ( currentData . publicKey ) ,
164+ 'secret-key' : currentData . secretKey ,
165+ 'correlation-id' : currentData . correlationId ,
166+ }
167167 : {
168- 'public-key' : btoa ( pub ) ,
169- 'secret-key' : secret ,
170- 'correlation-id' : correlation ,
171- } ;
168+ 'public-key' : btoa ( pub ) ,
169+ 'secret-key' : secret ,
170+ 'correlation-id' : correlation ,
171+ } ;
172172
173173 const contentType = { 'Content-Type' : 'application/json' } ;
174174 const authorizationHeader = { Authorization : token } ;
@@ -194,7 +194,7 @@ export const register = (
194194 1 ,
195195 host
196196 ) ;
197-
197+
198198 const tabData : Tab [ ] = [
199199 {
200200 'unique-id' : uniqueId ,
@@ -208,40 +208,40 @@ export const register = (
208208 const data : StoredData = reregister
209209 ? { ...currentData , aesKey : '' , token }
210210 : {
211- privateKey : priv ,
212- publicKey : pub ,
213- correlationId : correlation ,
214- secretKey : secret ,
215- view : currentData . view ,
216- theme : currentData . theme ,
217- host,
218- correlationIdLength : currentData . correlationIdLength ,
219- correlationIdNonceLength : currentData . correlationIdNonceLength ,
220- responseExport : false ,
221- increment : 1 ,
222- token,
223- telegram : {
224- enabled : false ,
225- botToken : '' ,
226- chatId : '' ,
227- } ,
228- slack : {
229- enabled : false ,
230- hookKey : '' ,
231- channel : '' ,
232- } ,
233- discord : {
234- enabled : false ,
235- webhook : '' ,
236- channel : '' ,
237- } ,
238- tabs : tabData ,
239- selectedTab : tabData [ 0 ] ,
240- data : [ ] ,
241- aesKey : '' ,
242- notes : [ ] ,
243- filter : defaultFilter ,
244- } ;
211+ privateKey : priv ,
212+ publicKey : pub ,
213+ correlationId : correlation ,
214+ secretKey : secret ,
215+ view : currentData . view ,
216+ theme : currentData . theme ,
217+ host,
218+ correlationIdLength : currentData . correlationIdLength ,
219+ correlationIdNonceLength : currentData . correlationIdNonceLength ,
220+ responseExport : false ,
221+ increment : 1 ,
222+ token,
223+ telegram : {
224+ enabled : false ,
225+ botToken : '' ,
226+ chatId : '' ,
227+ } ,
228+ slack : {
229+ enabled : false ,
230+ hookKey : '' ,
231+ channel : '' ,
232+ } ,
233+ discord : {
234+ enabled : false ,
235+ webhook : '' ,
236+ channel : '' ,
237+ } ,
238+ tabs : tabData ,
239+ selectedTab : tabData [ 0 ] ,
240+ data : [ ] ,
241+ aesKey : '' ,
242+ notes : [ ] ,
243+ filter : defaultFilter ,
244+ } ;
245245
246246 if ( ! reregister ) {
247247 clearIntervals ( ) ;
@@ -267,7 +267,7 @@ export const poll = (
267267 handleCustomHostDialogVisibility : ( ) => void
268268) : Promise < PolledData > => {
269269 const headers : Record < string , string > = token !== '' ? { Authorization : token } : { } ;
270-
270+
271271 return fetch ( `https://${ host } /poll?id=${ correlationId } &secret=${ secretKey } ` , {
272272 method : 'GET' ,
273273 cache : 'no-cache' ,
@@ -284,7 +284,7 @@ export const poll = (
284284 }
285285 } ;
286286 const data = await getRes ( ) ;
287-
287+
288288 if ( ! res . ok ) {
289289 const err = data . error ;
290290 if ( err === 'could not get interactions: could not get correlation-id from cache' ) {
0 commit comments