@webiny/wcp 5.29.0 → 5.30.0
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/encryption.js +11 -3
- package/encryption.js.map +1 -1
- package/package.json +6 -6
- package/urls.d.ts +3 -3
package/encryption.js
CHANGED
|
@@ -10,14 +10,22 @@ exports.encrypt = exports.decrypt = void 0;
|
|
|
10
10
|
* Potentially, we'll revisit this in the future and implement actual encryption.
|
|
11
11
|
*/
|
|
12
12
|
const encrypt = rawObject => {
|
|
13
|
-
|
|
13
|
+
try {
|
|
14
|
+
return Buffer.from(JSON.stringify(rawObject), "utf-8").toString("base64");
|
|
15
|
+
} catch {
|
|
16
|
+
throw new Error("Could not encrypt given data.");
|
|
17
|
+
}
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
exports.encrypt = encrypt;
|
|
17
21
|
|
|
18
22
|
const decrypt = encryptedString => {
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
try {
|
|
24
|
+
const decryptedString = Buffer.from(encryptedString, "base64").toString("utf-8");
|
|
25
|
+
return JSON.parse(decryptedString);
|
|
26
|
+
} catch {
|
|
27
|
+
throw new Error(`Could not decrypt the given string (${encryptedString}).`);
|
|
28
|
+
}
|
|
21
29
|
};
|
|
22
30
|
|
|
23
31
|
exports.decrypt = decrypt;
|
package/encryption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["encrypt","rawObject","Buffer","from","JSON","stringify","toString","decrypt","encryptedString","decryptedString","parse"],"sources":["encryption.ts"],"sourcesContent":["/**\n * For now, we're not doing actual encryption, just simple base64 encoding/decoding.\n * Potentially, we'll revisit this in the future and implement actual encryption.\n */\n\nexport const encrypt = <T = Record<string, any>>(rawObject: T): string => {\n return Buffer.from(JSON.stringify(rawObject), \"utf-8\").toString(\"base64\");\n};\n\nexport const decrypt = <T = Record<string, any>>(encryptedString: string): T => {\n const decryptedString = Buffer.from(encryptedString, \"base64\").toString(\"utf-8\");\n
|
|
1
|
+
{"version":3,"names":["encrypt","rawObject","Buffer","from","JSON","stringify","toString","Error","decrypt","encryptedString","decryptedString","parse"],"sources":["encryption.ts"],"sourcesContent":["/**\n * For now, we're not doing actual encryption, just simple base64 encoding/decoding.\n * Potentially, we'll revisit this in the future and implement actual encryption.\n */\n\nexport const encrypt = <T = Record<string, any>>(rawObject: T): string => {\n try {\n return Buffer.from(JSON.stringify(rawObject), \"utf-8\").toString(\"base64\");\n } catch {\n throw new Error(\"Could not encrypt given data.\");\n }\n};\n\nexport const decrypt = <T = Record<string, any>>(encryptedString: string): T => {\n try {\n const decryptedString = Buffer.from(encryptedString, \"base64\").toString(\"utf-8\");\n return JSON.parse(decryptedString) as T;\n } catch {\n throw new Error(`Could not decrypt the given string (${encryptedString}).`);\n }\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AAEO,MAAMA,OAAO,GAA6BC,SAA1B,IAAmD;EACtE,IAAI;IACA,OAAOC,MAAM,CAACC,IAAP,CAAYC,IAAI,CAACC,SAAL,CAAeJ,SAAf,CAAZ,EAAuC,OAAvC,EAAgDK,QAAhD,CAAyD,QAAzD,CAAP;EACH,CAFD,CAEE,MAAM;IACJ,MAAM,IAAIC,KAAJ,CAAU,+BAAV,CAAN;EACH;AACJ,CANM;;;;AAQA,MAAMC,OAAO,GAA6BC,eAA1B,IAAyD;EAC5E,IAAI;IACA,MAAMC,eAAe,GAAGR,MAAM,CAACC,IAAP,CAAYM,eAAZ,EAA6B,QAA7B,EAAuCH,QAAvC,CAAgD,OAAhD,CAAxB;IACA,OAAOF,IAAI,CAACO,KAAL,CAAWD,eAAX,CAAP;EACH,CAHD,CAGE,MAAM;IACJ,MAAM,IAAIH,KAAJ,CAAW,uCAAsCE,eAAgB,IAAjE,CAAN;EACH;AACJ,CAPM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/wcp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Webiny Ltd.",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@babel/runtime": "7.18.
|
|
14
|
+
"@babel/runtime": "7.18.6",
|
|
15
15
|
"node-fetch": "2.6.7"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
22
22
|
"@babel/preset-env": "^7.16.4",
|
|
23
23
|
"@babel/preset-typescript": "^7.16.0",
|
|
24
|
-
"@webiny/cli": "^5.
|
|
25
|
-
"@webiny/project-utils": "^5.
|
|
24
|
+
"@webiny/cli": "^5.30.0",
|
|
25
|
+
"@webiny/project-utils": "^5.30.0",
|
|
26
26
|
"rimraf": "^3.0.2",
|
|
27
27
|
"ttypescript": "^1.5.12",
|
|
28
|
-
"typescript": "4.
|
|
28
|
+
"typescript": "4.7.4"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"__tests__"
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "3cadc5d26e565586b28772afbc18ae554ce7b782"
|
|
44
44
|
}
|
package/urls.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getWcpApiUrl: (path?: string
|
|
2
|
-
export declare const getWcpGqlApiUrl: (path?: string
|
|
3
|
-
export declare const getWcpAppUrl: (path?: string
|
|
1
|
+
export declare const getWcpApiUrl: (path?: string) => string;
|
|
2
|
+
export declare const getWcpGqlApiUrl: (path?: string) => string;
|
|
3
|
+
export declare const getWcpAppUrl: (path?: string) => string;
|