@elastic/request-crypto
Advanced tools
Comparing version 1.0.2 to 1.1.0
export * from './jwks'; | ||
export * from './jwk'; | ||
export * from './aes'; | ||
export * from './random-bytes'; | ||
export * from './request'; |
@@ -8,5 +8,4 @@ "use strict"; | ||
__export(require("./jwk")); | ||
__export(require("./aes")); | ||
__export(require("./random-bytes")); | ||
__export(require("./request")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference types="node" /> | ||
import { Crypto } from '@elastic/node-crypto'; | ||
import { PrivateJWKS, PublicJWK, PublicJWKS } from './jwks'; | ||
@@ -9,3 +9,3 @@ export interface Encryptor { | ||
getWellKnowns(): PublicJWKS; | ||
decrypt(encryptedBody: string): Promise<Buffer>; | ||
decrypt(encryptedBody: string): ReturnType<Crypto['decrypt']>; | ||
} | ||
@@ -12,0 +12,0 @@ export declare function createRequestEncryptor(publicJWKS: PublicJWKS): Promise<Encryptor>; |
@@ -38,5 +38,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// @ts-ignore | ||
var node_crypto_1 = require("@elastic/node-crypto"); | ||
var node_jose_1 = require("node-jose"); | ||
var aes_1 = require("./aes"); | ||
var jwk_1 = require("./jwk"); | ||
@@ -60,3 +59,3 @@ var random_bytes_1 = require("./random-bytes"); | ||
AESKeyBuffer = random_bytes_1.generatePassphrase(); | ||
AES = aes_1.makeAESCryptoWith({ encryptionKey: AESKeyBuffer }); | ||
AES = node_crypto_1.default({ encryptionKey: AESKeyBuffer.toString() }); | ||
return [4 /*yield*/, AES.encrypt(input)]; | ||
@@ -104,3 +103,3 @@ case 1: | ||
encryptionKeyBuffer = _b.sent(); | ||
AES = aes_1.makeAESCryptoWith({ encryptionKey: encryptionKeyBuffer }); | ||
AES = node_crypto_1.default({ encryptionKey: encryptionKeyBuffer.toString() }); | ||
return [2 /*return*/, AES.decrypt(encryptedPayload)]; | ||
@@ -107,0 +106,0 @@ } |
{ | ||
"name": "@elastic/request-crypto", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Request Cryptography", | ||
@@ -22,22 +22,22 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.4", | ||
"@types/expect": "^1.20.3", | ||
"@types/mocha": "^5.2.4", | ||
"@types/node": "^10.12.12", | ||
"chai": "^4.2.0", | ||
"cross-env": "^5.2.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2", | ||
"prettier": "^1.15.3", | ||
"rimraf": "^2.6.2", | ||
"source-map-support": "^0.5.6", | ||
"ts-node": "^7.0.1", | ||
"tsconfig-paths": "^3.6.0", | ||
"tslint": "^5.10.0", | ||
"tslint-config-prettier": "^1.17.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"@types/chai": "4.1.4", | ||
"@types/expect": "1.20.3", | ||
"@types/mocha": "5.2.4", | ||
"@types/node": "10.12.12", | ||
"chai": "4.2.0", | ||
"cross-env": "5.2.0", | ||
"mocha": "5.2.0", | ||
"nyc": "12.0.2", | ||
"prettier": "1.15.3", | ||
"rimraf": "2.6.2", | ||
"source-map-support": "0.5.6", | ||
"ts-node": "7.0.1", | ||
"tsconfig-paths": "3.6.0", | ||
"tslint": "5.10.0", | ||
"tslint-config-prettier": "1.17.0", | ||
"tslint-plugin-prettier": "2.0.1", | ||
"typescript": "3.2.1" | ||
}, | ||
"dependencies": { | ||
"@elastic/node-crypto": "^0.1.2", | ||
"@elastic/node-crypto": "1.1.0", | ||
"@types/node-jose": "1.1.0", | ||
@@ -44,0 +44,0 @@ "node-jose": "1.1.0" |
export * from './jwks'; | ||
export * from './jwk'; | ||
export * from './aes'; | ||
export * from './random-bytes'; | ||
export * from './request'; |
@@ -1,4 +0,4 @@ | ||
// @ts-ignore | ||
import makeAESCryptoWith, { Crypto } from '@elastic/node-crypto'; | ||
import { util } from 'node-jose'; | ||
import { makeAESCryptoWith } from './aes'; | ||
import { createJWKManager } from './jwk'; | ||
@@ -15,3 +15,3 @@ import { PrivateJWKS, PublicJWK, PublicJWKS } from './jwks'; | ||
getWellKnowns(): PublicJWKS; | ||
decrypt(encryptedBody: string): Promise<Buffer>; | ||
decrypt(encryptedBody: string): ReturnType<Crypto['decrypt']>; | ||
} | ||
@@ -24,3 +24,3 @@ | ||
const AESKeyBuffer = generatePassphrase(); | ||
const AES = makeAESCryptoWith({ encryptionKey: AESKeyBuffer }); | ||
const AES = makeAESCryptoWith({ encryptionKey: AESKeyBuffer.toString() }); | ||
const encryptedPayload = await AES.encrypt(input); | ||
@@ -45,3 +45,3 @@ const encryptedKey = await jwkManager.encrypt(kid, AESKeyBuffer); | ||
const encryptionKeyBuffer = await jwkManager.decrypt(encryptedAESKey); | ||
const AES = makeAESCryptoWith({ encryptionKey: encryptionKeyBuffer }); | ||
const AES = makeAESCryptoWith({ encryptionKey: encryptionKeyBuffer.toString() }); | ||
return AES.decrypt(encryptedPayload); | ||
@@ -48,0 +48,0 @@ }, |
@@ -22,3 +22,9 @@ { | ||
"tslint-plugin-prettier" | ||
] | ||
} | ||
], | ||
"linterOptions": { | ||
"exclude": [ | ||
"*.json", | ||
"**/*.json" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58974
38
1266
+ Added@elastic/node-crypto@1.1.0(transitive)
- Removed@elastic/node-crypto@0.1.2(transitive)
Updated@elastic/node-crypto@1.1.0