encrypt-rsa 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +3 -3
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var NodeRSA = /** @class */ (function () {
|
|
|
79
79
|
var text = args.text, _a = args.privateKey, privateKey = _a === void 0 ? this.privateKey : _a;
|
|
80
80
|
var publicKeyDecoded = (0, helpers_1.decode)(this.convertKetToBase64(privateKey));
|
|
81
81
|
var buffer = Buffer.from(text);
|
|
82
|
-
var encrypted = crypto === null || crypto === void 0 ? void 0 : crypto.
|
|
82
|
+
var encrypted = crypto === null || crypto === void 0 ? void 0 : crypto.privateEncrypt(publicKeyDecoded, buffer);
|
|
83
83
|
return encrypted.toString('base64');
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
@@ -94,7 +94,7 @@ var NodeRSA = /** @class */ (function () {
|
|
|
94
94
|
var text = args.text, _a = args.publicKey, publicKey = _a === void 0 ? this.publicKey : _a;
|
|
95
95
|
var publicKeyDecoded = (0, helpers_1.decode)(this.convertKetToBase64(publicKey));
|
|
96
96
|
var buffer = Buffer.from(text, 'base64');
|
|
97
|
-
var decrypted = crypto === null || crypto === void 0 ? void 0 : crypto.
|
|
97
|
+
var decrypted = crypto === null || crypto === void 0 ? void 0 : crypto.publicDecrypt(publicKeyDecoded, buffer);
|
|
98
98
|
return decrypted.toString('utf8');
|
|
99
99
|
};
|
|
100
100
|
NodeRSA.prototype.createPrivateAndPublicKeys = function (modulusLength) {
|
|
@@ -111,7 +111,7 @@ var NodeRSA = /** @class */ (function () {
|
|
|
111
111
|
format: 'pem',
|
|
112
112
|
},
|
|
113
113
|
}), privateKey = _a.privateKey, publicKey = _a.publicKey;
|
|
114
|
-
return { publicKey:
|
|
114
|
+
return { publicKey: publicKey, privateKey: privateKey }; // Corrected order
|
|
115
115
|
}
|
|
116
116
|
return { privateKey: '', publicKey: '' };
|
|
117
117
|
};
|
package/package.json
CHANGED