* First draft of moving out restoreKeyBackup out of MatrixClient
* Deprecate `restoreKeyBackup*` in `MatrixClient`
* Move types
* Handle only the room keys response
* Renaming and refactor `keysCountInBatch` & `getTotalKeyCount`
* Fix `importRoomKeysAsJson` tsdoc
* Fix typo
* Move `backupDecryptor.free()``
* Comment and simplify a bit `handleDecryptionOfAFullBackup`
* Fix decryption crash by moving`backupDecryptor.free`
* Use new api in `megolm-backup.spec.ts`
* Add tests to get recovery key from secret storage
* Add doc to `KeyBackupRestoreOpts` & `KeyBackupRestoreResult`
* Add doc to `restoreKeyBackupWithKey`
* Add doc to `backup.ts`
* Apply comment suggestions
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* - Decryption key is recovered from the cache in `RustCrypto.restoreKeyBackup`
- Add `CryptoApi.getSecretStorageBackupPrivateKey` to get the decryption key from the secret storage.
* Add `CryptoApi.restoreKeyBackup` to `ImportRoomKeyProgressData` doc.
* Add deprecated symbol to all the `restoreKeyBackup*` overrides.
* Update tests
* Move `RustBackupManager.getTotalKeyCount` to `backup#calculateKeyCountInKeyBackup`
* Fix `RustBackupManager.restoreKeyBackup` tsdoc
* Move `backupDecryptor.free` in rust crypto.
* Move `handleDecryptionOfAFullBackup` in `importKeyBackup`
* Rename `calculateKeyCountInKeyBackup` to `countKeystInBackup`
* Fix `passphrase` typo
* Rename `backupInfoVersion` to `backupVersion`
* Complete restoreKeyBackup* methods documentation
* Add `loadSessionBackupPrivateKeyFromSecretStorage`
* Remove useless intermediary result variable.
* Check that decryption key matchs key backup info in `loadSessionBackupPrivateKeyFromSecretStorage`
* Get backup info from a specific version
* Fix typo in `countKeysInBackup`
* Improve documentation and naming
* Use `RustSdkCryptoJs.BackupDecryptionKey` as `decryptionKeyMatchesKeyBackupInfo` parameter.
* Call directly `olmMachine.getBackupKeys` in `restoreKeyBackup`
* Last review changes
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update e2e doc in `README.md`
* Update `ICreateClientOpts.cryptoStore` doc
* Apply first batch of suggestion
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Fix `cryptoStore` tsdoc in `client.ts`
* Changes in Initialization chapter.
* Add doc about deprecated methods in `MatrixClient`.
* Update SecretStorage doc
* Fis typos
* Improve e2e docs
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Handle M_MAX_DELAY_EXCEEDED errors
Use a lower delay time if the server rejects a delay as too long.
* Add test
* Lint test
* Update src/matrixrtc/MatrixRTCSession.ts
Co-authored-by: Robin <robin@robin.town>
* Test computed expiry timeout value
---------
Co-authored-by: Robin <robin@robin.town>
* When state says you've left ongoing call, rejoin
When receiving a state change that says you are no longer a member of a
RTC session that you are actually still participating in, send another
state event to put yourself back in the session membership.
This can happen when an administrator overwrites your call membership
event (which is allowed even with MSC3757's restrictions on state), or
if your delayed disconnection event (via MSC4140) timed out before your
client could send a heartbeat to delay it further.
* Don't emit state changed on join recovery
* MatrixRTCSession: handle rate limit errors
* Lint
* Handle ratelimiting for non-legacy state setting
Each request must be retried, as the non-legacy flow involves a sequence
of requests that must resolve in order.
* Fix broken test
* Check for MSC3757 instead of the unmerged MSC3779
* Move helper out of beforeEach
* Test ratelimit errors
* Send/receive error details with widgets
* Fix embedded client tests
* Use all properties of error responses
* Lint
* Rewrite ternary expression as if statement
* Put typehints on overridden functions
* Lint
* Update matrix-widget-api
* Don't @link across packages
as gendoc fails when doing so.
* Add a missing docstring
* Set widget response error string to correct value
* Test conversion to/from widget error payloads
* Test processing errors thrown by widget transport
* Lint
* Test processing errors from transport.sendComplete
* Remove redundant `pre-release.sh` script
This is now a no-op (there are no `matrix_lib` fields in package.json), so we
may as well remove it.
* Remove redundant `post-merge-master` script
Just as pre-release is a no-op, so is this
* Remove redundant switch_package_to_release script
Once more: this script is a no-op.
* Make doc clearer on getCrossSigningKeyId
I was trying to work out why this was being used in a check. It
turns out it only returns the key ID if the private part is stored
locally, which seems very much non-obvious.
* Better doc
* Formatting & clarity
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>
* Update src with globalThis
* Update spec with globalThis
* Replace in more spec/ places
* More changes to src/
* Add a linter rule for global
* Prettify
* lint
* Include HTTP response headers in MatrixError
* Lint
* Support MSC4041 / Retry-After header
* Fix tests
* Remove redundant MatrixError parameter properties
They are inherited from HTTPError, so there is no need to mark them as
parameter properties.
* Comment that retry_after_ms is deprecated
* Properly handle colons in XHR header values
Also remove the negation in the if-condition for better readability
* Improve Retry-After parsing and docstring
* Revert ternary operator to if statements
for readability
* Reuse resolved Headers for Content-Type parsing
* Treat empty Content-Type differently from null
* Add MatrixError#isRateLimitError
This is separate from MatrixError#getRetryAfterMs because it's possible
for a rate-limit error to have no Retry-After time, and having separate
methods to check each makes that more clear.
* Ignore HTTP status code when getting Retry-After
because status codes other than 429 may have Retry-After
* Catch Retry-After parsing errors
* Add test coverage for HTTP error headers
* Update license years
* Move safe Retry-After lookup to global function
so it can more conveniently check if an error is a MatrixError
* Lint
* Inline Retry-After header value parsing
as it is only used in one place and doesn't need to be exported
* Update docstrings
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Use bare catch
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Give HTTPError methods for rate-limit checks
and make MatrixError inherit them
* Cover undefined errcode in rate-limit check
* Update safeGetRetryAfterMs docstring
Be explicit that errors that don't look like rate-limiting errors will
not pull a retry delay value from the error.
* Use rate-limit helper functions in more places
* Group the header tests
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>