@raytio/decrypt-helper 2.1.3 → 2.2.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/CHANGELOG.md CHANGED
@@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 2.2.0 (2022-02-04)
11
+
12
+ - !153 fix rendering of arrays of primitive values
13
+ - !152 Update @raytio/core to v9 to fix a bug with `hashed_n_id`
14
+ - !155, !154, !146, !147, !150, !151 automated dependency updates
15
+
10
16
  ## 2.1.3 (2021-10-08)
11
17
 
12
- - !126 Add more logging to `saveToS3Bucket`
18
+ - !134 Add more logging to `saveToS3Bucket`
19
+ - !129, !131, !132, !133 automated dependency updates
13
20
 
14
21
  ## 2.1.2 (2021-09-24)
15
22
 
@@ -31,16 +31,20 @@ const profileObjects = [
31
31
  },
32
32
  ];
33
33
  const allSchemas = [
34
- { name: "ss_name", title: "Your Name" },
34
+ { name: "ss_name", title: "Your Name", description: "", properties: {} },
35
35
  {
36
36
  name: "ss_nz_drivers_license",
37
37
  schema_group: "DL",
38
38
  title: "NZ Drivers License",
39
+ description: "",
40
+ properties: {},
39
41
  },
40
42
  {
41
43
  name: "ss_nsw_drivers_license",
42
44
  schema_group: "DL",
43
45
  title: "NSW Drivers License",
46
+ description: "",
47
+ properties: {},
44
48
  },
45
49
  ];
46
50
  const realVers = [];
@@ -30,7 +30,7 @@ describe("maybeAddLookupValue", () => {
30
30
  },
31
31
  };
32
32
  const result = yield (0, lookup_ts_1.maybeAddLookupValue)(schema, key, value);
33
- expect(result).toStrictEqual("NZ");
33
+ expect(result).toBe("NZ");
34
34
  }));
