@raytio/core 10.1.0 → 11.1.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 +10 -0
- package/README.md +198 -59
- package/dist/{util/hash.d.ts → __tests__/docs.test.d.ts} +1 -1
- package/dist/__tests__/docs.test.js +24 -0
- package/dist/accessApplication/createAA.d.ts +17 -17
- package/dist/accessApplication/createAA.js +71 -71
- package/dist/accessApplication/index.d.ts +1 -1
- package/dist/accessApplication/index.js +17 -17
- package/dist/crypto/cognitoAttributes.d.ts +15 -15
- package/dist/crypto/cognitoAttributes.js +33 -33
- package/dist/crypto/decryptKeys.d.ts +1 -1
- package/dist/crypto/decryptKeys.js +33 -33
- package/dist/crypto/decryptSharedData.d.ts +26 -26
- package/dist/crypto/decryptSharedData.js +38 -38
- package/dist/crypto/getAADecryptor.d.ts +16 -16
- package/dist/crypto/getAADecryptor.js +20 -20
- package/dist/crypto/helpers.d.ts +18 -18
- package/dist/crypto/helpers.js +26 -26
- package/dist/crypto/index.d.ts +4 -4
- package/dist/crypto/index.js +21 -21
- package/dist/general/conditional.d.ts +17 -17
- package/dist/general/conditional.js +32 -32
- package/dist/general/date.d.ts +2 -2
- package/dist/general/date.js +18 -18
- package/dist/general/index.d.ts +4 -4
- package/dist/general/index.js +20 -20
- package/dist/general/password.d.ts +10 -10
- package/dist/general/password.js +31 -31
- package/dist/general/types.d.ts +6 -6
- package/dist/general/types.js +13 -13
- package/dist/index.d.ts +6 -6
- package/dist/index.js +22 -22
- package/dist/rules/calculateScore.d.ts +28 -23
- package/dist/rules/calculateScore.js +82 -76
- package/dist/rules/convertInstanceToRuleInput.d.ts +3 -3
- package/dist/rules/convertInstanceToRuleInput.js +138 -139
- package/dist/rules/evaluateScoreCondition.d.ts +2 -2
- package/dist/rules/evaluateScoreCondition.js +44 -45
- package/dist/{verifications/checkVerifications.d.ts → rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.js +27 -0
- package/dist/{verifications/checkVerificationsNew.d.ts → rules/helpers/__tests__/checkTypeofValue.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/checkTypeofValue.test.js +49 -0
- package/dist/{verifications/verifyCheck/util/canonicalJsonify.d.ts → rules/helpers/__tests__/getValuesFromPath.test.d.ts} +1 -1
- package/dist/rules/helpers/__tests__/getValuesFromPath.test.js +67 -0
- package/dist/rules/helpers/__tests__/thresholds.test.d.ts +1 -0
- package/dist/rules/helpers/__tests__/thresholds.test.js +32 -0
- package/dist/rules/helpers/addInfiniteThresholdBoundaries.d.ts +8 -8
- package/dist/rules/helpers/addInfiniteThresholdBoundaries.js +11 -11
- package/dist/rules/helpers/checkTypeofValue.d.ts +9 -9
- package/dist/rules/helpers/checkTypeofValue.js +60 -55
- package/dist/rules/helpers/getValuesFromPath.d.ts +3 -3
- package/dist/rules/helpers/getValuesFromPath.js +50 -50
- package/dist/rules/helpers/index.d.ts +5 -5
- package/dist/rules/helpers/index.js +21 -21
- package/dist/rules/helpers/symbols.d.ts +2 -2
- package/dist/rules/helpers/symbols.js +5 -5
- package/dist/rules/helpers/thresholds.d.ts +5 -5
- package/dist/rules/helpers/thresholds.js +46 -47
- package/dist/rules/index.d.ts +7 -7
- package/dist/rules/index.js +25 -25
- package/dist/rules/operators/__tests__/bool.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/bool.test.js +21 -0
- package/dist/rules/operators/__tests__/date.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/date.test.js +81 -0
- package/dist/rules/operators/__tests__/hfield.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/hfield.test.js +38 -0
- package/dist/rules/operators/__tests__/hschema.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/hschema.test.js +24 -0
- package/dist/rules/operators/__tests__/number.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/number.test.js +53 -0
- package/dist/rules/operators/__tests__/string.test.d.ts +1 -0
- package/dist/rules/operators/__tests__/string.test.js +74 -0
- package/dist/rules/operators/bool.d.ts +2 -2
- package/dist/rules/operators/bool.js +17 -17
- package/dist/rules/operators/date.d.ts +2 -2
- package/dist/rules/operators/date.js +91 -91
- package/dist/rules/operators/hfield.d.ts +2 -2
- package/dist/rules/operators/hfield.js +33 -33
- package/dist/rules/operators/hschema.d.ts +2 -2
- package/dist/rules/operators/hschema.js +21 -21
- package/dist/rules/operators/index.d.ts +3 -3
- package/dist/rules/operators/index.js +11 -11
- package/dist/rules/operators/number.d.ts +2 -2
- package/dist/rules/operators/number.js +41 -41
- package/dist/rules/operators/string.d.ts +2 -2
- package/dist/rules/operators/string.js +58 -58
- package/dist/rules/types/config.d.ts +95 -91
- package/dist/rules/types/config.js +2 -2
- package/dist/rules/types/dataValueTypes.d.ts +19 -19
- package/dist/rules/types/dataValueTypes.js +4 -4
- package/dist/rules/types/index.d.ts +3 -3
- package/dist/rules/types/index.js +19 -19
- package/dist/rules/types/internal.d.ts +20 -20
- package/dist/rules/types/internal.js +2 -2
- package/dist/rules/validate.d.ts +6 -6
- package/dist/rules/validate.js +14 -14
- package/dist/rules/version.d.ts +1 -1
- package/dist/rules/version.js +5 -5
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.js +24 -0
- package/dist/schema/expandSchema/__tests__/expandSchema.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/expandSchema.test.js +95 -0
- package/dist/schema/expandSchema/__tests__/i18n.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/i18n.test.js +32 -0
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.js +98 -0
- package/dist/schema/expandSchema/__tests__/processSchema.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/processSchema.test.js +326 -0
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.js +182 -0
- package/dist/schema/expandSchema/__tests__/util.test.d.ts +1 -0
- package/dist/schema/expandSchema/__tests__/util.test.js +19 -0
- package/dist/schema/expandSchema/addLoadingTimes.d.ts +2 -0
- package/dist/schema/expandSchema/addLoadingTimes.js +12 -0
- package/dist/schema/expandSchema/constants.d.ts +2 -0
- package/dist/schema/expandSchema/constants.js +11 -0
- package/dist/schema/expandSchema/expandSchema.d.ts +7 -0
- package/dist/schema/expandSchema/expandSchema.js +19 -0
- package/dist/schema/expandSchema/i18n.d.ts +5 -0
- package/dist/schema/expandSchema/i18n.js +20 -0
- package/dist/schema/expandSchema/index.d.ts +3 -0
- package/dist/schema/expandSchema/index.js +21 -0
- package/dist/schema/expandSchema/maybeUseI18n.d.ts +2 -0
- package/dist/schema/expandSchema/maybeUseI18n.js +40 -0
- package/dist/schema/expandSchema/processSchema.d.ts +4 -0
- package/dist/schema/expandSchema/processSchema.js +94 -0
- package/dist/schema/expandSchema/removePrivateFields.d.ts +119 -0
- package/dist/schema/expandSchema/removePrivateFields.js +15 -0
- package/dist/schema/expandSchema/sortSchemaProperties.d.ts +21 -0
- package/dist/schema/expandSchema/sortSchemaProperties.js +40 -0
- package/dist/schema/expandSchema/unwrapSchema.d.ts +6 -0
- package/dist/schema/expandSchema/unwrapSchema.js +7 -0
- package/dist/schema/expandSchema/util.d.ts +6 -0
- package/dist/schema/expandSchema/util.js +15 -0
- package/dist/schema/index.d.ts +2 -1
- package/dist/schema/index.js +18 -17
- package/dist/schema/labels.d.ts +2 -2
- package/dist/schema/labels.js +20 -20
- package/dist/util/canonicalJsonify.d.ts +1 -1
- package/dist/util/canonicalJsonify.js +50 -50
- package/dist/util/handleResponse.d.ts +1 -1
- package/dist/util/handleResponse.js +21 -21
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +18 -18
- package/dist/verifications/cleanInstance.d.ts +9 -9
- package/dist/verifications/cleanInstance.js +15 -15
- package/dist/verifications/getPOVerification.d.ts +19 -16
- package/dist/verifications/getPOVerification.js +105 -94
- package/dist/verifications/getVerifiedBy.d.ts +1 -1
- package/dist/verifications/getVerifiedBy.js +19 -19
- package/dist/verifications/index.d.ts +5 -5
- package/dist/verifications/index.js +21 -21
- package/dist/verifications/maybeRereference.d.ts +1 -1
- package/dist/verifications/maybeRereference.js +10 -10
- package/dist/verifications/safeHarbour.d.ts +20 -20
- package/dist/verifications/safeHarbour.js +67 -74
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.js +152 -0
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +205 -0
- package/dist/verifications/verifyCheck/getOwnRealVerifications.d.ts +13 -13
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +66 -64
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.d.ts +19 -19
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +72 -72
- package/dist/verifications/verifyCheck/index.d.ts +3 -3
- package/dist/verifications/verifyCheck/index.js +21 -21
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +91 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.d.ts +1 -0
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.js +49 -0
- package/dist/verifications/verifyCheck/operations/__tests__/sampleBundle.json +43 -0
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.d.ts +15 -15
- package/dist/verifications/verifyCheck/operations/checkOwnVerification.js +39 -39
- package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.d.ts +1 -1
- package/dist/verifications/verifyCheck/operations/checkSomeoneElsesVerifications.js +16 -16
- package/dist/verifications/verifyCheck/operations/index.d.ts +2 -2
- package/dist/verifications/verifyCheck/operations/index.js +18 -18
- package/package.json +13 -10
- package/dist/rules/helpers/getLhsTypeofValue.d.ts +0 -0
- package/dist/rules/helpers/getLhsTypeofValue.js +0 -1
- package/dist/rules/helpers/getValueFromPath.d.ts +0 -2
- package/dist/rules/helpers/getValueFromPath.js +0 -35
- package/dist/rules/helpers/rebuildInfiniteValues.d.ts +0 -3
- package/dist/rules/helpers/rebuildInfiniteValues.js +0 -6
- package/dist/rules/isScoreResultValid.d.ts +0 -2
- package/dist/rules/isScoreResultValid.js +0 -9
- package/dist/rules/operators/array.d.ts +0 -2
- package/dist/rules/operators/array.js +0 -74
- package/dist/rules/types/operators.d.ts +0 -19
- package/dist/rules/types/operators.js +0 -2
- package/dist/rules/types/score.d.ts +0 -50
- package/dist/rules/types/score.js +0 -2
- package/dist/util/conditional.d.ts +0 -7
- package/dist/util/conditional.js +0 -15
- package/dist/util/hash.js +0 -11
- package/dist/verifications/checkSingleVerification.d.ts +0 -9
- package/dist/verifications/checkSingleVerification.js +0 -29
- package/dist/verifications/checkVerifications.js +0 -16
- package/dist/verifications/checkVerificationsNew.js +0 -16
- package/dist/verifications/getOwnRealVerifications.d.ts +0 -14
- package/dist/verifications/getOwnRealVerifications.js +0 -64
- package/dist/verifications/getRealVerifications.d.ts +0 -22
- package/dist/verifications/getRealVerifications.js +0 -71
- package/dist/verifications/verifyCheck/util/canonicalJsonify.js +0 -48
- package/dist/verifications/verifyCheck/util/getValuesForAField.d.ts +0 -2
- package/dist/verifications/verifyCheck/util/getValuesForAField.js +0 -9
- package/dist/verifications/verifyCheck/util/index.d.ts +0 -2
- package/dist/verifications/verifyCheck/util/index.js +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## 11.1.0 (2022-04-20)
|
|
11
|
+
|
|
12
|
+
- Move `expandSchema` into core
|
|
13
|
+
|
|
14
|
+
## 11.0.0 (2022-04-20)
|
|
15
|
+
|
|
16
|
+
- 💥 BREAKING CHANGE: Changed the input arguments of `convertInstanceToRuleInput` to only require a list of `ProfileObject`s, instead of the whole `Instance` object.
|
|
17
|
+
- Any profile object with an expired field is now considered `Expired`, even if other fields are verified.
|
|
18
|
+
- Fix the `valid_until` attribute being ignored on verifications
|
|
19
|
+
|
|
10
20
|
## 10.1.0 (2022-07-06)
|
|
11
21
|
|
|
12
22
|
- move `repairDate` into core, and use it when processing verifications
|
package/README.md
CHANGED
|
@@ -16,10 +16,11 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
|
|
|
16
16
|
|
|
17
17
|
## Table of contents
|
|
18
18
|
|
|
19
|
-
### Type
|
|
19
|
+
### Type Aliases
|
|
20
20
|
|
|
21
21
|
- [SafeHarbourObj](#safeharbourobj)
|
|
22
22
|
- [SafeHarbourResult](#safeharbourresult)
|
|
23
|
+
- [VerDetails](#verdetails)
|
|
23
24
|
|
|
24
25
|
### Functions
|
|
25
26
|
|
|
@@ -30,9 +31,13 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
|
|
|
30
31
|
- [convertInstanceToRuleInput](#convertinstancetoruleinput)
|
|
31
32
|
- [createAA](#createaa)
|
|
32
33
|
- [decryptSharedData](#decryptshareddata)
|
|
34
|
+
- [evaluateRule](#evaluaterule)
|
|
35
|
+
- [expandSchema](#expandschema)
|
|
33
36
|
- [findSchemaLabel](#findschemalabel)
|
|
37
|
+
- [findSuitableLocale](#findsuitablelocale)
|
|
34
38
|
- [fromCognitoAttributes](#fromcognitoattributes)
|
|
35
39
|
- [getAADecryptor](#getaadecryptor)
|
|
40
|
+
- [getNidFromUrn](#getnidfromurn)
|
|
36
41
|
- [getOwnRealVerifications](#getownrealverifications)
|
|
37
42
|
- [getPOVerification](#getpoverification)
|
|
38
43
|
- [getSomeoneElsesRealVerifications](#getsomeoneelsesrealverifications)
|
|
@@ -44,9 +49,10 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
|
|
|
44
49
|
- [isScoreResultValid](#isscoreresultvalid)
|
|
45
50
|
- [repairDate](#repairdate)
|
|
46
51
|
- [someEncrypted](#someencrypted)
|
|
52
|
+
- [sortSchemaProperties](#sortschemaproperties)
|
|
47
53
|
- [toCognitoAttributes](#tocognitoattributes)
|
|
48
54
|
|
|
49
|
-
## Type
|
|
55
|
+
## Type Aliases
|
|
50
56
|
|
|
51
57
|
### SafeHarbourObj
|
|
52
58
|
|
|
@@ -69,11 +75,25 @@ the response from [calcSafeHarbourScore](#calcsafeharbourscore)
|
|
|
69
75
|
| `flags` | [`SafeHarbourObj`](#safeharbourobj) |
|
|
70
76
|
| `isSafe` | `boolean` |
|
|
71
77
|
|
|
78
|
+
___
|
|
79
|
+
|
|
80
|
+
### VerDetails
|
|
81
|
+
|
|
82
|
+
Ƭ **VerDetails**: `Object`
|
|
83
|
+
|
|
84
|
+
#### Type declaration
|
|
85
|
+
|
|
86
|
+
| Name | Type | Description |
|
|
87
|
+
| :------ | :------ | :------ |
|
|
88
|
+
| `expiryDate?` | `Date` | field only present for expired verifications |
|
|
89
|
+
| `sourceNId?` | `NId` | - |
|
|
90
|
+
| `verifiers` | `VerificationProvider`[] | - |
|
|
91
|
+
|
|
72
92
|
## Functions
|
|
73
93
|
|
|
74
94
|
### calcSafeHarbourScore
|
|
75
95
|
|
|
76
|
-
▸
|
|
96
|
+
▸ **calcSafeHarbourScore**(`data`): `Promise`<[`SafeHarbourResult`](#safeharbourresult)\>
|
|
77
97
|
|
|
78
98
|
The Safe Harbour Score indidicates whether a person's identity has been verified
|
|
79
99
|
to the extent requried for Safe Harbour Compliance. This requires multiple verifications
|
|
@@ -85,8 +105,8 @@ from different sources. For information, refer to the
|
|
|
85
105
|
| Name | Type |
|
|
86
106
|
| :------ | :------ |
|
|
87
107
|
| `data` | `Object` |
|
|
88
|
-
| `data.person` | `ProfileObject
|
|
89
|
-
| `data.profileObjects` | `ProfileObject
|
|
108
|
+
| `data.person` | `ProfileObject` |
|
|
109
|
+
| `data.profileObjects` | `ProfileObject`[] |
|
|
90
110
|
| `data.realVers` | `RealVer`[] |
|
|
91
111
|
| `data.getSchema` | (`schemaName`: `string`) => `Promise`<`Schema`\> |
|
|
92
112
|
|
|
@@ -118,7 +138,7 @@ ___
|
|
|
118
138
|
|
|
119
139
|
### checkJsonSignature
|
|
120
140
|
|
|
121
|
-
▸
|
|
141
|
+
▸ **checkJsonSignature**(`data`, `signature`): `Promise`<`boolean`\>
|
|
122
142
|
|
|
123
143
|
checks that a json object was signed by the provided signature. Unless you're
|
|
124
144
|
dealing with bundled verifications, you should use `getOwnRealVerifications`
|
|
@@ -161,13 +181,13 @@ ___
|
|
|
161
181
|
|
|
162
182
|
### convertInstanceToRuleInput
|
|
163
183
|
|
|
164
|
-
▸
|
|
184
|
+
▸ **convertInstanceToRuleInput**(`POs`, `realVers`, `getSchema`): `Promise`<`RuleData`\>
|
|
165
185
|
|
|
166
186
|
#### Parameters
|
|
167
187
|
|
|
168
188
|
| Name | Type |
|
|
169
189
|
| :------ | :------ |
|
|
170
|
-
| `
|
|
190
|
+
| `POs` | `ProfileObject`[] |
|
|
171
191
|
| `realVers` | `RealVer`[] |
|
|
172
192
|
| `getSchema` | (`schemaName`: `string`) => `Promise`<`Schema`\> |
|
|
173
193
|
|
|
@@ -179,7 +199,7 @@ ___
|
|
|
179
199
|
|
|
180
200
|
### createAA
|
|
181
201
|
|
|
182
|
-
▸ **createAA**(
|
|
202
|
+
▸ **createAA**(`«destructured»`): `Promise`<`AA`\>
|
|
183
203
|
|
|
184
204
|
Creates an Access Application and associated public+private keys.
|
|
185
205
|
|
|
@@ -192,12 +212,12 @@ as well as the `userDoc` data which is stored in the user's cognito attributes.
|
|
|
192
212
|
|
|
193
213
|
| Name | Type |
|
|
194
214
|
| :------ | :------ |
|
|
195
|
-
|
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
215
|
+
| `«destructured»` | `Object` |
|
|
216
|
+
| › `apiToken` | `string` |
|
|
217
|
+
| › `apiUrl` | `string` |
|
|
218
|
+
| › `application` | `Omit`<`AA`, ``"a_id"``\> |
|
|
219
|
+
| › `maxcryptor` | `DataEncryptorI` |
|
|
220
|
+
| › `userDoc` | `UserDoc` |
|
|
201
221
|
|
|
202
222
|
#### Returns
|
|
203
223
|
|
|
@@ -207,7 +227,7 @@ ___
|
|
|
207
227
|
|
|
208
228
|
### decryptSharedData
|
|
209
229
|
|
|
210
|
-
▸
|
|
230
|
+
▸ **decryptSharedData**(`«destructured»`): `Promise`<{ `applicationDecryptor`: `ApplicationDataEncryptorI` ; `instance`: `Instance` }\>
|
|
211
231
|
|
|
212
232
|
Decrypts any encrypted properties included in the supplied `instanceData`.
|
|
213
233
|
If nothing is encrypted the supplied `instanceData` is returned.
|
|
@@ -220,24 +240,70 @@ supply a `onCorruptedData` function which returns a value to use instead.
|
|
|
220
240
|
|
|
221
241
|
| Name | Type |
|
|
222
242
|
| :------ | :------ |
|
|
223
|
-
|
|
|
224
|
-
| `
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
243
|
+
| `«destructured»` | `Object` |
|
|
244
|
+
| › `apiToken` | `string` |
|
|
245
|
+
| › `apiUrl` | `string` |
|
|
246
|
+
| › `instanceData` | `Instance` |
|
|
247
|
+
| › `maxcryptor` | `DataEncryptorI` |
|
|
248
|
+
| › `onCorruptedData?` | (`fieldName`: `string`, `fieldValue`: `Encrypted`, `error`: `Error`) => `any` |
|
|
229
249
|
|
|
230
250
|
#### Returns
|
|
231
251
|
|
|
232
|
-
`Promise
|
|
252
|
+
`Promise`<{ `applicationDecryptor`: `ApplicationDataEncryptorI` ; `instance`: `Instance` }\>
|
|
233
253
|
|
|
234
254
|
a copy of `instanceData` with all properties decrypted.
|
|
235
255
|
|
|
236
256
|
___
|
|
237
257
|
|
|
258
|
+
### evaluateRule
|
|
259
|
+
|
|
260
|
+
▸ **evaluateRule**(`rule`, `data`): `Object`
|
|
261
|
+
|
|
262
|
+
evaluates an individual rule, normally you should use [calculateScore](#calculatescore)
|
|
263
|
+
|
|
264
|
+
#### Parameters
|
|
265
|
+
|
|
266
|
+
| Name | Type |
|
|
267
|
+
| :------ | :------ |
|
|
268
|
+
| `rule` | `ScoreRule` |
|
|
269
|
+
| `data` | `RuleData` |
|
|
270
|
+
|
|
271
|
+
#### Returns
|
|
272
|
+
|
|
273
|
+
`Object`
|
|
274
|
+
|
|
275
|
+
| Name | Type |
|
|
276
|
+
| :------ | :------ |
|
|
277
|
+
| `passed` | `boolean` |
|
|
278
|
+
| `score` | `number` |
|
|
279
|
+
|
|
280
|
+
___
|
|
281
|
+
|
|
282
|
+
### expandSchema
|
|
283
|
+
|
|
284
|
+
▸ **expandSchema**(`wrappedSchema`, `allUnexpandedSchemas`, `userLocales`): `Schema`
|
|
285
|
+
|
|
286
|
+
❣️ This is the main function to transform a schema from
|
|
287
|
+
the JSON that the API returns, into a `Schema` object that's useful
|
|
288
|
+
to the client.
|
|
289
|
+
|
|
290
|
+
#### Parameters
|
|
291
|
+
|
|
292
|
+
| Name | Type |
|
|
293
|
+
| :------ | :------ |
|
|
294
|
+
| `wrappedSchema` | `WrappedSchema` |
|
|
295
|
+
| `allUnexpandedSchemas` | `WrappedSchema`[] |
|
|
296
|
+
| `userLocales` | readonly `string`[] |
|
|
297
|
+
|
|
298
|
+
#### Returns
|
|
299
|
+
|
|
300
|
+
`Schema`
|
|
301
|
+
|
|
302
|
+
___
|
|
303
|
+
|
|
238
304
|
### findSchemaLabel
|
|
239
305
|
|
|
240
|
-
▸
|
|
306
|
+
▸ **findSchemaLabel**(`labels`): `undefined` \| `string`
|
|
241
307
|
|
|
242
308
|
Finds the label (on a profile object) which is the schema name
|
|
243
309
|
|
|
@@ -253,9 +319,29 @@ Finds the label (on a profile object) which is the schema name
|
|
|
253
319
|
|
|
254
320
|
___
|
|
255
321
|
|
|
322
|
+
### findSuitableLocale
|
|
323
|
+
|
|
324
|
+
▸ **findSuitableLocale**(`options`, `langs`): `undefined` \| `string`
|
|
325
|
+
|
|
326
|
+
Selects the most suitable locale to use from a list of options.
|
|
327
|
+
Returns undefined if there is no language that the user speaks
|
|
328
|
+
|
|
329
|
+
#### Parameters
|
|
330
|
+
|
|
331
|
+
| Name | Type |
|
|
332
|
+
| :------ | :------ |
|
|
333
|
+
| `options` | `string`[] |
|
|
334
|
+
| `langs` | readonly `string`[] |
|
|
335
|
+
|
|
336
|
+
#### Returns
|
|
337
|
+
|
|
338
|
+
`undefined` \| `string`
|
|
339
|
+
|
|
340
|
+
___
|
|
341
|
+
|
|
256
342
|
### fromCognitoAttributes
|
|
257
343
|
|
|
258
|
-
▸
|
|
344
|
+
▸ **fromCognitoAttributes**(`attributes`): `UserDoc`
|
|
259
345
|
|
|
260
346
|
This function converts Cognito's userAttributes into a maxcryptor UserDoc.
|
|
261
347
|
The userAttributes come from `const attributes = await Auth.userAttributes(user)`
|
|
@@ -274,32 +360,64 @@ ___
|
|
|
274
360
|
|
|
275
361
|
### getAADecryptor
|
|
276
362
|
|
|
277
|
-
▸ **getAADecryptor**(
|
|
363
|
+
▸ **getAADecryptor**(`«destructured»`): `Promise`<{ `decryptor`: `ApplicationEncryptor` ; `publicKeyNId`: `NId` }\>
|
|
278
364
|
|
|
279
365
|
Fetchs the public and private keys for an Access Application, then initializes
|
|
280
|
-
the [Maxcryptor](https://npm.im/@raytio/maxcryptor)'s `ApplicationEncryptor`.
|
|
366
|
+
the [https://npm.im/@raytio/maxcryptor|Maxcryptor](https://npm.im/@raytio/maxcryptor|Maxcryptor)'s `ApplicationEncryptor`.
|
|
281
367
|
|
|
282
368
|
#### Parameters
|
|
283
369
|
|
|
284
370
|
| Name | Type |
|
|
285
371
|
| :------ | :------ |
|
|
286
|
-
|
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
372
|
+
| `«destructured»` | `Object` |
|
|
373
|
+
| › `aId` | `AId` |
|
|
374
|
+
| › `apiToken` | `string` |
|
|
375
|
+
| › `apiUrl` | `string` |
|
|
376
|
+
| › `maxcryptor` | `DataEncryptorI` |
|
|
291
377
|
|
|
292
378
|
#### Returns
|
|
293
379
|
|
|
294
|
-
`Promise
|
|
380
|
+
`Promise`<{ `decryptor`: `ApplicationEncryptor` ; `publicKeyNId`: `NId` }\>
|
|
295
381
|
|
|
296
382
|
an `ApplicationEncryptor` and the public key of the Access Application
|
|
297
383
|
|
|
298
384
|
___
|
|
299
385
|
|
|
386
|
+
### getNidFromUrn
|
|
387
|
+
|
|
388
|
+
▸ **getNidFromUrn**(`urn`): `NId`
|
|
389
|
+
|
|
390
|
+
two overloads - if you provide undefined, you might get undefined back
|
|
391
|
+
|
|
392
|
+
#### Parameters
|
|
393
|
+
|
|
394
|
+
| Name | Type |
|
|
395
|
+
| :------ | :------ |
|
|
396
|
+
| `urn` | \`urn:user:${string}\` \| \`urn:profile\_object:${string}\` \| \`urn:instance:${string}\` \| \`urn:schema:${string}\` \| \`urn:temp\_object:${string}\` \| \`urn:document:${string}\` |
|
|
397
|
+
|
|
398
|
+
#### Returns
|
|
399
|
+
|
|
400
|
+
`NId`
|
|
401
|
+
|
|
402
|
+
▸ **getNidFromUrn**(`urn`): `undefined` \| `NId`
|
|
403
|
+
|
|
404
|
+
two overloads - if you provide undefined, you might get undefined back
|
|
405
|
+
|
|
406
|
+
#### Parameters
|
|
407
|
+
|
|
408
|
+
| Name | Type |
|
|
409
|
+
| :------ | :------ |
|
|
410
|
+
| `urn` | `undefined` \| \`urn:user:${string}\` \| \`urn:profile\_object:${string}\` \| \`urn:instance:${string}\` \| \`urn:schema:${string}\` \| \`urn:temp\_object:${string}\` \| \`urn:document:${string}\` |
|
|
411
|
+
|
|
412
|
+
#### Returns
|
|
413
|
+
|
|
414
|
+
`undefined` \| `NId`
|
|
415
|
+
|
|
416
|
+
___
|
|
417
|
+
|
|
300
418
|
### getOwnRealVerifications
|
|
301
419
|
|
|
302
|
-
▸
|
|
420
|
+
▸ **getOwnRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
303
421
|
|
|
304
422
|
Given a list of verifications and decrypted profile objects, this function
|
|
305
423
|
locally verifies the credibility of the signatures in the verifications.
|
|
@@ -310,10 +428,10 @@ This function does NOT call the API, except to fetch the public key.
|
|
|
310
428
|
|
|
311
429
|
| Name | Type |
|
|
312
430
|
| :------ | :------ |
|
|
313
|
-
|
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
431
|
+
| `«destructured»` | `Object` |
|
|
432
|
+
| › `profileObjects` | `ProfileObject`[] |
|
|
433
|
+
| › `userId` | `UId` |
|
|
434
|
+
| › `verifications` | `Verification`[] |
|
|
317
435
|
|
|
318
436
|
#### Returns
|
|
319
437
|
|
|
@@ -325,7 +443,7 @@ ___
|
|
|
325
443
|
|
|
326
444
|
### getPOVerification
|
|
327
445
|
|
|
328
|
-
▸ **getPOVerification**(
|
|
446
|
+
▸ **getPOVerification**(`«destructured»`): `Object`
|
|
329
447
|
|
|
330
448
|
Determines the verification status of a profile object, and its individual fields.
|
|
331
449
|
|
|
@@ -333,10 +451,10 @@ Determines the verification status of a profile object, and its individual field
|
|
|
333
451
|
|
|
334
452
|
| Name | Type |
|
|
335
453
|
| :------ | :------ |
|
|
336
|
-
|
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
454
|
+
| `«destructured»` | `Object` |
|
|
455
|
+
| › `PO` | `ProfileObject` \| `ProfileObjectForUpload` |
|
|
456
|
+
| › `realVers` | `RealVer`[] |
|
|
457
|
+
| › `schema` | `Schema` |
|
|
340
458
|
|
|
341
459
|
#### Returns
|
|
342
460
|
|
|
@@ -344,9 +462,7 @@ Determines the verification status of a profile object, and its individual field
|
|
|
344
462
|
|
|
345
463
|
| Name | Type |
|
|
346
464
|
| :------ | :------ |
|
|
347
|
-
| `details` | `
|
|
348
|
-
| `details.sourceNId?` | `NId` |
|
|
349
|
-
| `details.verifiers` | `VerificationProvider`[] |
|
|
465
|
+
| `details` | [`VerDetails`](#verdetails) |
|
|
350
466
|
| `fieldVerifications` | `Record`<`string`, `FieldVerification`\> |
|
|
351
467
|
| `status` | `POVerification` |
|
|
352
468
|
|
|
@@ -354,7 +470,7 @@ ___
|
|
|
354
470
|
|
|
355
471
|
### getSomeoneElsesRealVerifications
|
|
356
472
|
|
|
357
|
-
▸
|
|
473
|
+
▸ **getSomeoneElsesRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
358
474
|
|
|
359
475
|
Given a list of verifications and decrypted profile objects, this function calls
|
|
360
476
|
the Raytio API to verify the credibility of these verifications, returning only valid
|
|
@@ -366,7 +482,7 @@ verifications.
|
|
|
366
482
|
|
|
367
483
|
| Name | Type |
|
|
368
484
|
| :------ | :------ |
|
|
369
|
-
|
|
|
485
|
+
| `«destructured»` | `Props` |
|
|
370
486
|
|
|
371
487
|
#### Returns
|
|
372
488
|
|
|
@@ -380,7 +496,9 @@ ___
|
|
|
380
496
|
|
|
381
497
|
▸ **hashPassword**(`password`): `Promise`<`string`\>
|
|
382
498
|
|
|
383
|
-
**`
|
|
499
|
+
**`Deprecated`**
|
|
500
|
+
|
|
501
|
+
legacy feature, see #1252
|
|
384
502
|
|
|
385
503
|
AWS Cognito never gets the raw password. We send them
|
|
386
504
|
a hashed verison using PBKDF2 with SHA-256 and 10,000
|
|
@@ -402,12 +520,13 @@ ___
|
|
|
402
520
|
|
|
403
521
|
### isConditionMet
|
|
404
522
|
|
|
405
|
-
▸
|
|
523
|
+
▸ **isConditionMet**(`condition`, `formValues`): `boolean`
|
|
406
524
|
|
|
407
525
|
Checks all other form values in case any have a
|
|
408
526
|
trigger value that makes this field required.
|
|
409
527
|
|
|
410
|
-
**`
|
|
528
|
+
**`Example`**
|
|
529
|
+
|
|
411
530
|
```json
|
|
412
531
|
[
|
|
413
532
|
{ "if": { "age": [17, 18], "city": ["Taupō"] } },
|
|
@@ -432,7 +551,7 @@ ___
|
|
|
432
551
|
|
|
433
552
|
### isEncrypted
|
|
434
553
|
|
|
435
|
-
▸
|
|
554
|
+
▸ **isEncrypted**(`value`): value is Encrypted
|
|
436
555
|
|
|
437
556
|
Determines where the input is an encrypted Raytio object
|
|
438
557
|
|
|
@@ -444,7 +563,7 @@ Determines where the input is an encrypted Raytio object
|
|
|
444
563
|
|
|
445
564
|
#### Returns
|
|
446
565
|
|
|
447
|
-
value is Encrypted
|
|
566
|
+
value is Encrypted
|
|
448
567
|
|
|
449
568
|
true or false depending on whether the input is an encrypted Raytio object
|
|
450
569
|
|
|
@@ -452,7 +571,7 @@ ___
|
|
|
452
571
|
|
|
453
572
|
### isEncryptedFile
|
|
454
573
|
|
|
455
|
-
▸
|
|
574
|
+
▸ **isEncryptedFile**(`value`): value is Encrypted
|
|
456
575
|
|
|
457
576
|
Determines where the input is an encrypted Raytio file
|
|
458
577
|
|
|
@@ -464,7 +583,7 @@ Determines where the input is an encrypted Raytio file
|
|
|
464
583
|
|
|
465
584
|
#### Returns
|
|
466
585
|
|
|
467
|
-
value is Encrypted
|
|
586
|
+
value is Encrypted
|
|
468
587
|
|
|
469
588
|
true or false depending on whether the input is an encrypted Raytio file
|
|
470
589
|
|
|
@@ -472,7 +591,7 @@ ___
|
|
|
472
591
|
|
|
473
592
|
### isScoreConfigValid
|
|
474
593
|
|
|
475
|
-
▸
|
|
594
|
+
▸ **isScoreConfigValid**(`x`): x is ScoreConfig
|
|
476
595
|
|
|
477
596
|
determines whether a `ScoreConfig` object is valid
|
|
478
597
|
|
|
@@ -490,7 +609,7 @@ ___
|
|
|
490
609
|
|
|
491
610
|
### isScoreResultValid
|
|
492
611
|
|
|
493
|
-
▸
|
|
612
|
+
▸ **isScoreResultValid**(`x`): x is ScoreResult
|
|
494
613
|
|
|
495
614
|
determines whether a `ScoreResult` object is valid
|
|
496
615
|
|
|
@@ -526,7 +645,7 @@ ___
|
|
|
526
645
|
|
|
527
646
|
### someEncrypted
|
|
528
647
|
|
|
529
|
-
▸
|
|
648
|
+
▸ **someEncrypted**<`T`, `K`\>(`...args`): `number`
|
|
530
649
|
|
|
531
650
|
Given a profile object's properties, returns the number
|
|
532
651
|
of properties that are encryted.
|
|
@@ -550,9 +669,29 @@ of properties that are encryted.
|
|
|
550
669
|
|
|
551
670
|
___
|
|
552
671
|
|
|
672
|
+
### sortSchemaProperties
|
|
673
|
+
|
|
674
|
+
▸ **sortSchemaProperties**(`properties`): `Section`[]
|
|
675
|
+
|
|
676
|
+
Schema properties are an object, so they need to be converted into an
|
|
677
|
+
array, grouped by the group tag, and then sorted based on the `priority`
|
|
678
|
+
attribute within their group.
|
|
679
|
+
|
|
680
|
+
#### Parameters
|
|
681
|
+
|
|
682
|
+
| Name | Type |
|
|
683
|
+
| :------ | :------ |
|
|
684
|
+
| `properties` | `Record`<`string`, `SchemaField`\> |
|
|
685
|
+
|
|
686
|
+
#### Returns
|
|
687
|
+
|
|
688
|
+
`Section`[]
|
|
689
|
+
|
|
690
|
+
___
|
|
691
|
+
|
|
553
692
|
### toCognitoAttributes
|
|
554
693
|
|
|
555
|
-
▸
|
|
694
|
+
▸ **toCognitoAttributes**(`userDoc`): `Object`
|
|
556
695
|
|
|
557
696
|
Given a `UserDoc` from the maxcryptor, this returns an object
|
|
558
697
|
which you can provide to `Auth.updateUserAttributes()`. It is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const util_1 = require("util");
|
|
7
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
8
|
+
describe("docs", () => {
|
|
9
|
+
it("generates a nice README for @raytio/core & @raytio/types", async () => {
|
|
10
|
+
console.log("(1/4) Running `yarn docs` for core...");
|
|
11
|
+
console.log(Object.values(await execAsync("yarn docs")).join("\n"));
|
|
12
|
+
console.log("(2/4) Reading README.md for core...");
|
|
13
|
+
const readmeCore = await fs_1.promises.readFile("README.md", { encoding: "utf-8" });
|
|
14
|
+
expect(readmeCore).toMatchSnapshot();
|
|
15
|
+
// types & core are in the same test to avoid jest parallelizing them
|
|
16
|
+
console.log("(3/4) Running `yarn docs` for types...");
|
|
17
|
+
console.log(Object.values(await execAsync("cd ../types && yarn docs")).join("\n"));
|
|
18
|
+
console.log("(4/4) Reading README.md for types...");
|
|
19
|
+
const readmeTypes = await fs_1.promises.readFile("../types/README.md", {
|
|
20
|
+
encoding: "utf-8",
|
|
21
|
+
});
|
|
22
|
+
expect(readmeTypes).toMatchSnapshot();
|
|
23
|
+
}, 30000);
|
|
24
|
+
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { Maxcryptor, UserDoc } from "@raytio/maxcryptor";
|
|
2
|
-
import type { AA } from "@raytio/types";
|
|
3
|
-
/**
|
|
4
|
-
* Creates an Access Application and associated public+private keys.
|
|
5
|
-
*
|
|
6
|
-
* The user must be part of an organization, and you need to include the `orgId`.
|
|
7
|
-
*
|
|
8
|
-
* You must also supply an apiToken and an instance of the maxcryptor for that user,
|
|
9
|
-
* as well as the `userDoc` data which is stored in the user's cognito attributes.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createAA({ apiUrl, apiToken, userDoc, maxcryptor, application, }: {
|
|
12
|
-
apiUrl: string;
|
|
13
|
-
apiToken: string;
|
|
14
|
-
application: Omit<AA, "a_id">;
|
|
15
|
-
userDoc: UserDoc;
|
|
16
|
-
maxcryptor: Maxcryptor;
|
|
17
|
-
}): Promise<AA>;
|
|
1
|
+
import type { Maxcryptor, UserDoc } from "@raytio/maxcryptor";
|
|
2
|
+
import type { AA } from "@raytio/types";
|
|
3
|
+
/**
|
|
4
|
+
* Creates an Access Application and associated public+private keys.
|
|
5
|
+
*
|
|
6
|
+
* The user must be part of an organization, and you need to include the `orgId`.
|
|
7
|
+
*
|
|
8
|
+
* You must also supply an apiToken and an instance of the maxcryptor for that user,
|
|
9
|
+
* as well as the `userDoc` data which is stored in the user's cognito attributes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAA({ apiUrl, apiToken, userDoc, maxcryptor, application, }: {
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
apiToken: string;
|
|
14
|
+
application: Omit<AA, "a_id">;
|
|
15
|
+
userDoc: UserDoc;
|
|
16
|
+
maxcryptor: Maxcryptor;
|
|
17
|
+
}): Promise<AA>;
|