@raytio/core 11.4.1 → 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 +6 -0
- package/README.md +10 -0
- package/dist/schema/expandSchema/index.d.ts +1 -0
- package/dist/schema/expandSchema/index.js +1 -0
- package/dist/util/canonicalJsonify.js +8 -8
- package/dist/verifications/cleanInstance.d.ts +1 -1
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.js +4 -0
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +1 -0
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +1 -0
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +1 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +40 -33
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,12 @@ 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
|
+
|
|
16
22
|
## 11.4.0 (2024-12-18)
|
|
17
23
|
|
|
18
24
|
- 💥 BREAKING CHANGE: The `createAA` function now requires the application object to include a `customer_id` instead of `org_id`
|
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
|
|
@@ -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,
|
|
2
|
+
/* eslint-disable fp/no-mutating-methods, prefer-reflect */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.canonicalJsonify = void 0;
|
|
5
|
-
|
|
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
|
-
//
|
|
34
|
-
|
|
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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vebCf4Qf+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} | ${
|
|
45
|
-
${"whatever/raytio"} | ${
|
|
46
|
-
${"whatever/somethingElse"} | ${
|
|
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
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
72
|
-
url: "https://
|
|
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 =
|
|
76
|
-
const userId = "
|
|
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.
|
|
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": "
|
|
20
|
+
"@raytio/types": "8.0.0",
|
|
21
21
|
"ramda": "0.30.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|