35
35
  it("Returns lookup value", () => __awaiter(void 0, void 0, void 0, function* () {
36
36
  getLookupOption_ts_1.getLookupOption.mockImplementation(() => [
@@ -52,7 +52,7 @@ describe("maybeAddLookupValue", () => {
52
52
  },
53
53
  };
54
54
  const result = yield (0, lookup_ts_1.maybeAddLookupValue)(schema, key, value);
55
- expect(result).toStrictEqual("New Zealand");
55
+ expect(result).toBe("New Zealand");
56
56
  }));
57
57
  it("Returns value if no corresponding key in lookup", () => __awaiter(void 0, void 0, void 0, function* () {
58
58
  getLookupOption_ts_1.getLookupOption.mockImplementation(() => [
@@ -74,6 +74,6 @@ describe("maybeAddLookupValue", () => {
74
74
  },
75
75
  };
76
76
  const result = yield (0, lookup_ts_1.maybeAddLookupValue)(schema, key, value);
77
- expect(result).toStrictEqual("NZ");
77
+ expect(result).toBe("NZ");
78
78
  }));
79
79
  });
@@ -15,8 +15,11 @@ const ramda_1 = require("ramda");
15
15
  const api_1 = require("../api");
16
16
  const constants_1 = require("../constants");
17
17
  const lookup_1 = require("./lookup");
18
+ const types_1 = require("./types");
18
19
  const byPriority = (schema) => ([a], [b]) => {
19
20
  var _a, _b, _c, _d, _e, _f;
21
+ (0, types_1.assertSafeProperty)(a);
22
+ (0, types_1.assertSafeProperty)(b);
20
23
  // if no priority, it becomes the last
21
24
  const aPriority = (_c = (_b = (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[a]) === null || _b === void 0 ? void 0 : _b.priority) !== null && _c !== void 0 ? _c : Infinity;
22
25
  const bPriority = (_f = (_e = (_d = schema.properties) === null || _d === void 0 ? void 0 : _d[b]) === null || _e === void 0 ? void 0 : _e.priority) !== null && _f !== void 0 ? _f : Infinity;
@@ -36,11 +39,13 @@ function formatOutput(profileObjects, allSchemas, realVers, apiToken, CONFIG, en
36
39
  const verDetails = (0, core_1.getPOVerification)({ PO, schema, realVers });
37
40
  const realProps = (0, ramda_1.omit)(constants_1.FIELDS_TO_REMOVE, PO.properties);
38
41
  const schemaNameOrGroup = (_a = schema.schema_group) !== null && _a !== void 0 ? _a : schema.name;
42
+ (0, types_1.assertSafeProperty)(schemaNameOrGroup);
39
43
  const existing = ac[schemaNameOrGroup] || [];
40
44
  const poProperties = Object.entries(realProps).sort(byPriority(schema));
41
45
  const reducedProperties = yield poProperties.reduce((acc, [key, value]) => __awaiter(this, void 0, void 0, function* () {
42
46
  var _c, _d;
43
47
  const accP = yield acc;
48
+ (0, types_1.assertSafeProperty)(key);
44
49
  return Object.assign(Object.assign({}, accP), { [key]: {
45
50
  title: ((_d = (_c = schema.properties) === null || _c === void 0 ? void 0 : _c[key]) === null || _d === void 0 ? void 0 : _d.title) || key,
46
51
  value: typeof value === "string"
@@ -51,7 +56,7 @@ function formatOutput(profileObjects, allSchemas, realVers, apiToken, CONFIG, en
51
56
  }), Promise.resolve({}));
52
57
  const thisPO = Object.assign({
53
58
  // these are always included
54
- $verified: verDetails.status, $verification_details: yield (0, api_1.resolveVerificationDetails)(verDetails.details, apiToken, envConfig), $shouldBeVerifiedFields: (_b = schema.verified_fields) === null || _b === void 0 ? void 0 : _b.map((x) => typeof x === "string" ? x : x.field),
59
+ $verified: verDetails.status, $verification_details: yield (0, api_1.resolveVerificationDetails)(verDetails.details.verifiers, apiToken, envConfig), $shouldBeVerifiedFields: (_b = schema.verified_fields) === null || _b === void 0 ? void 0 : _b.map((x) => typeof x === "string" ? x : x.field),
55
60
  // these are not included in the CSV for legacy reasons
56
61
  $nId: PO.n_id, $schemaName: schemaName, $properties: reducedProperties, $safeHarbour: schemaName === "ss_Person_Name"
57
62
  ? (yield (0, core_1.calcSafeHarbourScore)({
@@ -64,9 +69,11 @@ function formatOutput(profileObjects, allSchemas, realVers, apiToken, CONFIG, en
64
69
  .sort(byPriority(schema))
65
70
  .reduce((acc, [key, value]) => {
66
71
  var _a, _b;
72
+ (0, types_1.assertSafeProperty)(key);
67
73
  const title = readable
68
74
  ? ((_b = (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.title) || key
69
75
  : key;
76
+ (0, types_1.assertSafeProperty)(title);
70
77
  const titleV = readable
71
78
  ? `${title} Verification`
72
79
  : `${title}.verification`;
@@ -3,3 +3,4 @@ export * from "./json2csv";
3
3
  export * from "./setupMaxcryptor";
4
4
  export * from "./splitPOAndVers";
5
5
  export * from "./file";
6
+ export * from "./types";
@@ -15,3 +15,4 @@ __exportStar(require("./json2csv"), exports);
15
15
  __exportStar(require("./setupMaxcryptor"), exports);
16
16
  __exportStar(require("./splitPOAndVers"), exports);
17
17
  __exportStar(require("./file"), exports);
18
+ __exportStar(require("./types"), exports);
@@ -1,2 +1,2 @@
1
1
  import { Schema } from "@raytio/types";
2
- export declare const maybeAddLookupValue: <T extends unknown>(schema: Schema, k: string, value: T, apiToken: string) => Promise<string | number | T>;
2
+ export declare const maybeAddLookupValue: <T>(schema: Schema, k: string, value: T, apiToken: string) => Promise<string | number | T>;
@@ -0,0 +1 @@
1
+ export declare function assertSafeProperty(property: unknown): asserts property is string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSafeProperty = void 0;
4
+ function assertSafeProperty(property) {
5
+ if (typeof property !== "string" || property in {}) {
6
+ throw new Error(`Invalid property name '${property}'`);
7
+ }
8
+ }
9
+ exports.assertSafeProperty = assertSafeProperty;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { FieldVerification } from "@raytio/types";
3
- export declare function FieldVerificationBadge({ status, width, }: {
3
+ export declare const FieldVerificationBadge: ({ status, width, }: {
4
4
  status: FieldVerification | undefined;
5
5
  width: number;
6
- }): null | JSX.Element;
6
+ }) => null | JSX.Element;
@@ -7,7 +7,7 @@ exports.FieldVerificationBadge = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
8
  const types_1 = require("@raytio/types");
9
9
  const general_1 = require("../helpers/general");
10
- function FieldVerificationBadge({ status, width, }) {
10
+ const FieldVerificationBadge = ({ status, width, }) => {
11
11
  if (status === types_1.FieldVerification.VerifiedFalse) {
12
12
  return (jsx_pdf_1.default.createElement("svg", { content: (0, general_1.loadAsset)("verified_false_small.svg"), width: width }));
13
13
  }
@@ -15,5 +15,5 @@ function FieldVerificationBadge({ status, width, }) {
15
15
  return jsx_pdf_1.default.createElement("svg", { content: (0, general_1.loadAsset)("verified_tick_small.svg"), width: width });
16
16
  }
17
17
  return null;
18
- }
18
+ };
19
19
  exports.FieldVerificationBadge = FieldVerificationBadge;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { Files } from "../types";
3
- export declare function Images({ nIds, files, }: {
3
+ export declare const Images: ({ nIds, files, }: {
4
4
  nIds: string[];
5
5
  files: Files;
6
- }): JSX.Element;
6
+ }) => JSX.Element;
@@ -5,11 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Images = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
- function Images({ nIds, files, }) {
8
+ const helpers_1 = require("../../helpers");
9
+ const Images = ({ nIds, files, }) => {
9
10
  return (jsx_pdf_1.default.createElement(jsx_pdf_1.default.Fragment, null, nIds.map((nId) => {
10
11
  var _a;
11
12
  const file = (_a = files[nId]) === null || _a === void 0 ? void 0 : _a[0];
13
+ if (file)
14
+ (0, helpers_1.assertSafeProperty)(file);
12
15
  return file ? (jsx_pdf_1.default.createElement("image", { src: file, width: 300 })) : (jsx_pdf_1.default.createElement("text", null, "File not found"));
13
16
  })));
14
- }
17
+ };
15
18
  exports.Images = Images;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { Files, PdfConfig } from "../types";
3
- export declare function InnerTableRows({ key, value, imageFieldNames, config, files, color, }: {
3
+ export declare const InnerTableRows: ({ key, value, imageFieldNames, config, files, color, }: {
4
4
  key: string;
5
5
  value: any;
6
6
  files: Files;
7
7
  config: PdfConfig;
8
8
  color: string;
9
9
  imageFieldNames: string[];
10
- }): JSX.Element;
10
+ }) => JSX.Element;
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.InnerTableRows = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
8
  const ramda_1 = require("ramda");
9
+ const helpers_1 = require("../../helpers");
9
10
  const transform_1 = require("../helpers/transform");
10
11
  const Images_1 = require("./Images");
11
12
  const ValidationDisplay_1 = require("./ValidationDisplay");
12
- function InnerTableRows({ key, value, imageFieldNames, config, files, color, }) {
13
+ const InnerTableRows = ({ key, value, imageFieldNames, config, files, color, }) => {
13
14
  if (typeof value === "object" &&
14
15
  value &&
15
16
  "score" in value &&
@@ -25,11 +26,12 @@ function InnerTableRows({ key, value, imageFieldNames, config, files, color, })
25
26
  const tableValues = [...headers, ...value];
26
27
  return (jsx_pdf_1.default.createElement("table", { headerRows: 1, layout: "headerLineOnly" }, tableValues.map((data, tableValueIndex) => {
27
28
  return (jsx_pdf_1.default.createElement("row", null, headers[0].map((header) => {
29
+ (0, helpers_1.assertSafeProperty)(header);
28
30
  return (jsx_pdf_1.default.createElement("cell", null,
29
- jsx_pdf_1.default.createElement(InnerTableRows, { key: header, value: data[header] || (tableValueIndex === 0 ? header : "-"), files: files, config: config, color: color, imageFieldNames: imageFieldNames })));
31
+ jsx_pdf_1.default.createElement(exports.InnerTableRows, { key: header, value: data[header] || (tableValueIndex === 0 ? header : "-"), files: files, config: config, color: color, imageFieldNames: imageFieldNames })));
30
32
  })));
31
33
  })));
32
34
  }
33
35
  return jsx_pdf_1.default.createElement("text", { color: color }, text.slice(0, 100));
34
- }
36
+ };
35
37
  exports.InnerTableRows = InnerTableRows;
@@ -2,7 +2,7 @@
2
2
  import { POVerification } from "@raytio/types";
3
3
  import { PdfSchema } from "../types";
4
4
  export declare const FILE_MAP: Record<POVerification, string>;
5
- export declare function POVerificationBadge({ width, schema, }: {
5
+ export declare const POVerificationBadge: ({ width, schema, }: {
6
6
  width: number;
7
7
  schema: PdfSchema;
8
- }): JSX.Element;
8
+ }) => JSX.Element;
@@ -18,7 +18,7 @@ exports.FILE_MAP = {
18
18
  [types_1.POVerification.Encrypted]: "not_verified_big",
19
19
  [types_1.POVerification.Loading]: "not_verified_big",
20
20
  };
21
- function POVerificationBadge({ width, schema, }) {
21
+ const POVerificationBadge = ({ width, schema, }) => {
22
22
  const [, profileObjects] = schema;
23
23
  // TODO: this won't work if multiple POs of the same schema are shared
24
24
  const { $verified, $verification_details, $shouldBeVerifiedFields, $safeHarbour, } = profileObjects[0];
@@ -39,5 +39,5 @@ function POVerificationBadge({ width, schema, }) {
39
39
  jsx_pdf_1.default.createElement("text", { alignment: "center" },
40
40
  $safeHarbour ? "" : "Not ",
41
41
  "Safe Harbour Compliant"))))));
42
- }
42
+ };
43
43
  exports.POVerificationBadge = POVerificationBadge;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import type { AId } from "@raytio/types";
3
3
  import { Files, PdfConfig, ReportData } from "../types";
4
- export declare function Report({ data, files, config, aId, clientUrl, version, }: {
4
+ export declare const Report: ({ data, files, config, aId, clientUrl, version, }: {
5
5
  data: ReportData;
6
6
  files: Files;
7
7
  config: PdfConfig;
8
8
  aId: AId;
9
9
  clientUrl: string;
10
10
  version: string;
11
- }): JSX.Element;
11
+ }) => JSX.Element;
@@ -15,7 +15,7 @@ const general_1 = require("../helpers/general");
15
15
  const VerifyBox_1 = require("./VerifyBox");
16
16
  const constants_1 = require("../constants");
17
17
  const transform_1 = require("../helpers/transform");
18
- function Report({ data, files, config, aId, clientUrl, version, }) {
18
+ const Report = ({ data, files, config, aId, clientUrl, version, }) => {
19
19
  const schemas = Object.entries(data).filter(([, val]) => Array.isArray(val) && val.length && "$verified" in val[0]);
20
20
  // The PDF is read only; there's no reason why anyone would ever need to unlock it.
21
21
  const randomToken = (0, crypto_1.randomBytes)(32).toString("base64");
@@ -67,5 +67,5 @@ function Report({ data, files, config, aId, clientUrl, version, }) {
67
67
  currentPage,
68
68
  " of ",
69
69
  pageCount))))));
70
- }
70
+ };
71
71
  exports.Report = Report;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="jsx-pdf" />
2
- export declare function Subheader(): JSX.Element;
2
+ export declare const Subheader: () => JSX.Element;
@@ -7,7 +7,7 @@ exports.Subheader = void 0;
7
7
  const types_1 = require("@raytio/types");
8
8
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
9
9
  const FieldVerificationBadge_1 = require("./FieldVerificationBadge");
10
- function Subheader() {
10
+ const Subheader = () => {
11
11
  return (jsx_pdf_1.default.createElement(jsx_pdf_1.default.Fragment, null,
12
12
  jsx_pdf_1.default.createElement("text", { bold: true, style: "marginBottom" }, "Key:"),
13
13
  jsx_pdf_1.default.createElement("table", { layout: "noBorders" },
@@ -23,5 +23,5 @@ function Subheader() {
23
23
  jsx_pdf_1.default.createElement("cell", null,
24
24
  jsx_pdf_1.default.createElement(FieldVerificationBadge_1.FieldVerificationBadge, { width: 10, status: types_1.FieldVerification.VerifiedFalse })),
25
25
  jsx_pdf_1.default.createElement("cell", null, "Verified False")))));
26
- }
26
+ };
27
27
  exports.Subheader = Subheader;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { PdfSchema, Files, PdfConfig } from "../types";
3
- export declare function Table({ schema, files, config, }: {
3
+ export declare const Table: ({ schema, files, config, }: {
4
4
  schema: PdfSchema;
5
5
  files: Files;
6
6
  config: PdfConfig;
7
- }): JSX.Element;
7
+ }) => JSX.Element;
@@ -10,7 +10,7 @@ const FieldVerificationBadge_1 = require("./FieldVerificationBadge");
10
10
  const Images_1 = require("./Images");
11
11
  const InnerTableRows_1 = require("./InnerTableRows");
12
12
  const helpers_1 = require("../../helpers");
13
- function Table({ schema, files, config, }) {
13
+ const Table = ({ schema, files, config, }) => {
14
14
  const [, profileObjects] = schema;
15
15
  /** every fieldName in this profile object */
16
16
  const fieldNames = [
@@ -29,6 +29,7 @@ function Table({ schema, files, config, }) {
29
29
  jsx_pdf_1.default.createElement("cell", null,
30
30
  jsx_pdf_1.default.createElement("text", { color: "#12130e" }, fieldName.replace(/_/g, " "))),
31
31
  profileObjects.flatMap((PO) => {
32
+ (0, helpers_1.assertSafeProperty)(fieldName);
32
33
  const status = PO[`${fieldName}.verification`] ||
33
34
  PO[`${fieldName} Verification`];
34
35
  const color = (0, general_1.verifyColour)(status);
@@ -40,5 +41,5 @@ function Table({ schema, files, config, }) {
40
41
  jsx_pdf_1.default.createElement(InnerTableRows_1.InnerTableRows, { key: fieldName, value: PO[fieldName], files: files, config: config, color: color, imageFieldNames: imageFieldNames })),
41
42
  ];
42
43
  }))))));
43
- }
44
+ };
44
45
  exports.Table = Table;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { PdfSchema } from "../types";
3
- export declare function TableTitle({ schema }: {
3
+ export declare const TableTitle: ({ schema }: {
4
4
  schema: PdfSchema;
5
- }): JSX.Element;
5
+ }) => JSX.Element;
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TableTitle = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
8
  const helpers_1 = require("../../helpers");
9
- function TableTitle({ schema }) {
9
+ const TableTitle = ({ schema }) => {
10
10
  const [schemaTitle, POs] = schema;
11
11
  const maybeFileName = POs.some(helpers_1.isFile) && (POs[0].title || POs[0].Title);
12
12
  return (jsx_pdf_1.default.createElement("text", { bold: true, fontSize: 14, style: "marginBottom" }, maybeFileName || schemaTitle));
13
- }
13
+ };
14
14
  exports.TableTitle = TableTitle;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="jsx-pdf" />
2
2
  import { Validation } from "@raytio/types";
3
- export declare function ValidationDisplay({ value, }: {
3
+ export declare const ValidationDisplay: ({ value, }: {
4
4
  value: Validation;
5
- }): null | JSX.Element;
5
+ }) => null | JSX.Element;
@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ValidationDisplay = void 0;
7
7
  const jsx_pdf_1 = __importDefault(require("jsx-pdf"));
8
8
  const pieChart_1 = require("./pieChart");
9
+ const helpers_1 = require("../../helpers");
9
10
  const SEVERITY_COLOURS = {
10
11
  low: "#2e8bc0",
11
12
  medium: "#ff9800",
12
13
  high: "#fb7171",
13
14
  };
14
- function ValidationDisplay({ value, }) {
15
+ const ValidationDisplay = ({ value, }) => {
15
16
  const colour = value.score > 0.5 ? "#c2d887" : "#fb7171";
16
17
  return (jsx_pdf_1.default.createElement(jsx_pdf_1.default.Fragment, null,
17
18
  jsx_pdf_1.default.createElement("svg", { content: (0, pieChart_1.pieChart)(colour, value.score * 100), width: 50 }),
@@ -20,6 +21,10 @@ function ValidationDisplay({ value, }) {
20
21
  "/10",
21
22
  Object.values(value.breakdown)
22
23
  .filter((x) => x.severity && x.reason)
23
- .map((x) => (jsx_pdf_1.default.createElement("text", { color: SEVERITY_COLOURS[x.severity] }, x.reason)))));
24
- }
24
+ .map((x) => {
25
+ const key = x.severity;
26
+ (0, helpers_1.assertSafeProperty)(key);
27
+ return jsx_pdf_1.default.createElement("text", { color: SEVERITY_COLOURS[key] }, x.reason);
28
+ })));
29
+ };
25
30
  exports.ValidationDisplay = ValidationDisplay;
@@ -4,7 +4,12 @@ exports.formatDate = exports.verifyColour = exports.loadAsset = exports.asset =
4
4
  const types_1 = require("@raytio/types");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
- const asset = (name) => (0, path_1.join)(__dirname, "../../../assets/", name);
7
+ const asset = (name) => {
8
+ if (name.match(/[^A-Za-z\-_.]/) || name.includes("..")) {
9
+ throw new Error("Invalid asset name");
10
+ }
11
+ return (0, path_1.join)(__dirname, "../../../assets/", name);
12
+ };
8
13
  exports.asset = asset;
9
14
  const loadAsset = (name) => (0, fs_1.readFileSync)((0, exports.asset)(name), { encoding: "utf-8" });
10
15
  exports.loadAsset = loadAsset;
@@ -15,8 +15,12 @@ function transform(key, value, pdfConfig, imageFieldNames) {
15
15
  if (imageFieldNames === null || imageFieldNames === void 0 ? void 0 : imageFieldNames.includes(key)) {
16
16
  return exports.IS_IMAGE;
17
17
  }
18
- if (Array.isArray(value))
19
- return exports.IS_ARRAY_OF_OBJECTS;
18
+ if (Array.isArray(value)) {
19
+ if (value.every((v) => typeof v === "object")) {
20
+ return exports.IS_ARRAY_OF_OBJECTS;
21
+ }
22
+ return value.join(", ");
23
+ }
20
24
  if (typeof value !== "string") {
21
25
  return `${value}`;
22
26
  }
@@ -44,7 +44,8 @@ function processSubmission({ applicationId, instanceId, verbose, config, _suplie
44
44
  (yield decryptStage(log, config, envConfig, instanceId));
45
45
  log("Checking verifications...");
46
46
  const [profileObjects, verifications] = (0, helpers_1.splitPOAndVers)(instance.profile_objects);
47
- const realVers = yield (0, core_1.getRealVerifications)({
47
+ const realVers = yield (0, core_1.getSomeoneElsesRealVerifications)({
48
+ aId: instance.a_id,
48
49
  apiUrl: envConfig.api_url,
49
50
  profileObjects,
50
51
  verifications,
@@ -64,7 +65,7 @@ function processSubmission({ applicationId, instanceId, verbose, config, _suplie
64
65
  const files = yield (0, api_1.getFiles)(profileObjects, instance, apiToken, envConfig, applicationDecryptor);
65
66
  const instanceDataToPassOn = (0, ramda_1.omit)(constants_1.INSTANCE_FIELDS_TO_REMOVE, instance);
66
67
  // final outputs
67
- const csv = (0, helpers_1.deepJsonToCsv)(Object.assign(Object.assign({}, (0, ramda_1.omit)(["a_id", "aa_name"], instanceDataToPassOn)), (0, ramda_1.mapObjIndexed)(
68
+ const csv = (0, helpers_1.deepJsonToCsv)(Object.assign(Object.assign({}, (0, ramda_1.omit)(["a_id", "aa_name", "device_id", "source_ip"], instanceDataToPassOn)), (0, ramda_1.mapObjIndexed)(
68
69
  // TODO: (semver breaking) we omit these fields because it would a breaking change for the csv format.
69
70
  (v) => v.map((a) => {
70
71
  // TODO: (semver breaking) map the verification enums to the text to prevent a breaking change
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/decrypt-helper",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "author": "Raytio",
5
5
  "description": "A helper to decrypt data shared by Raytio users",
6
6
  "main": "dist",
@@ -21,37 +21,37 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@aws-amplify/auth": "3.4.25",
24
- "@peculiar/webcrypto": "^1.1.7",
25
- "@raytio/core": "^8.1.2",
26
- "@raytio/maxcryptor": "^3.0.1",
27
- "@raytio/types": "^5.2.0",
24
+ "@peculiar/webcrypto": "^1.2.3",
25
+ "@raytio/core": "^9.0.0",
26
+ "@raytio/maxcryptor": "^3.1.0",
27
+ "@raytio/types": "^5.2.1",
28
28
  "aws-sdk": "^2.754.0",
29
29
  "jsx-pdf": "^2.3.0",
30
30
  "localstorage-polyfill": "^1.0.1",
31
- "mime-types": "^2.1.33",
32
- "node-fetch": "^2.6.2",
33
- "pdfmake": "^0.2.2",
34
- "ramda": "^0.27.1"
31
+ "mime-types": "^2.1.34",
32
+ "node-fetch": "^2.6.7",
33
+ "pdfmake": "^0.2.4",
34
+ "ramda": "^0.28.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/jest": "^27.0.2",
37
+ "@types/jest": "^27.4.0",
38
38
  "@types/jest-image-snapshot": "^4.3.1",
39
39
  "@types/jsx-pdf": "^2.2.2",
40
40
  "@types/mime-types": "^2.1.1",
41
- "@types/node": "^14.17.18",
41
+ "@types/node": "^16.11.22",
42
42
  "@types/node-fetch": "^2.5.12",
43
- "@types/pdfmake": "^0.1.18",
44
- "@types/ramda": "^0.27.44",
45
- "dotenv": "^10.0.0",
46
- "eslint": "^7.32.0",
47
- "eslint-config-kyle": "^3.3.0",
48
- "jest": "^27.2.1",
43
+ "@types/pdfmake": "^0.1.20",
44
+ "@types/ramda": "^0.27.64",
45
+ "dotenv": "^16.0.0",
46
+ "eslint": "^8.8.0",
47
+ "eslint-config-kyle": "^8.1.1",
48
+ "jest": "^27.4.7",
49
49
  "jest-image-snapshot": "^4.5.1",
50
50
  "jest-junit": "^13.0.0",
51
- "pdf-to-img": "^1.1.1",
52
- "ts-jest": "^27.0.5",
53
- "ts-node": "^10.2.1",
54
- "typescript": "^4.4.3"
51
+ "pdf-to-img": "^1.2.0",
52
+ "ts-jest": "^27.1.3",
53
+ "ts-node": "^10.4.0",
54
+ "typescript": "^4.5.5"
55
55
  },
56
56
  "eslintConfig": {
57
57
  "extends": "kyle",