| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -8,7 +8,7 @@ import {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { fromUInt8ArrayToBase64 } from '../../utils/String';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { NetworkTime } from '../../../util/NetworkTime';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { DURATION } from '../../constants';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { getOSArchitecture } from '../../../OS';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { getOSArchitecture, getOSPlatform } from '../../../OS';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import type { ReleaseChannels } from '../../../updater/types';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import { Storage } from '../../../util/storage';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -16,7 +16,7 @@ export const fileServerHost = 'filev2.getsession.org';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				export const fileServerURL = `http://${fileServerHost}`;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				export const fileServerPubKey = 'da21e1d886c6fbaea313f75298bd64aab03a97ce985b46bb2dad9f2089c8ee59';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const RELEASE_VERSION_ENDPOINT = '/session_version?platform=desktop';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const RELEASE_VERSION_ENDPOINT = '/session_version';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				const POST_GET_FILE_ENDPOINT = '/file';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -133,15 +133,23 @@ const parseStatusCodeFromOnionRequestV4 = (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				 * This call is onion routed and so do not expose our ip to github nor the file server.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				 */
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				export const getLatestReleaseFromFileServer = async (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  userEd25519SecretKey: Uint8Array
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  userEd25519SecretKey: Uint8Array,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  releaseType?: ReleaseChannels
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				): Promise<string | null> => {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const sigTimestampSeconds = NetworkTime.getNowWithNetworkOffsetSeconds();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const blindedPkHex = await BlindingActions.blindVersionPubkey({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    ed25519SecretKey: userEd25519SecretKey,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const signature = await BlindingActions.blindVersionSign({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const method = 'GET';
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const releaseChannel = Storage.get('releaseChannel') as ReleaseChannels;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const endpoint = `${RELEASE_VERSION_ENDPOINT}?platform=desktop&os=${getOSPlatform()}&arch=${getOSArchitecture()}${releaseChannel ? `&release_channel=${releaseType || releaseChannel}` : ''}`;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const signature = await BlindingActions.blindVersionSignRequest({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    ed25519SecretKey: userEd25519SecretKey,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sigTimestampSeconds,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sigMethod: method,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sigPath: endpoint,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    sigBody: null,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const headers = {
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -150,16 +158,15 @@ export const getLatestReleaseFromFileServer = async (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    'X-FS-Signature': fromUInt8ArrayToBase64(signature),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const releaseChannel = Storage.get('releaseChannel') as ReleaseChannels;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const endpoint = `${RELEASE_VERSION_ENDPOINT}&arch=${getOSArchitecture()}${releaseChannel ? `&releases=${releaseChannel}` : ''}`;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const result = await OnionSending.sendJsonViaOnionV4ToFileServer({
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const params = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    abortSignal: new AbortController().signal,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    endpoint,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    method: 'GET',
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    method,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    stringifiedBody: null,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    headers,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    timeoutMs: 10 * DURATION.SECONDS,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  const result = await OnionSending.sendJsonViaOnionV4ToFileServer(params);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  if (!batchGlobalIsSuccess(result) || parseStatusCodeFromOnionRequestV4(result) !== 200) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return null;
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |