* fix(crypto): `resetEncryption` remove secrets in 4S
Remove the cross signing keys and the backup decryption key of the 4S when calling `resetEncryption`
* test(crypto): expect secrets to be deleted in 4S when `resetEncryption` is called
* test(secret storage): add test case when the secret is set at null
* fix(crypto): remove default key in 4S
* test(crypto): default key should be removed from 4S
...and renames them, removing the special lowercase and uppercase
versions and exporting the underlying function instead.
Any apps that use these will either need to take the speed hit from
secure random functions and use the new ones, or write their own
insecure versions.
The lowercase and uppercasde verisons were used exactly once each
in element-web and never in js-sdk itself. The underlying function
is very simple and exporting just this gives more flexibility with
fewer exports.
* Use mapped types around account data events
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Harden types for reading account data too
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Correct empty object type
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update src/secret-storage.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Move `SecretEncryptedPayload` in `src/utils/@types`
* Move `encryptAES` to a dedicated file. Moved in a utils folder.
* Move `deriveKeys` to a dedicated file in order to share it
* Move `decryptAES` to a dedicated file. Moved in a utils folder.
* Move `calculateKeyCheck` to a dedicated file. Moved in a utils folder.
* Remove AES functions in `aes.ts` and export new ones for backward compatibility
* Update import to use new functions
* Add `src/utils` entrypoint in `README.md`
* - Rename `SecretEncryptedPayload` to `AESEncryptedSecretStoragePayload`.
- Move into `src/@types`
* Move `calculateKeyCheck` into `secret-storage.ts`.
* Move `deriveKeys` into `src/utils/internal` folder.
* - Rename `encryptAES` on `encryptAESSecretStorageItem`
- Change named export by default export
* - Rename `decryptAES` on `decryptAESSecretStorageItem`
- Change named export by default export
* Update documentation
* Update `decryptAESSecretStorageItem` doc
* Add lnk to spec for `calculateKeyCheck`
* Fix downstream tests
* fix missing key check in key storage
* code review
* fix tests
* add recovery keys test for both backends
* fix api break on GeneratedSecretStorageKey
* fix test
* fix test
* Update src/crypto-api.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update spec/unit/rust-crypto/rust-crypto.spec.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update src/crypto-api.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Pull `SecretStorageCallbacks` out of `ICryptoCallbacks`
* Pull the storage part of SecretStorage out to a new class
* Move SecretSharing to a separate class
* Move `ISecretRequest` into `SecretSharing.ts`
* Pull out ISecretStorage interface, and use it
* Mark old `SecretStorage` as deprecated, and rename accesses to it
* Move a `SecretStorage` unit test into its own file
* Use new `SecretStorage` in a couple of places
* add some more unit tests
* Fix test file name
... to match the unit under test
* even more tests
* Add a load of comments
* Rename classes
* Fix some broken tsdoc links
* fix broken test
* Fix compaints about superlinear regex
* just one more test