@raytio/decrypt-helper 5.1.2 → 5.1.3
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/CHANGELOG.md +5 -0
- package/dist/api/getFiles.d.ts +2 -2
- package/dist/api/getFiles.js +3 -2
- package/package.json +17 -16
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## 5.1.3 (2022-11-11)
|
|
11
|
+
|
|
12
|
+
- !196 fix more issues caused by corrupted images
|
|
13
|
+
- !192, !194 automated dependency updates
|
|
14
|
+
|
|
10
15
|
## 5.1.2 (2022-11-10)
|
|
11
16
|
|
|
12
17
|
- !195 retry API requests that fail with a 504 error
|
package/dist/api/getFiles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Instance, ProfileObject } from "@raytio/types";
|
|
1
|
+
import type { Instance, NId, ProfileObject } from "@raytio/types";
|
|
2
2
|
import { ApplicationEncryptorLike } from "../types";
|
|
3
3
|
import { EnvConfig } from "./fetchEnvConfig";
|
|
4
|
-
export declare function getFiles(profileObjects: ProfileObject[], instance: Instance, apiToken: string, envConfig: EnvConfig, applicationDecryptor: ApplicationEncryptorLike): Promise<Record<
|
|
4
|
+
export declare function getFiles(profileObjects: ProfileObject[], instance: Instance, apiToken: string, envConfig: EnvConfig, applicationDecryptor: ApplicationEncryptorLike): Promise<Record<NId, [dataUrl: string, fileExtension: string]>>;
|
package/dist/api/getFiles.js
CHANGED
|
@@ -29,7 +29,7 @@ const decryptFile = (encryptedData, encryptedObj, applicationDecryptor, wdek) =>
|
|
|
29
29
|
const cleanApiResponse = (responseBody) => {
|
|
30
30
|
try {
|
|
31
31
|
const realB64 = atob(responseBody);
|
|
32
|
-
if (realB64.
|
|
32
|
+
if (realB64.slice(0, 5) === "data:") {
|
|
33
33
|
return realB64;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -65,6 +65,7 @@ function getFiles(profileObjects, instance, apiToken, envConfig, applicationDecr
|
|
|
65
65
|
const dataUrl = `data:${type};base64,${b64}`;
|
|
66
66
|
return [fileNId, [dataUrl, getFileExtn(dataUrl)]];
|
|
67
67
|
}
|
|
68
|
+
// TODO: should realB64 be renamed to "realDataUrl"?
|
|
68
69
|
const realB64 = yield (0, authedFetch_1.authedFetch)(apiToken, `${envConfig.api_url}/share/v2/access_application/instance/${instance.i_id}/profile_object/${fileNId}/content`).then(cleanApiResponse);
|
|
69
70
|
if ((0, core_1.isEncrypted)(urnOrEncrypted)) {
|
|
70
71
|
const wdek = (_b = (_a = instance.keys[PONId]) === null || _a === void 0 ? void 0 : _a[fieldName]) === null || _b === void 0 ? void 0 : _b.data;
|
|
@@ -75,7 +76,7 @@ function getFiles(profileObjects, instance, apiToken, envConfig, applicationDecr
|
|
|
75
76
|
}
|
|
76
77
|
return [fileNId, [realB64, getFileExtn(realB64)]];
|
|
77
78
|
})));
|
|
78
|
-
return Object.fromEntries(filesBase64.filter(([
|
|
79
|
+
return Object.fromEntries(filesBase64.filter((file) => { var _a; return !!file[1] && ((_a = file[1][0]) === null || _a === void 0 ? void 0 : _a.includes(",")); }));
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
exports.getFiles = getFiles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/decrypt-helper",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"author": "Raytio",
|
|
5
5
|
"description": "A helper to decrypt data shared by Raytio users",
|
|
6
6
|
"main": "dist",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-amplify/auth": "3.4.25",
|
|
25
|
-
"@peculiar/webcrypto": "^1.4.
|
|
25
|
+
"@peculiar/webcrypto": "^1.4.1",
|
|
26
26
|
"@raytio/core": "^10.1.0",
|
|
27
27
|
"@raytio/maxcryptor": "^3.1.0",
|
|
28
28
|
"@raytio/types": "^6.0.2",
|
|
@@ -31,36 +31,37 @@
|
|
|
31
31
|
"localstorage-polyfill": "^1.0.1",
|
|
32
32
|
"mime-types": "^2.1.35",
|
|
33
33
|
"node-fetch": "^2.6.7",
|
|
34
|
-
"pdfmake": "^0.2.
|
|
34
|
+
"pdfmake": "^0.2.6",
|
|
35
35
|
"ramda": "^0.28.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@raytio/react-intl-manager": "^6.3.0",
|
|
39
|
-
"@types/jest": "^
|
|
39
|
+
"@types/jest": "^29.2.2",
|
|
40
40
|
"@types/jest-image-snapshot": "^5.1.0",
|
|
41
41
|
"@types/jsx-pdf": "^2.2.2",
|
|
42
42
|
"@types/mime-types": "^2.1.1",
|
|
43
|
-
"@types/node": "^
|
|
43
|
+
"@types/node": "^18.11.9",
|
|
44
44
|
"@types/node-fetch": "^2.5.12",
|
|
45
|
-
"@types/pdfmake": "^0.2.
|
|
46
|
-
"@types/ramda": "^0.28.
|
|
45
|
+
"@types/pdfmake": "^0.2.2",
|
|
46
|
+
"@types/ramda": "^0.28.19",
|
|
47
47
|
"babel-preset-react-app": "^10.0.1",
|
|
48
|
-
"dotenv": "^16.0.
|
|
49
|
-
"eslint": "^8.
|
|
50
|
-
"eslint-config-kyle": "^
|
|
51
|
-
"jest": "^
|
|
52
|
-
"jest-image-snapshot": "^
|
|
53
|
-
"jest-junit": "^14.0.
|
|
54
|
-
"pdf-to-img": "^
|
|
55
|
-
"ts-jest": "^
|
|
48
|
+
"dotenv": "^16.0.3",
|
|
49
|
+
"eslint": "^8.27.0",
|
|
50
|
+
"eslint-config-kyle": "^9.12.1",
|
|
51
|
+
"jest": "^29.3.1",
|
|
52
|
+
"jest-image-snapshot": "^6.0.0",
|
|
53
|
+
"jest-junit": "^14.0.1",
|
|
54
|
+
"pdf-to-img": "^2.0.0",
|
|
55
|
+
"ts-jest": "^29.0.3",
|
|
56
56
|
"ts-node": "^10.9.1",
|
|
57
|
-
"typescript": "^4.
|
|
57
|
+
"typescript": "^4.8.4"
|
|
58
58
|
},
|
|
59
59
|
"eslintConfig": {
|
|
60
60
|
"extends": "kyle",
|
|
61
61
|
"rules": {
|
|
62
62
|
"react/react-in-jsx-scope": 0,
|
|
63
63
|
"react/style-prop-object": 0,
|
|
64
|
+
"react/no-unknown-property": 0,
|
|
64
65
|
"@typescript-eslint/no-non-null-assertion": 0,
|
|
65
66
|
"@typescript-eslint/no-unused-vars": [
|
|
66
67
|
2,
|