matrix-js-sdk 28.2.0 → 29.0.0-rc.1

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -16
  3. package/git-revision.txt +1 -1
  4. package/lib/@types/auth.d.ts +2 -4
  5. package/lib/@types/auth.d.ts.map +1 -1
  6. package/lib/@types/auth.js +1 -3
  7. package/lib/@types/auth.js.map +1 -1
  8. package/lib/browser-index.d.ts +0 -1
  9. package/lib/browser-index.d.ts.map +1 -1
  10. package/lib/browser-index.js +4 -12
  11. package/lib/browser-index.js.map +1 -1
  12. package/lib/client.d.ts +45 -15
  13. package/lib/client.d.ts.map +1 -1
  14. package/lib/client.js +60 -33
  15. package/lib/client.js.map +1 -1
  16. package/lib/crypto/backup.d.ts.map +1 -1
  17. package/lib/crypto/backup.js +0 -1
  18. package/lib/crypto/backup.js.map +1 -1
  19. package/lib/crypto/crypto.d.ts.map +1 -1
  20. package/lib/crypto/crypto.js +4 -4
  21. package/lib/crypto/crypto.js.map +1 -1
  22. package/lib/crypto/index.d.ts.map +1 -1
  23. package/lib/crypto/index.js +11 -2
  24. package/lib/crypto/index.js.map +1 -1
  25. package/lib/matrixrtc/CallMembership.d.ts +2 -0
  26. package/lib/matrixrtc/CallMembership.d.ts.map +1 -1
  27. package/lib/matrixrtc/CallMembership.js +3 -0
  28. package/lib/matrixrtc/CallMembership.js.map +1 -1
  29. package/lib/matrixrtc/MatrixRTCSession.d.ts +1 -0
  30. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  31. package/lib/matrixrtc/MatrixRTCSession.js +15 -2
  32. package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  33. package/lib/pushprocessor.d.ts.map +1 -1
  34. package/lib/pushprocessor.js +0 -28
  35. package/lib/pushprocessor.js.map +1 -1
  36. package/lib/rendezvous/MSC3906Rendezvous.d.ts.map +1 -1
  37. package/lib/rendezvous/MSC3906Rendezvous.js +3 -3
  38. package/lib/rendezvous/MSC3906Rendezvous.js.map +1 -1
  39. package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +1 -1
  40. package/lib/rust-crypto/CrossSigningIdentity.js +49 -16
  41. package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
  42. package/lib/rust-crypto/index.d.ts +5 -2
  43. package/lib/rust-crypto/index.d.ts.map +1 -1
  44. package/lib/rust-crypto/index.js +6 -3
  45. package/lib/rust-crypto/index.js.map +1 -1
  46. package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  47. package/lib/rust-crypto/rust-crypto.js +10 -1
  48. package/lib/rust-crypto/rust-crypto.js.map +1 -1
  49. package/lib/rust-crypto/secret-storage.d.ts +12 -1
  50. package/lib/rust-crypto/secret-storage.d.ts.map +1 -1
  51. package/lib/rust-crypto/secret-storage.js +24 -13
  52. package/lib/rust-crypto/secret-storage.js.map +1 -1
  53. package/lib/rust-crypto/verification.js +8 -7
  54. package/lib/rust-crypto/verification.js.map +1 -1
  55. package/lib/sync.d.ts.map +1 -1
  56. package/lib/sync.js +10 -0
  57. package/lib/sync.js.map +1 -1
  58. package/package.json +4 -30
  59. package/src/@types/auth.ts +2 -4
  60. package/src/browser-index.ts +4 -7
  61. package/src/client.ts +94 -44
  62. package/src/crypto/backup.ts +0 -1
  63. package/src/crypto/crypto.ts +3 -3
  64. package/src/crypto/index.ts +10 -2
  65. package/src/matrixrtc/CallMembership.ts +5 -0
  66. package/src/matrixrtc/MatrixRTCSession.ts +16 -1
  67. package/src/pushprocessor.ts +0 -30
  68. package/src/rendezvous/MSC3906Rendezvous.ts +4 -9
  69. package/src/rust-crypto/CrossSigningIdentity.ts +62 -30
  70. package/src/rust-crypto/index.ts +6 -2
  71. package/src/rust-crypto/rust-crypto.ts +16 -2
  72. package/src/rust-crypto/secret-storage.ts +33 -17
  73. package/src/sync.ts +11 -0
  74. package/dist/browser-matrix.js +0 -108318
  75. package/dist/browser-matrix.js.map +0 -917
  76. package/dist/browser-matrix.min.js +0 -18
  77. package/dist/browser-matrix.min.js.map +0 -1
  78. package/lib/rust-crypto/browserify-index.d.ts +0 -5
  79. package/lib/rust-crypto/browserify-index.d.ts.map +0 -1
  80. package/lib/rust-crypto/browserify-index.js +0 -32
  81. package/lib/rust-crypto/browserify-index.js.map +0 -1
  82. package/src/rust-crypto/browserify-index.ts +0 -31
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ Changes in [29.0.0-rc.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v29.0.0-rc.1) (2023-10-03)
2
+ ============================================================================================================
3
+
4
+ ## 🚨 BREAKING CHANGES
5
+ * Remove browserify builds ([\#3759](https://github.com/matrix-org/matrix-js-sdk/pull/3759)).
6
+
7
+ ## ✨ Features
8
+ * Export AutoDiscoveryError and fix type of ALL_ERRORS ([\#3768](https://github.com/matrix-org/matrix-js-sdk/pull/3768)).
9
+ * Support for stable MSC3882 get_login_token ([\#3416](https://github.com/matrix-org/matrix-js-sdk/pull/3416)). Contributed by @hughns.
10
+ * Remove IsUserMention and IsRoomMention from DEFAULT_OVERRIDE_RULES ([\#3752](https://github.com/matrix-org/matrix-js-sdk/pull/3752)). Contributed by @kerryarchibald.
11
+
12
+ ## 🐛 Bug Fixes
13
+ * Fix a case where joinRoom creates a duplicate Room object ([\#3747](https://github.com/matrix-org/matrix-js-sdk/pull/3747)).
14
+ * Add membershipID to call memberships ([\#3745](https://github.com/matrix-org/matrix-js-sdk/pull/3745)).
15
+ * Fix the warning for messages from unsigned devices ([\#3743](https://github.com/matrix-org/matrix-js-sdk/pull/3743)).
16
+ * Stop keep alive, when sync was stoped ([\#3720](https://github.com/matrix-org/matrix-js-sdk/pull/3720)). Contributed by @finsterwalder.
17
+
1
18
  Changes in [28.2.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v28.2.0) (2023-09-26)
2
19
  ==================================================================================================
3
20
 
package/README.md CHANGED
@@ -23,19 +23,7 @@ endpoints from before Matrix 1.1, for example.
23
23
 
24
24
  ## In a browser
25
25
 
26
- ### Note, the browserify build has been deprecated. Please use a bundler like webpack or vite instead.
27
-
28
- Download the browser version from
29
- https://github.com/matrix-org/matrix-js-sdk/releases/latest and add that as a
30
- `<script>` to your page. There will be a global variable `matrixcs`
31
- attached to `window` through which you can access the SDK. See below for how to
32
- include libolm to enable end-to-end-encryption.
33
-
34
- The browser bundle supports recent versions of browsers. Typically this is ES2015
35
- or `> 0.5%, last 2 versions, Firefox ESR, not dead` if using
36
- [browserlists](https://github.com/browserslist/browserslist).
37
-
38
- Please check [the working browser example](examples/browser) for more information.
26
+ ### Note, the browserify build has been removed. Please use a bundler like webpack or vite instead.
39
27
 
40
28
  ## In Node.js
41
29
 
@@ -375,9 +363,6 @@ To run tests (Jest):
375
363
  $ yarn test
376
364
  ```
377
365
 
378
- > **Note**
379
- > The `sync-browserify.spec.ts` requires a browser build (`yarn build`) in order to pass
380
-
381
366
  To run linting:
382
367
 
383
368
  ```
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- a49150854336b703ba106c791ed0a0406b2f97de
1
+ 53a72df01ba684340f83a0d68ab5c29248a8e9d4
@@ -197,9 +197,7 @@ export interface LoginResponse {
197
197
  home_server?: string;
198
198
  }
199
199
  /**
200
- * The result of a successful [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882)
201
- * `m.login.token` issuance request.
202
- * Note that this is UNSTABLE and subject to breaking changes without notice.
200
+ * The result of a successful `m.login.token` issuance request as per https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token
203
201
  */
204
202
  export interface LoginTokenPostResponse {
205
203
  /**
@@ -209,7 +207,7 @@ export interface LoginTokenPostResponse {
209
207
  /**
210
208
  * Expiration in seconds.
211
209
  *
212
- * @deprecated this is only provided for compatibility with original revision of the MSC.
210
+ * @deprecated this is only provided for compatibility with original revision of [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882).
213
211
  */
214
212
  expires_in: number;
215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gBAAgB,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACzB"}
@@ -92,9 +92,7 @@ let SSOAction = /*#__PURE__*/function (SSOAction) {
92
92
  * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login
93
93
  */
94
94
  /**
95
- * The result of a successful [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882)
96
- * `m.login.token` issuance request.
97
- * Note that this is UNSTABLE and subject to breaking changes without notice.
95
+ * The result of a successful `m.login.token` issuance request as per https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token
98
96
  */
99
97
  exports.SSOAction = SSOAction;
100
98
  //# sourceMappingURL=auth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","names":["_NamespacedValue","require","DELEGATED_OIDC_COMPATIBILITY","UnstableValue","exports","IdentityProviderBrand","SSOAction"],"sources":["../../src/@types/auth.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { UnstableValue } from \"../NamespacedValue\";\nimport { IClientWellKnown } from \"../client\";\n\n// disable lint because these are wire responses\n/* eslint-disable camelcase */\n\n/**\n * Represents a response to the CSAPI `/refresh` endpoint.\n */\nexport interface IRefreshTokenResponse {\n access_token: string;\n expires_in_ms: number;\n refresh_token: string;\n}\n\n/* eslint-enable camelcase */\n\n/**\n * Response to GET login flows as per https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3login\n */\nexport interface ILoginFlowsResponse {\n flows: LoginFlow[];\n}\n\nexport type LoginFlow = ISSOFlow | IPasswordFlow | ILoginFlow;\n\nexport interface ILoginFlow {\n type: string;\n}\n\nexport interface IPasswordFlow extends ILoginFlow {\n type: \"m.login.password\";\n}\n\nexport const DELEGATED_OIDC_COMPATIBILITY = new UnstableValue(\n \"delegated_oidc_compatibility\",\n \"org.matrix.msc3824.delegated_oidc_compatibility\",\n);\n\n/**\n * Representation of SSO flow as per https://spec.matrix.org/v1.3/client-server-api/#client-login-via-sso\n */\nexport interface ISSOFlow extends ILoginFlow {\n type: \"m.login.sso\" | \"m.login.cas\";\n // eslint-disable-next-line camelcase\n identity_providers?: IIdentityProvider[];\n [DELEGATED_OIDC_COMPATIBILITY.name]?: boolean;\n [DELEGATED_OIDC_COMPATIBILITY.altName]?: boolean;\n}\n\nexport enum IdentityProviderBrand {\n Gitlab = \"gitlab\",\n Github = \"github\",\n Apple = \"apple\",\n Google = \"google\",\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n}\n\nexport interface IIdentityProvider {\n id: string;\n name: string;\n icon?: string;\n brand?: IdentityProviderBrand | string;\n}\n\nexport enum SSOAction {\n /** The user intends to login to an existing account */\n LOGIN = \"login\",\n\n /** The user intends to register for a new account */\n REGISTER = \"register\",\n}\n\n/**\n * A client can identify a user using their Matrix ID.\n * This can either be the fully qualified Matrix user ID, or just the localpart of the user ID.\n * @see https://spec.matrix.org/v1.7/client-server-api/#matrix-user-id\n */\ntype UserLoginIdentifier = {\n type: \"m.id.user\";\n user: string;\n};\n\n/**\n * A client can identify a user using a 3PID associated with the user’s account on the homeserver,\n * where the 3PID was previously associated using the /account/3pid API.\n * See the 3PID Types Appendix for a list of Third-party ID media.\n * @see https://spec.matrix.org/v1.7/client-server-api/#third-party-id\n */\ntype ThirdPartyLoginIdentifier = {\n type: \"m.id.thirdparty\";\n medium: string;\n address: string;\n};\n\n/**\n * A client can identify a user using a phone number associated with the user’s account,\n * where the phone number was previously associated using the /account/3pid API.\n * The phone number can be passed in as entered by the user; the homeserver will be responsible for canonicalising it.\n * If the client wishes to canonicalise the phone number,\n * then it can use the m.id.thirdparty identifier type with a medium of msisdn instead.\n *\n * The country is the two-letter uppercase ISO-3166-1 alpha-2 country code that the number in phone should be parsed as if it were dialled from.\n *\n * @see https://spec.matrix.org/v1.7/client-server-api/#phone-number\n */\ntype PhoneLoginIdentifier = {\n type: \"m.id.phone\";\n country: string;\n phone: string;\n};\n\ntype SpecUserIdentifier = UserLoginIdentifier | ThirdPartyLoginIdentifier | PhoneLoginIdentifier;\n\n/**\n * User Identifiers usable for login & user-interactive authentication.\n *\n * Extensibly allows more than Matrix specified identifiers.\n */\nexport type UserIdentifier =\n | SpecUserIdentifier\n | { type: Exclude<string, SpecUserIdentifier[\"type\"]>; [key: string]: any };\n\n/**\n * Request body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginRequest {\n /**\n * The login type being used.\n */\n type: \"m.login.password\" | \"m.login.token\" | string;\n /**\n * Third-party identifier for the user.\n * @deprecated in favour of `identifier`.\n */\n address?: string;\n /**\n * ID of the client device.\n * If this does not correspond to a known client device, a new device will be created.\n * The given device ID must not be the same as a cross-signing key ID.\n * The server will auto-generate a device_id if this is not specified.\n */\n device_id?: string;\n /**\n * Identification information for a user\n */\n identifier?: UserIdentifier;\n /**\n * A display name to assign to the newly-created device.\n * Ignored if device_id corresponds to a known device.\n */\n initial_device_display_name?: string;\n /**\n * When logging in using a third-party identifier, the medium of the identifier.\n * Must be `email`.\n * @deprecated in favour of `identifier`.\n */\n medium?: \"email\";\n /**\n * Required when type is `m.login.password`. The user’s password.\n */\n password?: string;\n /**\n * If true, the client supports refresh tokens.\n */\n refresh_token?: boolean;\n /**\n * Required when type is `m.login.token`. Part of Token-based login.\n */\n token?: string;\n /**\n * The fully qualified user ID or just local part of the user ID, to log in.\n * @deprecated in favour of identifier.\n */\n user?: string;\n // Extensible\n [key: string]: any;\n}\n\n// Export for backwards compatibility\nexport type ILoginParams = LoginRequest;\n\n/**\n * Response body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginResponse {\n /**\n * An access token for the account.\n * This access token can then be used to authorize other requests.\n */\n access_token: string;\n /**\n * ID of the logged-in device.\n * Will be the same as the corresponding parameter in the request, if one was specified.\n */\n device_id: string;\n /**\n * The fully-qualified Matrix ID for the account.\n */\n user_id: string;\n /**\n * The lifetime of the access token, in milliseconds.\n * Once the access token has expired a new access token can be obtained by using the provided refresh token.\n * If no refresh token is provided, the client will need to re-log in to obtain a new access token.\n * If not given, the client can assume that the access token will not expire.\n */\n expires_in_ms?: number;\n /**\n * A refresh token for the account.\n * This token can be used to obtain a new access token when it expires by calling the /refresh endpoint.\n */\n refresh_token?: string;\n /**\n * Optional client configuration provided by the server.\n * If present, clients SHOULD use the provided object to reconfigure themselves, optionally validating the URLs within.\n * This object takes the same form as the one returned from .well-known autodiscovery.\n */\n well_known?: IClientWellKnown;\n /**\n * The server_name of the homeserver on which the account has been registered.\n * @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it.\n */\n home_server?: string;\n}\n\n/**\n * The result of a successful [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882)\n * `m.login.token` issuance request.\n * Note that this is UNSTABLE and subject to breaking changes without notice.\n */\nexport interface LoginTokenPostResponse {\n /**\n * The token to use with `m.login.token` to authenticate.\n */\n login_token: string;\n /**\n * Expiration in seconds.\n *\n * @deprecated this is only provided for compatibility with original revision of the MSC.\n */\n expires_in: number;\n /**\n * Expiration in milliseconds.\n */\n expires_in_ms: number;\n}\n"],"mappings":";;;;;;AAgBA,IAAAA,gBAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;;AAEA;AACA;AACA;;AAOA;;AAEA;AACA;AACA;;AAeO,MAAMC,4BAA4B,GAAG,IAAIC,8BAAa,CACzD,8BAA8B,EAC9B,iDACJ,CAAC;;AAED;AACA;AACA;AAFAC,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAWYG,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAAD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAAA,IAgBrBC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAQrB;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAsDA;AAGA;AACA;AACA;AACA;AAyCA;AACA;AACA;AACA;AACA;AAJAF,OAAA,CAAAE,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"auth.js","names":["_NamespacedValue","require","DELEGATED_OIDC_COMPATIBILITY","UnstableValue","exports","IdentityProviderBrand","SSOAction"],"sources":["../../src/@types/auth.ts"],"sourcesContent":["/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { UnstableValue } from \"../NamespacedValue\";\nimport { IClientWellKnown } from \"../client\";\n\n// disable lint because these are wire responses\n/* eslint-disable camelcase */\n\n/**\n * Represents a response to the CSAPI `/refresh` endpoint.\n */\nexport interface IRefreshTokenResponse {\n access_token: string;\n expires_in_ms: number;\n refresh_token: string;\n}\n\n/* eslint-enable camelcase */\n\n/**\n * Response to GET login flows as per https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3login\n */\nexport interface ILoginFlowsResponse {\n flows: LoginFlow[];\n}\n\nexport type LoginFlow = ISSOFlow | IPasswordFlow | ILoginFlow;\n\nexport interface ILoginFlow {\n type: string;\n}\n\nexport interface IPasswordFlow extends ILoginFlow {\n type: \"m.login.password\";\n}\n\nexport const DELEGATED_OIDC_COMPATIBILITY = new UnstableValue(\n \"delegated_oidc_compatibility\",\n \"org.matrix.msc3824.delegated_oidc_compatibility\",\n);\n\n/**\n * Representation of SSO flow as per https://spec.matrix.org/v1.3/client-server-api/#client-login-via-sso\n */\nexport interface ISSOFlow extends ILoginFlow {\n type: \"m.login.sso\" | \"m.login.cas\";\n // eslint-disable-next-line camelcase\n identity_providers?: IIdentityProvider[];\n [DELEGATED_OIDC_COMPATIBILITY.name]?: boolean;\n [DELEGATED_OIDC_COMPATIBILITY.altName]?: boolean;\n}\n\nexport enum IdentityProviderBrand {\n Gitlab = \"gitlab\",\n Github = \"github\",\n Apple = \"apple\",\n Google = \"google\",\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n}\n\nexport interface IIdentityProvider {\n id: string;\n name: string;\n icon?: string;\n brand?: IdentityProviderBrand | string;\n}\n\nexport enum SSOAction {\n /** The user intends to login to an existing account */\n LOGIN = \"login\",\n\n /** The user intends to register for a new account */\n REGISTER = \"register\",\n}\n\n/**\n * A client can identify a user using their Matrix ID.\n * This can either be the fully qualified Matrix user ID, or just the localpart of the user ID.\n * @see https://spec.matrix.org/v1.7/client-server-api/#matrix-user-id\n */\ntype UserLoginIdentifier = {\n type: \"m.id.user\";\n user: string;\n};\n\n/**\n * A client can identify a user using a 3PID associated with the user’s account on the homeserver,\n * where the 3PID was previously associated using the /account/3pid API.\n * See the 3PID Types Appendix for a list of Third-party ID media.\n * @see https://spec.matrix.org/v1.7/client-server-api/#third-party-id\n */\ntype ThirdPartyLoginIdentifier = {\n type: \"m.id.thirdparty\";\n medium: string;\n address: string;\n};\n\n/**\n * A client can identify a user using a phone number associated with the user’s account,\n * where the phone number was previously associated using the /account/3pid API.\n * The phone number can be passed in as entered by the user; the homeserver will be responsible for canonicalising it.\n * If the client wishes to canonicalise the phone number,\n * then it can use the m.id.thirdparty identifier type with a medium of msisdn instead.\n *\n * The country is the two-letter uppercase ISO-3166-1 alpha-2 country code that the number in phone should be parsed as if it were dialled from.\n *\n * @see https://spec.matrix.org/v1.7/client-server-api/#phone-number\n */\ntype PhoneLoginIdentifier = {\n type: \"m.id.phone\";\n country: string;\n phone: string;\n};\n\ntype SpecUserIdentifier = UserLoginIdentifier | ThirdPartyLoginIdentifier | PhoneLoginIdentifier;\n\n/**\n * User Identifiers usable for login & user-interactive authentication.\n *\n * Extensibly allows more than Matrix specified identifiers.\n */\nexport type UserIdentifier =\n | SpecUserIdentifier\n | { type: Exclude<string, SpecUserIdentifier[\"type\"]>; [key: string]: any };\n\n/**\n * Request body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginRequest {\n /**\n * The login type being used.\n */\n type: \"m.login.password\" | \"m.login.token\" | string;\n /**\n * Third-party identifier for the user.\n * @deprecated in favour of `identifier`.\n */\n address?: string;\n /**\n * ID of the client device.\n * If this does not correspond to a known client device, a new device will be created.\n * The given device ID must not be the same as a cross-signing key ID.\n * The server will auto-generate a device_id if this is not specified.\n */\n device_id?: string;\n /**\n * Identification information for a user\n */\n identifier?: UserIdentifier;\n /**\n * A display name to assign to the newly-created device.\n * Ignored if device_id corresponds to a known device.\n */\n initial_device_display_name?: string;\n /**\n * When logging in using a third-party identifier, the medium of the identifier.\n * Must be `email`.\n * @deprecated in favour of `identifier`.\n */\n medium?: \"email\";\n /**\n * Required when type is `m.login.password`. The user’s password.\n */\n password?: string;\n /**\n * If true, the client supports refresh tokens.\n */\n refresh_token?: boolean;\n /**\n * Required when type is `m.login.token`. Part of Token-based login.\n */\n token?: string;\n /**\n * The fully qualified user ID or just local part of the user ID, to log in.\n * @deprecated in favour of identifier.\n */\n user?: string;\n // Extensible\n [key: string]: any;\n}\n\n// Export for backwards compatibility\nexport type ILoginParams = LoginRequest;\n\n/**\n * Response body for POST /login request\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3login\n */\nexport interface LoginResponse {\n /**\n * An access token for the account.\n * This access token can then be used to authorize other requests.\n */\n access_token: string;\n /**\n * ID of the logged-in device.\n * Will be the same as the corresponding parameter in the request, if one was specified.\n */\n device_id: string;\n /**\n * The fully-qualified Matrix ID for the account.\n */\n user_id: string;\n /**\n * The lifetime of the access token, in milliseconds.\n * Once the access token has expired a new access token can be obtained by using the provided refresh token.\n * If no refresh token is provided, the client will need to re-log in to obtain a new access token.\n * If not given, the client can assume that the access token will not expire.\n */\n expires_in_ms?: number;\n /**\n * A refresh token for the account.\n * This token can be used to obtain a new access token when it expires by calling the /refresh endpoint.\n */\n refresh_token?: string;\n /**\n * Optional client configuration provided by the server.\n * If present, clients SHOULD use the provided object to reconfigure themselves, optionally validating the URLs within.\n * This object takes the same form as the one returned from .well-known autodiscovery.\n */\n well_known?: IClientWellKnown;\n /**\n * The server_name of the homeserver on which the account has been registered.\n * @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it.\n */\n home_server?: string;\n}\n\n/**\n * The result of a successful `m.login.token` issuance request as per https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv1loginget_token\n */\nexport interface LoginTokenPostResponse {\n /**\n * The token to use with `m.login.token` to authenticate.\n */\n login_token: string;\n /**\n * Expiration in seconds.\n *\n * @deprecated this is only provided for compatibility with original revision of [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882).\n */\n expires_in: number;\n /**\n * Expiration in milliseconds.\n */\n expires_in_ms: number;\n}\n"],"mappings":";;;;;;AAgBA,IAAAA,gBAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;;AAEA;AACA;AACA;;AAOA;;AAEA;AACA;AACA;;AAeO,MAAMC,4BAA4B,GAAG,IAAIC,8BAAa,CACzD,8BAA8B,EAC9B,iDACJ,CAAC;;AAED;AACA;AACA;AAFAC,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAWYG,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAAD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAAA,IAgBrBC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAQrB;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAsDA;AAGA;AACA;AACA;AACA;AAyCA;AACA;AACA;AAFAF,OAAA,CAAAE,SAAA,GAAAA,SAAA"}
@@ -5,5 +5,4 @@ declare global {
5
5
  var matrixcs: BrowserMatrix;
6
6
  }
7
7
  export * from "./matrix";
8
- export default matrixcs;
9
8
  //# sourceMappingURL=browser-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-index.d.ts","sourceRoot":"","sources":["../src/browser-index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,KAAK,aAAa,GAAG,OAAO,QAAQ,CAAC;AACrC,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,mBAAmB,EAAE,OAAO,CAAC;IACjC,IAAI,QAAQ,EAAE,aAAa,CAAC;CAE/B;AAoBD,cAAc,UAAU,CAAC;AACzB,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"browser-index.d.ts","sourceRoot":"","sources":["../src/browser-index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,KAAK,aAAa,GAAG,OAAO,QAAQ,CAAC;AACrC,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,mBAAmB,EAAE,OAAO,CAAC;IACjC,IAAI,QAAQ,EAAE,aAAa,CAAC;CAE/B;AAkBD,cAAc,UAAU,CAAC"}
@@ -3,12 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {};
7
- exports.default = void 0;
8
6
  var matrixcs = _interopRequireWildcard(require("./matrix"));
9
7
  Object.keys(matrixcs).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
12
9
  if (key in exports && exports[key] === matrixcs[key]) return;
13
10
  Object.defineProperty(exports, key, {
14
11
  enumerable: true,
@@ -35,25 +32,20 @@ See the License for the specific language governing permissions and
35
32
  limitations under the License.
36
33
  */
37
34
 
38
- if (global.__js_sdk_entrypoint) {
35
+ if (globalThis.__js_sdk_entrypoint) {
39
36
  throw new Error("Multiple matrix-js-sdk entrypoints detected!");
40
37
  }
41
- global.__js_sdk_entrypoint = true;
38
+ globalThis.__js_sdk_entrypoint = true;
42
39
 
43
40
  // just *accessing* indexedDB throws an exception in firefox with indexeddb disabled.
44
41
  let indexedDB;
45
42
  try {
46
- indexedDB = global.indexedDB;
43
+ indexedDB = globalThis.indexedDB;
47
44
  } catch (e) {}
48
45
 
49
46
  // if our browser (appears to) support indexeddb, use an indexeddb crypto store.
50
47
  if (indexedDB) {
51
48
  matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB, "matrix-js-sdk:crypto"));
52
49
  }
53
-
54
- // We export 3 things to make browserify happy as well as downstream projects.
55
- // It's awkward, but required.
56
- var _default = matrixcs; // keep export for browserify package deps
57
- exports.default = _default;
58
- global.matrixcs = matrixcs;
50
+ globalThis.matrixcs = matrixcs;
59
51
  //# sourceMappingURL=browser-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-index.js","names":["matrixcs","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","global","__js_sdk_entrypoint","Error","indexedDB","e","setCryptoStoreFactory","IndexedDBCryptoStore","_default"],"sources":["../src/browser-index.ts"],"sourcesContent":["/*\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as matrixcs from \"./matrix\";\n\ntype BrowserMatrix = typeof matrixcs;\ndeclare global {\n /* eslint-disable no-var, camelcase */\n var __js_sdk_entrypoint: boolean;\n var matrixcs: BrowserMatrix;\n /* eslint-enable no-var */\n}\n\nif (global.__js_sdk_entrypoint) {\n throw new Error(\"Multiple matrix-js-sdk entrypoints detected!\");\n}\nglobal.__js_sdk_entrypoint = true;\n\n// just *accessing* indexedDB throws an exception in firefox with indexeddb disabled.\nlet indexedDB: IDBFactory | undefined;\ntry {\n indexedDB = global.indexedDB;\n} catch (e) {}\n\n// if our browser (appears to) support indexeddb, use an indexeddb crypto store.\nif (indexedDB) {\n matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB!, \"matrix-js-sdk:crypto\"));\n}\n\n// We export 3 things to make browserify happy as well as downstream projects.\n// It's awkward, but required.\nexport * from \"./matrix\";\nexport default matrixcs; // keep export for browserify package deps\nglobal.matrixcs = matrixcs;\n"],"mappings":";;;;;;;AAgBA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AA4BAC,MAAA,CAAAC,IAAA,CAAAJ,QAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,QAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAd,QAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAAyB,SAAAS,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAf,wBAAAmB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAT,GAAA,CAAAM,GAAA,SAAAK,MAAA,WAAAC,qBAAA,GAAAvB,MAAA,CAAAS,cAAA,IAAAT,MAAA,CAAAwB,wBAAA,WAAArB,GAAA,IAAAc,GAAA,QAAAd,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAW,GAAA,EAAAd,GAAA,SAAAsB,IAAA,GAAAF,qBAAA,GAAAvB,MAAA,CAAAwB,wBAAA,CAAAP,GAAA,EAAAd,GAAA,cAAAsB,IAAA,KAAAA,IAAA,CAAAd,GAAA,IAAAc,IAAA,CAAAC,GAAA,KAAA1B,MAAA,CAAAS,cAAA,CAAAa,MAAA,EAAAnB,GAAA,EAAAsB,IAAA,YAAAH,MAAA,CAAAnB,GAAA,IAAAc,GAAA,CAAAd,GAAA,SAAAmB,MAAA,CAAAH,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAM,GAAA,CAAAT,GAAA,EAAAK,MAAA,YAAAA,MAAA;AA5CzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,IAAIK,MAAM,CAACC,mBAAmB,EAAE;EAC5B,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;AACnE;AACAF,MAAM,CAACC,mBAAmB,GAAG,IAAI;;AAEjC;AACA,IAAIE,SAAiC;AACrC,IAAI;EACAA,SAAS,GAAGH,MAAM,CAACG,SAAS;AAChC,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;;AAEb;AACA,IAAID,SAAS,EAAE;EACXjC,QAAQ,CAACmC,qBAAqB,CAAC,MAAM,IAAInC,QAAQ,CAACoC,oBAAoB,CAACH,SAAS,EAAG,sBAAsB,CAAC,CAAC;AAC/G;;AAEA;AACA;AAAA,IAAAI,QAAA,GAEerC,QAAQ,EAAE;AAAAW,OAAA,CAAAW,OAAA,GAAAe,QAAA;AACzBP,MAAM,CAAC9B,QAAQ,GAAGA,QAAQ"}
1
+ {"version":3,"file":"browser-index.js","names":["matrixcs","_interopRequireWildcard","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","prototype","hasOwnProperty","call","desc","set","globalThis","__js_sdk_entrypoint","Error","indexedDB","e","setCryptoStoreFactory","IndexedDBCryptoStore"],"sources":["../src/browser-index.ts"],"sourcesContent":["/*\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as matrixcs from \"./matrix\";\n\ntype BrowserMatrix = typeof matrixcs;\ndeclare global {\n /* eslint-disable no-var, camelcase */\n var __js_sdk_entrypoint: boolean;\n var matrixcs: BrowserMatrix;\n /* eslint-enable no-var */\n}\n\nif (globalThis.__js_sdk_entrypoint) {\n throw new Error(\"Multiple matrix-js-sdk entrypoints detected!\");\n}\nglobalThis.__js_sdk_entrypoint = true;\n\n// just *accessing* indexedDB throws an exception in firefox with indexeddb disabled.\nlet indexedDB: IDBFactory | undefined;\ntry {\n indexedDB = globalThis.indexedDB;\n} catch (e) {}\n\n// if our browser (appears to) support indexeddb, use an indexeddb crypto store.\nif (indexedDB) {\n matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB!, \"matrix-js-sdk:crypto\"));\n}\n\nexport * from \"./matrix\";\nglobalThis.matrixcs = matrixcs;\n"],"mappings":";;;;;AAgBA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AA0BAC,MAAA,CAAAC,IAAA,CAAAJ,QAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA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A,CAAAH,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAS,GAAA,CAAAZ,GAAA,EAAAK,MAAA,YAAAA,MAAA;AA1CzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,IAAIQ,UAAU,CAACC,mBAAmB,EAAE;EAChC,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;AACnE;AACAF,UAAU,CAACC,mBAAmB,GAAG,IAAI;;AAErC;AACA,IAAIE,SAAiC;AACrC,IAAI;EACAA,SAAS,GAAGH,UAAU,CAACG,SAAS;AACpC,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;;AAEb;AACA,IAAID,SAAS,EAAE;EACXhC,QAAQ,CAACkC,qBAAqB,CAAC,MAAM,IAAIlC,QAAQ,CAACmC,oBAAoB,CAACH,SAAS,EAAG,sBAAsB,CAAC,CAAC;AAC/G;AAGAH,UAAU,CAAC7B,QAAQ,GAAGA,QAAQ"}
package/lib/client.d.ts CHANGED
@@ -18,8 +18,8 @@ import { IOlmDevice } from "./crypto/algorithms/megolm";
18
18
  import { TypedReEmitter } from "./ReEmitter";
19
19
  import { IRoomEncryption, RoomList } from "./crypto/RoomList";
20
20
  import { SERVICE_TYPES } from "./service-types";
21
- import { HttpApiEvent, HttpApiEventHandlerMap, Upload, UploadOpts, MatrixError, MatrixHttpApi, IHttpOpts, FileType, UploadResponse, IRequestOpts } from "./http-api";
22
- import { Crypto, CryptoEvent, CryptoEventHandlerMap, ICryptoCallbacks, ICheckOwnCrossSigningTrustOpts, VerificationMethod } from "./crypto";
21
+ import { FileType, HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts, MatrixError, MatrixHttpApi, Upload, UploadOpts, UploadResponse } from "./http-api";
22
+ import { Crypto, CryptoEvent, CryptoEventHandlerMap, ICheckOwnCrossSigningTrustOpts, ICryptoCallbacks, VerificationMethod } from "./crypto";
23
23
  import { DeviceInfo } from "./crypto/deviceinfo";
24
24
  import { User, UserEvent, UserEventHandlerMap } from "./models/user";
25
25
  import { IDehydratedDevice, IDehydratedDeviceKeyInfo } from "./crypto/dehydration";
@@ -37,7 +37,7 @@ import { CrossSigningInfo, DeviceTrustLevel, ICacheCallbacks, UserTrustLevel } f
37
37
  import { Room, RoomEvent, RoomEventHandlerMap, RoomNameState } from "./models/room";
38
38
  import { RoomMemberEvent, RoomMemberEventHandlerMap } from "./models/room-member";
39
39
  import { RoomStateEvent, RoomStateEventHandlerMap } from "./models/room-state";
40
- import { IAddThreePidOnlyBody, IBindThreePidBody, ICreateRoomOpts, IEventSearchOpts, IGuestAccessOpts, IJoinRoomOpts, IPaginateOpts, IPresenceOpts, IRedactOpts, IRelationsRequestOpts, IRelationsResponse, IRoomDirectoryOptions, ISearchOpts, ISendEventResponse, ITagsResponse, IStatusResponse, KnockRoomOpts } from "./@types/requests";
40
+ import { IAddThreePidOnlyBody, IBindThreePidBody, ICreateRoomOpts, IEventSearchOpts, IGuestAccessOpts, IJoinRoomOpts, IPaginateOpts, IPresenceOpts, IRedactOpts, IRelationsRequestOpts, IRelationsResponse, IRoomDirectoryOptions, ISearchOpts, ISendEventResponse, IStatusResponse, ITagsResponse, KnockRoomOpts } from "./@types/requests";
41
41
  import { EventType, RelationType, RoomType } from "./@types/event";
42
42
  import { IdServerUnbindResult, IImageInfo, JoinRule, Preset, Visibility } from "./@types/partials";
43
43
  import { EventMapper, MapperOpts } from "./event-mapper";
@@ -52,16 +52,16 @@ import { IHierarchyRoom } from "./@types/spaces";
52
52
  import { IPusher, IPusherRequest, IPushRule, IPushRules, PushRuleAction, PushRuleKind, RuleId } from "./@types/PushRules";
53
53
  import { IThreepid } from "./@types/threepids";
54
54
  import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base";
55
- import { GroupCall, IGroupCallDataChannelOptions, GroupCallIntent, GroupCallType } from "./webrtc/groupCall";
55
+ import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall";
56
56
  import { MediaHandler } from "./webrtc/mediaHandler";
57
- import { LoginTokenPostResponse, ILoginFlowsResponse, IRefreshTokenResponse, SSOAction, LoginResponse, LoginRequest } from "./@types/auth";
57
+ import { ILoginFlowsResponse, IRefreshTokenResponse, LoginRequest, LoginResponse, LoginTokenPostResponse, SSOAction } from "./@types/auth";
58
58
  import { TypedEventEmitter } from "./models/typed-event-emitter";
59
59
  import { ReceiptType } from "./@types/read_receipts";
60
60
  import { MSC3575SlidingSyncRequest, MSC3575SlidingSyncResponse, SlidingSync } from "./sliding-sync";
61
61
  import { SlidingSyncSdk } from "./sliding-sync-sdk";
62
62
  import { FeatureSupport, ThreadFilterType } from "./models/thread";
63
63
  import { MBeaconInfoEventContent } from "./@types/beacon";
64
- import { UnstableValue } from "./NamespacedValue";
64
+ import { NamespacedValue, UnstableValue } from "./NamespacedValue";
65
65
  import { ToDeviceBatch } from "./models/ToDeviceMessage";
66
66
  import { IgnoredInvites } from "./models/invites-ignorer";
67
67
  import { UIAResponse } from "./@types/uia";
@@ -166,7 +166,14 @@ export interface ICreateClientOpts {
166
166
  */
167
167
  deviceToImport?: IExportedDevice;
168
168
  /**
169
- * Key used to pickle olm objects or other sensitive data.
169
+ * Encryption key used for encrypting sensitive data (such as e2ee keys) in storage.
170
+ *
171
+ * This must be set to the same value every time the client is initialised for the same device.
172
+ *
173
+ * If unset, either a hardcoded key or no encryption at all is used, depending on the Crypto implementation.
174
+ *
175
+ * No particular requirement is placed on the key data (it is fed into an HKDF to generate the actual encryption
176
+ * keys).
170
177
  */
171
178
  pickleKey?: string;
172
179
  /**
@@ -306,9 +313,17 @@ export interface IChangePasswordCapability extends ICapability {
306
313
  }
307
314
  export interface IThreadsCapability extends ICapability {
308
315
  }
309
- export interface IMSC3882GetLoginTokenCapability extends ICapability {
316
+ export interface IGetLoginTokenCapability extends ICapability {
310
317
  }
311
- export declare const UNSTABLE_MSC3882_CAPABILITY: UnstableValue<"m.get_login_token", "org.matrix.msc3882.get_login_token">;
318
+ /**
319
+ * @deprecated use {@link IGetLoginTokenCapability} instead
320
+ */
321
+ export type IMSC3882GetLoginTokenCapability = IGetLoginTokenCapability;
322
+ export declare const GET_LOGIN_TOKEN_CAPABILITY: NamespacedValue<"m.get_login_token", "org.matrix.msc3882.get_login_token">;
323
+ /**
324
+ * @deprecated use {@link GET_LOGIN_TOKEN_CAPABILITY} instead
325
+ */
326
+ export declare const UNSTABLE_MSC3882_CAPABILITY: NamespacedValue<"m.get_login_token", "org.matrix.msc3882.get_login_token">;
312
327
  export declare const UNSTABLE_MSC2666_SHARED_ROOMS = "uk.half-shot.msc2666";
313
328
  export declare const UNSTABLE_MSC2666_MUTUAL_ROOMS = "uk.half-shot.msc2666.mutual_rooms";
314
329
  export declare const UNSTABLE_MSC2666_QUERY_MUTUAL_ROOMS = "uk.half-shot.msc2666.query_mutual_rooms";
@@ -321,8 +336,8 @@ export interface Capabilities {
321
336
  "m.change_password"?: IChangePasswordCapability;
322
337
  "m.room_versions"?: IRoomVersionsCapability;
323
338
  "io.element.thread"?: IThreadsCapability;
324
- [UNSTABLE_MSC3882_CAPABILITY.name]?: IMSC3882GetLoginTokenCapability;
325
- [UNSTABLE_MSC3882_CAPABILITY.altName]?: IMSC3882GetLoginTokenCapability;
339
+ "m.get_login_token"?: IGetLoginTokenCapability;
340
+ "org.matrix.msc3882.get_login_token"?: IGetLoginTokenCapability;
326
341
  }
327
342
  /** @deprecated prefer {@link CrossSigningKeyInfo}. */
328
343
  export type ICrossSigningKey = CrossSigningKeyInfo;
@@ -831,6 +846,15 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
831
846
  credentials: {
832
847
  userId: string | null;
833
848
  };
849
+ /**
850
+ * Encryption key used for encrypting sensitive data (such as e2ee keys) in storage.
851
+ *
852
+ * As supplied in the constructor via {@link IMatrixClientCreateOpts#pickleKey}.
853
+ *
854
+ * If unset, either a hardcoded key or no encryption at all is used, depending on the Crypto implementation.
855
+ *
856
+ * @deprecated this should be a private property.
857
+ */
834
858
  pickleKey?: string;
835
859
  scheduler?: MatrixScheduler;
836
860
  clientRunning: boolean;
@@ -1796,10 +1820,14 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
1796
1820
  */
1797
1821
  checkKeyBackup(): Promise<IKeyBackupCheck | null>;
1798
1822
  /**
1799
- * Get information about the current key backup.
1800
- * @returns Information object from API or null
1823
+ * Get information about the current key backup from the server.
1801
1824
  *
1802
- * @deprecated Prefer {@link CryptoApi.checkKeyBackupAndEnable}.
1825
+ * Performs some basic validity checks on the shape of the result, and raises an error if it is not as expected.
1826
+ *
1827
+ * **Note**: there is no (supported) way to distinguish between "failure to talk to the server" and "another client
1828
+ * uploaded a key backup version using an algorithm I don't understand.
1829
+ *
1830
+ * @returns Information object from API, or null if no backup is present on the server.
1803
1831
  */
1804
1832
  getKeyBackupVersion(): Promise<IKeyBackupInfo | null>;
1805
1833
  /**
@@ -3107,7 +3135,9 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
3107
3135
  * Make a request for an `m.login.token` to be issued as per
3108
3136
  * [MSC3882](https://github.com/matrix-org/matrix-spec-proposals/pull/3882).
3109
3137
  * The server may require User-Interactive auth.
3110
- * Note that this is UNSTABLE and subject to breaking changes without notice.
3138
+ *
3139
+ * Compatibility with unstable implementations of MSC3882 is deprecated and will be removed in a future release.
3140
+ *
3111
3141
  * @param auth - Optional. Auth data to supply for User-Interactive auth.
3112
3142
  * @returns Promise which resolves: On success, the token response
3113
3143
  * or UIA auth data.