mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
move crypto to server utils (#62344)
* move crypto to server utils * fix mocks
This commit is contained in:
parent
7039abaf3b
commit
4cb96ee74a
18 changed files with 8 additions and 8 deletions
|
@ -22,7 +22,7 @@ jest.mock('fs', () => ({ readFileSync: mockReadFileSync }));
|
|||
|
||||
export const mockReadPkcs12Keystore = jest.fn();
|
||||
export const mockReadPkcs12Truststore = jest.fn();
|
||||
jest.mock('../../utils', () => ({
|
||||
jest.mock('../utils', () => ({
|
||||
readPkcs12Keystore: mockReadPkcs12Keystore,
|
||||
readPkcs12Truststore: mockReadPkcs12Truststore,
|
||||
}));
|
||||
|
|
|
@ -227,7 +227,7 @@ describe('throws when config is invalid', () => {
|
|||
beforeAll(() => {
|
||||
const realFs = jest.requireActual('fs');
|
||||
mockReadFileSync.mockImplementation((path: string) => realFs.readFileSync(path));
|
||||
const utils = jest.requireActual('../../utils');
|
||||
const utils = jest.requireActual('../utils');
|
||||
mockReadPkcs12Keystore.mockImplementation((path: string, password?: string) =>
|
||||
utils.readPkcs12Keystore(path, password)
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ import { schema, TypeOf } from '@kbn/config-schema';
|
|||
import { Duration } from 'moment';
|
||||
import { readFileSync } from 'fs';
|
||||
import { ConfigDeprecationProvider } from 'src/core/server';
|
||||
import { readPkcs12Keystore, readPkcs12Truststore } from '../../utils';
|
||||
import { readPkcs12Keystore, readPkcs12Truststore } from '../utils';
|
||||
import { ServiceConfigDescriptor } from '../internal_types';
|
||||
|
||||
const hostURISchema = schema.uri({ scheme: ['http', 'https'] });
|
||||
|
|
|
@ -24,7 +24,7 @@ jest.mock('fs', () => {
|
|||
|
||||
export const mockReadPkcs12Keystore = jest.fn();
|
||||
export const mockReadPkcs12Truststore = jest.fn();
|
||||
jest.mock('../../utils', () => ({
|
||||
jest.mock('../utils', () => ({
|
||||
readPkcs12Keystore: mockReadPkcs12Keystore,
|
||||
readPkcs12Truststore: mockReadPkcs12Truststore,
|
||||
}));
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('#SslConfig', () => {
|
|||
beforeEach(() => {
|
||||
const realFs = jest.requireActual('fs');
|
||||
mockReadFileSync.mockImplementation((path: string) => realFs.readFileSync(path));
|
||||
const utils = jest.requireActual('../../utils');
|
||||
const utils = jest.requireActual('../utils');
|
||||
mockReadPkcs12Keystore.mockImplementation((path: string, password?: string) =>
|
||||
utils.readPkcs12Keystore(path, password)
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import crypto from 'crypto';
|
||||
import { readFileSync } from 'fs';
|
||||
import { readPkcs12Keystore, readPkcs12Truststore } from '../../utils';
|
||||
import { readPkcs12Keystore, readPkcs12Truststore } from '../utils';
|
||||
|
||||
// `crypto` type definitions doesn't currently include `crypto.constants`, see
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/fa5baf1733f49cf26228a4e509914572c1b74adf/types/node/v6/index.d.ts#L3412
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
import { NO_CA_PATH, NO_CERT_PATH, NO_KEY_PATH, TWO_CAS_PATH, TWO_KEYS_PATH } from './__fixtures__';
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
import { readPkcs12Keystore, Pkcs12ReadResult, readPkcs12Truststore } from '.';
|
||||
import { readPkcs12Keystore, Pkcs12ReadResult, readPkcs12Truststore } from './index';
|
||||
|
||||
const reformatPem = (pem: string) => {
|
||||
// ensure consistency in line endings when comparing two PEM files
|
|
@ -17,5 +17,6 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export * from './crypto';
|
||||
export * from './from_root';
|
||||
export * from './package_json';
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
export * from './assert_never';
|
||||
export * from './context';
|
||||
export * from './crypto';
|
||||
export * from './deep_freeze';
|
||||
export * from './get';
|
||||
export * from './map_to_object';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue