@raytio/core 11.4.0 → 11.5.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
@@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## 11.5.0 (2025-3-30)
17
+
18
+ - Export TAG_DENYLIST
19
+ - Include `verification_type_id` in RealVer object
20
+ - Migrate to new API for AA keys
21
+
22
+ ## 11.4.0 (2024-12-18)
23
+
24
+ - 💥 BREAKING CHANGE: The `createAA` function now requires the application object to include a `customer_id` instead of `org_id`
25
+
16
26
  ## 11.3.0 (2023-12-05)
17
27
 
18
28
  - Migrate to the v3 API for instances
package/README.md CHANGED
@@ -24,6 +24,10 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
24
24
  - [ServerRelationship](#serverrelationship)
25
25
  - [VerDetails](#verdetails)
26
26
 
27
+ ### Variables
28
+
29
+ - [TAG\_DENYLIST](#tag_denylist)
30
+
27
31
  ### Functions
28
32
 
29
33
  - [calcSafeHarbourScore](#calcsafeharbourscore)
@@ -108,6 +112,12 @@ ___
108
112
  | `sourceNId?` | `NId` | - |
109
113
  | `verifiers` | `VerificationProvider`[] | - |
110
114
 
115
+ ## Variables
116
+
117
+ ### TAG\_DENYLIST
118
+
119
+ • `Const` **TAG\_DENYLIST**: `SchemaTag`[]
120
+
111
121
  ## Functions
112
122
 
113
123
  ### calcSafeHarbourScore
@@ -31,7 +31,7 @@ const createAATransitions = async ({ apiUrl, apiToken, transitions, }) => fetch(
31
31
  Authorization: `Bearer ${apiToken}`,
32
32
  "Content-Type": "application/json",
33
33
  },
34
- }).then(util_1.handleResponse);
34
+ });
35
35
  /** @internal */
