@raytio/core 11.4.1 → 11.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1714 -213
- 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/index.d.ts +1 -0
- package/dist/schema/expandSchema/index.js +1 -0
- 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 +11 -10
- package/dist/verifications/safeHarbour.js +5 -0
- package/dist/verifications/verifyCheck/getOwnRealVerifications.js +3 -0
- package/dist/verifications/verifyCheck/getSomeoneElsesRealVerifications.js +1 -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 -217
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/__tests__/getSomeoneElsesRealVerifications.test.js +0 -205
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.d.ts +0 -1
- package/dist/verifications/verifyCheck/operations/__tests__/checkOwnVerification.test.js +0 -131
- 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,49 +16,217 @@ 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)
|
|
24
55
|
- [ServerRelationship](#serverrelationship)
|
|
25
56
|
- [VerDetails](#verdetails)
|
|
26
57
|
|
|
58
|
+
### Variables
|
|
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)
|
|
68
|
+
- [TAG\_DENYLIST](#tag_denylist)
|
|
69
|
+
|
|
27
70
|
### Functions
|
|
28
71
|
|
|
72
|
+
- [base64ToUint8Array](#base64touint8array)
|
|
73
|
+
- [bytesToPem](#bytestopem)
|
|
29
74
|
- [calcSafeHarbourScore](#calcsafeharbourscore)
|
|
30
75
|
- [calculateScore](#calculatescore)
|
|
76
|
+
- [canonicalJsonify](#canonicaljsonify)
|
|
31
77
|
- [checkJsonSignature](#checkjsonsignature)
|
|
78
|
+
- [computeKeyFingerprint](#computekeyfingerprint)
|
|
79
|
+
- [constantTimeEqual](#constanttimeequal)
|
|
32
80
|
- [convertInstanceToRuleInput](#convertinstancetoruleinput)
|
|
33
81
|
- [convertServerRelationship](#convertserverrelationship)
|
|
34
82
|
- [createAA](#createaa)
|
|
83
|
+
- [createArgon2idConfig](#createargon2idconfig)
|
|
35
84
|
- [createHashedNId](#createhashednid)
|
|
85
|
+
- [createIndexedDBPGPKeyStorage](#createindexeddbpgpkeystorage)
|
|
86
|
+
- [createIndexedDBStorage](#createindexeddbstorage)
|
|
87
|
+
- [decryptPrivateKey](#decryptprivatekey)
|
|
36
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)
|
|
37
97
|
- [evaluateRule](#evaluaterule)
|
|
98
|
+
- [evaluateUserBadges](#evaluateuserbadges)
|
|
38
99
|
- [expandSchema](#expandschema)
|
|
100
|
+
- [exportPGPKeyToArmored](#exportpgpkeytoarmored)
|
|
101
|
+
- [extractPemType](#extractpemtype)
|
|
39
102
|
- [findSchemaLabel](#findschemalabel)
|
|
40
103
|
- [findSuitableLocale](#findsuitablelocale)
|
|
104
|
+
- [formatFingerprint](#formatfingerprint)
|
|
105
|
+
- [formatLocalSecret](#formatlocalsecret)
|
|
41
106
|
- [fromCognitoAttributes](#fromcognitoattributes)
|
|
107
|
+
- [generateDeviceId](#generatedeviceid)
|
|
108
|
+
- [generateLocalSecret](#generatelocalsecret)
|
|
109
|
+
- [generatePGPKeyPair](#generatepgpkeypair)
|
|
110
|
+
- [generateRandomBytes](#generaterandombytes)
|
|
111
|
+
- [generateSalt](#generatesalt)
|
|
42
112
|
- [getAADecryptor](#getaadecryptor)
|
|
43
113
|
- [getAAPublicKey](#getaapublickey)
|
|
114
|
+
- [getKdfVersion](#getkdfversion)
|
|
115
|
+
- [getLocalSecret](#getlocalsecret)
|
|
116
|
+
- [getLocalSecretRecord](#getlocalsecretrecord)
|
|
44
117
|
- [getMissingDataForInstance](#getmissingdataforinstance)
|
|
45
118
|
- [getNidFromUrn](#getnidfromurn)
|
|
119
|
+
- [getOrCreateDeviceId](#getorcreatedeviceid)
|
|
46
120
|
- [getOwnRealVerifications](#getownrealverifications)
|
|
121
|
+
- [getPGPPrivateKey](#getpgpprivatekey)
|
|
47
122
|
- [getPOVerification](#getpoverification)
|
|
48
123
|
- [getSomeoneElsesRealVerifications](#getsomeoneelsesrealverifications)
|
|
124
|
+
- [hasLocalSecret](#haslocalsecret)
|
|
125
|
+
- [hasPGPPrivateKey](#haspgpprivatekey)
|
|
49
126
|
- [hashPassword](#hashpassword)
|
|
127
|
+
- [importPrivateKey](#importprivatekey)
|
|
128
|
+
- [importPublicKey](#importpublickey)
|
|
129
|
+
- [isArgon2Available](#isargon2available)
|
|
130
|
+
- [isArgon2idConfig](#isargon2idconfig)
|
|
131
|
+
- [isArmoredPGPKey](#isarmoredpgpkey)
|
|
50
132
|
- [isConditionMet](#isconditionmet)
|
|
51
133
|
- [isEncrypted](#isencrypted)
|
|
52
134
|
- [isEncryptedFile](#isencryptedfile)
|
|
135
|
+
- [isPbkdf2Config](#ispbkdf2config)
|
|
136
|
+
- [isPemFormat](#ispemformat)
|
|
53
137
|
- [isScoreConfigValid](#isscoreconfigvalid)
|
|
54
138
|
- [isScoreResultValid](#isscoreresultvalid)
|
|
139
|
+
- [isValidFormattedLocalSecret](#isvalidformattedlocalsecret)
|
|
140
|
+
- [isValidLocalSecret](#isvalidlocalsecret)
|
|
141
|
+
- [maskLocalSecret](#masklocalsecret)
|
|
142
|
+
- [normalizePassword](#normalizepassword)
|
|
143
|
+
- [parseArmoredPGPKey](#parsearmoredpgpkey)
|
|
144
|
+
- [parseLocalSecret](#parselocalsecret)
|
|
145
|
+
- [pemToBytes](#pemtobytes)
|
|
55
146
|
- [repairDate](#repairdate)
|
|
147
|
+
- [requiresLocalSecret](#requireslocalsecret)
|
|
148
|
+
- [setArgon2Module](#setargon2module)
|
|
149
|
+
- [signData](#signdata)
|
|
150
|
+
- [signText](#signtext)
|
|
56
151
|
- [someEncrypted](#someencrypted)
|
|
57
152
|
- [sortSchemaProperties](#sortschemaproperties)
|
|
153
|
+
- [storeLocalSecret](#storelocalsecret)
|
|
154
|
+
- [storePGPPrivateKey](#storepgpprivatekey)
|
|
58
155
|
- [toCognitoAttributes](#tocognitoattributes)
|
|
156
|
+
- [uint8ArrayToBase64](#uint8arraytobase64)
|
|
157
|
+
- [validateImportedKey](#validateimportedkey)
|
|
158
|
+
- [verifySignature](#verifysignature)
|
|
159
|
+
- [verifyTextSignature](#verifytextsignature)
|
|
160
|
+
- [xorBytes](#xorbytes)
|
|
59
161
|
|
|
60
162
|
## Type Aliases
|
|
61
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
|
+
|
|
62
230
|
### SafeHarbourObj
|
|
63
231
|
|
|
64
232
|
Ƭ **SafeHarbourObj**: `Partial`<`Record`<`SafeHarbourCode`, `string`[]\>\>
|
|
@@ -90,7 +258,7 @@ ___
|
|
|
90
258
|
|
|
91
259
|
### ServerRelationship
|
|
92
260
|
|
|
93
|
-
Ƭ **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`` }
|
|
94
262
|
|
|
95
263
|
This type represents the relationship format returned by the Postgres API
|
|
96
264
|
|
|
@@ -108,8 +276,146 @@ ___
|
|
|
108
276
|
| `sourceNId?` | `NId` | - |
|
|
109
277
|
| `verifiers` | `VerificationProvider`[] | - |
|
|
110
278
|
|
|
279
|
+
## Variables
|
|
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
|
+
|
|
371
|
+
### TAG\_DENYLIST
|
|
372
|
+
|
|
373
|
+
• `Const` **TAG\_DENYLIST**: `SchemaTag`[]
|
|
374
|
+
|
|
111
375
|
## Functions
|
|
112
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
|
+
|
|
113
419
|
### calcSafeHarbourScore
|
|
114
420
|
|
|
115
421
|
▸ **calcSafeHarbourScore**(`data`): `Promise`<[`SafeHarbourResult`](#safeharbourresult)\>
|
|
@@ -155,6 +461,27 @@ Might throw an error.
|
|
|
155
461
|
|
|
156
462
|
___
|
|
157
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
|
+
|
|
158
485
|
### checkJsonSignature
|
|
159
486
|
|
|
160
487
|
▸ **checkJsonSignature**(`data`, `signature`, `keyId`): `Promise`<`boolean`\>
|
|
@@ -177,6 +504,49 @@ or `getSomeoneElsesRealVerifications` instead.
|
|
|
177
504
|
|
|
178
505
|
___
|
|
179
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
|
+
|
|
180
550
|
### convertInstanceToRuleInput
|
|
181
551
|
|
|
182
552
|
▸ **convertInstanceToRuleInput**(`POs`, `realVers`, `getSchema`): `Promise`<`RuleData`\>
|
|
@@ -243,6 +613,27 @@ as well as the `userDoc` data which is stored in the user's cognito attributes.
|
|
|
243
613
|
|
|
244
614
|
___
|
|
245
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
|
+
|
|
246
637
|
### createHashedNId
|
|
247
638
|
|
|
248
639
|
▸ **createHashedNId**(`nId`, `aId`): `NId`
|
|
@@ -266,6 +657,56 @@ This was first introduced in #1048
|
|
|
266
657
|
|
|
267
658
|
___
|
|
268
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
|
+
|
|
269
710
|
### decryptSharedData
|
|
270
711
|
|
|
271
712
|
▸ **decryptSharedData**(`«destructured»`): `Promise`<{ `applicationDecryptor`: `ApplicationDataEncryptorI` ; `instance`: `Instance` }\>
|
|
@@ -296,65 +737,328 @@ a copy of `instanceData` with all properties decrypted.
|
|
|
296
737
|
|
|
297
738
|
___
|
|
298
739
|
|
|
299
|
-
###
|
|
740
|
+
### deleteLocalSecret
|
|
300
741
|
|
|
301
|
-
▸ **
|
|
742
|
+
▸ **deleteLocalSecret**(`userId`): `Promise`<`void`\>
|
|
302
743
|
|
|
303
|
-
|
|
744
|
+
Delete a LocalSecret from IndexedDB
|
|
304
745
|
|
|
305
746
|
#### Parameters
|
|
306
747
|
|
|
307
|
-
| Name | Type |
|
|
308
|
-
| :------ | :------ |
|
|
309
|
-
| `
|
|
310
|
-
| `data` | `RuleData` |
|
|
748
|
+
| Name | Type | Description |
|
|
749
|
+
| :------ | :------ | :------ |
|
|
750
|
+
| `userId` | `string` | User's Cognito sub |
|
|
311
751
|
|
|
312
752
|
#### Returns
|
|
313
753
|
|
|
314
|
-
`
|
|
315
|
-
|
|
316
|
-
| Name | Type |
|
|
317
|
-
| :------ | :------ |
|
|
318
|
-
| `passed` | `boolean` |
|
|
319
|
-
| `score` | `number` |
|
|
754
|
+
`Promise`<`void`\>
|
|
320
755
|
|
|
321
756
|
___
|
|
322
757
|
|
|
323
|
-
###
|
|
758
|
+
### deletePGPPrivateKey
|
|
324
759
|
|
|
325
|
-
▸ **
|
|
760
|
+
▸ **deletePGPPrivateKey**(`userId`): `Promise`<`void`\>
|
|
326
761
|
|
|
327
|
-
|
|
328
|
-
the JSON that the API returns, into a `Schema` object that's useful
|
|
329
|
-
to the client.
|
|
762
|
+
Delete an encrypted PGP private key from IndexedDB
|
|
330
763
|
|
|
331
764
|
#### Parameters
|
|
332
765
|
|
|
333
|
-
| Name | Type |
|
|
334
|
-
| :------ | :------ |
|
|
335
|
-
| `
|
|
336
|
-
| `allUnexpandedSchemas` | `WrappedSchema`[] |
|
|
337
|
-
| `userLocales` | readonly `string`[] |
|
|
766
|
+
| Name | Type | Description |
|
|
767
|
+
| :------ | :------ | :------ |
|
|
768
|
+
| `userId` | `string` | User's Cognito sub |
|
|
338
769
|
|
|
339
770
|
#### Returns
|
|
340
771
|
|
|
341
|
-
`
|
|
772
|
+
`Promise`<`void`\>
|
|
342
773
|
|
|
343
774
|
___
|
|
344
775
|
|
|
345
|
-
###
|
|
776
|
+
### deriveArgon2id
|
|
346
777
|
|
|
347
|
-
▸ **
|
|
778
|
+
▸ **deriveArgon2id**(`password`, `config`): `Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
348
779
|
|
|
349
|
-
|
|
780
|
+
Derive a key using Argon2id
|
|
350
781
|
|
|
351
|
-
|
|
782
|
+
**`Throws`**
|
|
352
783
|
|
|
353
|
-
|
|
354
|
-
| :------ | :------ |
|
|
355
|
-
| `labels` | `undefined` \| `string`[] |
|
|
784
|
+
Error if argon2 module is not available
|
|
356
785
|
|
|
357
|
-
####
|
|
786
|
+
#### Parameters
|
|
787
|
+
|
|
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 |
|
|
792
|
+
|
|
793
|
+
#### Returns
|
|
794
|
+
|
|
795
|
+
`Promise`<[`KdfResult`](interfaces/KdfResult.md)\>
|
|
796
|
+
|
|
797
|
+
KdfResult containing the derived 32-byte key
|
|
798
|
+
|
|
799
|
+
___
|
|
800
|
+
|
|
801
|
+
### deriveKey
|
|
802
|
+
|
|
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
|
|
358
1062
|
|
|
359
1063
|
`undefined` \| `SchemaName`
|
|
360
1064
|
|
|
@@ -365,7 +1069,12 @@ ___
|
|
|
365
1069
|
▸ **findSuitableLocale**(`options`, `langs`): `undefined` \| `string`
|
|
366
1070
|
|
|
367
1071
|
Selects the most suitable locale to use from a list of options.
|
|
368
|
-
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)
|
|
369
1078
|
|
|
370
1079
|
#### Parameters
|
|
371
1080
|
|
|
@@ -380,6 +1089,49 @@ Returns undefined if there is no language that the user speaks
|
|
|
380
1089
|
|
|
381
1090
|
___
|
|
382
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
|
+
|
|
383
1135
|
### fromCognitoAttributes
|
|
384
1136
|
|
|
385
1137
|
▸ **fromCognitoAttributes**(`attributes`): `UserDoc`
|
|
@@ -399,18 +1151,99 @@ The userAttributes come from `const attributes = await Auth.userAttributes(user)
|
|
|
399
1151
|
|
|
400
1152
|
___
|
|
401
1153
|
|
|
402
|
-
###
|
|
1154
|
+
### generateDeviceId
|
|
403
1155
|
|
|
404
|
-
▸ **
|
|
1156
|
+
▸ **generateDeviceId**(): `string`
|
|
405
1157
|
|
|
406
|
-
|
|
407
|
-
|
|
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
|
|
408
1206
|
|
|
409
1207
|
#### Parameters
|
|
410
1208
|
|
|
411
|
-
| Name | Type |
|
|
412
|
-
| :------ | :------ |
|
|
413
|
-
|
|
|
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` |
|
|
414
1247
|
| › `aId` | `AId` |
|
|
415
1248
|
| › `apiToken` | `string` |
|
|
416
1249
|
| › `apiUrl` | `string` |
|
|
@@ -418,388 +1251,1056 @@ the [https://npm.im/@raytio/maxcryptor|Maxcryptor](https://npm.im/@raytio/maxcry
|
|
|
418
1251
|
|
|
419
1252
|
#### Returns
|
|
420
1253
|
|
|
421
|
-
`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`
|
|
422
1907
|
|
|
423
|
-
|
|
1908
|
+
Normalized password string
|
|
424
1909
|
|
|
425
1910
|
___
|
|
426
1911
|
|
|
427
|
-
###
|
|
1912
|
+
### parseArmoredPGPKey
|
|
428
1913
|
|
|
429
|
-
▸ **
|
|
1914
|
+
▸ **parseArmoredPGPKey**(`armoredKey`, `passphrase?`): `Promise`<[`ParsedPGPKey`](interfaces/ParsedPGPKey.md)\>
|
|
430
1915
|
|
|
431
|
-
|
|
1916
|
+
Parse an armored PGP private key
|
|
1917
|
+
|
|
1918
|
+
**`Throws`**
|
|
1919
|
+
|
|
1920
|
+
PGPKeyImportError if parsing fails
|
|
432
1921
|
|
|
433
1922
|
#### Parameters
|
|
434
1923
|
|
|
435
|
-
| Name | Type |
|
|
436
|
-
| :------ | :------ |
|
|
437
|
-
|
|
|
438
|
-
|
|
|
439
|
-
| › `apiToken` | `string` |
|
|
440
|
-
| › `apiUrl` | `string` |
|
|
1924
|
+
| Name | Type | Description |
|
|
1925
|
+
| :------ | :------ | :------ |
|
|
1926
|
+
| `armoredKey` | `string` | Armored PGP private key string |
|
|
1927
|
+
| `passphrase?` | `string` | Optional passphrase if key is encrypted |
|
|
441
1928
|
|
|
442
1929
|
#### Returns
|
|
443
1930
|
|
|
444
|
-
`Promise
|
|
1931
|
+
`Promise`<[`ParsedPGPKey`](interfaces/ParsedPGPKey.md)\>
|
|
445
1932
|
|
|
446
|
-
|
|
1933
|
+
Parsed key data
|
|
447
1934
|
|
|
448
1935
|
___
|
|
449
1936
|
|
|
450
|
-
###
|
|
1937
|
+
### parseLocalSecret
|
|
451
1938
|
|
|
452
|
-
▸ **
|
|
1939
|
+
▸ **parseLocalSecret**(`formatted`): `Uint8Array`
|
|
453
1940
|
|
|
454
|
-
|
|
455
|
-
|
|
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-...
|
|
456
1948
|
|
|
457
1949
|
#### Parameters
|
|
458
1950
|
|
|
459
|
-
| Name | Type |
|
|
460
|
-
| :------ | :------ |
|
|
461
|
-
|
|
|
462
|
-
| › `apiToken` | `string` |
|
|
463
|
-
| › `apiUrl` | `string` |
|
|
464
|
-
| › `instanceWithoutData` | `InstanceWithoutData` |
|
|
1951
|
+
| Name | Type | Description |
|
|
1952
|
+
| :------ | :------ | :------ |
|
|
1953
|
+
| `formatted` | `string` | The formatted LocalSecret string |
|
|
465
1954
|
|
|
466
1955
|
#### Returns
|
|
467
1956
|
|
|
468
|
-
`
|
|
1957
|
+
`Uint8Array`
|
|
1958
|
+
|
|
1959
|
+
The 32-byte LocalSecret
|
|
469
1960
|
|
|
470
1961
|
___
|
|
471
1962
|
|
|
472
|
-
###
|
|
1963
|
+
### pemToBytes
|
|
473
1964
|
|
|
474
|
-
▸ **
|
|
1965
|
+
▸ **pemToBytes**(`pem`): `Uint8Array`
|
|
475
1966
|
|
|
476
|
-
|
|
1967
|
+
Convert PEM-formatted string to raw bytes
|
|
477
1968
|
|
|
478
|
-
|
|
1969
|
+
Extracts the base64 content from between the PEM headers and decodes it.
|
|
479
1970
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
1971
|
+
**`Throws`**
|
|
1972
|
+
|
|
1973
|
+
Error if the input is not valid PEM format
|
|
483
1974
|
|
|
484
1975
|
#### Parameters
|
|
485
1976
|
|
|
486
|
-
| Name | Type |
|
|
487
|
-
| :------ | :------ |
|
|
488
|
-
| `
|
|
1977
|
+
| Name | Type | Description |
|
|
1978
|
+
| :------ | :------ | :------ |
|
|
1979
|
+
| `pem` | `string` | PEM-formatted string |
|
|
489
1980
|
|
|
490
1981
|
#### Returns
|
|
491
1982
|
|
|
492
|
-
`
|
|
1983
|
+
`Uint8Array`
|
|
493
1984
|
|
|
494
|
-
|
|
1985
|
+
Raw bytes as Uint8Array
|
|
495
1986
|
|
|
496
|
-
|
|
1987
|
+
___
|
|
497
1988
|
|
|
498
|
-
|
|
1989
|
+
### repairDate
|
|
499
1990
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
1991
|
+
▸ **repairDate**(`date`): `Date`
|
|
1992
|
+
|
|
1993
|
+
repairs broken ISO dates into valid JS date objects
|
|
503
1994
|
|
|
504
1995
|
#### Parameters
|
|
505
1996
|
|
|
506
1997
|
| Name | Type |
|
|
507
1998
|
| :------ | :------ |
|
|
508
|
-
| `
|
|
1999
|
+
| `date` | `string` \| `Date` |
|
|
509
2000
|
|
|
510
2001
|
#### Returns
|
|
511
2002
|
|
|
512
|
-
`
|
|
2003
|
+
`Date`
|
|
513
2004
|
|
|
514
2005
|
___
|
|
515
2006
|
|
|
516
|
-
###
|
|
517
|
-
|
|
518
|
-
▸ **getOwnRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
2007
|
+
### requiresLocalSecret
|
|
519
2008
|
|
|
520
|
-
|
|
521
|
-
locally verifies the credibility of the signatures in the verifications.
|
|
2009
|
+
▸ **requiresLocalSecret**(`config`): `boolean`
|
|
522
2010
|
|
|
523
|
-
|
|
2011
|
+
Check if a KDF configuration requires LocalSecret
|
|
524
2012
|
|
|
525
2013
|
#### Parameters
|
|
526
2014
|
|
|
527
|
-
| Name | Type |
|
|
528
|
-
| :------ | :------ |
|
|
529
|
-
|
|
|
530
|
-
| › `profileObjects` | `ProfileObject`[] |
|
|
531
|
-
| › `userId` | `UId` |
|
|
532
|
-
| › `verifications` | `Verification`[] |
|
|
2015
|
+
| Name | Type | Description |
|
|
2016
|
+
| :------ | :------ | :------ |
|
|
2017
|
+
| `config` | [`KdfConfig`](#kdfconfig) | KDF configuration |
|
|
533
2018
|
|
|
534
2019
|
#### Returns
|
|
535
2020
|
|
|
536
|
-
`
|
|
2021
|
+
`boolean`
|
|
537
2022
|
|
|
538
|
-
|
|
2023
|
+
true if LocalSecret is required
|
|
539
2024
|
|
|
540
2025
|
___
|
|
541
2026
|
|
|
542
|
-
###
|
|
2027
|
+
### setArgon2Module
|
|
543
2028
|
|
|
544
|
-
▸ **
|
|
2029
|
+
▸ **setArgon2Module**(`module`): `void`
|
|
545
2030
|
|
|
546
|
-
|
|
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.
|
|
547
2035
|
|
|
548
2036
|
#### Parameters
|
|
549
2037
|
|
|
550
|
-
| Name | Type |
|
|
551
|
-
| :------ | :------ |
|
|
552
|
-
|
|
|
553
|
-
| › `PO` | `ProfileObject` \| `ProfileObjectForUpload` |
|
|
554
|
-
| › `realVers` | `RealVer`[] |
|
|
555
|
-
| › `schema` | `Schema` |
|
|
2038
|
+
| Name | Type | Description |
|
|
2039
|
+
| :------ | :------ | :------ |
|
|
2040
|
+
| `module` | `Argon2Module` | The argon2-browser module |
|
|
556
2041
|
|
|
557
2042
|
#### Returns
|
|
558
2043
|
|
|
559
|
-
`
|
|
560
|
-
|
|
561
|
-
| Name | Type |
|
|
562
|
-
| :------ | :------ |
|
|
563
|
-
| `details` | [`VerDetails`](#verdetails) |
|
|
564
|
-
| `fieldVerifications` | `Record`<`string`, `FieldVerification`\> |
|
|
565
|
-
| `status` | `POVerification` |
|
|
2044
|
+
`void`
|
|
566
2045
|
|
|
567
2046
|
___
|
|
568
2047
|
|
|
569
|
-
###
|
|
570
|
-
|
|
571
|
-
▸ **getSomeoneElsesRealVerifications**(`«destructured»`): `Promise`<`RealVer`[]\>
|
|
2048
|
+
### signData
|
|
572
2049
|
|
|
573
|
-
|
|
574
|
-
the Raytio API to verify the credibility of these verifications, returning only valid
|
|
575
|
-
verifications.
|
|
2050
|
+
▸ **signData**(`data`, `privateKey`): `Promise`<`Uint8Array`\>
|
|
576
2051
|
|
|
577
|
-
|
|
2052
|
+
Sign raw bytes with an RSA-PSS private key
|
|
578
2053
|
|
|
579
2054
|
#### Parameters
|
|
580
2055
|
|
|
581
|
-
| Name | Type |
|
|
582
|
-
| :------ | :------ |
|
|
583
|
-
|
|
|
2056
|
+
| Name | Type | Description |
|
|
2057
|
+
| :------ | :------ | :------ |
|
|
2058
|
+
| `data` | `Uint8Array` | Data to sign as Uint8Array |
|
|
2059
|
+
| `privateKey` | `CryptoKey` | CryptoKey configured for RSA-PSS signing |
|
|
584
2060
|
|
|
585
2061
|
#### Returns
|
|
586
2062
|
|
|
587
|
-
`Promise`<`
|
|
2063
|
+
`Promise`<`Uint8Array`\>
|
|
588
2064
|
|
|
589
|
-
|
|
2065
|
+
Signature bytes (512 bytes for RSA-4096)
|
|
590
2066
|
|
|
591
2067
|
___
|
|
592
2068
|
|
|
593
|
-
###
|
|
594
|
-
|
|
595
|
-
▸ **hashPassword**(`password`): `Promise`<`string`\>
|
|
2069
|
+
### signText
|
|
596
2070
|
|
|
597
|
-
|
|
2071
|
+
▸ **signText**(`text`, `privateKey`): `Promise`<`string`\>
|
|
598
2072
|
|
|
599
|
-
|
|
2073
|
+
Sign text and return base64-encoded signature
|
|
600
2074
|
|
|
601
|
-
|
|
602
|
-
a hashed verison using PBKDF2 with SHA-256 and 10,000
|
|
603
|
-
iterations.
|
|
2075
|
+
Convenience wrapper that encodes text to UTF-8 bytes before signing.
|
|
604
2076
|
|
|
605
2077
|
#### Parameters
|
|
606
2078
|
|
|
607
2079
|
| Name | Type | Description |
|
|
608
2080
|
| :------ | :------ | :------ |
|
|
609
|
-
| `
|
|
2081
|
+
| `text` | `string` | Text to sign |
|
|
2082
|
+
| `privateKey` | `CryptoKey` | CryptoKey configured for RSA-PSS signing |
|
|
610
2083
|
|
|
611
2084
|
#### Returns
|
|
612
2085
|
|
|
613
2086
|
`Promise`<`string`\>
|
|
614
2087
|
|
|
615
|
-
|
|
2088
|
+
Base64-encoded signature string
|
|
616
2089
|
|
|
617
2090
|
___
|
|
618
2091
|
|
|
619
|
-
###
|
|
620
|
-
|
|
621
|
-
▸ **isConditionMet**(`condition`, `formValues`): `boolean`
|
|
2092
|
+
### someEncrypted
|
|
622
2093
|
|
|
623
|
-
|
|
624
|
-
trigger value that makes this field required.
|
|
2094
|
+
▸ **someEncrypted**<`T`\>(`...args`): `number`
|
|
625
2095
|
|
|
626
|
-
|
|
2096
|
+
Given a profile object's properties, returns the number
|
|
2097
|
+
of properties that are encryted.
|
|
627
2098
|
|
|
628
|
-
|
|
629
|
-
[
|
|
630
|
-
{ "if": { "age": [17, 18], "city": ["Taupō"] } },
|
|
631
|
-
{ "if": { "age": [19, 20] } }
|
|
632
|
-
]
|
|
633
|
-
```
|
|
2099
|
+
#### Type parameters
|
|
634
2100
|
|
|
635
|
-
|
|
2101
|
+
| Name | Type |
|
|
2102
|
+
| :------ | :------ |
|
|
2103
|
+
| `T` | extends `object` |
|
|
636
2104
|
|
|
637
2105
|
#### Parameters
|
|
638
2106
|
|
|
639
2107
|
| Name | Type |
|
|
640
2108
|
| :------ | :------ |
|
|
641
|
-
| `
|
|
642
|
-
| `formValues` | `Record`<`string`, `unknown`\> |
|
|
2109
|
+
| `...args` | [obj: T] |
|
|
643
2110
|
|
|
644
2111
|
#### Returns
|
|
645
2112
|
|
|
646
|
-
`
|
|
2113
|
+
`number`
|
|
647
2114
|
|
|
648
2115
|
___
|
|
649
2116
|
|
|
650
|
-
###
|
|
2117
|
+
### sortSchemaProperties
|
|
651
2118
|
|
|
652
|
-
▸ **
|
|
2119
|
+
▸ **sortSchemaProperties**(`properties`, `groupOrder?`): `Section`[]
|
|
653
2120
|
|
|
654
|
-
|
|
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.
|
|
655
2124
|
|
|
656
2125
|
#### Parameters
|
|
657
2126
|
|
|
658
2127
|
| Name | Type | Description |
|
|
659
2128
|
| :------ | :------ | :------ |
|
|
660
|
-
| `
|
|
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. |
|
|
661
2131
|
|
|
662
2132
|
#### Returns
|
|
663
2133
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
true or false depending on whether the input is an encrypted Raytio object
|
|
2134
|
+
`Section`[]
|
|
667
2135
|
|
|
668
2136
|
___
|
|
669
2137
|
|
|
670
|
-
###
|
|
2138
|
+
### storeLocalSecret
|
|
671
2139
|
|
|
672
|
-
▸ **
|
|
2140
|
+
▸ **storeLocalSecret**(`userId`, `secret`): `Promise`<`void`\>
|
|
673
2141
|
|
|
674
|
-
|
|
2142
|
+
Store a LocalSecret in IndexedDB
|
|
675
2143
|
|
|
676
2144
|
#### Parameters
|
|
677
2145
|
|
|
678
2146
|
| Name | Type | Description |
|
|
679
2147
|
| :------ | :------ | :------ |
|
|
680
|
-
| `
|
|
2148
|
+
| `userId` | `string` | User's Cognito sub |
|
|
2149
|
+
| `secret` | `Uint8Array` | The 32-byte LocalSecret |
|
|
681
2150
|
|
|
682
2151
|
#### Returns
|
|
683
2152
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
true or false depending on whether the input is an encrypted Raytio file
|
|
2153
|
+
`Promise`<`void`\>
|
|
687
2154
|
|
|
688
2155
|
___
|
|
689
2156
|
|
|
690
|
-
###
|
|
2157
|
+
### storePGPPrivateKey
|
|
691
2158
|
|
|
692
|
-
▸ **
|
|
2159
|
+
▸ **storePGPPrivateKey**(`record`): `Promise`<`void`\>
|
|
693
2160
|
|
|
694
|
-
|
|
2161
|
+
Store an encrypted PGP private key in IndexedDB
|
|
695
2162
|
|
|
696
2163
|
#### Parameters
|
|
697
2164
|
|
|
698
|
-
| Name | Type |
|
|
699
|
-
| :------ | :------ |
|
|
700
|
-
| `
|
|
2165
|
+
| Name | Type | Description |
|
|
2166
|
+
| :------ | :------ | :------ |
|
|
2167
|
+
| `record` | [`StoredPGPPrivateKey`](interfaces/StoredPGPPrivateKey.md) | The encrypted private key record to store |
|
|
701
2168
|
|
|
702
2169
|
#### Returns
|
|
703
2170
|
|
|
704
|
-
|
|
2171
|
+
`Promise`<`void`\>
|
|
705
2172
|
|
|
706
2173
|
___
|
|
707
2174
|
|
|
708
|
-
###
|
|
2175
|
+
### toCognitoAttributes
|
|
709
2176
|
|
|
710
|
-
▸ **
|
|
2177
|
+
▸ **toCognitoAttributes**(`userDoc`): `Object`
|
|
711
2178
|
|
|
712
|
-
|
|
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.
|
|
713
2185
|
|
|
714
2186
|
#### Parameters
|
|
715
2187
|
|
|
716
2188
|
| Name | Type |
|
|
717
2189
|
| :------ | :------ |
|
|
718
|
-
| `
|
|
2190
|
+
| `userDoc` | `UserDoc` |
|
|
719
2191
|
|
|
720
2192
|
#### Returns
|
|
721
2193
|
|
|
722
|
-
|
|
2194
|
+
`Object`
|
|
723
2195
|
|
|
724
2196
|
___
|
|
725
2197
|
|
|
726
|
-
###
|
|
2198
|
+
### uint8ArrayToBase64
|
|
727
2199
|
|
|
728
|
-
▸ **
|
|
2200
|
+
▸ **uint8ArrayToBase64**(`bytes`): `string`
|
|
729
2201
|
|
|
730
|
-
|
|
2202
|
+
Convert Uint8Array to base64 string
|
|
731
2203
|
|
|
732
2204
|
#### Parameters
|
|
733
2205
|
|
|
734
2206
|
| Name | Type |
|
|
735
2207
|
| :------ | :------ |
|
|
736
|
-
| `
|
|
2208
|
+
| `bytes` | `Uint8Array` |
|
|
737
2209
|
|
|
738
2210
|
#### Returns
|
|
739
2211
|
|
|
740
|
-
`
|
|
2212
|
+
`string`
|
|
741
2213
|
|
|
742
2214
|
___
|
|
743
2215
|
|
|
744
|
-
###
|
|
2216
|
+
### validateImportedKey
|
|
745
2217
|
|
|
746
|
-
▸ **
|
|
2218
|
+
▸ **validateImportedKey**(`parsedKey`): [`KeyValidationResult`](interfaces/KeyValidationResult.md)
|
|
747
2219
|
|
|
748
|
-
|
|
749
|
-
of properties that are encryted.
|
|
2220
|
+
Validate an imported key
|
|
750
2221
|
|
|
751
|
-
####
|
|
2222
|
+
#### Parameters
|
|
752
2223
|
|
|
753
|
-
| Name | Type |
|
|
754
|
-
| :------ | :------ |
|
|
755
|
-
| `
|
|
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
|
|
756
2241
|
|
|
757
2242
|
#### Parameters
|
|
758
2243
|
|
|
759
|
-
| Name | Type |
|
|
760
|
-
| :------ | :------ |
|
|
761
|
-
|
|
|
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 |
|
|
762
2249
|
|
|
763
2250
|
#### Returns
|
|
764
2251
|
|
|
765
|
-
`
|
|
2252
|
+
`Promise`<`boolean`\>
|
|
2253
|
+
|
|
2254
|
+
True if signature is valid, false otherwise
|
|
766
2255
|
|
|
767
2256
|
___
|
|
768
2257
|
|
|
769
|
-
###
|
|
2258
|
+
### verifyTextSignature
|
|
770
2259
|
|
|
771
|
-
▸ **
|
|
2260
|
+
▸ **verifyTextSignature**(`text`, `signatureBase64`, `publicKey`): `Promise`<`boolean`\>
|
|
772
2261
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
2262
|
+
Verify a base64-encoded signature for text
|
|
2263
|
+
|
|
2264
|
+
Convenience wrapper that decodes base64 signature and encodes text to UTF-8.
|
|
776
2265
|
|
|
777
2266
|
#### Parameters
|
|
778
2267
|
|
|
779
|
-
| Name | Type |
|
|
780
|
-
| :------ | :------ |
|
|
781
|
-
| `
|
|
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 |
|
|
782
2273
|
|
|
783
2274
|
#### Returns
|
|
784
2275
|
|
|
785
|
-
`
|
|
2276
|
+
`Promise`<`boolean`\>
|
|
2277
|
+
|
|
2278
|
+
True if signature is valid, false otherwise
|
|
786
2279
|
|
|
787
2280
|
___
|
|
788
2281
|
|
|
789
|
-
###
|
|
2282
|
+
### xorBytes
|
|
790
2283
|
|
|
791
|
-
▸ **
|
|
2284
|
+
▸ **xorBytes**(`a`, `b`): `Uint8Array`
|
|
792
2285
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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
|
|
796
2294
|
|
|
797
2295
|
#### Parameters
|
|
798
2296
|
|
|
799
|
-
| Name | Type |
|
|
800
|
-
| :------ | :------ |
|
|
801
|
-
| `
|
|
2297
|
+
| Name | Type | Description |
|
|
2298
|
+
| :------ | :------ | :------ |
|
|
2299
|
+
| `a` | `Uint8Array` | First byte array |
|
|
2300
|
+
| `b` | `Uint8Array` | Second byte array |
|
|
802
2301
|
|
|
803
2302
|
#### Returns
|
|
804
2303
|
|
|
805
|
-
`
|
|
2304
|
+
`Uint8Array`
|
|
2305
|
+
|
|
2306
|
+
XOR result
|