@apify/utilities
Advanced tools
Comparing version 2.2.0 to 2.2.1
/// <reference types="node" /> | ||
import { KeyObject } from 'crypto'; | ||
declare type DecryptOptions = { | ||
privateKey: Buffer; | ||
passphrase: string; | ||
privateKey: KeyObject; | ||
encryptedPassword: string; | ||
@@ -9,3 +9,3 @@ encryptedValue: string; | ||
declare type EncryptOptions = { | ||
publicKey: Buffer; | ||
publicKey: KeyObject; | ||
value: string; | ||
@@ -18,3 +18,3 @@ }; | ||
* | ||
* @param publicKey {Buffer} Public key used for encryption | ||
* @param publicKey {KeyObject} Public key used for encryption | ||
* @param value {string} Value to be encrypted | ||
@@ -32,4 +32,3 @@ * @returns {Object<encryptedPassword, encryptedValue>} | ||
* | ||
* @param privateKey {Buffer} Private key used for decryption | ||
* @param passphrase {string} Passphrase from private key | ||
* @param privateKey {KeyObject} Private key used for decryption | ||
* @param encryptedPassword {string} Password in Base64 encrypted using private key | ||
@@ -39,3 +38,3 @@ * @param encryptedValue {string} Content in Base64 encrypted using AES cipher | ||
*/ | ||
export declare function privateDecrypt({ privateKey, passphrase, encryptedPassword, encryptedValue, }: DecryptOptions): string; | ||
export declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue, }: DecryptOptions): string; | ||
export {}; |
@@ -1700,3 +1700,2 @@ "use strict"; | ||
privateKey, | ||
passphrase, | ||
encryptedPassword, | ||
@@ -1707,3 +1706,3 @@ encryptedValue | ||
const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64"); | ||
const passwordBuffer = import_crypto2.default.privateDecrypt({ key: privateKey, passphrase }, encryptedPasswordBuffer); | ||
const passwordBuffer = import_crypto2.default.privateDecrypt(privateKey, encryptedPasswordBuffer); | ||
if (passwordBuffer.length !== ENCRYPTION_KEY_LENGTH + ENCRYPTION_IV_LENGTH) { | ||
@@ -1710,0 +1709,0 @@ throw new Error("privateDecrypt: Decryption failed, invalid password length!"); |
{ | ||
"name": "@apify/utilities", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Tools and constants shared across Apify projects.", | ||
@@ -52,3 +52,3 @@ "main": "./index.js", | ||
}, | ||
"gitHead": "12df45163799817e0940171210f9eaf9f20b366a" | ||
"gitHead": "8dd6cb90aaa57abe3a9ab0a388e724626d371008" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
293707
3966