@replyke/core 4.0.3 → 4.0.4
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.
|
@@ -5,12 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = default_1;
|
|
7
7
|
var node_forge_1 = __importDefault(require("node-forge"));
|
|
8
|
-
var buffer_1 = require("buffer");
|
|
9
8
|
function default_1(rawData, publicKeyBase64) {
|
|
10
|
-
|
|
9
|
+
// Decode the base64-encoded PEM string using node-forge
|
|
10
|
+
var restoredPublicKeyPem = node_forge_1.default.util.decode64(publicKeyBase64);
|
|
11
11
|
// Convert PEM to a public key object
|
|
12
12
|
var restoredPublicKey = node_forge_1.default.pki.publicKeyFromPem(restoredPublicKeyPem);
|
|
13
|
+
// Encrypt the raw data using RSA-OAEP
|
|
13
14
|
var encryptedData = restoredPublicKey.encrypt(rawData, "RSA-OAEP");
|
|
15
|
+
// Return the encrypted data as a base64-encoded string
|
|
14
16
|
return node_forge_1.default.util.encode64(encryptedData);
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=rsaEncryptBase64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsaEncryptBase64.js","sourceRoot":"","sources":["../../../src/utils/rsaEncryptBase64.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"rsaEncryptBase64.js","sourceRoot":"","sources":["../../../src/utils/rsaEncryptBase64.ts"],"names":[],"mappings":";;;;;AAEA,4BAYC;AAdD,0DAA+B;AAE/B,mBAAyB,OAAe,EAAE,eAAuB;IAC9D,wDAAwD;IACzD,IAAM,oBAAoB,GAAG,oBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAElE,qCAAqC;IACrC,IAAM,iBAAiB,GAAG,oBAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IAE3E,sCAAsC;IACtC,IAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAErE,uDAAuD;IACvD,OAAO,oBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import forge from "node-forge";
|
|
2
|
-
import { Buffer } from "buffer";
|
|
3
2
|
export default function (rawData, publicKeyBase64) {
|
|
4
|
-
|
|
3
|
+
// Decode the base64-encoded PEM string using node-forge
|
|
4
|
+
var restoredPublicKeyPem = forge.util.decode64(publicKeyBase64);
|
|
5
5
|
// Convert PEM to a public key object
|
|
6
6
|
var restoredPublicKey = forge.pki.publicKeyFromPem(restoredPublicKeyPem);
|
|
7
|
+
// Encrypt the raw data using RSA-OAEP
|
|
7
8
|
var encryptedData = restoredPublicKey.encrypt(rawData, "RSA-OAEP");
|
|
9
|
+
// Return the encrypted data as a base64-encoded string
|
|
8
10
|
return forge.util.encode64(encryptedData);
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=rsaEncryptBase64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsaEncryptBase64.js","sourceRoot":"","sources":["../../../src/utils/rsaEncryptBase64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"rsaEncryptBase64.js","sourceRoot":"","sources":["../../../src/utils/rsaEncryptBase64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,CAAC,OAAO,WAAW,OAAe,EAAE,eAAuB;IAC9D,wDAAwD;IACzD,IAAM,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAElE,qCAAqC;IACrC,IAAM,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;IAE3E,sCAAsC;IACtC,IAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAErE,uDAAuD;IACvD,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replyke/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"author": "Replyke, maintained by Yanay Tsabary",
|
|
5
5
|
"description": "Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"axios": "^1.4.0",
|
|
43
|
-
"buffer": "^6.0.3",
|
|
44
43
|
"js-cookie": "^3.0.5",
|
|
45
44
|
"lodash": "^4.17.21",
|
|
46
45
|
"node-forge": "^1.3.1"
|