Extract certificate utils
Summary: Extract utilities for certificate server-side certificate handling Reviewed By: lawrencelomax Differential Revision: D33820263 fbshipit-source-id: 21f1a9ed5f3b83b8350151bdf6d8862aa0b18e8f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e686766e5f
commit
b1f19ecd68
@@ -7,10 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
CertificateExchangeMedium,
|
||||
SecureServerConfig,
|
||||
} from '../utils/CertificateProvider';
|
||||
import {CertificateExchangeMedium} from '../utils/CertificateProvider';
|
||||
import {ClientConnection} from './ClientConnection';
|
||||
import {transformCertificateExchangeMediumToType} from './Utilities';
|
||||
import {
|
||||
@@ -18,6 +15,7 @@ import {
|
||||
ClientQuery,
|
||||
SignCertificateMessage,
|
||||
} from 'flipper-common';
|
||||
import {SecureServerConfig} from '../utils/certificateUtils';
|
||||
|
||||
/**
|
||||
* ClientCsrQuery defines a client query with CSR
|
||||
|
||||
@@ -41,6 +41,10 @@ import {
|
||||
getServerPortsConfig,
|
||||
getFlipperServerConfig,
|
||||
} from '../FlipperServerConfig';
|
||||
import {
|
||||
extractAppNameFromCSR,
|
||||
loadSecureServerConfig,
|
||||
} from '../utils/certificateUtils';
|
||||
|
||||
type ClientTimestampTracker = {
|
||||
insecureStart?: number;
|
||||
@@ -115,7 +119,7 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
}
|
||||
const {insecure, secure} = getServerPortsConfig().serverPorts;
|
||||
|
||||
const options = await this.certificateProvider.loadSecureServerConfig();
|
||||
const options = await loadSecureServerConfig();
|
||||
|
||||
console.info('[conn] secure server listening at port: ', secure);
|
||||
this.secureServer = await createServer(secure, this, options);
|
||||
@@ -343,9 +347,7 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
|
||||
// For Android, device id might change
|
||||
if (csr_path && csr && query.os === 'Android') {
|
||||
const app_name = await this.certificateProvider.extractAppNameFromCSR(
|
||||
csr,
|
||||
);
|
||||
const app_name = await extractAppNameFromCSR(csr);
|
||||
// TODO: allocate new object, kept now as is to keep changes minimal
|
||||
(query as any).device_id =
|
||||
await this.certificateProvider.getTargetDeviceId(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {SecureServerConfig} from '../utils/CertificateProvider';
|
||||
import {SecureServerConfig} from '../utils/certificateUtils';
|
||||
import ServerAdapter, {ServerEventsListener} from './ServerAdapter';
|
||||
import ServerRSocket from './ServerRSocket';
|
||||
import SecureServerWebSocket from './SecureServerWebSocket';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {SecureServerConfig} from '../utils/CertificateProvider';
|
||||
import {SecureServerConfig} from '../utils/certificateUtils';
|
||||
import ServerAdapter, {
|
||||
SecureClientQuery,
|
||||
ServerEventsListener,
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
parseMessageToJson,
|
||||
verifyClientQueryComesFromCertExchangeSupportedOS,
|
||||
} from './Utilities';
|
||||
import {SecureServerConfig} from '../utils/CertificateProvider';
|
||||
import {SecureServerConfig} from '../utils/certificateUtils';
|
||||
import {Server} from 'net';
|
||||
import {serializeError} from 'serialize-error';
|
||||
import {WSCloseCode} from '../utils/WSCloseCode';
|
||||
|
||||
Reference in New Issue
Block a user