@raytio/core 11.5.0 → 11.7.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/README.md +1708 -217
- package/dist/accessApplication/api/legacy/convertRelationships.d.ts +3 -5
- package/dist/accessApplication/api/legacy/convertRelationships.js +3 -3
- package/dist/crypto/cognitoAttributes.d.ts +3 -0
- package/dist/crypto/cognitoAttributes.js +15 -4
- package/dist/crypto/getAADecryptor.d.ts +1 -1
- package/dist/crypto/getAADecryptor.js +1 -3
- package/dist/crypto/index.d.ts +3 -0
- package/dist/crypto/index.js +6 -0
- package/dist/crypto/kdf/argon2.d.ts +67 -0
- package/dist/crypto/kdf/argon2.js +99 -0
- package/dist/crypto/kdf/index.d.ts +43 -0
- package/dist/crypto/kdf/index.js +106 -0
- package/dist/crypto/kdf/pbkdf2.d.ts +16 -0
- package/dist/crypto/kdf/pbkdf2.js +45 -0
- package/dist/crypto/kdf/twoSecretKdf.d.ts +37 -0
- package/dist/crypto/kdf/twoSecretKdf.js +66 -0
- package/dist/crypto/kdf/types.d.ts +65 -0
- package/dist/crypto/kdf/types.js +50 -0
- package/dist/crypto/kdf/utils.d.ts +59 -0
- package/dist/crypto/kdf/utils.js +110 -0
- package/dist/crypto/localSecret/format.d.ts +48 -0
- package/dist/crypto/localSecret/format.js +157 -0
- package/dist/crypto/localSecret/generator.d.ts +23 -0
- package/dist/crypto/localSecret/generator.js +53 -0
- package/dist/crypto/localSecret/index.d.ts +12 -0
- package/dist/crypto/localSecret/index.js +46 -0
- package/dist/crypto/localSecret/storage.d.ts +53 -0
- package/dist/crypto/localSecret/storage.js +207 -0
- package/dist/crypto/localSecret/types.d.ts +68 -0
- package/dist/crypto/localSecret/types.js +31 -0
- package/dist/crypto/pgpKey/encryption.d.ts +49 -0
- package/dist/crypto/pgpKey/encryption.js +104 -0
- package/dist/crypto/pgpKey/export.d.ts +59 -0
- package/dist/crypto/pgpKey/export.js +322 -0
- package/dist/crypto/pgpKey/format.d.ts +61 -0
- package/dist/crypto/pgpKey/format.js +143 -0
- package/dist/crypto/pgpKey/generator.d.ts +20 -0
- package/dist/crypto/pgpKey/generator.js +76 -0
- package/dist/crypto/pgpKey/import.d.ts +69 -0
- package/dist/crypto/pgpKey/import.js +239 -0
- package/dist/crypto/pgpKey/index.d.ts +19 -0
- package/dist/crypto/pgpKey/index.js +67 -0
- package/dist/crypto/pgpKey/signing.d.ts +44 -0
- package/dist/crypto/pgpKey/signing.js +71 -0
- package/dist/crypto/pgpKey/storage.d.ts +43 -0
- package/dist/crypto/pgpKey/storage.js +141 -0
- package/dist/crypto/pgpKey/types.d.ts +86 -0
- package/dist/crypto/pgpKey/types.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/rules/calculateScore.d.ts +1 -1
- package/dist/rules/convertInstanceToRuleInput.js +99 -97
- package/dist/rules/evaluateBadge.d.ts +36 -0
- package/dist/rules/evaluateBadge.js +36 -0
- package/dist/rules/index.d.ts +1 -0
- package/dist/rules/index.js +1 -0
- package/dist/rules/types/config.d.ts +1 -1
- package/dist/rules/types/dataValueTypes.d.ts +4 -4
- package/dist/schema/expandSchema/constants.js +1 -1
- package/dist/schema/expandSchema/expandSchema.d.ts +3 -3
- package/dist/schema/expandSchema/expandSchema.js +4 -4
- package/dist/schema/expandSchema/i18n.d.ts +6 -1
- package/dist/schema/expandSchema/i18n.js +32 -4
- package/dist/schema/expandSchema/maybeUseI18n.d.ts +2 -2
- package/dist/schema/expandSchema/maybeUseI18n.js +68 -11
- package/dist/schema/expandSchema/processSchema.js +14 -5
- package/dist/schema/expandSchema/removePrivateFields.d.ts +75 -22
- package/dist/schema/expandSchema/sortSchemaProperties.d.ts +4 -1
- package/dist/schema/expandSchema/sortSchemaProperties.js +24 -1
- package/dist/schema/labels.js +1 -2
- package/dist/util/canonicalJsonify.d.ts +7 -1
- package/dist/util/canonicalJsonify.js +3 -2
- package/dist/verifications/safeHarbour.js +5 -0
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +2 -0
- package/package.json +6 -4
- package/dist/__tests__/docs.test.d.ts +0 -1
- package/dist/__tests__/docs.test.js +0 -24
- package/dist/accessApplication/api/__tests__/fetchKeysForSubmission.test.d.ts +0 -1
- package/dist/accessApplication/api/__tests__/fetchKeysForSubmission.test.js +0 -28
- package/dist/accessApplication/api/__tests__/fetchPOsOrAOsForSubmission.test.d.ts +0 -1
- package/dist/accessApplication/api/__tests__/fetchPOsOrAOsForSubmission.test.js +0 -23
- package/dist/accessApplication/api/__tests__/fetchRelationshipsForSubmission.test.d.ts +0 -1
- package/dist/accessApplication/api/__tests__/fetchRelationshipsForSubmission.test.js +0 -27
- package/dist/accessApplication/api/__tests__/getMissingDataForInstance.test.d.ts +0 -1
- package/dist/accessApplication/api/__tests__/getMissingDataForInstance.test.js +0 -30
- package/dist/accessApplication/api/legacy/__tests__/convertRelationships.test.d.ts +0 -1
- package/dist/accessApplication/api/legacy/__tests__/convertRelationships.test.js +0 -37
- package/dist/rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.d.ts +0 -1
- package/dist/rules/helpers/__tests__/addInfiniteThresholdBoundaries.test.js +0 -27
- package/dist/rules/helpers/__tests__/checkTypeofValue.test.d.ts +0 -1
- package/dist/rules/helpers/__tests__/checkTypeofValue.test.js +0 -49
- package/dist/rules/helpers/__tests__/getValuesFromPath.test.d.ts +0 -1
- package/dist/rules/helpers/__tests__/getValuesFromPath.test.js +0 -67
- package/dist/rules/helpers/__tests__/thresholds.test.d.ts +0 -1
- package/dist/rules/helpers/__tests__/thresholds.test.js +0 -32
- package/dist/rules/operators/__tests__/bool.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/bool.test.js +0 -21
- package/dist/rules/operators/__tests__/date.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/date.test.js +0 -81
- package/dist/rules/operators/__tests__/hfield.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/hfield.test.js +0 -38
- package/dist/rules/operators/__tests__/hschema.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/hschema.test.js +0 -24
- package/dist/rules/operators/__tests__/number.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/number.test.js +0 -53
- package/dist/rules/operators/__tests__/string.test.d.ts +0 -1
- package/dist/rules/operators/__tests__/string.test.js +0 -74
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/addLoadingTimes.test.js +0 -24
- package/dist/schema/expandSchema/__tests__/expandSchema.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/expandSchema.test.js +0 -96
- package/dist/schema/expandSchema/__tests__/i18n.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/i18n.test.js +0 -32
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/maybeUseI18n.test.js +0 -98
- package/dist/schema/expandSchema/__tests__/processSchema.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/processSchema.test.js +0 -326
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/sortSchemaProperties.test.js +0 -182
- package/dist/schema/expandSchema/__tests__/util.test.d.ts +0 -1
- package/dist/schema/expandSchema/__tests__/util.test.js +0 -19
- package/dist/verifications/cleanInstance.d.ts +0 -9
- package/dist/verifications/cleanInstance.js +0 -15
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/__tests__/getOwnRealVerifications.test.js +0 -221
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +0 -206
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +0 -138
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/operations/__tests__/checkSomeoneElsesVerifications.test.js +0 -49
- package/dist/verifications/verifyCheck/operations/__tests__/sampleBundle.json +0 -44
package/README.md
CHANGED
|
@@ -16,8 +16,39 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
|
|
|
16
16
|
|
|
17
17
|
## Table of contents
|
|
18
18
|
|
|
19
|
+
### Classes
|
|
20
|
+
|
|
21
|
+
- [LocalSecretRequiredError](classes/LocalSecretRequiredError.md)
|
|
22
|
+
- [PGPKeyExportError](classes/PGPKeyExportError.md)
|
|
23
|
+
- [PGPKeyImportError](classes/PGPKeyImportError.md)
|
|
24
|
+
- [UnknownKdfAlgorithmError](classes/UnknownKdfAlgorithmError.md)
|
|
25
|
+
|
|
26
|
+
### Interfaces
|
|
27
|
+
|
|
28
|
+
- [Argon2idConfig](interfaces/Argon2idConfig.md)
|
|
29
|
+
- [EncryptedPrivateKey](interfaces/EncryptedPrivateKey.md)
|
|
30
|
+
- [ExportPGPKeyOptions](interfaces/ExportPGPKeyOptions.md)
|
|
31
|
+
- [ExportedPGPKey](interfaces/ExportedPGPKey.md)
|
|
32
|
+
- [FormattedLocalSecret](interfaces/FormattedLocalSecret.md)
|
|
33
|
+
- [KdfResult](interfaces/KdfResult.md)
|
|
34
|
+
- [KeyValidationResult](interfaces/KeyValidationResult.md)
|
|
35
|
+
- [LocalSecretStorage](interfaces/LocalSecretStorage.md)
|
|
36
|
+
- [PGPKeyPair](interfaces/PGPKeyPair.md)
|
|
37
|
+
- [PGPKeyStorage](interfaces/PGPKeyStorage.md)
|
|
38
|
+
- [PGPPublicKeyProperties](interfaces/PGPPublicKeyProperties.md)
|
|
39
|
+
- [ParsedPGPKey](interfaces/ParsedPGPKey.md)
|
|
40
|
+
- [Pbkdf2Config](interfaces/Pbkdf2Config.md)
|
|
41
|
+
- [StoredLocalSecret](interfaces/StoredLocalSecret.md)
|
|
42
|
+
- [StoredPGPPrivateKey](interfaces/StoredPGPPrivateKey.md)
|
|
43
|
+
|
|
19
44
|
### Type Aliases
|
|
20
45
|
|
|
46
|
+
- [BadgeDefinition](#badgedefinition)
|
|
47
|
+
- [BadgeResult](#badgeresult)
|
|
48
|
+
- [BadgeState](#badgestate)
|
|
49
|
+
- [BadgeStateDisplay](#badgestatedisplay)
|
|
50
|
+
- [KdfConfig](#kdfconfig)
|
|
51
|
+
- [PGPKeyAlgorithm](#pgpkeyalgorithm)
|
|
21
52
|
- [SafeHarbourObj](#safeharbourobj)
|
|
22
53
|
- [SafeHarbourResult](#safeharbourresult)
|
|
23
54
|
- [ServerAA](#serveraa)
|
|
@@ -26,43 +57,176 @@ If you wish to use `@raytio/core` directly, an example of configuring polyfills
|
|
|
26
57
|
|
|
27
58
|
### Variables
|
|
28
59
|
|
|
60
|
+
- [AES\_GCM\_IV\_SIZE](#aes_gcm_iv_size)
|
|
61
|
+
- [DEFAULT\_ARGON2ID\_PARAMS](#default_argon2id_params)
|
|
62
|
+
- [KEY\_FINGERPRINT\_LENGTH](#key_fingerprint_length)
|
|
63
|
+
- [LOCAL\_SECRET\_CHARSET](#local_secret_charset)
|
|
64
|
+
- [LOCAL\_SECRET\_DB\_CONFIG](#local_secret_db_config)
|
|
65
|
+
- [LOCAL\_SECRET\_GROUP\_SIZE](#local_secret_group_size)
|
|
66
|
+
- [LOCAL\_SECRET\_SIZE](#local_secret_size)
|
|
67
|
+
- [PGP\_KEY\_DB\_CONFIG](#pgp_key_db_config)
|
|
29
68
|
- [TAG\_DENYLIST](#tag_denylist)
|
|
30
69
|
|
|
31
70
|
### Functions
|
|
32
71
|
|
|
72
|
+
- [base64ToUint8Array](#base64touint8array)
|
|
73
|
+
- [bytesToPem](#bytestopem)
|
|
33
74
|
- [calcSafeHarbourScore](#calcsafeharbourscore)
|
|
34
75
|
- [calculateScore](#calculatescore)
|
|
76
|
+
- [canonicalJsonify](#canonicaljsonify)
|
|
35
77
|
- [checkJsonSignature](#checkjsonsignature)
|
|
78
|
+
- [computeKeyFingerprint](#computekeyfingerprint)
|
|
79
|
+
- [constantTimeEqual](#constanttimeequal)
|
|
36
80
|
- [convertInstanceToRuleInput](#convertinstancetoruleinput)
|
|
37
81
|
- [convertServerRelationship](#convertserverrelationship)
|
|
38
82
|
- [createAA](#createaa)
|
|
83
|
+
- [createArgon2idConfig](#createargon2idconfig)
|
|
39
84
|
- [createHashedNId](#createhashednid)
|
|
85
|
+
- [createIndexedDBPGPKeyStorage](#createindexeddbpgpkeystorage)
|
|
86
|
+
- [createIndexedDBStorage](#createindexeddbstorage)
|
|
87
|
+
- [decryptPrivateKey](#decryptprivatekey)
|
|
40
88
|
- [decryptSharedData](#decryptshareddata)
|
|
89
|
+
- [deleteLocalSecret](#deletelocalsecret)
|
|
90
|
+
- [deletePGPPrivateKey](#deletepgpprivatekey)
|
|
91
|
+
- [deriveArgon2id](#deriveargon2id)
|
|
92
|
+
- [deriveKey](#derivekey)
|
|
93
|
+
- [derivePbkdf2](#derivepbkdf2)
|
|
94
|
+
- [deriveTwoSecretKdf](#derivetwosecretkdf)
|
|
95
|
+
- [encryptPrivateKey](#encryptprivatekey)
|
|
96
|
+
- [evaluateBadge](#evaluatebadge)
|
|
41
97
|
- [evaluateRule](#evaluaterule)
|
|
98
|
+
- [evaluateUserBadges](#evaluateuserbadges)
|
|
42
99
|
- [expandSchema](#expandschema)
|
|
100
|
+
- [exportPGPKeyToArmored](#exportpgpkeytoarmored)
|
|
101
|
+
- [extractPemType](#extractpemtype)
|
|
43
102
|
- [findSchemaLabel](#findschemalabel)
|
|
44
103
|
- [findSuitableLocale](#findsuitablelocale)
|
|
104
|
+
- [formatFingerprint](#formatfingerprint)
|
|
105
|
+
- [formatLocalSecret](#formatlocalsecret)
|
|
45
106
|
- [fromCognitoAttributes](#fromcognitoattributes)
|
|
107
|
+
- [generateDeviceId](#generatedeviceid)
|
|
108
|
+
- [generateLocalSecret](#generatelocalsecret)
|
|
109
|
+
- [generatePGPKeyPair](#generatepgpkeypair)
|
|
110
|
+
- [generateRandomBytes](#generaterandombytes)
|
|
111
|
+
- [generateSalt](#generatesalt)
|
|
46
112
|
- [getAADecryptor](#getaadecryptor)
|
|
47
113
|
- [getAAPublicKey](#getaapublickey)
|
|
114
|
+
- [getKdfVersion](#getkdfversion)
|
|
115
|
+
- [getLocalSecret](#getlocalsecret)
|
|
116
|
+
- [getLocalSecretRecord](#getlocalsecretrecord)
|
|
48
117
|
- [getMissingDataForInstance](#getmissingdataforinstance)
|
|
49
118
|
- [getNidFromUrn](#getnidfromurn)
|
|
119
|
+
- [getOrCreateDeviceId](#getorcreatedeviceid)
|
|
50
120
|
- [getOwnRealVerifications](#getownrealverifications)
|
|
121
|
+
- [getPGPPrivateKey](#getpgpprivatekey)
|
|
51
122
|
- [getPOVerification](#getpoverification)
|
|
52
123
|
- [getSomeoneElsesRealVerifications](#getsomeoneelsesrealverifications)
|
|
124
|
+
- [hasLocalSecret](#haslocalsecret)
|
|
125
|
+
- [hasPGPPrivateKey](#haspgpprivatekey)
|
|
53
126
|
- [hashPassword](#hashpassword)
|
|
127
|
+
- [importPrivateKey](#importprivatekey)
|
|
128
|
+
- [importPublicKey](#importpublickey)
|
|
129
|
+
- [isArgon2Available](#isargon2available)
|
|
130
|
+
- [isArgon2idConfig](#isargon2idconfig)
|
|
131
|
+
- [isArmoredPGPKey](#isarmoredpgpkey)
|
|
54
132
|
- [isConditionMet](#isconditionmet)
|
|
55
133
|
- [isEncrypted](#isencrypted)
|
|
56
134
|
- [isEncryptedFile](#isencryptedfile)
|
|
135
|
+
- [isPbkdf2Config](#ispbkdf2config)
|
|
136
|
+
- [isPemFormat](#ispemformat)
|
|
57
137
|
- [isScoreConfigValid](#isscoreconfigvalid)
|
|
58
138
|
- [isScoreResultValid](#isscoreresultvalid)
|
|
139
|
+
- [isValidFormattedLocalSecret](#isvalidformattedlocalsecret)
|
|
140
|
+
- [isValidLocalSecret](#isvalidlocalsecret)
|
|
141
|
+
- [maskLocalSecret](#masklocalsecret)
|
|
142
|
+
- [normalizePassword](#normalizepassword)
|
|
143
|
+
- [parseArmoredPGPKey](#parsearmoredpgpkey)
|
|
144
|
+
- [parseLocalSecret](#parselocalsecret)
|
|
145
|
+
- [pemToBytes](#pemtobytes)
|
|
59
146
|
- [repairDate](#repairdate)
|
|
147
|
+
- [requiresLocalSecret](#requireslocalsecret)
|
|
148
|
+
- [setArgon2Module](#setargon2module)
|
|
149
|
+
- [signData](#signdata)
|
|
150
|
+
- [signText](#signtext)
|
|
60
151
|
- [someEncrypted](#someencrypted)
|
|
61
152
|
- [sortSchemaProperties](#sortschemaproperties)
|
|
153
|
+
- [storeLocalSecret](#storelocalsecret)
|
|
154
|
+
- [storePGPPrivateKey](#storepgpprivatekey)
|
|
62
155
|
- [toCognitoAttributes](#tocognitoattributes)
|
|
156
|
+
- [uint8ArrayToBase64](#uint8arraytobase64)
|
|
157
|
+
- [validateImportedKey](#validateimportedkey)
|
|
158
|
+
- [verifySignature](#verifysignature)
|
|
159
|
+
- [verifyTextSignature](#verifytextsignature)
|
|
160
|
+
- [xorBytes](#xorbytes)
|
|
63
161
|
|
|
64
162
|
## Type Aliases
|
|
65
163
|
|
|
164
|
+
### BadgeDefinition
|
|
165
|
+
|
|
166
|
+
Ƭ **BadgeDefinition**: `CommonFields`<`BId`\> & { `display`: { `states`: `Record`<[`BadgeState`](#badgestate), [`BadgeStateDisplay`](#badgestatedisplay)\> } ; `name`: `string` ; `ruleset`: `ScoreConfig` }
|
|
167
|
+
|
|
168
|
+
Badge definition as stored in dsm_schema_badges
|
|
169
|
+
|
|
170
|
+
___
|
|
171
|
+
|
|
172
|
+
### BadgeResult
|
|
173
|
+
|
|
174
|
+
Ƭ **BadgeResult**: `Object`
|
|
175
|
+
|
|
176
|
+
Result of evaluating a badge for a user
|
|
177
|
+
|
|
178
|
+
#### Type declaration
|
|
179
|
+
|
|
180
|
+
| Name | Type |
|
|
181
|
+
| :------ | :------ |
|
|
182
|
+
| `badgeId` | `string` |
|
|
183
|
+
| `badgeName` | `string` |
|
|
184
|
+
| `diagnostics` | `ScoreResult`[``"diagnostics"``] |
|
|
185
|
+
| `display` | [`BadgeStateDisplay`](#badgestatedisplay) |
|
|
186
|
+
| `state` | [`BadgeState`](#badgestate) |
|
|
187
|
+
|
|
188
|
+
___
|
|
189
|
+
|
|
190
|
+
### BadgeState
|
|
191
|
+
|
|
192
|
+
Ƭ **BadgeState**: ``"not_met"`` \| ``"partially_met"`` \| ``"fully_met"``
|
|
193
|
+
|
|
194
|
+
Standard badge states - consistent across all badges
|
|
195
|
+
|
|
196
|
+
___
|
|
197
|
+
|
|
198
|
+
### BadgeStateDisplay
|
|
199
|
+
|
|
200
|
+
Ƭ **BadgeStateDisplay**: `Object`
|
|
201
|
+
|
|
202
|
+
Display configuration for a single badge state
|
|
203
|
+
|
|
204
|
+
#### Type declaration
|
|
205
|
+
|
|
206
|
+
| Name | Type |
|
|
207
|
+
| :------ | :------ |
|
|
208
|
+
| `color` | `string` |
|
|
209
|
+
| `icon` | `string` |
|
|
210
|
+
| `label` | `string` |
|
|
211
|
+
|
|
212
|
+
___
|
|
213
|
+
|
|
214
|
+
### KdfConfig
|
|
215
|
+
|
|
216
|
+
Ƭ **KdfConfig**: [`Pbkdf2Config`](interfaces/Pbkdf2Config.md) \| [`Argon2idConfig`](interfaces/Argon2idConfig.md)
|
|
217
|
+
|
|
218
|
+
Union type for all KDF configurations
|
|
219
|
+
|
|
220
|
+
___
|
|
221
|
+
|
|
222
|
+
### PGPKeyAlgorithm
|
|
223
|
+
|
|
224
|
+
Ƭ **PGPKeyAlgorithm**: ``"RSA-4096"`` \| ``"RSA-2048"``
|
|
225
|
+
|
|
226
|
+
Supported PGP key algorithms
|
|
227
|
+
|
|
228
|
+
___
|
|
229
|
+
|
|
66
230
|
### SafeHarbourObj
|
|
67
231
|
|
|
68
232
|
Ƭ **SafeHarbourObj**: `Partial`<`Record`<`SafeHarbourCode`, `string`[]\>\>
|
|
@@ -94,7 +258,7 @@ ___
|
|
|
94
258
|
|
|
95
259
|
### ServerRelationship
|
|
96
260
|
|
|
97
|
-
Ƭ **ServerRelationship**: `Omit`<`Relationship`, ``"p_id"`` \| ``"start"`` \| ``"end"``\> & { `from_id`: `NId` ; `id`: `PId`
|
|
261
|
+
Ƭ **ServerRelationship**: `Omit`<`Relationship`, ``"p_id"`` \| ``"start"`` \| ``"end"``\> & { `from_id`: `NId` ; `id`: `PId` ; `to_i_id?`: `IId` \| ``null`` ; `to_id?`: `NId` \| ``null`` }
|
|
98
262
|
|
|
99
263
|
This type represents the relationship format returned by the Postgres API
|
|
100
264
|
|
|
@@ -114,12 +278,144 @@ ___
|
|
|
114
278
|
|
|
115
279
|
## Variables
|
|
116
280
|
|
|
281
|
+
### AES\_GCM\_IV\_SIZE
|
|
282
|
+
|
|
283
|
+
• `Const` **AES\_GCM\_IV\_SIZE**: ``12``
|
|
284
|
+
|
|
285
|
+
AES-GCM IV size in bytes
|
|
286
|
+
|
|
287
|
+
___
|
|
288
|
+
|
|
289
|
+
### DEFAULT\_ARGON2ID\_PARAMS
|
|
290
|
+
|
|
291
|
+
• `Const` **DEFAULT\_ARGON2ID\_PARAMS**: `Object`
|
|
292
|
+
|
|
293
|
+
Default Argon2id parameters (matching Bitwarden recommendations)
|
|
294
|
+
|
|
295
|
+
#### Type declaration
|
|
296
|
+
|
|
297
|
+
| Name | Type |
|
|
298
|
+
| :------ | :------ |
|
|
299
|
+
| `iterations` | ``3`` |
|
|
300
|
+
| `memory` | ``65536`` |
|
|
301
|
+
| `parallelism` | ``4`` |
|
|
302
|
+
|
|
303
|
+
___
|
|
304
|
+
|
|
305
|
+
### KEY\_FINGERPRINT\_LENGTH
|
|
306
|
+
|
|
307
|
+
• `Const` **KEY\_FINGERPRINT\_LENGTH**: ``40``
|
|
308
|
+
|
|
309
|
+
Key fingerprint length (hex characters)
|
|
310
|
+
|
|
311
|
+
___
|
|
312
|
+
|
|
313
|
+
### LOCAL\_SECRET\_CHARSET
|
|
314
|
+
|
|
315
|
+
• `Const` **LOCAL\_SECRET\_CHARSET**: ``"23456789ABCDEFGHJKLMNPQRSTUVWXYZ"``
|
|
316
|
+
|
|
317
|
+
Character set for LocalSecret display format
|
|
318
|
+
|
|
319
|
+
Excludes ambiguous characters: 0, 1, I, O
|
|
320
|
+
|
|
321
|
+
___
|
|
322
|
+
|
|
323
|
+
### LOCAL\_SECRET\_DB\_CONFIG
|
|
324
|
+
|
|
325
|
+
• `Const` **LOCAL\_SECRET\_DB\_CONFIG**: `Object`
|
|
326
|
+
|
|
327
|
+
IndexedDB configuration for LocalSecret storage
|
|
328
|
+
|
|
329
|
+
#### Type declaration
|
|
330
|
+
|
|
331
|
+
| Name | Type |
|
|
332
|
+
| :------ | :------ |
|
|
333
|
+
| `name` | ``"raytio-secrets"`` |
|
|
334
|
+
| `storeName` | ``"local-secrets"`` |
|
|
335
|
+
| `version` | ``1`` |
|
|
336
|
+
|
|
337
|
+
___
|
|
338
|
+
|
|
339
|
+
### LOCAL\_SECRET\_GROUP\_SIZE
|
|
340
|
+
|
|
341
|
+
• `Const` **LOCAL\_SECRET\_GROUP\_SIZE**: ``6``
|
|
342
|
+
|
|
343
|
+
Number of characters per group in formatted display
|
|
344
|
+
|
|
345
|
+
___
|
|
346
|
+
|
|
347
|
+
### LOCAL\_SECRET\_SIZE
|
|
348
|
+
|
|
349
|
+
• `Const` **LOCAL\_SECRET\_SIZE**: ``32``
|
|
350
|
+
|
|
351
|
+
LocalSecret size in bytes (256 bits)
|
|
352
|
+
|
|
353
|
+
___
|
|
354
|
+
|
|
355
|
+
### PGP\_KEY\_DB\_CONFIG
|
|
356
|
+
|
|
357
|
+
• `Const` **PGP\_KEY\_DB\_CONFIG**: `Object`
|
|
358
|
+
|
|
359
|
+
IndexedDB configuration for PGP key storage
|
|
360
|
+
|
|
361
|
+
#### Type declaration
|
|
362
|
+
|
|
363
|
+
| Name | Type |
|
|
364
|
+
| :------ | :------ |
|
|
365
|
+
| `name` | ``"raytio-pgp-keys"`` |
|
|
366
|
+
| `storeName` | ``"private-keys"`` |
|
|
367
|
+
| `version` | ``1`` |
|
|
368
|
+
|
|
369
|
+
___
|
|
370
|
+
|
|
117
371
|
### TAG\_DENYLIST
|
|
118
372
|
|
|
119
373
|
• `Const` **TAG\_DENYLIST**: `SchemaTag`[]
|
|
120
374
|
|
|
121
375
|
## Functions
|
|
122
376
|
|
|
377
|
+
### base64ToUint8Array
|
|
378
|
+
|
|
379
|
+
▸ **base64ToUint8Array**(`base64`): `Uint8Array`
|
|
380
|
+
|
|
381
|
+
Convert a base64 string to Uint8Array
|
|
382
|
+
|
|
383
|
+
#### Parameters
|
|
384
|
+
|
|
385
|
+
| Name | Type |
|
|
386
|
+
| :------ | :------ |
|
|
387
|
+
| `base64` | `string` |
|
|
388
|
+
|
|
389
|
+
#### Returns
|
|
390
|
+
|
|
391
|
+
`Uint8Array`
|
|
392
|
+
|
|
393
|
+
___
|
|
394
|
+
|
|
395
|
+
### bytesToPem
|
|
396
|
+
|
|
397
|
+
▸ **bytesToPem**(`bytes`, `type`): `string`
|
|
398
|
+
|
|
399
|
+
Convert raw bytes to PEM format
|
|
400
|
+
|
|
401
|
+
Encodes the bytes as base64 and wraps with PEM headers.
|
|
402
|
+
Base64 content is wrapped at 64 characters per line per RFC 7468.
|
|
403
|
+
|
|
404
|
+
#### Parameters
|
|
405
|
+
|
|
406
|
+
| Name | Type | Description |
|
|
407
|
+
| :------ | :------ | :------ |
|
|
408
|
+
| `bytes` | `Uint8Array` | Raw bytes to encode |
|
|
409
|
+
| `type` | `string` | PEM type (e.g., "PUBLIC KEY", "PRIVATE KEY") |
|
|
410
|
+
|
|
411
|
+
#### Returns
|
|
412
|
+
|
|
413
|
+
`string`
|
|
414
|
+
|
|
415
|
+
PEM-formatted string
|
|
416
|
+
|
|
417
|
+
___
|
|
418
|
+
|
|
123
419
|
### calcSafeHarbourScore
|
|
124
420
|
|
|
125
421
|
▸ **calcSafeHarbourScore**(`data`): `Promise`<[`SafeHarbourResult`](#safeharbourresult)\>
|
|
@@ -165,6 +461,27 @@ Might throw an error.
|
|
|
165
461
|
|
|
166
462
|
___
|
|
167
463
|
|
|
464
|
+
### canonicalJsonify
|
|
465
|
+
|
|
466
|
+
▸ **canonicalJsonify**(`object`): `string`
|
|
467
|
+
|
|
468
|
+
Creates a canonical JSON string representation of an object.
|
|
469
|
+
|
|
470
|
+
Spec compliant, and matches
|
|
471
|
+
https://gitlab.com/raytio/mono/-/blob/devo/common/signing/signing/canonical_json.py
|
|
472
|
+
|
|
473
|
+
#### Parameters
|
|
474
|
+
|
|
475
|
+
| Name | Type |
|
|
476
|
+
| :------ | :------ |
|
|
477
|
+
| `object` | `unknown` |
|
|
478
|
+
|
|
479
|
+
#### Returns
|
|
480
|
+
|
|
481
|
+
`string`
|
|
482
|
+
|
|
483
|
+
___
|
|
484
|
+
|
|
168
485
|
### checkJsonSignature
|
|
169
486
|
|
|
170
487
|
▸ **checkJsonSignature**(`data`, `signature`, `keyId`): `Promise`<`boolean`\>
|
|
@@ -187,6 +504,49 @@ or `getSomeoneElsesRealVerifications` instead.
|
|
|
187
504
|
|
|
188
505
|
___
|
|
189
506
|
|
|
507
|
+
### computeKeyFingerprint
|
|
508
|
+
|
|
509
|
+
▸ **computeKeyFingerprint**(`publicKeyBytes`): `Promise`<`string`\>
|
|
510
|
+
|
|
511
|
+
Compute SHA-256 fingerprint of public key bytes
|
|
512
|
+
|
|
513
|
+
#### Parameters
|
|
514
|
+
|
|
515
|
+
| Name | Type | Description |
|
|
516
|
+
| :------ | :------ | :------ |
|
|
517
|
+
| `publicKeyBytes` | `Uint8Array` | Raw public key bytes (SPKI format) |
|
|
518
|
+
|
|
519
|
+
#### Returns
|
|
520
|
+
|
|
521
|
+
`Promise`<`string`\>
|
|
522
|
+
|
|
523
|
+
First 40 hex characters of SHA-256 hash
|
|
524
|
+
|
|
525
|
+
___
|
|
526
|
+
|
|
527
|
+
### constantTimeEqual
|
|
528
|
+
|
|
529
|
+
▸ **constantTimeEqual**(`a`, `b`): `boolean`
|
|
530
|
+
|
|
531
|
+
Constant-time comparison of two byte arrays
|
|
532
|
+
|
|
533
|
+
Prevents timing attacks when comparing secrets.
|
|
534
|
+
|
|
535
|
+
#### Parameters
|
|
536
|
+
|
|
537
|
+
| Name | Type | Description |
|
|
538
|
+
| :------ | :------ | :------ |
|
|
539
|
+
| `a` | `Uint8Array` | First byte array |
|
|
540
|
+
| `b` | `Uint8Array` | Second byte array |
|
|
541
|
+
|
|
542
|
+
#### Returns
|
|
543
|
+
|
|
544
|
+
`boolean`
|
|
545
|
+
|
|
546
|
+
true if arrays are equal
|
|
547
|
+
|
|
548
|
+
___
|
|
549
|
+
|
|
190
550
|
### convertInstanceToRuleInput
|
|
191
551
|
|
|
192
552
|
▸ **convertInstanceToRuleInput**(`POs`, `realVers`, `getSchema`): `Promise`<`RuleData`\>
|
|
@@ -253,6 +613,27 @@ as well as the `userDoc` data which is stored in the user's cognito attributes.
|
|
|
253
613
|
|
|
254
614
|
___
|
|
255
615
|
|
|
616
|
+
### createArgon2idConfig
|
|
617
|
+
|
|
618
|
+
▸ **createArgon2idConfig**(`salt`, `params?`): [`Argon2idConfig`](interfaces/Argon2idConfig.md)
|
|
619
|
+
|
|
620
|
+
Create a new Argon2id configuration
|
|
621
|
+
|
|
622
|
+
#### Parameters
|
|
623
|
+
|
|
624
|
+
| Name | Type | Description |
|
|
625
|
+
| :------ | :------ | :------ |
|
|
626
|
+
| `salt` | `string` | Base64 encoded salt (optional, will generate if not provided) |
|
|
627
|
+
| `params?` | `Partial`<`Pick`<[`Argon2idConfig`](interfaces/Argon2idConfig.md), ``"iterations"`` \| ``"memory"`` \| ``"parallelism"``\>\> | Optional custom parameters |
|
|
628
|
+
|
|
629
|
+
#### Returns
|
|
630
|
+
|
|
631
|
+
[`Argon2idConfig`](interfaces/Argon2idConfig.md)
|
|
632
|
+
|
|
633
|
+
Argon2idConfig ready for storage
|
|
634
|
+
|
|
635
|
+
___
|
|
636
|
+
|
|
256
637
|
### createHashedNId
|
|
257
638
|
|
|
258
639
|
▸ **createHashedNId**(`nId`, `aId`): `NId`
|
|
@@ -276,6 +657,56 @@ This was first introduced in #1048
|
|
|
276
657
|
|
|
277
658
|
___
|
|
278
659
|
|
|
660
|
+
### createIndexedDBPGPKeyStorage
|
|
661
|
+
|
|
662
|
+
▸ **createIndexedDBPGPKeyStorage**(): [`PGPKeyStorage`](interfaces/PGPKeyStorage.md)
|
|
663
|
+
|
|
664
|
+
Create a PGPKeyStorage implementation using IndexedDB
|
|
665
|
+
|
|
666
|
+
#### Returns
|
|
667
|
+
|
|
668
|
+
[`PGPKeyStorage`](interfaces/PGPKeyStorage.md)
|
|
669
|
+
|
|
670
|
+
___
|
|
671
|
+
|
|
672
|
+
### createIndexedDBStorage
|
|
673
|
+
|
|
674
|
+
▸ **createIndexedDBStorage**(): [`LocalSecretStorage`](interfaces/LocalSecretStorage.md)
|
|
675
|
+
|
|
676
|
+
Create a LocalSecretStorage implementation using IndexedDB
|
|
677
|
+
|
|
678
|
+
#### Returns
|
|
679
|
+
|
|
680
|
+
[`LocalSecretStorage`](interfaces/LocalSecretStorage.md)
|
|
681
|
+
|
|
682
|
+
___
|
|
683
|
+
|
|
684
|
+
### decryptPrivateKey
|
|
685
|
+
|
|
686
|
+
▸ **decryptPrivateKey**(`encryptedPrivateKey`, `iv`, `kek`): `Promise`<`Uint8Array`\>
|
|
687
|
+
|
|
688
|
+
Decrypt private key bytes with the user's KEK using AES-GCM
|
|
689
|
+
|
|
690
|
+
**`Throws`**
|
|
691
|
+
|
|
692
|
+
Error if decryption fails (wrong key or tampered data)
|
|
693
|
+
|
|
694
|
+
#### Parameters
|
|
695
|
+
|
|
696
|
+
| Name | Type | Description |
|
|
697
|
+
| :------ | :------ | :------ |
|
|
698
|
+
| `encryptedPrivateKey` | `Uint8Array` | AES-GCM encrypted private key bytes |
|
|
699
|
+
| `iv` | `Uint8Array` | 12-byte initialization vector used during encryption |
|
|
700
|
+
| `kek` | `Uint8Array` | 32-byte Key Encryption Key from 2SKD |
|
|
701
|
+
|
|
702
|
+
#### Returns
|
|
703
|
+
|
|
704
|
+
`Promise`<`Uint8Array`\>
|
|
705
|
+
|
|
706
|
+
Decrypted private key bytes (PKCS8 format)
|
|
707
|
+
|
|
708
|
+
___
|
|
709
|
+
|
|
279
710
|
### decryptSharedData
|
|
280
711
|
|
|
281
712
|
▸ **decryptSharedData**(`«destructured»`): `Promise`<{ `applicationDecryptor`: `ApplicationDataEncryptorI` ; `instance`: `Instance` }\>
|
|
@@ -306,76 +737,344 @@ a copy of `instanceData` with all properties decrypted.
|
|
|
306
737
|
|
|
307
738
|
___
|
|
308
739
|
|
|
309
|
-
###
|
|
740
|
+
### deleteLocalSecret
|
|
310
741
|
|
|
311
|
-
▸ **
|
|
742
|
+
▸ **deleteLocalSecret**(`userId`): `Promise`<`void`\>
|
|
312
743
|
|
|
313
|
-
|
|
744
|
+
Delete a LocalSecret from IndexedDB
|
|
314
745
|
|
|
315
746
|
#### Parameters
|
|
316
747
|
|
|
317
|
-
| Name | Type |
|
|
318
|
-
| :------ | :------ |
|
|
319
|
-
| `
|
|
320
|
-
| `data` | `RuleData` |
|
|
748
|
+
| Name | Type | Description |
|
|
749
|
+
| :------ | :------ | :------ |
|
|
750
|
+
| `userId` | `string` | User's Cognito sub |
|
|
321
751
|
|
|
322
752
|
#### Returns
|
|
323
753
|
|
|
324
|
-
`
|
|
325
|
-
|
|
326
|
-
| Name | Type |
|
|
327
|
-
| :------ | :------ |
|
|
328
|
-
| `passed` | `boolean` |
|
|
329
|
-
| `score` | `number` |
|
|
754
|
+
`Promise`<`void`\>
|
|
330
755
|
|
|
331
756
|
___
|
|
332
757
|
|
|
333
|
-
###
|
|
758
|
+
### deletePGPPrivateKey
|
|
334
759
|
|
|
335
|
-
▸ **
|
|
760
|
+
▸ **deletePGPPrivateKey**(`userId`): `Promise`<`void`\>
|
|
336
761
|
|
|
337
|
-
|
|
338
|
-
the JSON that the API returns, into a `Schema` object that's useful
|
|
339
|
-
to the client.
|
|
762
|
+
Delete an encrypted PGP private key from IndexedDB
|
|
340
763
|
|
|
341
764
|
#### Parameters
|
|
342
765
|
|
|
343
|
-
| Name | Type |
|
|
344
|
-
| :------ | :------ |
|
|
345
|
-
| `
|
|
346
|
-
| `allUnexpandedSchemas` | `WrappedSchema`[] |
|
|
347
|
-
| `userLocales` | readonly `string`[] |
|
|
766
|
+
| Name | Type | Description |
|
|
767
|
+
| :------ | :------ | :------ |
|
|
768
|
+
| `userId` | `string` | User's Cognito sub |
|
|
348
769
|
|
|
349
770
|
#### Returns
|
|
350
771
|
|
|
351
|
-
`
|
|
772
|
+
`Promise`<`void`\>
|
|
352
773
|
|
|
353
774
|
___
|
|
354
775
|
|
|
355
|
-
###
|
|
776
|
+
### deriveArgon2id
|
|
356
777
|
|
|
357
|
-
▸ **
|
|
778
|
+
▸ **deriveArgon2id**(`password`, `config`): `Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
358
779
|
|
|
359
|
-
|
|
780
|
+
Derive a key using Argon2id
|
|
781
|
+
|
|
782
|
+
**`Throws`**
|
|
783
|
+
|
|
784
|
+
Error if argon2 module is not available
|
|
360
785
|
|
|
361
786
|
#### Parameters
|
|
362
787
|
|
|
363
|
-
| Name | Type |
|
|
364
|
-
| :------ | :------ |
|
|
365
|
-
| `
|
|
788
|
+
| Name | Type | Description |
|
|
789
|
+
| :------ | :------ | :------ |
|
|
790
|
+
| `password` | `string` | User's password (will be normalized) |
|
|
791
|
+
| `config` | [`Argon2idConfig`](interfaces/Argon2idConfig.md) | Argon2id configuration from Cognito attributes |
|
|
366
792
|
|
|
367
793
|
#### Returns
|
|
368
794
|
|
|
369
|
-
`
|
|
795
|
+
`Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
796
|
+
|
|
797
|
+
KdfResult containing the derived 32-byte key
|
|
370
798
|
|
|
371
799
|
___
|
|
372
800
|
|
|
373
|
-
###
|
|
801
|
+
### deriveKey
|
|
374
802
|
|
|
375
|
-
▸ **
|
|
803
|
+
▸ **deriveKey**(`password`, `config`, `localSecret?`): `Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
804
|
+
|
|
805
|
+
Derive a key using the appropriate KDF based on configuration
|
|
806
|
+
|
|
807
|
+
This is the main entry point for key derivation. It automatically
|
|
808
|
+
selects the correct algorithm based on the config.
|
|
809
|
+
|
|
810
|
+
**`Throws`**
|
|
811
|
+
|
|
812
|
+
LocalSecretRequiredError if LocalSecret is required but not provided
|
|
813
|
+
|
|
814
|
+
**`Throws`**
|
|
815
|
+
|
|
816
|
+
UnknownKdfAlgorithmError if the algorithm is not recognized
|
|
817
|
+
|
|
818
|
+
#### Parameters
|
|
819
|
+
|
|
820
|
+
| Name | Type | Description |
|
|
821
|
+
| :------ | :------ | :------ |
|
|
822
|
+
| `password` | `string` | User's password |
|
|
823
|
+
| `config` | [`KdfConfig`](#kdfconfig) | KDF configuration from Cognito attributes |
|
|
824
|
+
| `localSecret?` | ``null`` \| `Uint8Array` | Optional LocalSecret for 2SKD (required for Argon2id with requires_local_secret) |
|
|
825
|
+
|
|
826
|
+
#### Returns
|
|
827
|
+
|
|
828
|
+
`Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
829
|
+
|
|
830
|
+
KdfResult containing the derived key
|
|
831
|
+
|
|
832
|
+
___
|
|
833
|
+
|
|
834
|
+
### derivePbkdf2
|
|
835
|
+
|
|
836
|
+
▸ **derivePbkdf2**(`password`, `config`): `Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
837
|
+
|
|
838
|
+
Derive a key using PBKDF2
|
|
839
|
+
|
|
840
|
+
#### Parameters
|
|
841
|
+
|
|
842
|
+
| Name | Type | Description |
|
|
843
|
+
| :------ | :------ | :------ |
|
|
844
|
+
| `password` | `string` | User's password |
|
|
845
|
+
| `config` | [`Pbkdf2Config`](interfaces/Pbkdf2Config.md) | PBKDF2 configuration from Cognito attributes |
|
|
846
|
+
|
|
847
|
+
#### Returns
|
|
848
|
+
|
|
849
|
+
`Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
850
|
+
|
|
851
|
+
KdfResult containing the derived 32-byte key
|
|
852
|
+
|
|
853
|
+
___
|
|
854
|
+
|
|
855
|
+
### deriveTwoSecretKdf
|
|
856
|
+
|
|
857
|
+
▸ **deriveTwoSecretKdf**(`password`, `config`, `localSecret`): `Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
858
|
+
|
|
859
|
+
Derive KEK using Two-Secret Key Derivation
|
|
860
|
+
|
|
861
|
+
Combines:
|
|
862
|
+
1. Password → Argon2id → 32 bytes
|
|
863
|
+
2. LocalSecret → 32 bytes
|
|
864
|
+
3. XOR(1, 2) → KEK
|
|
865
|
+
|
|
866
|
+
**`Throws`**
|
|
867
|
+
|
|
868
|
+
LocalSecretRequiredError if localSecret is not provided but required
|
|
869
|
+
|
|
870
|
+
#### Parameters
|
|
871
|
+
|
|
872
|
+
| Name | Type | Description |
|
|
873
|
+
| :------ | :------ | :------ |
|
|
874
|
+
| `password` | `string` | User's password |
|
|
875
|
+
| `config` | [`Argon2idConfig`](interfaces/Argon2idConfig.md) | Argon2id configuration |
|
|
876
|
+
| `localSecret` | `undefined` \| ``null`` \| `Uint8Array` | Device-bound LocalSecret (32 bytes) |
|
|
877
|
+
|
|
878
|
+
#### Returns
|
|
879
|
+
|
|
880
|
+
`Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
881
|
+
|
|
882
|
+
KdfResult containing the derived KEK
|
|
883
|
+
|
|
884
|
+
___
|
|
885
|
+
|
|
886
|
+
### encryptPrivateKey
|
|
887
|
+
|
|
888
|
+
▸ **encryptPrivateKey**(`privateKeyBytes`, `kek`): `Promise`<[`EncryptedPrivateKey`](interfaces/EncryptedPrivateKey.md)\>
|
|
889
|
+
|
|
890
|
+
Encrypt private key bytes with the user's KEK using AES-GCM
|
|
891
|
+
|
|
892
|
+
Uses a random 12-byte IV for each encryption operation.
|
|
893
|
+
|
|
894
|
+
#### Parameters
|
|
895
|
+
|
|
896
|
+
| Name | Type | Description |
|
|
897
|
+
| :------ | :------ | :------ |
|
|
898
|
+
| `privateKeyBytes` | `Uint8Array` | Raw private key bytes (PKCS8 format) |
|
|
899
|
+
| `kek` | `Uint8Array` | 32-byte Key Encryption Key from 2SKD |
|
|
900
|
+
|
|
901
|
+
#### Returns
|
|
902
|
+
|
|
903
|
+
`Promise`<[`EncryptedPrivateKey`](interfaces/EncryptedPrivateKey.md)\>
|
|
904
|
+
|
|
905
|
+
Encrypted private key and IV
|
|
906
|
+
|
|
907
|
+
___
|
|
908
|
+
|
|
909
|
+
### evaluateBadge
|
|
910
|
+
|
|
911
|
+
▸ **evaluateBadge**(`badge`, `ruleData`): `Promise`<[`BadgeResult`](#badgeresult)\>
|
|
912
|
+
|
|
913
|
+
Evaluate a single badge definition against user data.
|
|
914
|
+
Thin wrapper around calculateScore() -- threshold names map to badge states.
|
|
915
|
+
|
|
916
|
+
#### Parameters
|
|
917
|
+
|
|
918
|
+
| Name | Type |
|
|
919
|
+
| :------ | :------ |
|
|
920
|
+
| `badge` | [`BadgeDefinition`](#badgedefinition) |
|
|
921
|
+
| `ruleData` | `RuleData` |
|
|
922
|
+
|
|
923
|
+
#### Returns
|
|
924
|
+
|
|
925
|
+
`Promise`<[`BadgeResult`](#badgeresult)\>
|
|
926
|
+
|
|
927
|
+
___
|
|
928
|
+
|
|
929
|
+
### evaluateRule
|
|
930
|
+
|
|
931
|
+
▸ **evaluateRule**(`rule`, `data`): `Object`
|
|
932
|
+
|
|
933
|
+
evaluates an individual rule, normally you should use [calculateScore](#calculatescore)
|
|
934
|
+
|
|
935
|
+
#### Parameters
|
|
936
|
+
|
|
937
|
+
| Name | Type |
|
|
938
|
+
| :------ | :------ |
|
|
939
|
+
| `rule` | `ScoreRule` |
|
|
940
|
+
| `data` | `RuleData` |
|
|
941
|
+
|
|
942
|
+
#### Returns
|
|
943
|
+
|
|
944
|
+
`Object`
|
|
945
|
+
|
|
946
|
+
| Name | Type |
|
|
947
|
+
| :------ | :------ |
|
|
948
|
+
| `passed` | `boolean` |
|
|
949
|
+
| `score` | `number` |
|
|
950
|
+
|
|
951
|
+
___
|
|
952
|
+
|
|
953
|
+
### evaluateUserBadges
|
|
954
|
+
|
|
955
|
+
▸ **evaluateUserBadges**(`badges`, `ruleData`): `Promise`<[`BadgeResult`](#badgeresult)[]\>
|
|
956
|
+
|
|
957
|
+
Evaluate all active badge definitions against user data.
|
|
958
|
+
|
|
959
|
+
#### Parameters
|
|
960
|
+
|
|
961
|
+
| Name | Type |
|
|
962
|
+
| :------ | :------ |
|
|
963
|
+
| `badges` | [`BadgeDefinition`](#badgedefinition)[] |
|
|
964
|
+
| `ruleData` | `RuleData` |
|
|
965
|
+
|
|
966
|
+
#### Returns
|
|
967
|
+
|
|
968
|
+
`Promise`<[`BadgeResult`](#badgeresult)[]\>
|
|
969
|
+
|
|
970
|
+
___
|
|
971
|
+
|
|
972
|
+
### expandSchema
|
|
973
|
+
|
|
974
|
+
▸ **expandSchema**(`wrappedSchema`, `allUnexpandedSchemas`, `userLocales`, `fndI18nEntries?`): `Schema`
|
|
975
|
+
|
|
976
|
+
This is the main function to transform a schema from
|
|
977
|
+
the JSON that the API returns, into a `Schema` object that's useful
|
|
978
|
+
to the client.
|
|
979
|
+
|
|
980
|
+
#### Parameters
|
|
981
|
+
|
|
982
|
+
| Name | Type |
|
|
983
|
+
| :------ | :------ |
|
|
984
|
+
| `wrappedSchema` | `WrappedSchema` |
|
|
985
|
+
| `allUnexpandedSchemas` | `WrappedSchema`[] |
|
|
986
|
+
| `userLocales` | readonly `string`[] |
|
|
987
|
+
| `fndI18nEntries?` | `FndI18nEntry`[] |
|
|
988
|
+
|
|
989
|
+
#### Returns
|
|
990
|
+
|
|
991
|
+
`Schema`
|
|
992
|
+
|
|
993
|
+
___
|
|
994
|
+
|
|
995
|
+
### exportPGPKeyToArmored
|
|
996
|
+
|
|
997
|
+
▸ **exportPGPKeyToArmored**(`privateKeyBytes`, `options?`): `Promise`<[`ExportedPGPKey`](interfaces/ExportedPGPKey.md)\>
|
|
998
|
+
|
|
999
|
+
Export a PKCS8 private key to OpenPGP armored format
|
|
1000
|
+
|
|
1001
|
+
This function converts existing PKCS8 RSA key material to OpenPGP format,
|
|
1002
|
+
preserving the original cryptographic material. The exported key can be
|
|
1003
|
+
used with GPG, GitHub, and other OpenPGP-compatible tools.
|
|
1004
|
+
|
|
1005
|
+
**`Throws`**
|
|
1006
|
+
|
|
1007
|
+
PGPKeyExportError if export fails
|
|
1008
|
+
|
|
1009
|
+
#### Parameters
|
|
1010
|
+
|
|
1011
|
+
| Name | Type | Description |
|
|
1012
|
+
| :------ | :------ | :------ |
|
|
1013
|
+
| `privateKeyBytes` | `Uint8Array` | PKCS8 encoded private key bytes |
|
|
1014
|
+
| `options` | [`ExportPGPKeyOptions`](interfaces/ExportPGPKeyOptions.md) | Export options (passphrase, userIds, date) |
|
|
1015
|
+
|
|
1016
|
+
#### Returns
|
|
1017
|
+
|
|
1018
|
+
`Promise`<[`ExportedPGPKey`](interfaces/ExportedPGPKey.md)\>
|
|
1019
|
+
|
|
1020
|
+
Armored private and public keys with fingerprint
|
|
1021
|
+
|
|
1022
|
+
___
|
|
1023
|
+
|
|
1024
|
+
### extractPemType
|
|
1025
|
+
|
|
1026
|
+
▸ **extractPemType**(`pem`): `string` \| ``null``
|
|
1027
|
+
|
|
1028
|
+
Extract the type from a PEM-formatted string
|
|
1029
|
+
|
|
1030
|
+
For example, extracts "PUBLIC KEY" from:
|
|
1031
|
+
-----BEGIN PUBLIC KEY-----
|
|
1032
|
+
...
|
|
1033
|
+
-----END PUBLIC KEY-----
|
|
1034
|
+
|
|
1035
|
+
#### Parameters
|
|
1036
|
+
|
|
1037
|
+
| Name | Type | Description |
|
|
1038
|
+
| :------ | :------ | :------ |
|
|
1039
|
+
| `pem` | `string` | PEM-formatted string |
|
|
1040
|
+
|
|
1041
|
+
#### Returns
|
|
1042
|
+
|
|
1043
|
+
`string` \| ``null``
|
|
1044
|
+
|
|
1045
|
+
The type string (e.g., "PUBLIC KEY", "PRIVATE KEY"), or null if not valid PEM
|
|
1046
|
+
|
|
1047
|
+
___
|
|
1048
|
+
|
|
1049
|
+
### findSchemaLabel
|
|
1050
|
+
|
|
1051
|
+
▸ **findSchemaLabel**(`labels`): `undefined` \| `SchemaName`
|
|
1052
|
+
|
|
1053
|
+
Finds the label (on a profile object) which is the schema name
|
|
1054
|
+
|
|
1055
|
+
#### Parameters
|
|
1056
|
+
|
|
1057
|
+
| Name | Type |
|
|
1058
|
+
| :------ | :------ |
|
|
1059
|
+
| `labels` | `undefined` \| `string`[] |
|
|
1060
|
+
|
|
1061
|
+
#### Returns
|
|
1062
|
+
|
|
1063
|
+
`undefined` \| `SchemaName`
|
|
1064
|
+
|
|
1065
|
+
___
|
|
1066
|
+
|
|
1067
|
+
### findSuitableLocale
|
|
1068
|
+
|
|
1069
|
+
▸ **findSuitableLocale**(`options`, `langs`): `undefined` \| `string`
|
|
376
1070
|
|
|
377
1071
|
Selects the most suitable locale to use from a list of options.
|
|
378
|
-
Returns undefined if there is no language that the user speaks
|
|
1072
|
+
Returns undefined if there is no language that the user speaks.
|
|
1073
|
+
|
|
1074
|
+
Priority order:
|
|
1075
|
+
1. Exact full locale match (e.g., user has en-NZ, schema has en-NZ)
|
|
1076
|
+
2. Base language match (e.g., user has en-US, schema has en)
|
|
1077
|
+
3. Any locale with matching base language (e.g., user has de-DE, schema has de-AT)
|
|
379
1078
|
|
|
380
1079
|
#### Parameters
|
|
381
1080
|
|
|
@@ -390,6 +1089,49 @@ Returns undefined if there is no language that the user speaks
|
|
|
390
1089
|
|
|
391
1090
|
___
|
|
392
1091
|
|
|
1092
|
+
### formatFingerprint
|
|
1093
|
+
|
|
1094
|
+
▸ **formatFingerprint**(`fingerprint`): `string`
|
|
1095
|
+
|
|
1096
|
+
Format a key fingerprint for display
|
|
1097
|
+
|
|
1098
|
+
Converts to uppercase and groups into 4-character blocks separated by spaces.
|
|
1099
|
+
For example: "abcd1234efgh5678" becomes "ABCD 1234 EFGH 5678"
|
|
1100
|
+
|
|
1101
|
+
#### Parameters
|
|
1102
|
+
|
|
1103
|
+
| Name | Type | Description |
|
|
1104
|
+
| :------ | :------ | :------ |
|
|
1105
|
+
| `fingerprint` | `string` | Raw fingerprint string (typically 40 hex characters) |
|
|
1106
|
+
|
|
1107
|
+
#### Returns
|
|
1108
|
+
|
|
1109
|
+
`string`
|
|
1110
|
+
|
|
1111
|
+
Formatted fingerprint string
|
|
1112
|
+
|
|
1113
|
+
___
|
|
1114
|
+
|
|
1115
|
+
### formatLocalSecret
|
|
1116
|
+
|
|
1117
|
+
▸ **formatLocalSecret**(`secret`): [`FormattedLocalSecret`](interfaces/FormattedLocalSecret.md)
|
|
1118
|
+
|
|
1119
|
+
Format a LocalSecret for human-readable display
|
|
1120
|
+
|
|
1121
|
+
#### Parameters
|
|
1122
|
+
|
|
1123
|
+
| Name | Type | Description |
|
|
1124
|
+
| :------ | :------ | :------ |
|
|
1125
|
+
| `secret` | `Uint8Array` | The 32-byte LocalSecret |
|
|
1126
|
+
|
|
1127
|
+
#### Returns
|
|
1128
|
+
|
|
1129
|
+
[`FormattedLocalSecret`](interfaces/FormattedLocalSecret.md)
|
|
1130
|
+
|
|
1131
|
+
Formatted LocalSecret with grouped characters
|
|
1132
|
+
|
|
1133
|
+
___
|
|
1134
|
+
|
|
393
1135
|
### fromCognitoAttributes
|
|
394
1136
|
|
|
395
1137
|
▸ **fromCognitoAttributes**(`attributes`): `UserDoc`
|
|
@@ -409,407 +1151,1156 @@ The userAttributes come from `const attributes = await Auth.userAttributes(user)
|
|
|
409
1151
|
|
|
410
1152
|
___
|
|
411
1153
|
|
|
412
|
-
###
|
|
1154
|
+
### generateDeviceId
|
|
413
1155
|
|
|
414
|
-
▸ **
|
|
1156
|
+
▸ **generateDeviceId**(): `string`
|
|
415
1157
|
|
|
416
|
-
|
|
417
|
-
|
|
1158
|
+
Generate a unique device ID
|
|
1159
|
+
|
|
1160
|
+
Used to identify devices for LocalSecret management.
|
|
1161
|
+
|
|
1162
|
+
#### Returns
|
|
1163
|
+
|
|
1164
|
+
`string`
|
|
1165
|
+
|
|
1166
|
+
UUID v4 string
|
|
1167
|
+
|
|
1168
|
+
___
|
|
1169
|
+
|
|
1170
|
+
### generateLocalSecret
|
|
1171
|
+
|
|
1172
|
+
▸ **generateLocalSecret**(): `Uint8Array`
|
|
1173
|
+
|
|
1174
|
+
Generate a new LocalSecret
|
|
1175
|
+
|
|
1176
|
+
Uses the Web Crypto API's getRandomValues for cryptographically
|
|
1177
|
+
secure random number generation.
|
|
1178
|
+
|
|
1179
|
+
#### Returns
|
|
1180
|
+
|
|
1181
|
+
`Uint8Array`
|
|
1182
|
+
|
|
1183
|
+
32-byte (256-bit) random LocalSecret
|
|
1184
|
+
|
|
1185
|
+
___
|
|
1186
|
+
|
|
1187
|
+
### generatePGPKeyPair
|
|
1188
|
+
|
|
1189
|
+
▸ **generatePGPKeyPair**(): `Promise`<[`PGPKeyPair`](interfaces/PGPKeyPair.md)\>
|
|
1190
|
+
|
|
1191
|
+
Generate an RSA 4096-bit key pair for digital signatures
|
|
1192
|
+
|
|
1193
|
+
#### Returns
|
|
1194
|
+
|
|
1195
|
+
`Promise`<[`PGPKeyPair`](interfaces/PGPKeyPair.md)\>
|
|
1196
|
+
|
|
1197
|
+
Generated key pair with PEM public key and raw private key bytes
|
|
1198
|
+
|
|
1199
|
+
___
|
|
1200
|
+
|
|
1201
|
+
### generateRandomBytes
|
|
1202
|
+
|
|
1203
|
+
▸ **generateRandomBytes**(`length`): `Uint8Array`
|
|
1204
|
+
|
|
1205
|
+
Generate cryptographically secure random bytes
|
|
418
1206
|
|
|
419
1207
|
#### Parameters
|
|
420
1208
|
|
|
421
|
-
| Name | Type |
|
|
422
|
-
| :------ | :------ |
|
|
423
|
-
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
1209
|
+
| Name | Type | Description |
|
|
1210
|
+
| :------ | :------ | :------ |
|
|
1211
|
+
| `length` | `number` | Number of bytes to generate |
|
|
1212
|
+
|
|
1213
|
+
#### Returns
|
|
1214
|
+
|
|
1215
|
+
`Uint8Array`
|
|
1216
|
+
|
|
1217
|
+
Random bytes
|
|
1218
|
+
|
|
1219
|
+
___
|
|
1220
|
+
|
|
1221
|
+
### generateSalt
|
|
1222
|
+
|
|
1223
|
+
▸ **generateSalt**(): `string`
|
|
1224
|
+
|
|
1225
|
+
Generate a random salt for key derivation
|
|
1226
|
+
|
|
1227
|
+
#### Returns
|
|
1228
|
+
|
|
1229
|
+
`string`
|
|
1230
|
+
|
|
1231
|
+
16-byte random salt as base64 string
|
|
1232
|
+
|
|
1233
|
+
___
|
|
1234
|
+
|
|
1235
|
+
### getAADecryptor
|
|
1236
|
+
|
|
1237
|
+
▸ **getAADecryptor**(`«destructured»`): `Promise`<{ `decryptor`: `ApplicationEncryptor` ; `publicKeyId`: `KId` }\>
|
|
1238
|
+
|
|
1239
|
+
Fetchs the public and private keys for an Access Application, then initializes
|
|
1240
|
+
the [https://npm.im/@raytio/maxcryptor|Maxcryptor](https://npm.im/@raytio/maxcryptor|Maxcryptor)'s `ApplicationEncryptor`.
|
|
1241
|
+
|
|
1242
|
+
#### Parameters
|
|
1243
|
+
|
|
1244
|
+
| Name | Type |
|
|
1245
|
+
| :------ | :------ |
|
|
1246
|
+
| `«destructured»` | `Object` |
|
|
1247
|
+
| › `aId` | `AId` |
|
|
1248
|
+
| › `apiToken` | `string` |
|
|
1249
|
+
| › `apiUrl` | `string` |
|
|
427
1250
|
| › `maxcryptor` | `DataEncryptorI` |
|
|
428
1251
|
|
|
429
1252
|
#### Returns
|
|
430
1253
|
|
|
431
|
-
`Promise`<{ `decryptor`: `ApplicationEncryptor` ; `publicKeyId`: `KId` }\>
|
|
1254
|
+
`Promise`<{ `decryptor`: `ApplicationEncryptor` ; `publicKeyId`: `KId` }\>
|
|
1255
|
+
|
|
1256
|
+
an `ApplicationEncryptor` and the public key of the Access Application
|
|
1257
|
+
|
|
1258
|
+
___
|
|
1259
|
+
|
|
1260
|
+
### getAAPublicKey
|
|
1261
|
+
|
|
1262
|
+
▸ **getAAPublicKey**(`«destructured»`): `Promise`<`PublicKeyNode`\>
|
|
1263
|
+
|
|
1264
|
+
Fetches the Public Key Information for an Access Application
|
|
1265
|
+
|
|
1266
|
+
#### Parameters
|
|
1267
|
+
|
|
1268
|
+
| Name | Type |
|
|
1269
|
+
| :------ | :------ |
|
|
1270
|
+
| `«destructured»` | `Object` |
|
|
1271
|
+
| › `aId` | `AId` |
|
|
1272
|
+
| › `apiToken?` | `string` |
|
|
1273
|
+
| › `apiUrl` | `string` |
|
|
1274
|
+
|
|
1275
|
+
#### Returns
|
|
1276
|
+
|
|
1277
|
+
`Promise`<`PublicKeyNode`\>
|
|
1278
|
+
|
|
1279
|
+
the id and Key information of the Applications Public Key
|
|
1280
|
+
|
|
1281
|
+
___
|
|
1282
|
+
|
|
1283
|
+
### getKdfVersion
|
|
1284
|
+
|
|
1285
|
+
▸ **getKdfVersion**(`config`): `number`
|
|
1286
|
+
|
|
1287
|
+
Get the KDF version from configuration
|
|
1288
|
+
|
|
1289
|
+
#### Parameters
|
|
1290
|
+
|
|
1291
|
+
| Name | Type | Description |
|
|
1292
|
+
| :------ | :------ | :------ |
|
|
1293
|
+
| `config` | [`KdfConfig`](#kdfconfig) | KDF configuration |
|
|
1294
|
+
|
|
1295
|
+
#### Returns
|
|
1296
|
+
|
|
1297
|
+
`number`
|
|
1298
|
+
|
|
1299
|
+
Version number (1 for PBKDF2, 2 for Argon2id with 2SKD)
|
|
1300
|
+
|
|
1301
|
+
___
|
|
1302
|
+
|
|
1303
|
+
### getLocalSecret
|
|
1304
|
+
|
|
1305
|
+
▸ **getLocalSecret**(`userId`): `Promise`<`Uint8Array` \| ``null``\>
|
|
1306
|
+
|
|
1307
|
+
Retrieve a LocalSecret from IndexedDB
|
|
1308
|
+
|
|
1309
|
+
#### Parameters
|
|
1310
|
+
|
|
1311
|
+
| Name | Type | Description |
|
|
1312
|
+
| :------ | :------ | :------ |
|
|
1313
|
+
| `userId` | `string` | User's Cognito sub |
|
|
1314
|
+
|
|
1315
|
+
#### Returns
|
|
1316
|
+
|
|
1317
|
+
`Promise`<`Uint8Array` \| ``null``\>
|
|
1318
|
+
|
|
1319
|
+
The LocalSecret or null if not found
|
|
1320
|
+
|
|
1321
|
+
___
|
|
1322
|
+
|
|
1323
|
+
### getLocalSecretRecord
|
|
1324
|
+
|
|
1325
|
+
▸ **getLocalSecretRecord**(`userId`): `Promise`<[`StoredLocalSecret`](interfaces/StoredLocalSecret.md) \| ``null``\>
|
|
1326
|
+
|
|
1327
|
+
Get the stored LocalSecret record (including metadata)
|
|
1328
|
+
|
|
1329
|
+
#### Parameters
|
|
1330
|
+
|
|
1331
|
+
| Name | Type | Description |
|
|
1332
|
+
| :------ | :------ | :------ |
|
|
1333
|
+
| `userId` | `string` | User's Cognito sub |
|
|
1334
|
+
|
|
1335
|
+
#### Returns
|
|
1336
|
+
|
|
1337
|
+
`Promise`<[`StoredLocalSecret`](interfaces/StoredLocalSecret.md) \| ``null``\>
|
|
1338
|
+
|
|
1339
|
+
The full storage record or null
|
|
1340
|
+
|
|
1341
|
+
___
|
|
1342
|
+
|
|
1343
|
+
### getMissingDataForInstance
|
|
1344
|
+
|
|
1345
|
+
▸ **getMissingDataForInstance**(`«destructured»`): `Promise`<`Instance`\>
|
|
1346
|
+
|
|
1347
|
+
the new API doesn't return the whole instance at once,
|
|
1348
|
+
so we have to make several additional API requests.
|
|
1349
|
+
|
|
1350
|
+
#### Parameters
|
|
1351
|
+
|
|
1352
|
+
| Name | Type |
|
|
1353
|
+
| :------ | :------ |
|
|
1354
|
+
| `«destructured»` | `Object` |
|
|
1355
|
+
| › `apiToken` | `string` |
|
|
1356
|
+
| › `apiUrl` | `string` |
|
|
1357
|
+
| › `instanceWithoutData` | `InstanceWithoutData` |
|
|
1358
|
+
|
|
1359
|
+
#### Returns
|
|
1360
|
+
|
|
1361
|
+
`Promise`<`Instance`\>
|
|
1362
|
+
|
|
1363
|
+
___
|
|
1364
|
+
|
|
1365
|
+
### getNidFromUrn
|
|
1366
|
+
|
|
1367
|
+
▸ **getNidFromUrn**<`IDType`\>(`urn`): `IDType`
|
|
1368
|
+
|
|
1369
|
+
two overloads - if you provide undefined, you might get undefined back
|
|
1370
|
+
|
|
1371
|
+
#### Type parameters
|
|
1372
|
+
|
|
1373
|
+
| Name | Type |
|
|
1374
|
+
| :------ | :------ |
|
|
1375
|
+
| `IDType` | `NId` |
|
|
1376
|
+
|
|
1377
|
+
#### Parameters
|
|
1378
|
+
|
|
1379
|
+
| Name | Type |
|
|
1380
|
+
| :------ | :------ |
|
|
1381
|
+
| `urn` | `Urn` |
|
|
1382
|
+
|
|
1383
|
+
#### Returns
|
|
1384
|
+
|
|
1385
|
+
`IDType`
|
|
1386
|
+
|
|
1387
|
+
▸ **getNidFromUrn**<`IDType`\>(`urn`): `undefined` \| `IDType`
|
|
1388
|
+
|
|
1389
|
+
two overloads - if you provide undefined, you might get undefined back
|
|
1390
|
+
|
|
1391
|
+
#### Type parameters
|
|
1392
|
+
|
|
1393
|
+
| Name | Type |
|
|
1394
|
+
| :------ | :------ |
|
|
1395
|
+
| `IDType` | `NId` |
|
|
1396
|
+
|
|
1397
|
+
#### Parameters
|
|
1398
|
+
|
|
1399
|
+
| Name | Type |
|
|
1400
|
+
| :------ | :------ |
|
|
1401
|
+
| `urn` | `undefined` \| `Urn` |
|
|
1402
|
+
|
|
1403
|
+
#### Returns
|
|
1404
|
+
|
|
1405
|
+
`undefined` \| `IDType`
|
|
1406
|
+
|
|
1407
|
+
___
|
|
1408
|
+
|
|
1409
|
+
### getOrCreateDeviceId
|
|
1410
|
+
|
|
1411
|
+
▸ **getOrCreateDeviceId**(): `Promise`<`string`\>
|
|
1412
|
+
|
|
1413
|
+
Get or create a unique device ID
|
|
1414
|
+
|
|
1415
|
+
The device ID is stored in localStorage for persistence.
|
|
1416
|
+
|
|
1417
|
+
#### Returns
|
|
1418
|
+
|
|
1419
|
+
`Promise`<`string`\>
|
|
1420
|
+
|
|
1421
|
+
___
|
|
1422
|
+
|
|
1423
|
+
### getOwnRealVerifications
|
|
1424
|
+
|
|
1425
|
+
▸ **getOwnRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
1426
|
+
|
|
1427
|
+
Given a list of verifications and decrypted profile objects, this function
|
|
1428
|
+
locally verifies the credibility of the signatures in the verifications.
|
|
1429
|
+
|
|
1430
|
+
This function does NOT call the API, except to fetch the public key.
|
|
1431
|
+
|
|
1432
|
+
#### Parameters
|
|
1433
|
+
|
|
1434
|
+
| Name | Type |
|
|
1435
|
+
| :------ | :------ |
|
|
1436
|
+
| `«destructured»` | `Object` |
|
|
1437
|
+
| › `profileObjects` | `ProfileObject`[] |
|
|
1438
|
+
| › `userId` | `UId` |
|
|
1439
|
+
| › `verifications` | `Verification`[] |
|
|
1440
|
+
|
|
1441
|
+
#### Returns
|
|
1442
|
+
|
|
1443
|
+
`Promise`<`RealVer`[]\>
|
|
1444
|
+
|
|
1445
|
+
a list of authentic RealVer
|
|
1446
|
+
|
|
1447
|
+
___
|
|
1448
|
+
|
|
1449
|
+
### getPGPPrivateKey
|
|
1450
|
+
|
|
1451
|
+
▸ **getPGPPrivateKey**(`userId`): `Promise`<[`StoredPGPPrivateKey`](interfaces/StoredPGPPrivateKey.md) \| ``null``\>
|
|
1452
|
+
|
|
1453
|
+
Retrieve an encrypted PGP private key from IndexedDB
|
|
1454
|
+
|
|
1455
|
+
#### Parameters
|
|
1456
|
+
|
|
1457
|
+
| Name | Type | Description |
|
|
1458
|
+
| :------ | :------ | :------ |
|
|
1459
|
+
| `userId` | `string` | User's Cognito sub |
|
|
1460
|
+
|
|
1461
|
+
#### Returns
|
|
1462
|
+
|
|
1463
|
+
`Promise`<[`StoredPGPPrivateKey`](interfaces/StoredPGPPrivateKey.md) \| ``null``\>
|
|
1464
|
+
|
|
1465
|
+
The encrypted private key record or null if not found
|
|
1466
|
+
|
|
1467
|
+
___
|
|
1468
|
+
|
|
1469
|
+
### getPOVerification
|
|
1470
|
+
|
|
1471
|
+
▸ **getPOVerification**(`«destructured»`): `Object`
|
|
1472
|
+
|
|
1473
|
+
Determines the verification status of a profile object, and its individual fields.
|
|
1474
|
+
|
|
1475
|
+
#### Parameters
|
|
1476
|
+
|
|
1477
|
+
| Name | Type |
|
|
1478
|
+
| :------ | :------ |
|
|
1479
|
+
| `«destructured»` | `Object` |
|
|
1480
|
+
| › `PO` | `ProfileObject` \| `ProfileObjectForUpload` |
|
|
1481
|
+
| › `realVers` | `RealVer`[] |
|
|
1482
|
+
| › `schema` | `Schema` |
|
|
1483
|
+
|
|
1484
|
+
#### Returns
|
|
1485
|
+
|
|
1486
|
+
`Object`
|
|
1487
|
+
|
|
1488
|
+
| Name | Type |
|
|
1489
|
+
| :------ | :------ |
|
|
1490
|
+
| `details` | [`VerDetails`](#verdetails) |
|
|
1491
|
+
| `fieldVerifications` | `Record`<`string`, `FieldVerification`\> |
|
|
1492
|
+
| `status` | `POVerification` |
|
|
1493
|
+
|
|
1494
|
+
___
|
|
1495
|
+
|
|
1496
|
+
### getSomeoneElsesRealVerifications
|
|
1497
|
+
|
|
1498
|
+
▸ **getSomeoneElsesRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
1499
|
+
|
|
1500
|
+
Given a list of verifications and decrypted profile objects, this function calls
|
|
1501
|
+
the Raytio API to verify the credibility of these verifications, returning only valid
|
|
1502
|
+
verifications.
|
|
1503
|
+
|
|
1504
|
+
❗ prefer `getOwnRealVerifications` if the data to be verified belongs to the current user.
|
|
1505
|
+
|
|
1506
|
+
#### Parameters
|
|
1507
|
+
|
|
1508
|
+
| Name | Type |
|
|
1509
|
+
| :------ | :------ |
|
|
1510
|
+
| `«destructured»` | `Props` |
|
|
1511
|
+
|
|
1512
|
+
#### Returns
|
|
1513
|
+
|
|
1514
|
+
`Promise`<`RealVer`[]\>
|
|
1515
|
+
|
|
1516
|
+
a list of fileNames/values that are verified.
|
|
1517
|
+
|
|
1518
|
+
___
|
|
1519
|
+
|
|
1520
|
+
### hasLocalSecret
|
|
1521
|
+
|
|
1522
|
+
▸ **hasLocalSecret**(`userId`): `Promise`<`boolean`\>
|
|
1523
|
+
|
|
1524
|
+
Check if a LocalSecret exists for a user
|
|
1525
|
+
|
|
1526
|
+
#### Parameters
|
|
1527
|
+
|
|
1528
|
+
| Name | Type | Description |
|
|
1529
|
+
| :------ | :------ | :------ |
|
|
1530
|
+
| `userId` | `string` | User's Cognito sub |
|
|
1531
|
+
|
|
1532
|
+
#### Returns
|
|
1533
|
+
|
|
1534
|
+
`Promise`<`boolean`\>
|
|
1535
|
+
|
|
1536
|
+
true if a LocalSecret exists
|
|
1537
|
+
|
|
1538
|
+
___
|
|
1539
|
+
|
|
1540
|
+
### hasPGPPrivateKey
|
|
1541
|
+
|
|
1542
|
+
▸ **hasPGPPrivateKey**(`userId`): `Promise`<`boolean`\>
|
|
1543
|
+
|
|
1544
|
+
Check if an encrypted PGP private key exists for a user
|
|
1545
|
+
|
|
1546
|
+
#### Parameters
|
|
1547
|
+
|
|
1548
|
+
| Name | Type | Description |
|
|
1549
|
+
| :------ | :------ | :------ |
|
|
1550
|
+
| `userId` | `string` | User's Cognito sub |
|
|
1551
|
+
|
|
1552
|
+
#### Returns
|
|
1553
|
+
|
|
1554
|
+
`Promise`<`boolean`\>
|
|
1555
|
+
|
|
1556
|
+
true if a key exists
|
|
1557
|
+
|
|
1558
|
+
___
|
|
1559
|
+
|
|
1560
|
+
### hashPassword
|
|
1561
|
+
|
|
1562
|
+
▸ **hashPassword**(`password`): `Promise`<`string`\>
|
|
1563
|
+
|
|
1564
|
+
**`Deprecated`**
|
|
1565
|
+
|
|
1566
|
+
legacy feature, see #1252
|
|
1567
|
+
|
|
1568
|
+
AWS Cognito never gets the raw password. We send them
|
|
1569
|
+
a hashed verison using PBKDF2 with SHA-256 and 10,000
|
|
1570
|
+
iterations.
|
|
1571
|
+
|
|
1572
|
+
#### Parameters
|
|
1573
|
+
|
|
1574
|
+
| Name | Type | Description |
|
|
1575
|
+
| :------ | :------ | :------ |
|
|
1576
|
+
| `password` | `string` | The raw password |
|
|
1577
|
+
|
|
1578
|
+
#### Returns
|
|
1579
|
+
|
|
1580
|
+
`Promise`<`string`\>
|
|
1581
|
+
|
|
1582
|
+
Promise resolving to the hashed password
|
|
1583
|
+
|
|
1584
|
+
___
|
|
1585
|
+
|
|
1586
|
+
### importPrivateKey
|
|
1587
|
+
|
|
1588
|
+
▸ **importPrivateKey**(`privateKeyBytes`): `Promise`<`CryptoKey`\>
|
|
1589
|
+
|
|
1590
|
+
Import private key bytes as a CryptoKey for RSA-PSS signing
|
|
1591
|
+
|
|
1592
|
+
#### Parameters
|
|
1593
|
+
|
|
1594
|
+
| Name | Type | Description |
|
|
1595
|
+
| :------ | :------ | :------ |
|
|
1596
|
+
| `privateKeyBytes` | `Uint8Array` | Private key in PKCS8 format |
|
|
1597
|
+
|
|
1598
|
+
#### Returns
|
|
1599
|
+
|
|
1600
|
+
`Promise`<`CryptoKey`\>
|
|
1601
|
+
|
|
1602
|
+
CryptoKey configured for RSA-PSS signing with SHA-256
|
|
1603
|
+
|
|
1604
|
+
___
|
|
1605
|
+
|
|
1606
|
+
### importPublicKey
|
|
1607
|
+
|
|
1608
|
+
▸ **importPublicKey**(`publicKeyPem`): `Promise`<`CryptoKey`\>
|
|
1609
|
+
|
|
1610
|
+
Import a PEM-encoded public key as a CryptoKey for RSA-PSS verification
|
|
1611
|
+
|
|
1612
|
+
#### Parameters
|
|
1613
|
+
|
|
1614
|
+
| Name | Type | Description |
|
|
1615
|
+
| :------ | :------ | :------ |
|
|
1616
|
+
| `publicKeyPem` | `string` | Public key in PEM format (SPKI) |
|
|
1617
|
+
|
|
1618
|
+
#### Returns
|
|
1619
|
+
|
|
1620
|
+
`Promise`<`CryptoKey`\>
|
|
1621
|
+
|
|
1622
|
+
CryptoKey configured for RSA-PSS verification with SHA-256
|
|
1623
|
+
|
|
1624
|
+
___
|
|
1625
|
+
|
|
1626
|
+
### isArgon2Available
|
|
1627
|
+
|
|
1628
|
+
▸ **isArgon2Available**(): `boolean`
|
|
1629
|
+
|
|
1630
|
+
Check if Argon2 module is available
|
|
1631
|
+
|
|
1632
|
+
#### Returns
|
|
1633
|
+
|
|
1634
|
+
`boolean`
|
|
1635
|
+
|
|
1636
|
+
___
|
|
1637
|
+
|
|
1638
|
+
### isArgon2idConfig
|
|
1639
|
+
|
|
1640
|
+
▸ **isArgon2idConfig**(`config`): config is Argon2idConfig
|
|
1641
|
+
|
|
1642
|
+
Type guard for Argon2id config
|
|
1643
|
+
|
|
1644
|
+
#### Parameters
|
|
1645
|
+
|
|
1646
|
+
| Name | Type |
|
|
1647
|
+
| :------ | :------ |
|
|
1648
|
+
| `config` | [`KdfConfig`](#kdfconfig) |
|
|
1649
|
+
|
|
1650
|
+
#### Returns
|
|
1651
|
+
|
|
1652
|
+
config is Argon2idConfig
|
|
1653
|
+
|
|
1654
|
+
___
|
|
1655
|
+
|
|
1656
|
+
### isArmoredPGPKey
|
|
1657
|
+
|
|
1658
|
+
▸ **isArmoredPGPKey**(`input`): `boolean`
|
|
1659
|
+
|
|
1660
|
+
Check if a string looks like an armored PGP key
|
|
1661
|
+
|
|
1662
|
+
#### Parameters
|
|
1663
|
+
|
|
1664
|
+
| Name | Type | Description |
|
|
1665
|
+
| :------ | :------ | :------ |
|
|
1666
|
+
| `input` | `string` | String to check |
|
|
1667
|
+
|
|
1668
|
+
#### Returns
|
|
1669
|
+
|
|
1670
|
+
`boolean`
|
|
1671
|
+
|
|
1672
|
+
true if it appears to be armored PGP format
|
|
1673
|
+
|
|
1674
|
+
___
|
|
1675
|
+
|
|
1676
|
+
### isConditionMet
|
|
1677
|
+
|
|
1678
|
+
▸ **isConditionMet**(`condition`, `formValues`): `boolean`
|
|
1679
|
+
|
|
1680
|
+
Checks all other form values in case any have a
|
|
1681
|
+
trigger value that makes this field required.
|
|
1682
|
+
|
|
1683
|
+
**`Example`**
|
|
1684
|
+
|
|
1685
|
+
```json
|
|
1686
|
+
[
|
|
1687
|
+
{ "if": { "age": [17, 18], "city": ["Taupō"] } },
|
|
1688
|
+
{ "if": { "age": [19, 20] } }
|
|
1689
|
+
]
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
This means `[(age=17 OR age=18) AND (city=Taupō)] OR [(age=19 OR age=20)]`
|
|
1693
|
+
|
|
1694
|
+
#### Parameters
|
|
1695
|
+
|
|
1696
|
+
| Name | Type |
|
|
1697
|
+
| :------ | :------ |
|
|
1698
|
+
| `condition` | `Record`<`string`, `ConditionValue`[]\> |
|
|
1699
|
+
| `formValues` | `Record`<`string`, `unknown`\> |
|
|
1700
|
+
|
|
1701
|
+
#### Returns
|
|
1702
|
+
|
|
1703
|
+
`boolean`
|
|
1704
|
+
|
|
1705
|
+
___
|
|
1706
|
+
|
|
1707
|
+
### isEncrypted
|
|
1708
|
+
|
|
1709
|
+
▸ **isEncrypted**(`value`): value is Encrypted
|
|
1710
|
+
|
|
1711
|
+
Determines where the input is an encrypted Raytio object
|
|
1712
|
+
|
|
1713
|
+
#### Parameters
|
|
1714
|
+
|
|
1715
|
+
| Name | Type | Description |
|
|
1716
|
+
| :------ | :------ | :------ |
|
|
1717
|
+
| `value` | `unknown` | anything |
|
|
1718
|
+
|
|
1719
|
+
#### Returns
|
|
1720
|
+
|
|
1721
|
+
value is Encrypted
|
|
1722
|
+
|
|
1723
|
+
true or false depending on whether the input is an encrypted Raytio object
|
|
1724
|
+
|
|
1725
|
+
___
|
|
1726
|
+
|
|
1727
|
+
### isEncryptedFile
|
|
1728
|
+
|
|
1729
|
+
▸ **isEncryptedFile**(`value`): value is Encrypted
|
|
1730
|
+
|
|
1731
|
+
Determines where the input is an encrypted Raytio file
|
|
1732
|
+
|
|
1733
|
+
#### Parameters
|
|
1734
|
+
|
|
1735
|
+
| Name | Type | Description |
|
|
1736
|
+
| :------ | :------ | :------ |
|
|
1737
|
+
| `value` | `unknown` | anything |
|
|
1738
|
+
|
|
1739
|
+
#### Returns
|
|
1740
|
+
|
|
1741
|
+
value is Encrypted
|
|
1742
|
+
|
|
1743
|
+
true or false depending on whether the input is an encrypted Raytio file
|
|
1744
|
+
|
|
1745
|
+
___
|
|
1746
|
+
|
|
1747
|
+
### isPbkdf2Config
|
|
1748
|
+
|
|
1749
|
+
▸ **isPbkdf2Config**(`config`): config is Pbkdf2Config
|
|
1750
|
+
|
|
1751
|
+
Type guard for PBKDF2 config
|
|
1752
|
+
|
|
1753
|
+
#### Parameters
|
|
1754
|
+
|
|
1755
|
+
| Name | Type |
|
|
1756
|
+
| :------ | :------ |
|
|
1757
|
+
| `config` | [`KdfConfig`](#kdfconfig) |
|
|
1758
|
+
|
|
1759
|
+
#### Returns
|
|
1760
|
+
|
|
1761
|
+
config is Pbkdf2Config
|
|
1762
|
+
|
|
1763
|
+
___
|
|
1764
|
+
|
|
1765
|
+
### isPemFormat
|
|
1766
|
+
|
|
1767
|
+
▸ **isPemFormat**(`input`): `boolean`
|
|
1768
|
+
|
|
1769
|
+
Check if a string is in valid PEM format
|
|
1770
|
+
|
|
1771
|
+
PEM format requires:
|
|
1772
|
+
- A BEGIN header with a type (e.g., "-----BEGIN PUBLIC KEY-----")
|
|
1773
|
+
- Base64-encoded content
|
|
1774
|
+
- An END footer with matching type (e.g., "-----END PUBLIC KEY-----")
|
|
1775
|
+
|
|
1776
|
+
#### Parameters
|
|
1777
|
+
|
|
1778
|
+
| Name | Type | Description |
|
|
1779
|
+
| :------ | :------ | :------ |
|
|
1780
|
+
| `input` | `string` | String to check |
|
|
1781
|
+
|
|
1782
|
+
#### Returns
|
|
1783
|
+
|
|
1784
|
+
`boolean`
|
|
1785
|
+
|
|
1786
|
+
true if the string is valid PEM format, false otherwise
|
|
1787
|
+
|
|
1788
|
+
___
|
|
1789
|
+
|
|
1790
|
+
### isScoreConfigValid
|
|
1791
|
+
|
|
1792
|
+
▸ **isScoreConfigValid**(`x`): x is ScoreConfig
|
|
1793
|
+
|
|
1794
|
+
determines whether a `ScoreConfig` object is valid
|
|
1795
|
+
|
|
1796
|
+
#### Parameters
|
|
1797
|
+
|
|
1798
|
+
| Name | Type |
|
|
1799
|
+
| :------ | :------ |
|
|
1800
|
+
| `x` | `unknown` |
|
|
1801
|
+
|
|
1802
|
+
#### Returns
|
|
1803
|
+
|
|
1804
|
+
x is ScoreConfig
|
|
1805
|
+
|
|
1806
|
+
___
|
|
1807
|
+
|
|
1808
|
+
### isScoreResultValid
|
|
1809
|
+
|
|
1810
|
+
▸ **isScoreResultValid**(`x`): x is ScoreResult
|
|
1811
|
+
|
|
1812
|
+
determines whether a `ScoreResult` object is valid
|
|
1813
|
+
|
|
1814
|
+
#### Parameters
|
|
1815
|
+
|
|
1816
|
+
| Name | Type |
|
|
1817
|
+
| :------ | :------ |
|
|
1818
|
+
| `x` | `unknown` |
|
|
1819
|
+
|
|
1820
|
+
#### Returns
|
|
1821
|
+
|
|
1822
|
+
x is ScoreResult
|
|
1823
|
+
|
|
1824
|
+
___
|
|
1825
|
+
|
|
1826
|
+
### isValidFormattedLocalSecret
|
|
1827
|
+
|
|
1828
|
+
▸ **isValidFormattedLocalSecret**(`formatted`): `boolean`
|
|
1829
|
+
|
|
1830
|
+
Validate a formatted LocalSecret string
|
|
1831
|
+
|
|
1832
|
+
#### Parameters
|
|
1833
|
+
|
|
1834
|
+
| Name | Type | Description |
|
|
1835
|
+
| :------ | :------ | :------ |
|
|
1836
|
+
| `formatted` | `string` | The formatted LocalSecret string |
|
|
1837
|
+
|
|
1838
|
+
#### Returns
|
|
1839
|
+
|
|
1840
|
+
`boolean`
|
|
1841
|
+
|
|
1842
|
+
true if valid, false otherwise
|
|
1843
|
+
|
|
1844
|
+
___
|
|
1845
|
+
|
|
1846
|
+
### isValidLocalSecret
|
|
1847
|
+
|
|
1848
|
+
▸ **isValidLocalSecret**(`localSecret`): localSecret is Uint8Array
|
|
1849
|
+
|
|
1850
|
+
Verify that a LocalSecret is valid
|
|
1851
|
+
|
|
1852
|
+
#### Parameters
|
|
1853
|
+
|
|
1854
|
+
| Name | Type | Description |
|
|
1855
|
+
| :------ | :------ | :------ |
|
|
1856
|
+
| `localSecret` | `undefined` \| ``null`` \| `Uint8Array` | The LocalSecret to verify |
|
|
1857
|
+
|
|
1858
|
+
#### Returns
|
|
1859
|
+
|
|
1860
|
+
localSecret is Uint8Array
|
|
1861
|
+
|
|
1862
|
+
true if valid
|
|
1863
|
+
|
|
1864
|
+
___
|
|
1865
|
+
|
|
1866
|
+
### maskLocalSecret
|
|
1867
|
+
|
|
1868
|
+
▸ **maskLocalSecret**(`formatted`): `string`
|
|
1869
|
+
|
|
1870
|
+
Mask a LocalSecret for partial display
|
|
1871
|
+
|
|
1872
|
+
Shows only the first and last groups, masking the middle.
|
|
1873
|
+
Example: A7K2M9-******-******-******-******-V6Z4C1
|
|
1874
|
+
|
|
1875
|
+
#### Parameters
|
|
1876
|
+
|
|
1877
|
+
| Name | Type | Description |
|
|
1878
|
+
| :------ | :------ | :------ |
|
|
1879
|
+
| `formatted` | `string` | The formatted LocalSecret |
|
|
1880
|
+
|
|
1881
|
+
#### Returns
|
|
1882
|
+
|
|
1883
|
+
`string`
|
|
1884
|
+
|
|
1885
|
+
Masked version for display
|
|
1886
|
+
|
|
1887
|
+
___
|
|
1888
|
+
|
|
1889
|
+
### normalizePassword
|
|
1890
|
+
|
|
1891
|
+
▸ **normalizePassword**(`password`): `string`
|
|
1892
|
+
|
|
1893
|
+
Normalize password for key derivation
|
|
1894
|
+
|
|
1895
|
+
Applies NFKD normalization and trims whitespace.
|
|
1896
|
+
This ensures consistent key derivation across platforms.
|
|
1897
|
+
|
|
1898
|
+
#### Parameters
|
|
1899
|
+
|
|
1900
|
+
| Name | Type | Description |
|
|
1901
|
+
| :------ | :------ | :------ |
|
|
1902
|
+
| `password` | `string` | Raw password input |
|
|
1903
|
+
|
|
1904
|
+
#### Returns
|
|
1905
|
+
|
|
1906
|
+
`string`
|
|
432
1907
|
|
|
433
|
-
|
|
1908
|
+
Normalized password string
|
|
434
1909
|
|
|
435
1910
|
___
|
|
436
1911
|
|
|
437
|
-
###
|
|
1912
|
+
### parseArmoredPGPKey
|
|
438
1913
|
|
|
439
|
-
▸ **
|
|
1914
|
+
▸ **parseArmoredPGPKey**(`armoredKey`, `passphrase?`): `Promise`<[`ParsedPGPKey`](interfaces/ParsedPGPKey.md)\>
|
|
440
1915
|
|
|
441
|
-
|
|
1916
|
+
Parse an armored PGP private key
|
|
1917
|
+
|
|
1918
|
+
**`Throws`**
|
|
1919
|
+
|
|
1920
|
+
PGPKeyImportError if parsing fails
|
|
442
1921
|
|
|
443
1922
|
#### Parameters
|
|
444
1923
|
|
|
445
|
-
| Name | Type |
|
|
446
|
-
| :------ | :------ |
|
|
447
|
-
|
|
|
448
|
-
|
|
|
449
|
-
| › `apiToken` | `string` |
|
|
450
|
-
| › `apiUrl` | `string` |
|
|
1924
|
+
| Name | Type | Description |
|
|
1925
|
+
| :------ | :------ | :------ |
|
|
1926
|
+
| `armoredKey` | `string` | Armored PGP private key string |
|
|
1927
|
+
| `passphrase?` | `string` | Optional passphrase if key is encrypted |
|
|
451
1928
|
|
|
452
1929
|
#### Returns
|
|
453
1930
|
|
|
454
|
-
`Promise
|
|
1931
|
+
`Promise`<[`ParsedPGPKey`](interfaces/ParsedPGPKey.md)\>
|
|
455
1932
|
|
|
456
|
-
|
|
1933
|
+
Parsed key data
|
|
457
1934
|
|
|
458
1935
|
___
|
|
459
1936
|
|
|
460
|
-
###
|
|
1937
|
+
### parseLocalSecret
|
|
461
1938
|
|
|
462
|
-
▸ **
|
|
1939
|
+
▸ **parseLocalSecret**(`formatted`): `Uint8Array`
|
|
463
1940
|
|
|
464
|
-
|
|
465
|
-
|
|
1941
|
+
Parse a formatted LocalSecret back to bytes
|
|
1942
|
+
|
|
1943
|
+
Handles various input formats:
|
|
1944
|
+
- With dashes: A7K2M9-X4P8N3-...
|
|
1945
|
+
- Without dashes: A7K2M9X4P8N3...
|
|
1946
|
+
- With spaces: A7K2M9 X4P8N3 ...
|
|
1947
|
+
- Lowercase: a7k2m9-x4p8n3-...
|
|
466
1948
|
|
|
467
1949
|
#### Parameters
|
|
468
1950
|
|
|
469
|
-
| Name | Type |
|
|
470
|
-
| :------ | :------ |
|
|
471
|
-
|
|
|
472
|
-
| › `apiToken` | `string` |
|
|
473
|
-
| › `apiUrl` | `string` |
|
|
474
|
-
| › `instanceWithoutData` | `InstanceWithoutData` |
|
|
1951
|
+
| Name | Type | Description |
|
|
1952
|
+
| :------ | :------ | :------ |
|
|
1953
|
+
| `formatted` | `string` | The formatted LocalSecret string |
|
|
475
1954
|
|
|
476
1955
|
#### Returns
|
|
477
1956
|
|
|
478
|
-
`
|
|
1957
|
+
`Uint8Array`
|
|
1958
|
+
|
|
1959
|
+
The 32-byte LocalSecret
|
|
479
1960
|
|
|
480
1961
|
___
|
|
481
1962
|
|
|
482
|
-
###
|
|
1963
|
+
### pemToBytes
|
|
483
1964
|
|
|
484
|
-
▸ **
|
|
1965
|
+
▸ **pemToBytes**(`pem`): `Uint8Array`
|
|
485
1966
|
|
|
486
|
-
|
|
1967
|
+
Convert PEM-formatted string to raw bytes
|
|
487
1968
|
|
|
488
|
-
|
|
1969
|
+
Extracts the base64 content from between the PEM headers and decodes it.
|
|
489
1970
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
1971
|
+
**`Throws`**
|
|
1972
|
+
|
|
1973
|
+
Error if the input is not valid PEM format
|
|
493
1974
|
|
|
494
1975
|
#### Parameters
|
|
495
1976
|
|
|
496
|
-
| Name | Type |
|
|
497
|
-
| :------ | :------ |
|
|
498
|
-
| `
|
|
1977
|
+
| Name | Type | Description |
|
|
1978
|
+
| :------ | :------ | :------ |
|
|
1979
|
+
| `pem` | `string` | PEM-formatted string |
|
|
499
1980
|
|
|
500
1981
|
#### Returns
|
|
501
1982
|
|
|
502
|
-
`
|
|
1983
|
+
`Uint8Array`
|
|
503
1984
|
|
|
504
|
-
|
|
1985
|
+
Raw bytes as Uint8Array
|
|
505
1986
|
|
|
506
|
-
|
|
1987
|
+
___
|
|
507
1988
|
|
|
508
|
-
|
|
1989
|
+
### repairDate
|
|
509
1990
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1991
|
+
▸ **repairDate**(`date`): `Date`
|
|
1992
|
+
|
|
1993
|
+
repairs broken ISO dates into valid JS date objects
|
|
513
1994
|
|
|
514
1995
|
#### Parameters
|
|
515
1996
|
|
|
516
1997
|
| Name | Type |
|
|
517
1998
|
| :------ | :------ |
|
|
518
|
-
| `
|
|
1999
|
+
| `date` | `string` \| `Date` |
|
|
519
2000
|
|
|
520
2001
|
#### Returns
|
|
521
2002
|
|
|
522
|
-
`
|
|
2003
|
+
`Date`
|
|
523
2004
|
|
|
524
2005
|
___
|
|
525
2006
|
|
|
526
|
-
###
|
|
527
|
-
|
|
528
|
-
▸ **getOwnRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
2007
|
+
### requiresLocalSecret
|
|
529
2008
|
|
|
530
|
-
|
|
531
|
-
locally verifies the credibility of the signatures in the verifications.
|
|
2009
|
+
▸ **requiresLocalSecret**(`config`): `boolean`
|
|
532
2010
|
|
|
533
|
-
|
|
2011
|
+
Check if a KDF configuration requires LocalSecret
|
|
534
2012
|
|
|
535
2013
|
#### Parameters
|
|
536
2014
|
|
|
537
|
-
| Name | Type |
|
|
538
|
-
| :------ | :------ |
|
|
539
|
-
|
|
|
540
|
-
| › `profileObjects` | `ProfileObject`[] |
|
|
541
|
-
| › `userId` | `UId` |
|
|
542
|
-
| › `verifications` | `Verification`[] |
|
|
2015
|
+
| Name | Type | Description |
|
|
2016
|
+
| :------ | :------ | :------ |
|
|
2017
|
+
| `config` | [`KdfConfig`](#kdfconfig) | KDF configuration |
|
|
543
2018
|
|
|
544
2019
|
#### Returns
|
|
545
2020
|
|
|
546
|
-
`
|
|
2021
|
+
`boolean`
|
|
547
2022
|
|
|
548
|
-
|
|
2023
|
+
true if LocalSecret is required
|
|
549
2024
|
|
|
550
2025
|
___
|
|
551
2026
|
|
|
552
|
-
###
|
|
2027
|
+
### setArgon2Module
|
|
553
2028
|
|
|
554
|
-
▸ **
|
|
2029
|
+
▸ **setArgon2Module**(`module`): `void`
|
|
555
2030
|
|
|
556
|
-
|
|
2031
|
+
Set the Argon2 module reference
|
|
2032
|
+
|
|
2033
|
+
This must be called before using deriveArgon2id.
|
|
2034
|
+
The module is passed in from packages/client where argon2-browser is imported.
|
|
557
2035
|
|
|
558
2036
|
#### Parameters
|
|
559
2037
|
|
|
560
|
-
| Name | Type |
|
|
561
|
-
| :------ | :------ |
|
|
562
|
-
|
|
|
563
|
-
| › `PO` | `ProfileObject` \| `ProfileObjectForUpload` |
|
|
564
|
-
| › `realVers` | `RealVer`[] |
|
|
565
|
-
| › `schema` | `Schema` |
|
|
2038
|
+
| Name | Type | Description |
|
|
2039
|
+
| :------ | :------ | :------ |
|
|
2040
|
+
| `module` | `Argon2Module` | The argon2-browser module |
|
|
566
2041
|
|
|
567
2042
|
#### Returns
|
|
568
2043
|
|
|
569
|
-
`
|
|
570
|
-
|
|
571
|
-
| Name | Type |
|
|
572
|
-
| :------ | :------ |
|
|
573
|
-
| `details` | [`VerDetails`](#verdetails) |
|
|
574
|
-
| `fieldVerifications` | `Record`<`string`, `FieldVerification`\> |
|
|
575
|
-
| `status` | `POVerification` |
|
|
2044
|
+
`void`
|
|
576
2045
|
|
|
577
2046
|
___
|
|
578
2047
|
|
|
579
|
-
###
|
|
580
|
-
|
|
581
|
-
▸ **getSomeoneElsesRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
2048
|
+
### signData
|
|
582
2049
|
|
|
583
|
-
|
|
584
|
-
the Raytio API to verify the credibility of these verifications, returning only valid
|
|
585
|
-
verifications.
|
|
2050
|
+
▸ **signData**(`data`, `privateKey`): `Promise`<`Uint8Array`\>
|
|
586
2051
|
|
|
587
|
-
|
|
2052
|
+
Sign raw bytes with an RSA-PSS private key
|
|
588
2053
|
|
|
589
2054
|
#### Parameters
|
|
590
2055
|
|
|
591
|
-
| Name | Type |
|
|
592
|
-
| :------ | :------ |
|
|
593
|
-
|
|
|
2056
|
+
| Name | Type | Description |
|
|
2057
|
+
| :------ | :------ | :------ |
|
|
2058
|
+
| `data` | `Uint8Array` | Data to sign as Uint8Array |
|
|
2059
|
+
| `privateKey` | `CryptoKey` | CryptoKey configured for RSA-PSS signing |
|
|
594
2060
|
|
|
595
2061
|
#### Returns
|
|
596
2062
|
|
|
597
|
-
`Promise`<`
|
|
2063
|
+
`Promise`<`Uint8Array`\>
|
|
598
2064
|
|
|
599
|
-
|
|
2065
|
+
Signature bytes (512 bytes for RSA-4096)
|
|
600
2066
|
|
|
601
2067
|
___
|
|
602
2068
|
|
|
603
|
-
###
|
|
604
|
-
|
|
605
|
-
▸ **hashPassword**(`password`): `Promise`<`string`\>
|
|
2069
|
+
### signText
|
|
606
2070
|
|
|
607
|
-
|
|
2071
|
+
▸ **signText**(`text`, `privateKey`): `Promise`<`string`\>
|
|
608
2072
|
|
|
609
|
-
|
|
2073
|
+
Sign text and return base64-encoded signature
|
|
610
2074
|
|
|
611
|
-
|
|
612
|
-
a hashed verison using PBKDF2 with SHA-256 and 10,000
|
|
613
|
-
iterations.
|
|
2075
|
+
Convenience wrapper that encodes text to UTF-8 bytes before signing.
|
|
614
2076
|
|
|
615
2077
|
#### Parameters
|
|
616
2078
|
|
|
617
2079
|
| Name | Type | Description |
|
|
618
2080
|
| :------ | :------ | :------ |
|
|
619
|
-
| `
|
|
2081
|
+
| `text` | `string` | Text to sign |
|
|
2082
|
+
| `privateKey` | `CryptoKey` | CryptoKey configured for RSA-PSS signing |
|
|
620
2083
|
|
|
621
2084
|
#### Returns
|
|
622
2085
|
|
|
623
2086
|
`Promise`<`string`\>
|
|
624
2087
|
|
|
625
|
-
|
|
2088
|
+
Base64-encoded signature string
|
|
626
2089
|
|
|
627
2090
|
___
|
|
628
2091
|
|
|
629
|
-
###
|
|
630
|
-
|
|
631
|
-
▸ **isConditionMet**(`condition`, `formValues`): `boolean`
|
|
2092
|
+
### someEncrypted
|
|
632
2093
|
|
|
633
|
-
|
|
634
|
-
trigger value that makes this field required.
|
|
2094
|
+
▸ **someEncrypted**<`T`\>(`...args`): `number`
|
|
635
2095
|
|
|
636
|
-
|
|
2096
|
+
Given a profile object's properties, returns the number
|
|
2097
|
+
of properties that are encryted.
|
|
637
2098
|
|
|
638
|
-
|
|
639
|
-
[
|
|
640
|
-
{ "if": { "age": [17, 18], "city": ["Taupō"] } },
|
|
641
|
-
{ "if": { "age": [19, 20] } }
|
|
642
|
-
]
|
|
643
|
-
```
|
|
2099
|
+
#### Type parameters
|
|
644
2100
|
|
|
645
|
-
|
|
2101
|
+
| Name | Type |
|
|
2102
|
+
| :------ | :------ |
|
|
2103
|
+
| `T` | extends `object` |
|
|
646
2104
|
|
|
647
2105
|
#### Parameters
|
|
648
2106
|
|
|
649
2107
|
| Name | Type |
|
|
650
2108
|
| :------ | :------ |
|
|
651
|
-
| `
|
|
652
|
-
| `formValues` | `Record`<`string`, `unknown`\> |
|
|
2109
|
+
| `...args` | [obj: T] |
|
|
653
2110
|
|
|
654
2111
|
#### Returns
|
|
655
2112
|
|
|
656
|
-
`
|
|
2113
|
+
`number`
|
|
657
2114
|
|
|
658
2115
|
___
|
|
659
2116
|
|
|
660
|
-
###
|
|
2117
|
+
### sortSchemaProperties
|
|
661
2118
|
|
|
662
|
-
▸ **
|
|
2119
|
+
▸ **sortSchemaProperties**(`properties`, `groupOrder?`): `Section`[]
|
|
663
2120
|
|
|
664
|
-
|
|
2121
|
+
Schema properties are an object, so they need to be converted into an
|
|
2122
|
+
array, grouped by the group tag, and then sorted based on the `priority`
|
|
2123
|
+
attribute within their group.
|
|
665
2124
|
|
|
666
2125
|
#### Parameters
|
|
667
2126
|
|
|
668
2127
|
| Name | Type | Description |
|
|
669
2128
|
| :------ | :------ | :------ |
|
|
670
|
-
| `
|
|
2129
|
+
| `properties` | `Record`<`string`, `SchemaField`\> | The schema properties to sort |
|
|
2130
|
+
| `groupOrder?` | `string`[] | Optional array specifying the order of groups. Groups not in this array will appear after ordered groups. |
|
|
671
2131
|
|
|
672
2132
|
#### Returns
|
|
673
2133
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
true or false depending on whether the input is an encrypted Raytio object
|
|
2134
|
+
`Section`[]
|
|
677
2135
|
|
|
678
2136
|
___
|
|
679
2137
|
|
|
680
|
-
###
|
|
2138
|
+
### storeLocalSecret
|
|
681
2139
|
|
|
682
|
-
▸ **
|
|
2140
|
+
▸ **storeLocalSecret**(`userId`, `secret`): `Promise`<`void`\>
|
|
683
2141
|
|
|
684
|
-
|
|
2142
|
+
Store a LocalSecret in IndexedDB
|
|
685
2143
|
|
|
686
2144
|
#### Parameters
|
|
687
2145
|
|
|
688
2146
|
| Name | Type | Description |
|
|
689
2147
|
| :------ | :------ | :------ |
|
|
690
|
-
| `
|
|
2148
|
+
| `userId` | `string` | User's Cognito sub |
|
|
2149
|
+
| `secret` | `Uint8Array` | The 32-byte LocalSecret |
|
|
691
2150
|
|
|
692
2151
|
#### Returns
|
|
693
2152
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
true or false depending on whether the input is an encrypted Raytio file
|
|
2153
|
+
`Promise`<`void`\>
|
|
697
2154
|
|
|
698
2155
|
___
|
|
699
2156
|
|
|
700
|
-
###
|
|
2157
|
+
### storePGPPrivateKey
|
|
701
2158
|
|
|
702
|
-
▸ **
|
|
2159
|
+
▸ **storePGPPrivateKey**(`record`): `Promise`<`void`\>
|
|
703
2160
|
|
|
704
|
-
|
|
2161
|
+
Store an encrypted PGP private key in IndexedDB
|
|
705
2162
|
|
|
706
2163
|
#### Parameters
|
|
707
2164
|
|
|
708
|
-
| Name | Type |
|
|
709
|
-
| :------ | :------ |
|
|
710
|
-
| `
|
|
2165
|
+
| Name | Type | Description |
|
|
2166
|
+
| :------ | :------ | :------ |
|
|
2167
|
+
| `record` | [`StoredPGPPrivateKey`](interfaces/StoredPGPPrivateKey.md) | The encrypted private key record to store |
|
|
711
2168
|
|
|
712
2169
|
#### Returns
|
|
713
2170
|
|
|
714
|
-
|
|
2171
|
+
`Promise`<`void`\>
|
|
715
2172
|
|
|
716
2173
|
___
|
|
717
2174
|
|
|
718
|
-
###
|
|
2175
|
+
### toCognitoAttributes
|
|
719
2176
|
|
|
720
|
-
▸ **
|
|
2177
|
+
▸ **toCognitoAttributes**(`userDoc`): `Object`
|
|
721
2178
|
|
|
722
|
-
|
|
2179
|
+
Given a `UserDoc` from the maxcryptor, this returns an object
|
|
2180
|
+
which you can provide to `Auth.updateUserAttributes()`. It is
|
|
2181
|
+
an object of stringified Json.
|
|
2182
|
+
|
|
2183
|
+
Note: Only includes attributes that exist in userDoc. Missing attributes
|
|
2184
|
+
are filtered out to avoid Cognito "Attribute value must not be null" errors.
|
|
723
2185
|
|
|
724
2186
|
#### Parameters
|
|
725
2187
|
|
|
726
2188
|
| Name | Type |
|
|
727
2189
|
| :------ | :------ |
|
|
728
|
-
| `
|
|
2190
|
+
| `userDoc` | `UserDoc` |
|
|
729
2191
|
|
|
730
2192
|
#### Returns
|
|
731
2193
|
|
|
732
|
-
|
|
2194
|
+
`Object`
|
|
733
2195
|
|
|
734
2196
|
___
|
|
735
2197
|
|
|
736
|
-
###
|
|
2198
|
+
### uint8ArrayToBase64
|
|
737
2199
|
|
|
738
|
-
▸ **
|
|
2200
|
+
▸ **uint8ArrayToBase64**(`bytes`): `string`
|
|
739
2201
|
|
|
740
|
-
|
|
2202
|
+
Convert Uint8Array to base64 string
|
|
741
2203
|
|
|
742
2204
|
#### Parameters
|
|
743
2205
|
|
|
744
2206
|
| Name | Type |
|
|
745
2207
|
| :------ | :------ |
|
|
746
|
-
| `
|
|
2208
|
+
| `bytes` | `Uint8Array` |
|
|
747
2209
|
|
|
748
2210
|
#### Returns
|
|
749
2211
|
|
|
750
|
-
`
|
|
2212
|
+
`string`
|
|
751
2213
|
|
|
752
2214
|
___
|
|
753
2215
|
|
|
754
|
-
###
|
|
2216
|
+
### validateImportedKey
|
|
755
2217
|
|
|
756
|
-
▸ **
|
|
2218
|
+
▸ **validateImportedKey**(`parsedKey`): [`KeyValidationResult`](interfaces/KeyValidationResult.md)
|
|
757
2219
|
|
|
758
|
-
|
|
759
|
-
of properties that are encryted.
|
|
2220
|
+
Validate an imported key
|
|
760
2221
|
|
|
761
|
-
####
|
|
2222
|
+
#### Parameters
|
|
762
2223
|
|
|
763
|
-
| Name | Type |
|
|
764
|
-
| :------ | :------ |
|
|
765
|
-
| `
|
|
2224
|
+
| Name | Type | Description |
|
|
2225
|
+
| :------ | :------ | :------ |
|
|
2226
|
+
| `parsedKey` | [`ParsedPGPKey`](interfaces/ParsedPGPKey.md) | Parsed key to validate |
|
|
2227
|
+
|
|
2228
|
+
#### Returns
|
|
2229
|
+
|
|
2230
|
+
[`KeyValidationResult`](interfaces/KeyValidationResult.md)
|
|
2231
|
+
|
|
2232
|
+
Validation result with any warnings
|
|
2233
|
+
|
|
2234
|
+
___
|
|
2235
|
+
|
|
2236
|
+
### verifySignature
|
|
2237
|
+
|
|
2238
|
+
▸ **verifySignature**(`data`, `signature`, `publicKey`): `Promise`<`boolean`\>
|
|
2239
|
+
|
|
2240
|
+
Verify an RSA-PSS signature
|
|
766
2241
|
|
|
767
2242
|
#### Parameters
|
|
768
2243
|
|
|
769
|
-
| Name | Type |
|
|
770
|
-
| :------ | :------ |
|
|
771
|
-
|
|
|
2244
|
+
| Name | Type | Description |
|
|
2245
|
+
| :------ | :------ | :------ |
|
|
2246
|
+
| `data` | `Uint8Array` | Original data that was signed |
|
|
2247
|
+
| `signature` | `Uint8Array` | Signature bytes to verify |
|
|
2248
|
+
| `publicKey` | `CryptoKey` | CryptoKey configured for RSA-PSS verification |
|
|
772
2249
|
|
|
773
2250
|
#### Returns
|
|
774
2251
|
|
|
775
|
-
`
|
|
2252
|
+
`Promise`<`boolean`\>
|
|
2253
|
+
|
|
2254
|
+
True if signature is valid, false otherwise
|
|
776
2255
|
|
|
777
2256
|
___
|
|
778
2257
|
|
|
779
|
-
###
|
|
2258
|
+
### verifyTextSignature
|
|
780
2259
|
|
|
781
|
-
▸ **
|
|
2260
|
+
▸ **verifyTextSignature**(`text`, `signatureBase64`, `publicKey`): `Promise`<`boolean`\>
|
|
782
2261
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
2262
|
+
Verify a base64-encoded signature for text
|
|
2263
|
+
|
|
2264
|
+
Convenience wrapper that decodes base64 signature and encodes text to UTF-8.
|
|
786
2265
|
|
|
787
2266
|
#### Parameters
|
|
788
2267
|
|
|
789
|
-
| Name | Type |
|
|
790
|
-
| :------ | :------ |
|
|
791
|
-
| `
|
|
2268
|
+
| Name | Type | Description |
|
|
2269
|
+
| :------ | :------ | :------ |
|
|
2270
|
+
| `text` | `string` | Original text that was signed |
|
|
2271
|
+
| `signatureBase64` | `string` | Base64-encoded signature to verify |
|
|
2272
|
+
| `publicKey` | `CryptoKey` | CryptoKey configured for RSA-PSS verification |
|
|
792
2273
|
|
|
793
2274
|
#### Returns
|
|
794
2275
|
|
|
795
|
-
`
|
|
2276
|
+
`Promise`<`boolean`\>
|
|
2277
|
+
|
|
2278
|
+
True if signature is valid, false otherwise
|
|
796
2279
|
|
|
797
2280
|
___
|
|
798
2281
|
|
|
799
|
-
###
|
|
2282
|
+
### xorBytes
|
|
800
2283
|
|
|
801
|
-
▸ **
|
|
2284
|
+
▸ **xorBytes**(`a`, `b`): `Uint8Array`
|
|
802
2285
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
2286
|
+
XOR two byte arrays of equal length
|
|
2287
|
+
|
|
2288
|
+
Used for combining password-derived key with LocalSecret in 2SKD.
|
|
2289
|
+
This follows the 1Password approach of XOR combination.
|
|
2290
|
+
|
|
2291
|
+
**`Throws`**
|
|
2292
|
+
|
|
2293
|
+
Error if arrays are not the same length
|
|
806
2294
|
|
|
807
2295
|
#### Parameters
|
|
808
2296
|
|
|
809
|
-
| Name | Type |
|
|
810
|
-
| :------ | :------ |
|
|
811
|
-
| `
|
|
2297
|
+
| Name | Type | Description |
|
|
2298
|
+
| :------ | :------ | :------ |
|
|
2299
|
+
| `a` | `Uint8Array` | First byte array |
|
|
2300
|
+
| `b` | `Uint8Array` | Second byte array |
|
|
812
2301
|
|
|
813
2302
|
#### Returns
|
|
814
2303
|
|
|
815
|
-
`
|
|
2304
|
+
`Uint8Array`
|
|
2305
|
+
|
|
2306
|
+
XOR result
|