36
36
  const createApplicationPublicKey = async ({ apiUrl, apiToken, aId, publicKey, }) => {
37
37
  const PO = await fetch(`${apiUrl}/db/v1/dsm_access_application_public_keys`, {
@@ -1,3 +1,4 @@
1
1
  export * from "./expandSchema";
2
2
  export * from "./sortSchemaProperties";
3
+ export * from "./constants";
3
4
  export { findSuitableLocale } from "./i18n";
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.findSuitableLocale = void 0;
18
18
  __exportStar(require("./expandSchema"), exports);
19
19
  __exportStar(require("./sortSchemaProperties"), exports);
20
+ __exportStar(require("./constants"), exports);
20
21
  var i18n_1 = require("./i18n");
21
22
  Object.defineProperty(exports, "findSuitableLocale", { enumerable: true, get: function () { return i18n_1.findSuitableLocale; } });
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
- /* eslint-disable fp/no-mutating-methods, fp/no-mutation, prefer-reflect */
2
+ /* eslint-disable fp/no-mutating-methods, prefer-reflect */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.canonicalJsonify = void 0;
5
- const isObject = (a) => Object.prototype.toString.call(a) === "[object Object]"; // TODO: wtf ?
5
+ // we only want plain objects!
6
+ const isObject = (a) => typeof a === "object" &&
7
+ a !== null &&
8
+ !Array.isArray(a) &&
9
+ Object.getPrototypeOf(a) === Object.prototype;
6
10
  const REGEX =
7
11
  // eslint-disable-next-line no-control-regex
8
12
  /[\u0000-\u001F]|"|\\|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g;
@@ -30,12 +34,8 @@ function copyObjectWithSortedKeys(object) {
30
34
  if (typeof object === "number" && object % 1 !== 0) {
31
35
  if (Number.isNaN(object) || !Number.isFinite(object))
32
36
  return "null";
33
- // float
34
- const exponent = Math.floor(Math.log10(Math.abs(object)));
35
- let mantissa = `${object / 10 ** exponent}`;
36
- if (!mantissa.includes("."))
37
- mantissa += ".0";
38
- return `${mantissa}E${exponent}`;
37
+ // TODO: Should be changed to conform to this spec: https://gibson042.github.io/canonicaljson-spec/
38
+ return object.toString(); // closer to how the backend does it atm. see https://github.com/matrix-org/python-canonicaljson?tab=readme-ov-file
39
39
  }
40
40
  if (typeof object === "string")
41
41
  return `"${object.replace(REGEX, replacer)}"`;
@@ -65,6 +65,7 @@ describe("getOwnRealVerifications", () => {
65
65
  verifier_service_id: "Minister for pike river re-entry",
66
66
  verifier_id: "v1",
67
67
  verification_date: "2020-08-28T23:11:20.592912",
68
+ verification_type_id: "vertype id2",
68
69
  request_div: "x2",
69
70
  passed: false,
70
71
  source_n_id: "n2",
@@ -170,6 +171,7 @@ describe("getOwnRealVerifications", () => {
170
171
  dataSourceNId: "Ministry of pike river mine re-entry",
171
172
  date: new Date("2020-08-28T23:11:20.592Z"),
172
173
  serviceProviderNId: "Minister for pike river re-entry",
174
+ verificationTypeId: undefined,
173
175
  verifierNId: "v1",
174
176
  },
175
177
  signature: "signatureForFirstNameMax",
@@ -187,6 +189,7 @@ describe("getOwnRealVerifications", () => {
187
189
  dataSourceNId: "Ministry of pike river mine re-entry",
188
190
  date: new Date("2020-08-28T23:11:20.592Z"),
189
191
  serviceProviderNId: "Minister for pike river re-entry",
192
+ verificationTypeId: "vertype id2",
190
193
  verifierNId: "v1",
191
194
  },
192
195
  signature: "signatureForFirstNameErika",
@@ -205,6 +208,7 @@ describe("getOwnRealVerifications", () => {
205
208
  provider: {
206
209
  dataSourceNId: "Ministry of pike river mine re-entry",
207
210
  date: new Date("2020-08-28T23:11:20.592Z"),
211
+ verificationTypeId: undefined,
208
212
  serviceProviderNId: "Minister for pike river re-entry",
209
213
  verifierNId: "v1",
210
214
  },
@@ -172,6 +172,7 @@ describe("getSomeoneElsesRealVerifications", () => {
172
172
  date: new Date("2020-08-28T23:11:20.592912Z"),
173
173
  serviceProviderNId: "verifier_service_id",
174
174
  verifierNId: "verifier_id",
175
+ verificationTypeId: undefined,
175
176
  },
176
177
  signature: "sig",
177
178
  value: "jean@example.com",
@@ -48,6 +48,7 @@ const getOwnRealVerifications = async ({ verifications, profileObjects, userId,
48
48
  provider: {
49
49
  dataSourceNId: data.verifier_source_id,
50
50
  serviceProviderNId: data.verifier_service_id,
51
+ verificationTypeId: data.verification_type_id,
51
52
  verifierNId: data.verifier_id,
52
53
  date: (0, general_1.repairDate)(data.verification_date),
53
54
  },
@@ -55,6 +55,7 @@ const getSomeoneElsesRealVerifications = async ({ aId, apiUrl, verifications, pr
55
55
  dataSourceNId: data.verifier_source_id,
56
56
  serviceProviderNId: data.verifier_service_id,
57
57
  verifierNId: data.verifier_id,
58
+ verificationTypeId: data.verification_type_id,
58
59
  date: (0, general_1.repairDate)(data.verification_date),
59
60
  },
60
61
  expired: valid_until ? (0, general_1.repairDate)(valid_until) : false,
@@ -24,26 +24,15 @@ jQE5DrM7vaTg6Gu9bjKuoeLIRzbOYK6qAWFoa0CLcN84PLjhDSRw2duatP08hcWg
24
24
  jTgOkLWnBFE7NyRU93uPp68CAwEAAQ==
25
25
  -----END PUBLIC KEY-----`
26
26
  : `-----BEGIN PUBLIC KEY-----
27
- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAgee+uBOgOsbwjMvGN1/H
28
- qpGXGJLol0Pc2KhI1fh1NBq+UGhk8PqgDd5wHZikbmrtVkvp/maIh+mbIdehY/RC
29
- ftMylvebCf4Qf+5SWzQsmB1o6nBUbwJzYE2XyvxRiNLhdIeE+GgfdpA5S3l0cDJ5
30
- B/1TagITmQUjThwTxDYZ6jlGJJ4NSjqlqeQrHhGWRLVQPWU8bYysX3jt3/uiv4tS
31
- n3TheLGY1TMlbFrVF2Spv1WxuqMZ4bX1mIotK3yEB3TaZSZaOwlUcEZ4xY+J4Vl+
32
- ZlrOgYbmzFd7UFh9UZbYZUkNSEfddEnFNFlFG3YQVt8UAumPBVJELdjiaRjTj/K4
33
- 62GAFyOcbcw9wcl69fPBnieBo2m2Dqf6U3wcrnvTnkMwjCewWXCH6FdbC4OllBZV
34
- Nrfn6zf9yX0J8ZEDEcw9ZsNLVkyl2U+Ya/h5CQt43ip/1eNM5LpTbfqBTtAH7iUO
35
- 4L9rxuSJFA2Q9kZfof6kYO9EGgMFB+GM47/Q068+IiTpifvPno4ilnowyS4hbLiy
36
- Os2yudW79flaz0a7rq5dLdSg9Mm5k7ETBm7WguDcocaiETmuYTJT2PozAGOC3+EP
37
- w5N7mQff4ecx/880FWYKQmU9Asav1V49DWSnG0ZXQ7U24dG8ANeAgKddDviJGlsh
38
- SsjKrz8LJqeoNQu30iSGZhUCAwEAAQ==
27
+ MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAgee+uBOgOsbwjMvGN1/HqpGXGJLol0Pc2KhI1fh1NBq+UGhk8PqgDd5wHZikbmrtVkvp/maIh+mbIdehY/RCftMylvebCf4Qf+5SWzQsmB1o6nBUbwJzYE2XyvxRiNLhdIeE+GgfdpA5S3l0cDJ5B/1TagITmQUjThwTxDYZ6jlGJJ4NSjqlqeQrHhGWRLVQPWU8bYysX3jt3/uiv4tSn3TheLGY1TMlbFrVF2Spv1WxuqMZ4bX1mIotK3yEB3TaZSZaOwlUcEZ4xY+J4Vl+ZlrOgYbmzFd7UFh9UZbYZUkNSEfddEnFNFlFG3YQVt8UAumPBVJELdjiaRjTj/K462GAFyOcbcw9wcl69fPBnieBo2m2Dqf6U3wcrnvTnkMwjCewWXCH6FdbC4OllBZVNrfn6zf9yX0J8ZEDEcw9ZsNLVkyl2U+Ya/h5CQt43ip/1eNM5LpTbfqBTtAH7iUO4L9rxuSJFA2Q9kZfof6kYO9EGgMFB+GM47/Q068+IiTpifvPno4ilnowyS4hbLiyOs2yudW79flaz0a7rq5dLdSg9Mm5k7ETBm7WguDcocaiETmuYTJT2PozAGOC3+EPw5N7mQff4ecx/880FWYKQmU9Asav1V49DWSnG0ZXQ7U24dG8ANeAgKddDviJGlshSsjKrz8LJqeoNQu30iSGZhUCAwEAAQ==
39
28
  -----END PUBLIC KEY-----`,
40
29
  }));
41
30
  describe("checkOwnVerification", () => {
42
31
  it.each `
43
32
  keyId | result
44
- ${undefined} | ${true}
45
- ${"whatever/raytio"} | ${true}
46
- ${"whatever/somethingElse"} | ${false}
33
+ ${undefined} | ${false}
34
+ ${"whatever/raytio"} | ${false}
35
+ ${"whatever/somethingElse"} | ${true}
47
36
  `("returns $result for a PO with keyId=$keyId", async ({ keyId, result }) => {
48
37
  //
49
38
  // This is an important integration test from ca. 2021-12-02.
@@ -51,29 +40,47 @@ describe("checkOwnVerification", () => {
51
40
  // backend, and all existing verifications will be erroneously
52
41
  // considered invalid
53
42
  //
54
- const signature = "e3ra4x0iwAvcLURf2Je8IpibByd6dvdIMUxsh5ZVOUvnQYsY99U2RkZWk63nBePy6bVWqnYnhrAR\n7bGbPpf2GYWq1WymKro9SGB552xWU1BIyJ5+78agWXDOqIthsnuRNoos52u46Mh6bq6taIj0vip6\nwIbnN8A0eS/Ulh2PpzrXKbjM6ITKDUOjEMSgbO7sDbRzZ1GbOm3Bh0WMvtniEk9dsN6wwAYI2XXb\nhaHjKfKGxv73DpFlv04+371VfP24NN8R6RGgD5YUqn9iFiHN17GlPmDGjzId/cSwz9tMshUgV2ZA\nylkAcRIyao6mYDQk75BQs6eK/dOlvUeWjEWgRpeYSJ3/5GkqiJn906+7Rj7iJ6P9+zSGN+OlhW3p\n7D0gS70ZqwLG5AVNB+N9PCUZYdaHHulQc5W8devQB3GImKhjHhH6sKLd2JdwTWeEW/SAnnqzTLTJ\nRrg7/XDoYIH20x+FVYVom5QYbjHvxdbHML19+zw0jJuhiPgKmm1bKt8fFv7T1nOeDEQa4hRZfdNu\nmdxZPt0ilBsIN7cXYn+X3nKZuEo3udCvNQx+zjSiJfKqBEw2grqBCDrF1u2HWyL77pXPJNMfxlRN\nkedWDSFSG5rXKDC0ffVRXs3Q2our6DCT2RgdDoZejBm3jKckUwOxnqzG5yTbjWsmGdduo/ePh/g=\n";
43
+ // UPDATED (see #1534). 3-26-25 We've added a new field `verification_type_id` in a verification object
44
+ const signature = `AzUQUmBKv88kehDKySMLiAjSRFNNQNLmdwv5u0fa89uzDGeNH3L7Jc2Kduw5rY09AHU6PIzxvlXE
45
+ 5KCy8k/0hPp/Gu9js1rWdcgJ0L5FLIIYEj2zSHZNthLEdi1mzLLiCbG2gvCPma0pZWobNJ/pSuMR
46
+ JvzDQuENZ4rbvacLfWl/E0NneC3weuxc2PRacsTObrDIQvjSNOOns59cO53V6sPWSk5/9Zuxd2l5
47
+ TsJ46MrtLlmN68Yg4IrQ0bWY3VATV98z1ZQJJbJCygzJgchzyxl1N82jD8FXKv0hF5WaGnK/cnHv
48
+ mVWcSm2D1EFAunctjdiEyETMemy6q/MPk8l/tkPB0I5q1aeahck9MllAIF78gu4XSYERyjVxTmMk
49
+ Zw/qdfvT22oeCL1ZXt0V5FZLKT6Ds7ueA0BTBl/0Uo4vVUS5rWOj3dkAIZo5i65ApeCrdxrq2Jmj
50
+ 41XujSbGRq5kte6C6UTnVZcyiab2dS1+yKDqdC9BchphZPvjqxc90tUBlsbeMeOMqlGxcWK4ejdM
51
+ kRblIeSeZE3UoiMQbLTV/1HCZMY/G8cFCEt78JxknrjpQ/7r45IMFoBi8LuZTVQqO7nTMs5ZILIR
52
+ QoA6x6GzJrhbuR4VE1af0FdllfB8yhfxSuCsQxAsENrpcbeRCuYgm5RsVWBRNaaKosE3FT1Rmyw=
53
+ `;
55
54
  // nId of this ver is "44371109-1a5c-41e7-b213-ff3befe194fc"
56
55
  const verObject = {
57
- passed: true,
58
- schema: "ss_NZ_Company",
59
- verifier_div: "ff341897-b847-4a56-8669-a7bef019758a",
60
- source_n_id: "f73e33bd-6673-4069-9ed4-76b57c8da2de",
61
- type: null,
62
- verifier_service_id: "",
63
- verification_date: "2021-11-16T20:35:59.147817",
64
- request_div: "95cc6670-f704-4221-beb9-3559ac47bce9",
65
- source: "NZ_COMPANY",
66
- field: "entity_type_description",
67
- v_id: "aec1c37d-f9d7-461a-b15d-1a83e41e981a",
68
- verifier_source_id: "185e9cdc-e8fb-4147-b996-3c2dd60fab59",
69
- verifier_id: "185e9cdc-e8fb-4147-b996-3c2dd60fab59",
56
+ v_id: "38d1d86f-ba46-4322-852d-c8d37eb9c84a",
57
+ field: "phone_number",
58
+ passed: false,
59
+ schema: "ss_Phone_Number",
60
+ source: "PHONE_NUMBER",
70
61
  metadata: {
71
- date_retrieved: "2021-11-16T20:36:00.732608",
72
- url: "https://api-dev.rayt.io/w-nz-mbie/v1/entities/9429033226651",
62
+ id: "VEd2b5fd534bc323e3fdc57605078028db",
63
+ url: "https://verify.twilio.com/v2/Services/VAa447486967ee88c1f59e2896f617f981/Verifications/VEd2b5fd534bc323e3fdc57605078028db",
64
+ status: "pending",
65
+ send_code_attempts: [
66
+ {
67
+ time: "2024-11-01T05:28:29.864Z",
68
+ channel: "sms",
69
+ attempt_sid: "VLdc4496dcd3fa274a015cc2f7e106f72a",
70
+ },
71
+ ],
73
72
  },
73
+ request_div: "a2998be0-59af-49fe-90fc-fc92a5fa7a8a",
74
+ source_n_id: "3a2c916d-03d6-4243-a43a-2a7a8a61b867",
75
+ verifier_id: "d796a383-5622-4e05-93b2-2fbe292d76fa",
76
+ verifier_div: "0d61af52-35da-4676-a125-39997a7a1428",
77
+ verification_date: "2024-11-01T05:28:25.846877+00:00",
78
+ verifier_source_id: "d796a383-5622-4e05-93b2-2fbe292d76fa",
79
+ verifier_service_id: "",
80
+ verification_type_id: "fde35030-930e-48b8-b00c-77bf8e87933e",
74
81
  };
75
- const value = "NZ Limited Company";
76
- const userId = "fd9c4903-65c2-4b75-b454-4fda6b682f3e"; // for 27july21 🦈
82
+ const value = 6421446202;
83
+ const userId = "c3920a9f-24fa-4101-a634-685b471c7d4d";
77
84
  expect(await (0, checkOwnVerification_1.checkOwnVerification)({
78
85
  value,
79
86
  signature,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/core",
3
- "version": "11.4.0",
3
+ "version": "11.5.0",
4
4
  "license": "MIT",
5
5
  "main": "index",
6
6
  "types": "index",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@raytio/maxcryptor": "3.1.0",
20
- "@raytio/types": "7.3.0",
20
+ "@raytio/types": "8.0.0",
21
21
  "ramda": "0.30.1"
22
22
  },
23
23
  "devDependencies": {