Skip to content

Commit

Permalink
create the @kbn/crypto package
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Mar 24, 2021
1 parent 0967c20 commit 54ee08a
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"@kbn/apm-utils": "link:packages/kbn-apm-utils",
"@kbn/config": "link:packages/kbn-config",
"@kbn/config-schema": "link:packages/kbn-config-schema",
"@kbn/crypto": "link:packages/kbn-crypto",
"@kbn/http-tools": "link:packages/kbn-http-tools",
"@kbn/i18n": "link:packages/kbn-i18n",
"@kbn/interpreter": "link:packages/kbn-interpreter",
Expand Down
13 changes: 13 additions & 0 deletions packages/kbn-crypto/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-crypto'],
};
16 changes: 16 additions & 0 deletions packages/kbn-crypto/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@kbn/crypto",
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"scripts": {
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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 './index';
import { readPkcs12Keystore, Pkcs12ReadResult, readPkcs12Truststore } from './pkcs12';

const reformatPem = (pem: string) => {
// ensure consistency in line endings when comparing two PEM files
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions packages/kbn-crypto/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",
"declaration": true,
"declarationMap": true
},
"include": [
"src/**/*"
]
}
2 changes: 1 addition & 1 deletion src/core/server/elasticsearch/elasticsearch_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
*/

import { schema, TypeOf } from '@kbn/config-schema';
import { readPkcs12Keystore, readPkcs12Truststore } from '@kbn/crypto';
import { Duration } from 'moment';
import { readFileSync } from 'fs';
import { ConfigDeprecationProvider } from 'src/core/server';
import { readPkcs12Keystore, readPkcs12Truststore } from '../utils';
import { ServiceConfigDescriptor } from '../internal_types';
import { getReservedHeaders } from './default_headers';

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/ssl_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/

import { schema, TypeOf } from '@kbn/config-schema';
import { readPkcs12Keystore, readPkcs12Truststore } from '@kbn/crypto';
import { constants as cryptoConstants } from 'crypto';
import { readFileSync } from 'fs';
import { readPkcs12Keystore, readPkcs12Truststore } from '../utils';

const protocolMap = new Map<string, number>([
['TLSv1', cryptoConstants.SSL_OP_NO_TLSv1],
Expand Down
1 change: 0 additions & 1 deletion src/core/server/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
* Side Public License, v 1.
*/

export * from './crypto';
export * from './from_root';
export * from './package_json';
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2625,6 +2625,10 @@
version "0.0.0"
uid ""

"@kbn/crypto@link:packages/kbn-crypto":
version "0.0.0"
uid ""

"@kbn/dev-utils@link:packages/kbn-dev-utils":
version "0.0.0"
uid ""
Expand Down

0 comments on commit 54ee08a

Please sign in to comment.