Skip to content

Commit

Permalink
Move certificate exchange bits to app-connectivity
Browse files Browse the repository at this point in the history
Summary: Bit of reorganising as utils is a bit too generic and crowded.

Reviewed By: passy

Differential Revision: D47186536

fbshipit-source-id: 7b1dd26db95aef00778ff4f23d91f7371c4d07ad
  • Loading branch information
lblasa authored and facebook-github-bot committed Jul 4, 2023
1 parent 20d7b57 commit f63e5d4
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
reportPlatformFailures,
FlipperServerEvents,
} from 'flipper-common';
import CertificateProvider from '../utils/CertificateProvider';
import CertificateProvider from './certificate-exchange/CertificateProvider';
import {ClientConnection, ConnectionStatus} from './ClientConnection';
import {EventEmitter} from 'events';
import invariant from 'invariant';
Expand All @@ -44,7 +44,7 @@ import {
import {
extractAppNameFromCSR,
loadSecureServerConfig,
} from '../utils/certificateUtils';
} from './certificate-exchange/certificate-utils';
import DesktopCertificateProvider from '../devices/desktop/DesktopCertificateProvider';
import WWWCertificateProvider from '../fb-stubs/WWWCertificateProvider';
import {tracker} from '../utils/tracker';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @format
*/

import {SecureServerConfig} from '../utils/certificateUtils';
import {SecureServerConfig} from './certificate-exchange/certificate-utils';
import ServerWebSocketBase, {ServerEventsListener} from './ServerWebSocketBase';
import ServerRSocket from './ServerRSocket';
import SecureServerWebSocket from './SecureServerWebSocket';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @format
*/

import {SecureServerConfig} from '../utils/certificateUtils';
import {SecureServerConfig} from './certificate-exchange/certificate-utils';
import ServerWebSocketBase, {
SecureClientQuery,
ServerEventsListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
parseMessageToJson,
verifyClientQueryComesFromCertExchangeSupportedOS,
} from './Utilities';
import {SecureServerConfig} from '../utils/certificateUtils';
import {SecureServerConfig} from './certificate-exchange/certificate-utils';
import {Server} from 'net';
import {serializeError} from 'serialize-error';
import {WSCloseCode} from '../utils/WSCloseCode';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ClientQuery,
SignCertificateMessage,
} from 'flipper-common';
import {SecureServerConfig} from '../utils/certificateUtils';
import {SecureServerConfig} from './certificate-exchange/certificate-utils';

/**
* ClientCsrQuery defines a client query with CSR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
extractAppNameFromCSR,
generateClientCertificate,
getCACertificate,
} from './certificateUtils';
} from './certificate-utils';

export default abstract class CertificateProvider {
abstract medium: CertificateExchangeMedium;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import path from 'path';
import tmp, {FileOptions} from 'tmp';
import {FlipperServerConfig, reportPlatformFailures} from 'flipper-common';
import {isTest} from 'flipper-common';
import {flipperDataFolder} from './paths';
import {flipperDataFolder} from '../../utils/paths';
import * as jwt from 'jsonwebtoken';
import {getFlipperServerConfig} from '../FlipperServerConfig';
import {getFlipperServerConfig} from '../../FlipperServerConfig';

const tmpFile = promisify(tmp.file) as (
options?: FileOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
* @format
*/

import CertificateProvider from '../../utils/CertificateProvider';
import CertificateProvider from '../../app-connectivity/certificate-exchange/CertificateProvider';
import {Client} from 'adbkit';
import * as androidUtil from './androidContainerUtility';
import {csrFileName, extractAppNameFromCSR} from '../../utils/certificateUtils';
import {
csrFileName,
extractAppNameFromCSR,
} from '../../app-connectivity/certificate-exchange/certificate-utils';

const logTag = 'AndroidCertificateProvider';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @format
*/

import CertificateProvider from '../../utils/CertificateProvider';
import CertificateProvider from '../../app-connectivity/certificate-exchange/CertificateProvider';
import fs from 'fs-extra';

export default class DesktopCertificateProvider extends CertificateProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
* @format
*/

import CertificateProvider from '../../utils/CertificateProvider';
import CertificateProvider from '../../app-connectivity/certificate-exchange/CertificateProvider';
import iosUtil, {IdbConfig} from './iOSContainerUtility';
import fs from 'fs-extra';
import {promisify} from 'util';
import tmp, {DirOptions} from 'tmp';
import {csrFileName, extractAppNameFromCSR} from '../../utils/certificateUtils';
import {
csrFileName,
extractAppNameFromCSR,
} from '../../app-connectivity/certificate-exchange/certificate-utils';
import path from 'path';

const tmpDir = promisify(tmp.dir) as (options?: DirOptions) => Promise<string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import {KeytarManager} from '../utils/keytar';
import CertificateProvider from '../utils/CertificateProvider';
import CertificateProvider from '../app-connectivity/certificate-exchange/CertificateProvider';

export default class WWWCertificateProvider extends CertificateProvider {
name = 'WWWCertificateProvider';
Expand Down
5 changes: 4 additions & 1 deletion desktop/flipper-server-core/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ export {isFBBuild} from './fb-stubs/constants';

export {WEBSOCKET_MAX_MESSAGE_SIZE} from './app-connectivity/ServerWebSocket';

export {getAuthToken, hasAuthToken} from './utils/certificateUtils';
export {
getAuthToken,
hasAuthToken,
} from './app-connectivity/certificate-exchange/certificate-utils';
2 changes: 1 addition & 1 deletion desktop/flipper-server-core/src/server/startServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import exitHook from 'exit-hook';
import {attachSocketServer} from './attachSocketServer';
import {FlipperServerImpl} from '../FlipperServerImpl';
import {FlipperServerCompanionEnv} from 'flipper-server-companion';
import {validateAuthToken} from '../utils/certificateUtils';
import {validateAuthToken} from '../app-connectivity/certificate-exchange/certificate-utils';
import {tracker} from '../utils/tracker';

type Config = {
Expand Down

0 comments on commit f63e5d4

Please sign in to comment.