@raytio/core 11.2.0 → 11.3.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 +4 -0
- package/README.md +119 -30
- package/dist/accessApplication/api/__tests__/fetchKeysForSubmission.test.d.ts +1 -0
- package/dist/accessApplication/api/__tests__/fetchKeysForSubmission.test.js +28 -0
- package/dist/accessApplication/api/__tests__/fetchPOsOrAOsForSubmission.test.d.ts +1 -0
- package/dist/accessApplication/api/__tests__/fetchPOsOrAOsForSubmission.test.js +23 -0
- package/dist/accessApplication/api/__tests__/fetchRelationshipsForSubmission.test.d.ts +1 -0
- package/dist/accessApplication/api/__tests__/fetchRelationshipsForSubmission.test.js +27 -0
- package/dist/accessApplication/api/__tests__/getMissingDataForInstance.test.d.ts +1 -0
- package/dist/accessApplication/api/__tests__/getMissingDataForInstance.test.js +30 -0
- package/dist/accessApplication/api/fetchKeysForSubmission.d.ts +12 -0
- package/dist/accessApplication/api/fetchKeysForSubmission.js +16 -0
- package/dist/accessApplication/api/fetchPOsOrAOsForSubmission.d.ts +6 -0
- package/dist/accessApplication/api/fetchPOsOrAOsForSubmission.js +25 -0
- package/dist/accessApplication/api/fetchRelationshipsForSubmission.d.ts +6 -0
- package/dist/accessApplication/api/fetchRelationshipsForSubmission.js +10 -0
- package/dist/accessApplication/api/getMissingDataForInstance.d.ts +10 -0
- package/dist/accessApplication/api/getMissingDataForInstance.js +28 -0
- package/dist/accessApplication/api/index.d.ts +2 -0
- package/dist/accessApplication/api/index.js +18 -0
- package/dist/accessApplication/api/legacy/__tests__/convertRelationships.test.d.ts +1 -0
- package/dist/accessApplication/api/legacy/__tests__/convertRelationships.test.js +37 -0
- package/dist/accessApplication/api/legacy/convertRelationships.d.ts +16 -0
- package/dist/accessApplication/api/legacy/convertRelationships.js +21 -0
- package/dist/accessApplication/api/legacy/index.d.ts +1 -0
- package/dist/accessApplication/api/legacy/index.js +17 -0
- package/dist/accessApplication/createAA.js +6 -5
- package/dist/accessApplication/index.d.ts +1 -0
- package/dist/accessApplication/index.js +1 -0
- package/dist/crypto/cognitoAttributes.d.ts +1 -1
- package/dist/crypto/decryptSharedData.d.ts +2 -2
- package/dist/crypto/decryptSharedData.js +2 -5
- package/dist/crypto/getAADecryptor.d.ts +18 -3
- package/dist/crypto/getAADecryptor.js +10 -10
- package/dist/crypto/helpers.d.ts +2 -2
- package/dist/general/types.d.ts +9 -0
- package/dist/general/types.js +10 -1
- package/dist/rules/calculateScore.d.ts +1 -1
- package/dist/rules/convertInstanceToRuleInput.d.ts +3 -3
- package/dist/rules/convertInstanceToRuleInput.js +5 -2
- package/dist/rules/evaluateScoreCondition.d.ts +1 -1
- package/dist/rules/helpers/__tests__/getValuesFromPath.test.js +1 -1
- package/dist/rules/helpers/addInfiniteThresholdBoundaries.d.ts +1 -1
- package/dist/rules/helpers/checkTypeofValue.d.ts +1 -1
- package/dist/rules/helpers/getValuesFromPath.d.ts +1 -1
- package/dist/rules/helpers/thresholds.d.ts +1 -1
- package/dist/rules/operators/bool.d.ts +1 -1
- package/dist/rules/operators/date.d.ts +1 -1
- package/dist/rules/operators/hfield.d.ts +1 -1
- package/dist/rules/operators/hschema.d.ts +1 -1
- package/dist/rules/operators/index.d.ts +1 -1
- package/dist/rules/operators/number.d.ts +1 -1
- package/dist/rules/operators/string.d.ts +1 -1
- package/dist/rules/types/config.d.ts +4 -3
- package/dist/rules/types/dataValueTypes.d.ts +2 -3
- package/dist/rules/types/internal.d.ts +4 -3
- package/dist/rules/validate.d.ts +2 -2
- package/dist/schema/expandSchema/__tests__/expandSchema.test.js +2 -2
- package/dist/schema/expandSchema/__tests__/i18n.test.js +1 -1
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.js +2 -2
- package/dist/schema/expandSchema/__tests__/processSchema.test.js +2 -2
- package/dist/schema/expandSchema/addLoadingTimes.d.ts +1 -1
- package/dist/schema/expandSchema/constants.d.ts +1 -1
- package/dist/schema/expandSchema/expandSchema.d.ts +1 -1
- package/dist/schema/expandSchema/maybeUseI18n.d.ts +1 -1
- package/dist/schema/expandSchema/processSchema.d.ts +1 -1
- package/dist/schema/expandSchema/removePrivateFields.d.ts +5 -5
- package/dist/schema/expandSchema/sortSchemaProperties.d.ts +3 -3
- package/dist/schema/expandSchema/unwrapSchema.d.ts +2 -6
- package/dist/schema/labels.d.ts +2 -1
- package/dist/testHelpers.d.ts +2 -2
- package/dist/verifications/cleanInstance.d.ts +1 -1
- package/dist/verifications/getPOVerification.d.ts +1 -1
- package/dist/verifications/index.d.ts +0 -1
- package/dist/verifications/index.js +0 -1
- package/dist/verifications/safeHarbour.d.ts +2 -2
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.js +3 -3
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +2 -2
- package/dist/verifications/verifyCheck/getOwnRealVerifications.d.ts +1 -1
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.d.ts +1 -1
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +1 -1
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +1 -1
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.js +2 -2
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.d.ts +1 -1
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.js +2 -0
- package/package.json +6 -42
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./cleanInstance"), exports);
|
|
18
17
|
__exportStar(require("./getPOVerification"), exports);
|
|
19
18
|
__exportStar(require("./verifyCheck"), exports);
|
|
20
19
|
__exportStar(require("./getVerifiedBy"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProfileObject, RealVer, SafeHarbourCode, Schema } from "@raytio/types";
|
|
1
|
+
import { type ProfileObject, type RealVer, type SafeHarbourCode, type Schema, type SchemaName } from "@raytio/types";
|
|
2
2
|
/** an object listing the `xId`s for each SafeHarbourCode */
|
|
3
3
|
export type SafeHarbourObj = Partial<Record<SafeHarbourCode, string[]>>;
|
|
4
4
|
/** the response from {@link calcSafeHarbourScore} */
|
|
@@ -16,5 +16,5 @@ export declare const calcSafeHarbourScore: (data: {
|
|
|
16
16
|
person: ProfileObject;
|
|
17
17
|
profileObjects: ProfileObject[];
|
|
18
18
|
realVers: RealVer[];
|
|
19
|
-
getSchema(schemaName:
|
|
19
|
+
getSchema(schemaName: SchemaName): Promise<Schema>;
|
|
20
20
|
}) => Promise<SafeHarbourResult>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const __1 = require("..");
|
|
4
4
|
const operations_1 = require("../operations");
|
|
5
5
|
const testHelpers_1 = require("../../../testHelpers");
|
|
6
|
-
|
|
6
|
+
vi.mock("../operations");
|
|
7
7
|
/**
|
|
8
8
|
* in this test case:
|
|
9
9
|
* - there are valid verifications for fName=Max and fName=Erika, but we don't which
|
|
@@ -17,7 +17,7 @@ jest.mock("../operations");
|
|
|
17
17
|
*/
|
|
18
18
|
describe("getOwnRealVerifications", () => {
|
|
19
19
|
beforeAll(() => {
|
|
20
|
-
|
|
20
|
+
vi.fn(() => 1).mockImplementation(() => 123);
|
|
21
21
|
(0, testHelpers_1.m)(operations_1.checkOwnVerification).mockImplementation(async ({ signature, keyId }) => {
|
|
22
22
|
if (signature === "signatureForLastNameMustermannFromN2")
|
|
23
23
|
return false;
|
|
@@ -35,7 +35,7 @@ describe("getOwnRealVerifications", () => {
|
|
|
35
35
|
{
|
|
36
36
|
n_id: "nv1",
|
|
37
37
|
properties: {
|
|
38
|
-
valid_until: "2020-08-28T23:12:35.678Z",
|
|
38
|
+
valid_until: "2020-08-28T23:12:35.678Z", // this one has expired
|
|
39
39
|
verifications: [
|
|
40
40
|
{
|
|
41
41
|
signature: "signatureForFirstNameMax",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const getSomeoneElsesRealVerifications_1 = require("../getSomeoneElsesRealVerifications");
|
|
4
4
|
const operations_1 = require("../operations");
|
|
5
|
-
|
|
5
|
+
vi.mock("../operations");
|
|
6
6
|
const checkVerificationsResp = [
|
|
7
7
|
{
|
|
8
8
|
verified: false,
|
|
@@ -133,7 +133,7 @@ const verifications = [
|
|
|
133
133
|
];
|
|
134
134
|
describe("getSomeoneElsesRealVerifications", () => {
|
|
135
135
|
beforeEach(() => {
|
|
136
|
-
|
|
136
|
+
vi.resetAllMocks();
|
|
137
137
|
operations_1.checkSomeoneElsesVerifications.mockResolvedValue(checkVerificationsResp);
|
|
138
138
|
});
|
|
139
139
|
it("returns an empty array if provided nothing", async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProfileObject,
|
|
1
|
+
import type { ProfileObject, RealVer, UId, Verification } from "@raytio/types";
|
|
2
2
|
/**
|
|
3
3
|
* Given a list of verifications and decrypted profile objects, this function
|
|
4
4
|
* locally verifies the credibility of the signatures in the verifications.
|
|
@@ -64,7 +64,7 @@ const getSomeoneElsesRealVerifications = async ({ aId, apiUrl, verifications, pr
|
|
|
64
64
|
verified: data.passed,
|
|
65
65
|
nID,
|
|
66
66
|
belongsToNId: data.source_hashed_n_id
|
|
67
|
-
?
|
|
67
|
+
? (0, general_1.createHashedNId)(data.source_hashed_n_id, aId)
|
|
68
68
|
: data.source_n_id,
|
|
69
69
|
}));
|
|
70
70
|
return realVers;
|
|
@@ -7,7 +7,7 @@ const __1 = require("..");
|
|
|
7
7
|
const util_1 = require("../../../../util");
|
|
8
8
|
const checkOwnVerification_1 = require("../checkOwnVerification");
|
|
9
9
|
const sampleBundle_json_1 = __importDefault(require("./sampleBundle.json"));
|
|
10
|
-
global.fetch =
|
|
10
|
+
global.fetch = vi.fn().mockImplementation(async (url) => ({
|
|
11
11
|
text: async () => url.endsWith("raytio.pem")
|
|
12
12
|
? `-----BEGIN PUBLIC KEY-----
|
|
13
13
|
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAn9QtCqYa3H3ipFFU0xP3
|
package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.js
CHANGED
|
@@ -13,7 +13,7 @@ const toVerify = [
|
|
|
13
13
|
];
|
|
14
14
|
describe("checkSomeoneElsesVerifications", () => {
|
|
15
15
|
it("calls the API and filters out garbage", async () => {
|
|
16
|
-
global.fetch =
|
|
16
|
+
global.fetch = vi
|
|
17
17
|
.fn()
|
|
18
18
|
.mockImplementation()
|
|
19
19
|
// first fetch request
|
|
@@ -34,7 +34,7 @@ describe("checkSomeoneElsesVerifications", () => {
|
|
|
34
34
|
expect(result).toStrictEqual([{ verified: true }, { verified: false }]);
|
|
35
35
|
});
|
|
36
36
|
it("throws an error if the API rejects", async () => {
|
|
37
|
-
global.fetch =
|
|
37
|
+
global.fetch = vi
|
|
38
38
|
.fn()
|
|
39
39
|
.mockImplementation()
|
|
40
40
|
// first fetch request
|
|
@@ -31,6 +31,8 @@ const checkJsonSignature = async (data, signature, keyId) => {
|
|
|
31
31
|
if (!keyFileName || /[^\w-]/.test(keyFileName)) {
|
|
32
32
|
throw new Error("Invalid key ID");
|
|
33
33
|
}
|
|
34
|
+
// NOTE: We have to hard code the URL, we can't use an environment
|
|
35
|
+
// variable here, since this package is used outside of the monorepo.
|
|
34
36
|
const keyUrl = `https://api-docs.rayt.io/lookups/${keyFileName}.pem`;
|
|
35
37
|
const jwk = await getJwk(keyUrl);
|
|
36
38
|
const stringified = (0, util_1.canonicalJsonify)(data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raytio/core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"types": "index",
|
|
@@ -12,52 +12,16 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"docs": "sh ../../scripts/generate-docs.sh",
|
|
15
|
-
"build": "tsc && rimraf dist
|
|
16
|
-
"test": "
|
|
15
|
+
"build": "tsc && rimraf dist/**/__tests__",
|
|
16
|
+
"test": "vitest && yarn docs"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@raytio/maxcryptor": "3.1.0",
|
|
20
|
-
"@raytio/types": "7.
|
|
21
|
-
"ramda": "0.29.
|
|
20
|
+
"@raytio/types": "7.3.0",
|
|
21
|
+
"ramda": "0.29.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/ramda": "0.29.
|
|
25
|
-
"jest": "29.6.1",
|
|
26
|
-
"ts-jest": "29.1.1"
|
|
27
|
-
},
|
|
28
|
-
"jest": {
|
|
29
|
-
"transform": {
|
|
30
|
-
"^.+\\.(t|j)sx?$": "ts-jest"
|
|
31
|
-
},
|
|
32
|
-
"testEnvironment": "node",
|
|
33
|
-
"collectCoverage": false,
|
|
34
|
-
"coverageThreshold": {
|
|
35
|
-
"global": {
|
|
36
|
-
"statements": 100
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"collectCoverageFrom": [
|
|
40
|
-
"**/*.js",
|
|
41
|
-
"**/*.ts",
|
|
42
|
-
"**/*.tsx"
|
|
43
|
-
],
|
|
44
|
-
"coveragePathIgnorePatterns": [
|
|
45
|
-
"/dist/",
|
|
46
|
-
"/coverage/"
|
|
47
|
-
],
|
|
48
|
-
"modulePathIgnorePatterns": [
|
|
49
|
-
"/dist/"
|
|
50
|
-
],
|
|
51
|
-
"reporters": [
|
|
52
|
-
"default",
|
|
53
|
-
"jest-junit"
|
|
54
|
-
],
|
|
55
|
-
"setupFilesAfterEnv": [
|
|
56
|
-
"./src/jest.setup.ts"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"jest-junit": {
|
|
60
|
-
"outputDirectory": "../../tmp"
|
|
24
|
+
"@types/ramda": "0.29.7"
|
|
61
25
|
},
|
|
62
26
|
"engineStrict": true,
|
|
63
27
|
"engines": {
|