matrix-js-sdk 27.2.0 → 28.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 (87) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -0
  3. package/dist/browser-matrix.js +141 -231
  4. package/dist/browser-matrix.js.map +16 -14
  5. package/dist/browser-matrix.min.js +1 -1
  6. package/dist/browser-matrix.min.js.map +1 -1
  7. package/git-revision.txt +1 -1
  8. package/lib/@types/requests.d.ts +0 -5
  9. package/lib/@types/requests.d.ts.map +1 -1
  10. package/lib/@types/requests.js.map +1 -1
  11. package/lib/autodiscovery.d.ts +3 -1
  12. package/lib/autodiscovery.d.ts.map +1 -1
  13. package/lib/autodiscovery.js +17 -2
  14. package/lib/autodiscovery.js.map +1 -1
  15. package/lib/client.d.ts +7 -69
  16. package/lib/client.d.ts.map +1 -1
  17. package/lib/client.js +21 -171
  18. package/lib/client.js.map +1 -1
  19. package/lib/content-repo.js +2 -2
  20. package/lib/content-repo.js.map +1 -1
  21. package/lib/crypto/backup.d.ts.map +1 -1
  22. package/lib/crypto/backup.js +18 -7
  23. package/lib/crypto/backup.js.map +1 -1
  24. package/lib/crypto/index.d.ts +7 -1
  25. package/lib/crypto/index.d.ts.map +1 -1
  26. package/lib/crypto/index.js +14 -0
  27. package/lib/crypto/index.js.map +1 -1
  28. package/lib/crypto-api/keybackup.d.ts +7 -0
  29. package/lib/crypto-api/keybackup.d.ts.map +1 -1
  30. package/lib/crypto-api/keybackup.js.map +1 -1
  31. package/lib/crypto-api.d.ts +20 -1
  32. package/lib/crypto-api.d.ts.map +1 -1
  33. package/lib/crypto-api.js.map +1 -1
  34. package/lib/http-api/index.js +3 -3
  35. package/lib/http-api/index.js.map +1 -1
  36. package/lib/http-api/prefix.d.ts +7 -7
  37. package/lib/http-api/prefix.d.ts.map +1 -1
  38. package/lib/http-api/prefix.js +2 -2
  39. package/lib/http-api/prefix.js.map +1 -1
  40. package/lib/interactive-auth.d.ts.map +1 -1
  41. package/lib/interactive-auth.js +2 -4
  42. package/lib/interactive-auth.js.map +1 -1
  43. package/lib/matrix.d.ts +1 -0
  44. package/lib/matrix.d.ts.map +1 -1
  45. package/lib/matrix.js +12 -0
  46. package/lib/matrix.js.map +1 -1
  47. package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +1 -1
  48. package/lib/rust-crypto/OutgoingRequestProcessor.js +4 -2
  49. package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  50. package/lib/rust-crypto/backup.d.ts +53 -3
  51. package/lib/rust-crypto/backup.d.ts.map +1 -1
  52. package/lib/rust-crypto/backup.js +206 -4
  53. package/lib/rust-crypto/backup.js.map +1 -1
  54. package/lib/rust-crypto/rust-crypto.d.ts +28 -5
  55. package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  56. package/lib/rust-crypto/rust-crypto.js +66 -7
  57. package/lib/rust-crypto/rust-crypto.js.map +1 -1
  58. package/lib/rust-crypto/verification.d.ts +10 -0
  59. package/lib/rust-crypto/verification.d.ts.map +1 -1
  60. package/lib/rust-crypto/verification.js +27 -0
  61. package/lib/rust-crypto/verification.js.map +1 -1
  62. package/lib/sync.d.ts.map +1 -1
  63. package/lib/sync.js +4 -11
  64. package/lib/sync.js.map +1 -1
  65. package/lib/version-support.d.ts +5 -0
  66. package/lib/version-support.d.ts.map +1 -0
  67. package/lib/version-support.js +28 -0
  68. package/lib/version-support.js.map +1 -0
  69. package/package.json +4 -4
  70. package/src/@types/requests.ts +0 -6
  71. package/src/autodiscovery.ts +19 -1
  72. package/src/client.ts +24 -185
  73. package/src/content-repo.ts +2 -2
  74. package/src/crypto/backup.ts +18 -10
  75. package/src/crypto/index.ts +15 -0
  76. package/src/crypto-api/keybackup.ts +8 -0
  77. package/src/crypto-api.ts +22 -1
  78. package/src/http-api/index.ts +3 -3
  79. package/src/http-api/prefix.ts +7 -7
  80. package/src/interactive-auth.ts +2 -4
  81. package/src/matrix.ts +1 -0
  82. package/src/rust-crypto/OutgoingRequestProcessor.ts +7 -2
  83. package/src/rust-crypto/backup.ts +244 -5
  84. package/src/rust-crypto/rust-crypto.ts +94 -15
  85. package/src/rust-crypto/verification.ts +27 -0
  86. package/src/sync.ts +4 -11
  87. package/src/version-support.ts +20 -0
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- 858db67778cd3d406bef59f1970910e8dfceb7d8
1
+ 9b8dcf53ed97fb2c359000cf40f8b33a85c37025
@@ -140,11 +140,6 @@ export interface IBindThreePidBody {
140
140
  id_access_token: string | null;
141
141
  sid: string;
142
142
  }
143
- export interface IAddThreePidBody {
144
- client_secret: string;
145
- id_server: string;
146
- sid: string;
147
- }
148
143
  export interface IRelationsRequestOpts {
149
144
  from?: string;
150
145
  to?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/@types/requests.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5D,MAAM,WAAW,aAAa;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED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AE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE;QACF,CAAC,KAAK,EAAE,MAAM,GAAG;YACb,KAAK,EAAE,MAAM,CAAC;SACjB,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"requests.js","names":[],"sources":["../../src/@types/requests.ts"],"sourcesContent":["/*\nCopyright 2021 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 { IContent, IEvent } from \"../models/event\";\nimport { Preset, Visibility } from \"./partials\";\nimport { IEventWithRoomId, SearchKey } from \"./search\";\nimport { IRoomEventFilter } from \"../filter\";\nimport { Direction } from \"../models/event-timeline\";\nimport { PushRuleAction } from \"./PushRules\";\nimport { IRoomEvent } from \"../sync-accumulator\";\nimport { EventType, RelationType, RoomType } from \"./event\";\n\n// allow camelcase as these are things that go onto the wire\n/* eslint-disable camelcase */\n\nexport interface IJoinRoomOpts {\n /**\n * True to do a room initial sync on the resulting\n * room. If false, the <strong>returned Room object will have no current state.\n * </strong> Default: true.\n */\n syncRoom?: boolean;\n\n /**\n * If the caller has a keypair 3pid invite, the signing URL is passed in this parameter.\n */\n inviteSignUrl?: string;\n\n /**\n * The server names to try and join through in addition to those that are automatically chosen.\n */\n viaServers?: string[];\n}\n\nexport interface KnockRoomOpts {\n /**\n * The reason for the knock.\n */\n reason?: string;\n\n /**\n * The server names to try and knock through in addition to those that are automatically chosen.\n */\n viaServers?: string | string[];\n}\n\nexport interface IRedactOpts {\n reason?: string;\n /**\n * If specified, then any events which relate to the event being redacted with\n * any of the relationship types listed will also be redacted.\n * Provide a \"*\" list item to tell the server to redact relations of any type.\n *\n * <b>Raises an Error if the server does not support it.</b>\n * Check for server-side support before using this param with\n * <code>client.canSupport.get(Feature.RelationBasedRedactions)</code>.\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/3912}\n */\n with_rel_types?: Array<RelationType | \"*\">;\n}\n\nexport interface ISendEventResponse {\n event_id: string;\n}\n\nexport interface IPresenceOpts {\n // One of \"online\", \"offline\" or \"unavailable\"\n presence: \"online\" | \"offline\" | \"unavailable\";\n // The status message to attach.\n status_msg?: string;\n}\n\nexport interface IPaginateOpts {\n // true to fill backwards, false to go forwards\n backwards?: boolean;\n // number of events to request\n limit?: number;\n}\n\nexport interface IGuestAccessOpts {\n /**\n * True to allow guests to join this room. This\n * implicitly gives guests write access. If false or not given, guests are\n * explicitly forbidden from joining the room.\n */\n allowJoin: boolean;\n /**\n * True to set history visibility to\n * be world_readable. This gives guests read access *from this point forward*.\n * If false or not given, history visibility is not modified.\n */\n allowRead: boolean;\n}\n\nexport interface ISearchOpts {\n keys?: SearchKey[];\n query: string;\n}\n\nexport interface IEventSearchOpts {\n // a JSON filter object to pass in the request\n filter?: IRoomEventFilter;\n // the term to search for\n term: string;\n}\n\nexport interface IInvite3PID {\n id_server: string;\n id_access_token?: string; // this gets injected by the js-sdk\n medium: string;\n address: string;\n}\n\nexport interface ICreateRoomStateEvent {\n type: string;\n state_key?: string; // defaults to an empty string\n content: IContent;\n}\n\nexport interface ICreateRoomOpts {\n // The alias localpart to assign to this room.\n room_alias_name?: string;\n // Either 'public' or 'private'.\n visibility?: Visibility;\n // The name to give this room.\n name?: string;\n // The topic to give this room.\n topic?: string;\n preset?: Preset;\n power_level_content_override?: {\n ban?: number;\n events?: Record<EventType | string, number>;\n events_default?: number;\n invite?: number;\n kick?: number;\n notifications?: Record<string, number>;\n redact?: number;\n state_default?: number;\n users?: Record<string, number>;\n users_default?: number;\n };\n creation_content?: object;\n initial_state?: ICreateRoomStateEvent[];\n // A list of user IDs to invite to this room.\n invite?: string[];\n invite_3pid?: IInvite3PID[];\n is_direct?: boolean;\n room_version?: string;\n}\n\nexport interface IRoomDirectoryOptions {\n server?: string;\n limit?: number;\n since?: string;\n\n // Filter parameters\n filter?: {\n // String to search for\n generic_search_term?: string;\n room_types?: Array<RoomType | null>;\n };\n include_all_networks?: boolean;\n third_party_instance_id?: string;\n}\n\nexport interface IAddThreePidOnlyBody {\n auth?: {\n type: string;\n session?: string;\n };\n client_secret: string;\n sid: string;\n}\n\nexport interface IBindThreePidBody {\n client_secret: string;\n id_server: string;\n // Some older identity servers have no auth enabled\n id_access_token: string | null;\n sid: string;\n}\n\nexport interface IAddThreePidBody {\n client_secret: string;\n id_server: string;\n sid: string;\n}\n\nexport interface IRelationsRequestOpts {\n from?: string;\n to?: string;\n limit?: number;\n dir?: Direction;\n recurse?: boolean; // MSC3981 Relations Recursion https://github.com/matrix-org/matrix-spec-proposals/pull/3981\n}\n\nexport interface IRelationsResponse {\n chunk: IEvent[];\n next_batch?: string;\n prev_batch?: string;\n}\n\nexport interface IContextResponse {\n end: string;\n start: string;\n state: IEventWithRoomId[];\n events_before: IEventWithRoomId[];\n events_after: IEventWithRoomId[];\n event: IEventWithRoomId;\n}\n\nexport interface IEventsResponse {\n chunk: IEventWithRoomId[];\n end: string;\n start: string;\n}\n\nexport interface INotification {\n actions: PushRuleAction[];\n event: IRoomEvent;\n profile_tag?: string;\n read: boolean;\n room_id: string;\n ts: number;\n}\n\nexport interface INotificationsResponse {\n next_token: string;\n notifications: INotification[];\n}\n\nexport interface IFilterResponse {\n filter_id: string;\n}\n\nexport interface ITagsResponse {\n tags: {\n [tagId: string]: {\n order: number;\n };\n };\n}\n\nexport interface IStatusResponse extends IPresenceOpts {\n currently_active?: boolean;\n last_active_ago?: number;\n}\n\n/* eslint-enable camelcase */\n"],"mappings":""}
1
+ {"version":3,"file":"requests.js","names":[],"sources":["../../src/@types/requests.ts"],"sourcesContent":["/*\nCopyright 2021 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 { IContent, IEvent } from \"../models/event\";\nimport { Preset, Visibility } from \"./partials\";\nimport { IEventWithRoomId, SearchKey } from \"./search\";\nimport { IRoomEventFilter } from \"../filter\";\nimport { Direction } from \"../models/event-timeline\";\nimport { PushRuleAction } from \"./PushRules\";\nimport { IRoomEvent } from \"../sync-accumulator\";\nimport { EventType, RelationType, RoomType } from \"./event\";\n\n// allow camelcase as these are things that go onto the wire\n/* eslint-disable camelcase */\n\nexport interface IJoinRoomOpts {\n /**\n * True to do a room initial sync on the resulting\n * room. If false, the <strong>returned Room object will have no current state.\n * </strong> Default: true.\n */\n syncRoom?: boolean;\n\n /**\n * If the caller has a keypair 3pid invite, the signing URL is passed in this parameter.\n */\n inviteSignUrl?: string;\n\n /**\n * The server names to try and join through in addition to those that are automatically chosen.\n */\n viaServers?: string[];\n}\n\nexport interface KnockRoomOpts {\n /**\n * The reason for the knock.\n */\n reason?: string;\n\n /**\n * The server names to try and knock through in addition to those that are automatically chosen.\n */\n viaServers?: string | string[];\n}\n\nexport interface IRedactOpts {\n reason?: string;\n /**\n * If specified, then any events which relate to the event being redacted with\n * any of the relationship types listed will also be redacted.\n * Provide a \"*\" list item to tell the server to redact relations of any type.\n *\n * <b>Raises an Error if the server does not support it.</b>\n * Check for server-side support before using this param with\n * <code>client.canSupport.get(Feature.RelationBasedRedactions)</code>.\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/3912}\n */\n with_rel_types?: Array<RelationType | \"*\">;\n}\n\nexport interface ISendEventResponse {\n event_id: string;\n}\n\nexport interface IPresenceOpts {\n // One of \"online\", \"offline\" or \"unavailable\"\n presence: \"online\" | \"offline\" | \"unavailable\";\n // The status message to attach.\n status_msg?: string;\n}\n\nexport interface IPaginateOpts {\n // true to fill backwards, false to go forwards\n backwards?: boolean;\n // number of events to request\n limit?: number;\n}\n\nexport interface IGuestAccessOpts {\n /**\n * True to allow guests to join this room. This\n * implicitly gives guests write access. If false or not given, guests are\n * explicitly forbidden from joining the room.\n */\n allowJoin: boolean;\n /**\n * True to set history visibility to\n * be world_readable. This gives guests read access *from this point forward*.\n * If false or not given, history visibility is not modified.\n */\n allowRead: boolean;\n}\n\nexport interface ISearchOpts {\n keys?: SearchKey[];\n query: string;\n}\n\nexport interface IEventSearchOpts {\n // a JSON filter object to pass in the request\n filter?: IRoomEventFilter;\n // the term to search for\n term: string;\n}\n\nexport interface IInvite3PID {\n id_server: string;\n id_access_token?: string; // this gets injected by the js-sdk\n medium: string;\n address: string;\n}\n\nexport interface ICreateRoomStateEvent {\n type: string;\n state_key?: string; // defaults to an empty string\n content: IContent;\n}\n\nexport interface ICreateRoomOpts {\n // The alias localpart to assign to this room.\n room_alias_name?: string;\n // Either 'public' or 'private'.\n visibility?: Visibility;\n // The name to give this room.\n name?: string;\n // The topic to give this room.\n topic?: string;\n preset?: Preset;\n power_level_content_override?: {\n ban?: number;\n events?: Record<EventType | string, number>;\n events_default?: number;\n invite?: number;\n kick?: number;\n notifications?: Record<string, number>;\n redact?: number;\n state_default?: number;\n users?: Record<string, number>;\n users_default?: number;\n };\n creation_content?: object;\n initial_state?: ICreateRoomStateEvent[];\n // A list of user IDs to invite to this room.\n invite?: string[];\n invite_3pid?: IInvite3PID[];\n is_direct?: boolean;\n room_version?: string;\n}\n\nexport interface IRoomDirectoryOptions {\n server?: string;\n limit?: number;\n since?: string;\n\n // Filter parameters\n filter?: {\n // String to search for\n generic_search_term?: string;\n room_types?: Array<RoomType | null>;\n };\n include_all_networks?: boolean;\n third_party_instance_id?: string;\n}\n\nexport interface IAddThreePidOnlyBody {\n auth?: {\n type: string;\n session?: string;\n };\n client_secret: string;\n sid: string;\n}\n\nexport interface IBindThreePidBody {\n client_secret: string;\n id_server: string;\n // Some older identity servers have no auth enabled\n id_access_token: string | null;\n sid: string;\n}\n\nexport interface IRelationsRequestOpts {\n from?: string;\n to?: string;\n limit?: number;\n dir?: Direction;\n recurse?: boolean; // MSC3981 Relations Recursion https://github.com/matrix-org/matrix-spec-proposals/pull/3981\n}\n\nexport interface IRelationsResponse {\n chunk: IEvent[];\n next_batch?: string;\n prev_batch?: string;\n}\n\nexport interface IContextResponse {\n end: string;\n start: string;\n state: IEventWithRoomId[];\n events_before: IEventWithRoomId[];\n events_after: IEventWithRoomId[];\n event: IEventWithRoomId;\n}\n\nexport interface IEventsResponse {\n chunk: IEventWithRoomId[];\n end: string;\n start: string;\n}\n\nexport interface INotification {\n actions: PushRuleAction[];\n event: IRoomEvent;\n profile_tag?: string;\n read: boolean;\n room_id: string;\n ts: number;\n}\n\nexport interface INotificationsResponse {\n next_token: string;\n notifications: INotification[];\n}\n\nexport interface IFilterResponse {\n filter_id: string;\n}\n\nexport interface ITagsResponse {\n tags: {\n [tagId: string]: {\n order: number;\n };\n };\n}\n\nexport interface IStatusResponse extends IPresenceOpts {\n currently_active?: boolean;\n last_active_ago?: number;\n}\n\n/* eslint-enable camelcase */\n"],"mappings":""}
@@ -17,7 +17,8 @@ declare enum AutoDiscoveryError {
17
17
  InvalidIdentityServer = "Identity server URL does not appear to be a valid identity server",
18
18
  InvalidIs = "Invalid identity server discovery response",
19
19
  MissingWellknown = "No .well-known JSON file found",
20
- InvalidJson = "Invalid JSON"
20
+ InvalidJson = "Invalid JSON",
21
+ HomeserverTooOld = "The homeserver does not meet the minimum version requirements"
21
22
  }
22
23
  interface AutoDiscoveryState {
23
24
  state: AutoDiscoveryAction;
@@ -59,6 +60,7 @@ export declare class AutoDiscovery {
59
60
  static readonly ERROR_INVALID_IS = AutoDiscoveryError.InvalidIs;
60
61
  static readonly ERROR_MISSING_WELLKNOWN = AutoDiscoveryError.MissingWellknown;
61
62
  static readonly ERROR_INVALID_JSON = AutoDiscoveryError.InvalidJson;
63
+ static readonly ERROR_HOMESERVER_TOO_OLD = AutoDiscoveryError.HomeserverTooOld;
62
64
  static readonly ALL_ERRORS: string[];
63
65
  /**
64
66
  * The auto discovery failed. The client is expected to communicate
@@ -1 +1 @@
1
- {"version":3,"file":"autodiscovery.d.ts","sourceRoot":"","sources":["../src/autodiscovery.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAqC,MAAM,UAAU,CAAC;AAIvH,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAG1B,MAAM,iBAAiB,CAAC;AAMzB,oBAAY,mBAAmB;IAC3B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC5B;AAED,aAAK,kBAAkB;IACnB,OAAO,0CAA0C;IACjD,cAAc,0DAA0D;IACxE,gBAAgB,sCAAsC;IACtD,iBAAiB,mEAAmE;IACpF,gB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");
13
13
  var _validate = require("./oidc/validate");
14
14
  var _error = require("./oidc/error");
15
+ var _versionSupport = require("./version-support");
15
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /*
17
18
  Copyright 2018 New Vector Ltd
@@ -50,8 +51,10 @@ var AutoDiscoveryError = /*#__PURE__*/function (AutoDiscoveryError) {
50
51
  AutoDiscoveryError["InvalidIs"] = "Invalid identity server discovery response";
51
52
  AutoDiscoveryError["MissingWellknown"] = "No .well-known JSON file found";
52
53
  AutoDiscoveryError["InvalidJson"] = "Invalid JSON";
54
+ AutoDiscoveryError["HomeserverTooOld"] = "The homeserver does not meet the minimum version requirements";
53
55
  return AutoDiscoveryError;
54
- }(AutoDiscoveryError || {});
56
+ }(AutoDiscoveryError || {}); // TODO: Implement when Sydent supports the `/versions` endpoint - https://github.com/matrix-org/sydent/issues/424
57
+ //IdentityServerTooOld = "The identity server does not meet the minimum version requirements",
55
58
  /**
56
59
  * @deprecated in favour of OidcClientConfig
57
60
  */
@@ -120,7 +123,7 @@ class AutoDiscovery {
120
123
 
121
124
  // Step 3: Make sure the homeserver URL points to a homeserver.
122
125
  const hsVersions = await this.fetchWellKnownObject(`${hsUrl}/_matrix/client/versions`);
123
- if (!(hsVersions !== null && hsVersions !== void 0 && (_hsVersions$raw = hsVersions.raw) !== null && _hsVersions$raw !== void 0 && _hsVersions$raw["versions"])) {
126
+ if (!hsVersions || !Array.isArray((_hsVersions$raw = hsVersions.raw) === null || _hsVersions$raw === void 0 ? void 0 : _hsVersions$raw["versions"])) {
124
127
  _logger.logger.error("Invalid /versions response");
125
128
  clientConfig["m.homeserver"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;
126
129
 
@@ -130,6 +133,17 @@ class AutoDiscovery {
130
133
  return Promise.resolve(clientConfig);
131
134
  }
132
135
 
136
+ // Step 3.1: Non-spec check to ensure the server will actually work for us
137
+ if (!hsVersions.raw["versions"].includes(_versionSupport.MINIMUM_MATRIX_VERSION)) {
138
+ _logger.logger.error("Homeserver does not meet minimum version requirements");
139
+ clientConfig["m.homeserver"].error = AutoDiscovery.ERROR_HOMESERVER_TOO_OLD;
140
+
141
+ // Supply the base_url to the caller because they may be ignoring liveliness
142
+ // errors, like this one.
143
+ clientConfig["m.homeserver"].base_url = hsUrl;
144
+ return Promise.resolve(clientConfig);
145
+ }
146
+
133
147
  // Step 4: Now that the homeserver looks valid, update our client config.
134
148
  clientConfig["m.homeserver"] = {
135
149
  state: AutoDiscovery.SUCCESS,
@@ -492,6 +506,7 @@ exports.AutoDiscovery = AutoDiscovery;
492
506
  (0, _defineProperty2.default)(AutoDiscovery, "ERROR_INVALID_IS", AutoDiscoveryError.InvalidIs);
493
507
  (0, _defineProperty2.default)(AutoDiscovery, "ERROR_MISSING_WELLKNOWN", AutoDiscoveryError.MissingWellknown);
494
508
  (0, _defineProperty2.default)(AutoDiscovery, "ERROR_INVALID_JSON", AutoDiscoveryError.InvalidJson);
509
+ (0, _defineProperty2.default)(AutoDiscovery, "ERROR_HOMESERVER_TOO_OLD", AutoDiscoveryError.HomeserverTooOld);
495
510
  (0, _defineProperty2.default)(AutoDiscovery, "ALL_ERRORS", Object.keys(AutoDiscoveryError));
496
511
  /**
497
512
  * The auto discovery failed. The client is expected to communicate
@@ -1 +1 @@
1
- {"version":3,"file":"autodiscovery.js","names":["_client","require","_logger","_httpApi","_discovery","_validate","_error","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","AutoDiscoveryAction","exports","AutoDiscoveryError","AutoDiscovery","fromDiscoveryConfig","wellknown","_hsVersions$raw","clientConfig","state","FAIL_ERROR","error","ERROR_INVALID","base_url","PROMPT","logger","FAIL_PROMPT","Promise","resolve","ERROR_INVALID_HS_BASE_URL","hsUrl","sanitizeWellKnownUrl","hsVersions","fetchWellKnownObject","raw","ERROR_INVALID_HOMESERVER","SUCCESS","isUrl","failingClientConfig","ERROR_INVALID_IS","ERROR_INVALID_IS_BASE_URL","isResponse","action","ERROR_INVALID_IDENTITY_SERVER","toString","k","notProps","prop","includes","authConfig","discoverAndValidateAuthenticationConfig","M_AUTHENTICATION","stable","validateDiscoveryAuthenticationConfig","wellKnown","authentication","findIn","undefined","homeserverAuthenticationConfig","validateWellKnownAuthentication","issuerOpenIdConfigUrl","issuer","issuerWellKnown","Error","OidcError","General","validatedIssuerConfig","validateOIDCIssuerWellKnown","delegatedAuthConfig","errorMessage","message","errorType","values","NotSupported","IGNORE","result","metadata","response","findClientConfig","domain","domainWithProtocol","reason","getRawClientConfig","_response$raw","url","_parsed","parsed","URL","e","hostname","protocol","port","path","pathname","saferUrl","endsWith","substring","fetch","resource","options","fetchFn","global","setFetchFn","method","Method","Get","signal","timeoutSignal","status","ERROR_MISSING_WELLKNOWN","ok","err","json","name","ERROR_INVALID_JSON","Invalid","GenericFailure","InvalidHsBaseUrl","InvalidHomeserver","InvalidIsBaseUrl","InvalidIdentityServer","InvalidIs","MissingWellknown","InvalidJson"],"sources":["../src/autodiscovery.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\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 { SigningKey } from \"oidc-client-ts\";\n\nimport { IClientWellKnown, IWellKnownConfig, IDelegatedAuthConfig, IServerVersions, M_AUTHENTICATION } from \"./client\";\nimport { logger } from \"./logger\";\nimport { MatrixError, Method, timeoutSignal } from \"./http-api\";\nimport { discoverAndValidateAuthenticationConfig } from \"./oidc/discovery\";\nimport {\n ValidatedIssuerConfig,\n ValidatedIssuerMetadata,\n validateOIDCIssuerWellKnown,\n validateWellKnownAuthentication,\n} from \"./oidc/validate\";\nimport { OidcError } from \"./oidc/error\";\n\n// Dev note: Auto discovery is part of the spec.\n// See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery\n\nexport enum AutoDiscoveryAction {\n SUCCESS = \"SUCCESS\",\n IGNORE = \"IGNORE\",\n PROMPT = \"PROMPT\",\n FAIL_PROMPT = \"FAIL_PROMPT\",\n FAIL_ERROR = \"FAIL_ERROR\",\n}\n\nenum AutoDiscoveryError {\n Invalid = \"Invalid homeserver discovery response\",\n GenericFailure = \"Failed to get autodiscovery configuration from server\",\n InvalidHsBaseUrl = \"Invalid base_url for m.homeserver\",\n InvalidHomeserver = \"Homeserver URL does not appear to be a valid Matrix homeserver\",\n InvalidIsBaseUrl = \"Invalid base_url for m.identity_server\",\n InvalidIdentityServer = \"Identity server URL does not appear to be a valid identity server\",\n InvalidIs = \"Invalid identity server discovery response\",\n MissingWellknown = \"No .well-known JSON file found\",\n InvalidJson = \"Invalid JSON\",\n}\n\ninterface AutoDiscoveryState {\n state: AutoDiscoveryAction;\n error?: IWellKnownConfig[\"error\"] | null;\n}\ninterface WellKnownConfig extends Omit<IWellKnownConfig, \"error\">, AutoDiscoveryState {}\n\n/**\n * @deprecated in favour of OidcClientConfig\n */\ninterface DelegatedAuthConfig extends IDelegatedAuthConfig, ValidatedIssuerConfig, AutoDiscoveryState {}\n\n/**\n * @experimental\n */\nexport interface OidcClientConfig extends IDelegatedAuthConfig, ValidatedIssuerConfig {\n metadata: ValidatedIssuerMetadata;\n signingKeys?: SigningKey[];\n}\n\nexport interface ClientConfig extends Omit<IClientWellKnown, \"m.homeserver\" | \"m.identity_server\"> {\n \"m.homeserver\": WellKnownConfig;\n \"m.identity_server\": WellKnownConfig;\n /**\n * @experimental\n */\n \"m.authentication\"?: (OidcClientConfig & AutoDiscoveryState) | AutoDiscoveryState;\n}\n\n/**\n * Utilities for automatically discovery resources, such as homeservers\n * for users to log in to.\n */\nexport class AutoDiscovery {\n // Dev note: the constants defined here are related to but not\n // exactly the same as those in the spec. This is to hopefully\n // translate the meaning of the states in the spec, but also\n // support our own if needed.\n\n public static readonly ERROR_INVALID = AutoDiscoveryError.Invalid;\n\n public static readonly ERROR_GENERIC_FAILURE = AutoDiscoveryError.GenericFailure;\n\n public static readonly ERROR_INVALID_HS_BASE_URL = AutoDiscoveryError.InvalidHsBaseUrl;\n\n public static readonly ERROR_INVALID_HOMESERVER = AutoDiscoveryError.InvalidHomeserver;\n\n public static readonly ERROR_INVALID_IS_BASE_URL = AutoDiscoveryError.InvalidIsBaseUrl;\n\n public static readonly ERROR_INVALID_IDENTITY_SERVER = AutoDiscoveryError.InvalidIdentityServer;\n\n public static readonly ERROR_INVALID_IS = AutoDiscoveryError.InvalidIs;\n\n public static readonly ERROR_MISSING_WELLKNOWN = AutoDiscoveryError.MissingWellknown;\n\n public static readonly ERROR_INVALID_JSON = AutoDiscoveryError.InvalidJson;\n\n public static readonly ALL_ERRORS = Object.keys(AutoDiscoveryError);\n\n /**\n * The auto discovery failed. The client is expected to communicate\n * the error to the user and refuse logging in.\n */\n public static readonly FAIL_ERROR = AutoDiscoveryAction.FAIL_ERROR;\n\n /**\n * The auto discovery failed, however the client may still recover\n * from the problem. The client is recommended to that the same\n * action it would for PROMPT while also warning the user about\n * what went wrong. The client may also treat this the same as\n * a FAIL_ERROR state.\n */\n public static readonly FAIL_PROMPT = AutoDiscoveryAction.FAIL_PROMPT;\n\n /**\n * The auto discovery didn't fail but did not find anything of\n * interest. The client is expected to prompt the user for more\n * information, or fail if it prefers.\n */\n public static readonly PROMPT = AutoDiscoveryAction.PROMPT;\n\n /**\n * The auto discovery was successful.\n */\n public static readonly SUCCESS = AutoDiscoveryAction.SUCCESS;\n\n /**\n * Validates and verifies client configuration information for purposes\n * of logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be included, and will be transparently brought into the\n * response object unaltered.\n * @param wellknown - The configuration object itself, as returned\n * by the .well-known auto-discovery endpoint.\n * @returns Promise which resolves to the verified\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when verification fails.\n */\n public static async fromDiscoveryConfig(wellknown: IClientWellKnown): Promise<ClientConfig> {\n // Step 1 is to get the config, which is provided to us here.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n if (!wellknown?.[\"m.homeserver\"]) {\n logger.error(\"No m.homeserver key in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n\n return Promise.resolve(clientConfig);\n }\n\n if (!wellknown[\"m.homeserver\"][\"base_url\"]) {\n logger.error(\"No m.homeserver base_url in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Make sure the homeserver URL is valid *looking*. We'll make\n // sure it points to a homeserver in Step 3.\n const hsUrl = this.sanitizeWellKnownUrl(wellknown[\"m.homeserver\"][\"base_url\"]);\n if (!hsUrl) {\n logger.error(\"Invalid base_url for m.homeserver\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n return Promise.resolve(clientConfig);\n }\n\n // Step 3: Make sure the homeserver URL points to a homeserver.\n const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);\n if (!hsVersions?.raw?.[\"versions\"]) {\n logger.error(\"Invalid /versions response\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 4: Now that the homeserver looks valid, update our client config.\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: hsUrl,\n };\n\n // Step 5: Try to pull out the identity server configuration\n let isUrl: string | boolean = \"\";\n if (wellknown[\"m.identity_server\"]) {\n // We prepare a failing identity server response to save lines later\n // in this branch.\n const failingClientConfig: ClientConfig = {\n \"m.homeserver\": clientConfig[\"m.homeserver\"],\n \"m.identity_server\": {\n state: AutoDiscovery.FAIL_PROMPT,\n error: AutoDiscovery.ERROR_INVALID_IS,\n base_url: null,\n },\n };\n\n // Step 5a: Make sure the URL is valid *looking*. We'll make sure it\n // points to an identity server in Step 5b.\n isUrl = this.sanitizeWellKnownUrl(wellknown[\"m.identity_server\"][\"base_url\"]);\n if (!isUrl) {\n logger.error(\"Invalid base_url for m.identity_server\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IS_BASE_URL;\n return Promise.resolve(failingClientConfig);\n }\n\n // Step 5b: Verify there is an identity server listening on the provided\n // URL.\n const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);\n if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Invalid /v2 response\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;\n\n // Supply the base_url to the caller because they may be ignoring\n // liveliness errors, like this one.\n failingClientConfig[\"m.identity_server\"].base_url = isUrl;\n\n return Promise.resolve(failingClientConfig);\n }\n }\n\n // Step 6: Now that the identity server is valid, or never existed,\n // populate the IS section.\n if (isUrl && isUrl.toString().length > 0) {\n clientConfig[\"m.identity_server\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: isUrl,\n };\n }\n\n // Step 7: Copy any other keys directly into the clientConfig. This is for\n // things like custom configuration of services.\n Object.keys(wellknown).forEach((k: keyof IClientWellKnown) => {\n if (k === \"m.homeserver\" || k === \"m.identity_server\") {\n // Only copy selected parts of the config to avoid overwriting\n // properties computed by the validation logic above.\n const notProps = [\"error\", \"state\", \"base_url\"];\n for (const prop of Object.keys(wellknown[k]!)) {\n if (notProps.includes(prop)) continue;\n type Prop = Exclude<keyof IWellKnownConfig, \"error\" | \"state\" | \"base_url\">;\n // @ts-ignore - ts gets unhappy as we're mixing types here\n clientConfig[k][prop as Prop] = wellknown[k]![prop as Prop];\n }\n } else {\n // Just copy the whole thing over otherwise\n clientConfig[k] = wellknown[k];\n }\n });\n\n const authConfig = await this.discoverAndValidateAuthenticationConfig(wellknown);\n clientConfig[M_AUTHENTICATION.stable!] = authConfig;\n\n // Step 8: Give the config to the caller (finally)\n return Promise.resolve(clientConfig);\n }\n\n /**\n * Validate delegated auth configuration\n * @deprecated use discoverAndValidateAuthenticationConfig\n * - m.authentication config is present and valid\n * - delegated auth issuer openid-configuration is reachable\n * - delegated auth issuer openid-configuration is configured correctly for us\n * When successful, DelegatedAuthConfig will be returned with endpoints used for delegated auth\n * Any errors are caught, and AutoDiscoveryState returned with error\n * @param wellKnown - configuration object as returned\n * by the .well-known auto-discovery endpoint\n * @returns Config or failure result\n */\n public static async validateDiscoveryAuthenticationConfig(\n wellKnown: IClientWellKnown,\n ): Promise<DelegatedAuthConfig | AutoDiscoveryState> {\n try {\n const authentication = M_AUTHENTICATION.findIn<IDelegatedAuthConfig>(wellKnown) || undefined;\n const homeserverAuthenticationConfig = validateWellKnownAuthentication(authentication);\n\n const issuerOpenIdConfigUrl = `${this.sanitizeWellKnownUrl(\n homeserverAuthenticationConfig.issuer,\n )}/.well-known/openid-configuration`;\n const issuerWellKnown = await this.fetchWellKnownObject<unknown>(issuerOpenIdConfigUrl);\n\n if (issuerWellKnown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Failed to fetch issuer openid configuration\");\n throw new Error(OidcError.General);\n }\n\n const validatedIssuerConfig = validateOIDCIssuerWellKnown(issuerWellKnown.raw);\n\n const delegatedAuthConfig: DelegatedAuthConfig = {\n state: AutoDiscoveryAction.SUCCESS,\n error: null,\n ...homeserverAuthenticationConfig,\n ...validatedIssuerConfig,\n };\n return delegatedAuthConfig;\n } catch (error) {\n const errorMessage = (error as Error).message as unknown as OidcError;\n const errorType = Object.values(OidcError).includes(errorMessage) ? errorMessage : OidcError.General;\n\n const state =\n errorType === OidcError.NotSupported ? AutoDiscoveryAction.IGNORE : AutoDiscoveryAction.FAIL_ERROR;\n\n return {\n state,\n error: errorType,\n };\n }\n }\n\n /**\n * Validate delegated auth configuration\n * - m.authentication config is present and valid\n * - delegated auth issuer openid-configuration is reachable\n * - delegated auth issuer openid-configuration is configured correctly for us\n * When successful, validated authentication metadata and optionally signing keys will be returned\n * Any errors are caught, and AutoDiscoveryState returned with error\n * @param wellKnown - configuration object as returned\n * by the .well-known auto-discovery endpoint\n * @returns Config or failure result\n */\n public static async discoverAndValidateAuthenticationConfig(\n wellKnown: IClientWellKnown,\n ): Promise<(OidcClientConfig & AutoDiscoveryState) | AutoDiscoveryState> {\n try {\n const authentication = M_AUTHENTICATION.findIn<IDelegatedAuthConfig>(wellKnown) || undefined;\n const result = await discoverAndValidateAuthenticationConfig(authentication);\n\n // include this for backwards compatibility\n const validatedIssuerConfig = validateOIDCIssuerWellKnown(result.metadata);\n\n const response = {\n state: AutoDiscoveryAction.SUCCESS,\n error: null,\n ...validatedIssuerConfig,\n ...result,\n };\n return response;\n } catch (error) {\n const errorMessage = (error as Error).message as unknown as OidcError;\n const errorType = Object.values(OidcError).includes(errorMessage) ? errorMessage : OidcError.General;\n\n const state =\n errorType === OidcError.NotSupported ? AutoDiscoveryAction.IGNORE : AutoDiscoveryAction.FAIL_ERROR;\n\n return {\n state,\n error: errorType,\n };\n }\n }\n\n /**\n * Attempts to automatically discover client configuration information\n * prior to logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be discovered, and will be transparently included in the\n * response object unaltered.\n * @param domain - The homeserver domain to perform discovery\n * on. For example, \"matrix.org\".\n * @returns Promise which resolves to the discovered\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when discovery fails.\n */\n public static async findClientConfig(domain: string): Promise<ClientConfig> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n // We use a .well-known lookup for all cases. According to the spec, we\n // can do other discovery mechanisms if we want such as custom lookups\n // however we won't bother with that here (mostly because the spec only\n // supports .well-known right now).\n //\n // By using .well-known, we need to ensure we at least pull out a URL\n // for the homeserver. We don't really need an identity server configuration\n // but will return one anyways (with state PROMPT) to make development\n // easier for clients. If we can't get a homeserver URL, all bets are\n // off on the rest of the config and we'll assume it is invalid too.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n // Step 1: Actually request the .well-known JSON file and make sure it\n // at least has a homeserver definition.\n const domainWithProtocol = domain.includes(\"://\") ? domain : `https://${domain}`;\n const wellknown = await this.fetchWellKnownObject(`${domainWithProtocol}/.well-known/matrix/client`);\n if (!wellknown || wellknown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"No response or error when parsing .well-known\");\n if (wellknown.reason) logger.error(wellknown.reason);\n if (wellknown.action === AutoDiscoveryAction.IGNORE) {\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n };\n } else {\n // this can only ever be FAIL_PROMPT at this point.\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n }\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Validate and parse the config\n return AutoDiscovery.fromDiscoveryConfig(wellknown.raw!);\n }\n\n /**\n * Gets the raw discovery client configuration for the given domain name.\n * Should only be used if there's no validation to be done on the resulting\n * object, otherwise use findClientConfig().\n * @param domain - The domain to get the client config for.\n * @returns Promise which resolves to the domain's client config. Can\n * be an empty object.\n */\n public static async getRawClientConfig(domain?: string): Promise<IClientWellKnown> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n const response = await this.fetchWellKnownObject(`https://${domain}/.well-known/matrix/client`);\n if (!response) return {};\n return response.raw ?? {};\n }\n\n /**\n * Sanitizes a given URL to ensure it is either an HTTP or HTTP URL and\n * is suitable for the requirements laid out by .well-known auto discovery.\n * If valid, the URL will also be stripped of any trailing slashes.\n * @param url - The potentially invalid URL to sanitize.\n * @returns The sanitized URL or a falsey value if the URL is invalid.\n * @internal\n */\n private static sanitizeWellKnownUrl(url?: string | null): string | false {\n if (!url) return false;\n\n try {\n let parsed: URL | undefined;\n try {\n parsed = new URL(url);\n } catch (e) {\n logger.error(\"Could not parse url\", e);\n }\n\n if (!parsed?.hostname) return false;\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false;\n\n const port = parsed.port ? `:${parsed.port}` : \"\";\n const path = parsed.pathname ? parsed.pathname : \"\";\n let saferUrl = `${parsed.protocol}//${parsed.hostname}${port}${path}`;\n if (saferUrl.endsWith(\"/\")) {\n saferUrl = saferUrl.substring(0, saferUrl.length - 1);\n }\n return saferUrl;\n } catch (e) {\n logger.error(e);\n return false;\n }\n }\n\n private static fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof global.fetch> {\n if (this.fetchFn) {\n return this.fetchFn(resource, options);\n }\n return global.fetch(resource, options);\n }\n\n private static fetchFn?: typeof global.fetch;\n\n public static setFetchFn(fetchFn: typeof global.fetch): void {\n AutoDiscovery.fetchFn = fetchFn;\n }\n\n /**\n * Fetches a JSON object from a given URL, as expected by all .well-known\n * related lookups. If the server gives a 404 then the `action` will be\n * IGNORE. If the server returns something that isn't JSON, the `action`\n * will be FAIL_PROMPT. For any other failure the `action` will be FAIL_PROMPT.\n *\n * The returned object will be a result of the call in object form with\n * the following properties:\n * raw: The JSON object returned by the server.\n * action: One of SUCCESS, IGNORE, or FAIL_PROMPT.\n * reason: Relatively human-readable description of what went wrong.\n * error: The actual Error, if one exists.\n * @param url - The URL to fetch a JSON object from.\n * @returns Promise which resolves to the returned state.\n * @internal\n */\n private static async fetchWellKnownObject<T = IWellKnownConfig>(\n url: string,\n ): Promise<IWellKnownConfig<Partial<T>>> {\n let response: Response;\n\n try {\n response = await AutoDiscovery.fetch(url, {\n method: Method.Get,\n signal: timeoutSignal(5000),\n });\n\n if (response.status === 404) {\n return {\n raw: {},\n action: AutoDiscoveryAction.IGNORE,\n reason: AutoDiscovery.ERROR_MISSING_WELLKNOWN,\n };\n }\n\n if (!response.ok) {\n return {\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: \"General failure\",\n };\n }\n } catch (err) {\n const error = err as AutoDiscoveryError | string | undefined;\n let reason = \"\";\n if (typeof error === \"object\") {\n reason = (<Error>error)?.message;\n }\n\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: reason || \"General failure\",\n };\n }\n\n try {\n return {\n raw: await response.json(),\n action: AutoDiscoveryAction.SUCCESS,\n };\n } catch (err) {\n const error = err as Error;\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason:\n (error as MatrixError)?.name === \"SyntaxError\"\n ? AutoDiscovery.ERROR_INVALID_JSON\n : AutoDiscovery.ERROR_INVALID,\n };\n }\n }\n}\n"],"mappings":";;;;;;;;AAmBA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AAAyC,SAAAM,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,W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CSO,aAAa,iBAuCeH,mBAAmB,CAACe,WAAW;AAEpE;AACJ;AACA;AACA;AACA;AAJI,IAAApB,gBAAA,CAAAC,OAAA,EAzCSO,aAAa,YA8CUH,mBAAmB,CAACa,MAAM;AAE1D;AACJ;AACA;AAFI,IAAAlB,gBAAA,CAAAC,OAAA,EAhDSO,aAAa,aAmDWH,mBAAmB,CAACyB,OAAO;AAAA,IAAA9B,gBAAA,CAAAC,OAAA,EAnDnDO,aAAa"}
1
+ {"version":3,"file":"autodiscovery.js","names":["_client","require","_logger","_httpApi","_discovery","_validate","_error","_versionSupport","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","AutoDiscoveryAction","exports","AutoDiscoveryError","AutoDiscovery","fromDiscoveryConfig","wellknown","_hsVersions$raw","clientConfig","state","FAIL_ERROR","error","ERROR_INVALID","base_url","PROMPT","logger","FAIL_PROMPT","Promise","resolve","ERROR_INVALID_HS_BASE_URL","hsUrl","sanitizeWellKnownUrl","hsVersions","fetchWellKnownObject","Array","isArray","raw","ERROR_INVALID_HOMESERVER","includes","MINIMUM_MATRIX_VERSION","ERROR_HOMESERVER_TOO_OLD","SUCCESS","isUrl","failingClientConfig","ERROR_INVALID_IS","ERROR_INVALID_IS_BASE_URL","isResponse","action","ERROR_INVALID_IDENTITY_SERVER","toString","k","notProps","prop","authConfig","discoverAndValidateAuthenticationConfig","M_AUTHENTICATION","stable","validateDiscoveryAuthenticationConfig","wellKnown","authentication","findIn","undefined","homeserverAuthenticationConfig","validateWellKnownAuthentication","issuerOpenIdConfigUrl","issuer","issuerWellKnown","Error","OidcError","General","validatedIssuerConfig","validateOIDCIssuerWellKnown","delegatedAuthConfig","errorMessage","message","errorType","values","NotSupported","IGNORE","result","metadata","response","findClientConfig","domain","domainWithProtocol","reason","getRawClientConfig","_response$raw","url","_parsed","parsed","URL","e","hostname","protocol","port","path","pathname","saferUrl","endsWith","substring","fetch","resource","options","fetchFn","global","setFetchFn","method","Method","Get","signal","timeoutSignal","status","ERROR_MISSING_WELLKNOWN","ok","err","json","name","ERROR_INVALID_JSON","Invalid","GenericFailure","InvalidHsBaseUrl","InvalidHomeserver","InvalidIsBaseUrl","InvalidIdentityServer","InvalidIs","MissingWellknown","InvalidJson","HomeserverTooOld"],"sources":["../src/autodiscovery.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\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 { SigningKey } from \"oidc-client-ts\";\n\nimport { IClientWellKnown, IWellKnownConfig, IDelegatedAuthConfig, IServerVersions, M_AUTHENTICATION } from \"./client\";\nimport { logger } from \"./logger\";\nimport { MatrixError, Method, timeoutSignal } from \"./http-api\";\nimport { discoverAndValidateAuthenticationConfig } from \"./oidc/discovery\";\nimport {\n ValidatedIssuerConfig,\n ValidatedIssuerMetadata,\n validateOIDCIssuerWellKnown,\n validateWellKnownAuthentication,\n} from \"./oidc/validate\";\nimport { OidcError } from \"./oidc/error\";\nimport { MINIMUM_MATRIX_VERSION } from \"./version-support\";\n\n// Dev note: Auto discovery is part of the spec.\n// See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery\n\nexport enum AutoDiscoveryAction {\n SUCCESS = \"SUCCESS\",\n IGNORE = \"IGNORE\",\n PROMPT = \"PROMPT\",\n FAIL_PROMPT = \"FAIL_PROMPT\",\n FAIL_ERROR = \"FAIL_ERROR\",\n}\n\nenum AutoDiscoveryError {\n Invalid = \"Invalid homeserver discovery response\",\n GenericFailure = \"Failed to get autodiscovery configuration from server\",\n InvalidHsBaseUrl = \"Invalid base_url for m.homeserver\",\n InvalidHomeserver = \"Homeserver URL does not appear to be a valid Matrix homeserver\",\n InvalidIsBaseUrl = \"Invalid base_url for m.identity_server\",\n InvalidIdentityServer = \"Identity server URL does not appear to be a valid identity server\",\n InvalidIs = \"Invalid identity server discovery response\",\n MissingWellknown = \"No .well-known JSON file found\",\n InvalidJson = \"Invalid JSON\",\n HomeserverTooOld = \"The homeserver does not meet the minimum version requirements\",\n // TODO: Implement when Sydent supports the `/versions` endpoint - https://github.com/matrix-org/sydent/issues/424\n //IdentityServerTooOld = \"The identity server does not meet the minimum version requirements\",\n}\n\ninterface AutoDiscoveryState {\n state: AutoDiscoveryAction;\n error?: IWellKnownConfig[\"error\"] | null;\n}\ninterface WellKnownConfig extends Omit<IWellKnownConfig, \"error\">, AutoDiscoveryState {}\n\n/**\n * @deprecated in favour of OidcClientConfig\n */\ninterface DelegatedAuthConfig extends IDelegatedAuthConfig, ValidatedIssuerConfig, AutoDiscoveryState {}\n\n/**\n * @experimental\n */\nexport interface OidcClientConfig extends IDelegatedAuthConfig, ValidatedIssuerConfig {\n metadata: ValidatedIssuerMetadata;\n signingKeys?: SigningKey[];\n}\n\nexport interface ClientConfig extends Omit<IClientWellKnown, \"m.homeserver\" | \"m.identity_server\"> {\n \"m.homeserver\": WellKnownConfig;\n \"m.identity_server\": WellKnownConfig;\n /**\n * @experimental\n */\n \"m.authentication\"?: (OidcClientConfig & AutoDiscoveryState) | AutoDiscoveryState;\n}\n\n/**\n * Utilities for automatically discovery resources, such as homeservers\n * for users to log in to.\n */\nexport class AutoDiscovery {\n // Dev note: the constants defined here are related to but not\n // exactly the same as those in the spec. This is to hopefully\n // translate the meaning of the states in the spec, but also\n // support our own if needed.\n\n public static readonly ERROR_INVALID = AutoDiscoveryError.Invalid;\n\n public static readonly ERROR_GENERIC_FAILURE = AutoDiscoveryError.GenericFailure;\n\n public static readonly ERROR_INVALID_HS_BASE_URL = AutoDiscoveryError.InvalidHsBaseUrl;\n\n public static readonly ERROR_INVALID_HOMESERVER = AutoDiscoveryError.InvalidHomeserver;\n\n public static readonly ERROR_INVALID_IS_BASE_URL = AutoDiscoveryError.InvalidIsBaseUrl;\n\n public static readonly ERROR_INVALID_IDENTITY_SERVER = AutoDiscoveryError.InvalidIdentityServer;\n\n public static readonly ERROR_INVALID_IS = AutoDiscoveryError.InvalidIs;\n\n public static readonly ERROR_MISSING_WELLKNOWN = AutoDiscoveryError.MissingWellknown;\n\n public static readonly ERROR_INVALID_JSON = AutoDiscoveryError.InvalidJson;\n\n public static readonly ERROR_HOMESERVER_TOO_OLD = AutoDiscoveryError.HomeserverTooOld;\n\n public static readonly ALL_ERRORS = Object.keys(AutoDiscoveryError);\n\n /**\n * The auto discovery failed. The client is expected to communicate\n * the error to the user and refuse logging in.\n */\n public static readonly FAIL_ERROR = AutoDiscoveryAction.FAIL_ERROR;\n\n /**\n * The auto discovery failed, however the client may still recover\n * from the problem. The client is recommended to that the same\n * action it would for PROMPT while also warning the user about\n * what went wrong. The client may also treat this the same as\n * a FAIL_ERROR state.\n */\n public static readonly FAIL_PROMPT = AutoDiscoveryAction.FAIL_PROMPT;\n\n /**\n * The auto discovery didn't fail but did not find anything of\n * interest. The client is expected to prompt the user for more\n * information, or fail if it prefers.\n */\n public static readonly PROMPT = AutoDiscoveryAction.PROMPT;\n\n /**\n * The auto discovery was successful.\n */\n public static readonly SUCCESS = AutoDiscoveryAction.SUCCESS;\n\n /**\n * Validates and verifies client configuration information for purposes\n * of logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be included, and will be transparently brought into the\n * response object unaltered.\n * @param wellknown - The configuration object itself, as returned\n * by the .well-known auto-discovery endpoint.\n * @returns Promise which resolves to the verified\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when verification fails.\n */\n public static async fromDiscoveryConfig(wellknown: IClientWellKnown): Promise<ClientConfig> {\n // Step 1 is to get the config, which is provided to us here.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n if (!wellknown?.[\"m.homeserver\"]) {\n logger.error(\"No m.homeserver key in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n\n return Promise.resolve(clientConfig);\n }\n\n if (!wellknown[\"m.homeserver\"][\"base_url\"]) {\n logger.error(\"No m.homeserver base_url in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Make sure the homeserver URL is valid *looking*. We'll make\n // sure it points to a homeserver in Step 3.\n const hsUrl = this.sanitizeWellKnownUrl(wellknown[\"m.homeserver\"][\"base_url\"]);\n if (!hsUrl) {\n logger.error(\"Invalid base_url for m.homeserver\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n return Promise.resolve(clientConfig);\n }\n\n // Step 3: Make sure the homeserver URL points to a homeserver.\n const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);\n if (!hsVersions || !Array.isArray(hsVersions.raw?.[\"versions\"])) {\n logger.error(\"Invalid /versions response\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 3.1: Non-spec check to ensure the server will actually work for us\n if (!hsVersions.raw![\"versions\"].includes(MINIMUM_MATRIX_VERSION)) {\n logger.error(\"Homeserver does not meet minimum version requirements\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_HOMESERVER_TOO_OLD;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 4: Now that the homeserver looks valid, update our client config.\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: hsUrl,\n };\n\n // Step 5: Try to pull out the identity server configuration\n let isUrl: string | boolean = \"\";\n if (wellknown[\"m.identity_server\"]) {\n // We prepare a failing identity server response to save lines later\n // in this branch.\n const failingClientConfig: ClientConfig = {\n \"m.homeserver\": clientConfig[\"m.homeserver\"],\n \"m.identity_server\": {\n state: AutoDiscovery.FAIL_PROMPT,\n error: AutoDiscovery.ERROR_INVALID_IS,\n base_url: null,\n },\n };\n\n // Step 5a: Make sure the URL is valid *looking*. We'll make sure it\n // points to an identity server in Step 5b.\n isUrl = this.sanitizeWellKnownUrl(wellknown[\"m.identity_server\"][\"base_url\"]);\n if (!isUrl) {\n logger.error(\"Invalid base_url for m.identity_server\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IS_BASE_URL;\n return Promise.resolve(failingClientConfig);\n }\n\n // Step 5b: Verify there is an identity server listening on the provided\n // URL.\n const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);\n if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Invalid /v2 response\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;\n\n // Supply the base_url to the caller because they may be ignoring\n // liveliness errors, like this one.\n failingClientConfig[\"m.identity_server\"].base_url = isUrl;\n\n return Promise.resolve(failingClientConfig);\n }\n }\n\n // Step 6: Now that the identity server is valid, or never existed,\n // populate the IS section.\n if (isUrl && isUrl.toString().length > 0) {\n clientConfig[\"m.identity_server\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: isUrl,\n };\n }\n\n // Step 7: Copy any other keys directly into the clientConfig. This is for\n // things like custom configuration of services.\n Object.keys(wellknown).forEach((k: keyof IClientWellKnown) => {\n if (k === \"m.homeserver\" || k === \"m.identity_server\") {\n // Only copy selected parts of the config to avoid overwriting\n // properties computed by the validation logic above.\n const notProps = [\"error\", \"state\", \"base_url\"];\n for (const prop of Object.keys(wellknown[k]!)) {\n if (notProps.includes(prop)) continue;\n type Prop = Exclude<keyof IWellKnownConfig, \"error\" | \"state\" | \"base_url\">;\n // @ts-ignore - ts gets unhappy as we're mixing types here\n clientConfig[k][prop as Prop] = wellknown[k]![prop as Prop];\n }\n } else {\n // Just copy the whole thing over otherwise\n clientConfig[k] = wellknown[k];\n }\n });\n\n const authConfig = await this.discoverAndValidateAuthenticationConfig(wellknown);\n clientConfig[M_AUTHENTICATION.stable!] = authConfig;\n\n // Step 8: Give the config to the caller (finally)\n return Promise.resolve(clientConfig);\n }\n\n /**\n * Validate delegated auth configuration\n * @deprecated use discoverAndValidateAuthenticationConfig\n * - m.authentication config is present and valid\n * - delegated auth issuer openid-configuration is reachable\n * - delegated auth issuer openid-configuration is configured correctly for us\n * When successful, DelegatedAuthConfig will be returned with endpoints used for delegated auth\n * Any errors are caught, and AutoDiscoveryState returned with error\n * @param wellKnown - configuration object as returned\n * by the .well-known auto-discovery endpoint\n * @returns Config or failure result\n */\n public static async validateDiscoveryAuthenticationConfig(\n wellKnown: IClientWellKnown,\n ): Promise<DelegatedAuthConfig | AutoDiscoveryState> {\n try {\n const authentication = M_AUTHENTICATION.findIn<IDelegatedAuthConfig>(wellKnown) || undefined;\n const homeserverAuthenticationConfig = validateWellKnownAuthentication(authentication);\n\n const issuerOpenIdConfigUrl = `${this.sanitizeWellKnownUrl(\n homeserverAuthenticationConfig.issuer,\n )}/.well-known/openid-configuration`;\n const issuerWellKnown = await this.fetchWellKnownObject<unknown>(issuerOpenIdConfigUrl);\n\n if (issuerWellKnown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Failed to fetch issuer openid configuration\");\n throw new Error(OidcError.General);\n }\n\n const validatedIssuerConfig = validateOIDCIssuerWellKnown(issuerWellKnown.raw);\n\n const delegatedAuthConfig: DelegatedAuthConfig = {\n state: AutoDiscoveryAction.SUCCESS,\n error: null,\n ...homeserverAuthenticationConfig,\n ...validatedIssuerConfig,\n };\n return delegatedAuthConfig;\n } catch (error) {\n const errorMessage = (error as Error).message as unknown as OidcError;\n const errorType = Object.values(OidcError).includes(errorMessage) ? errorMessage : OidcError.General;\n\n const state =\n errorType === OidcError.NotSupported ? AutoDiscoveryAction.IGNORE : AutoDiscoveryAction.FAIL_ERROR;\n\n return {\n state,\n error: errorType,\n };\n }\n }\n\n /**\n * Validate delegated auth configuration\n * - m.authentication config is present and valid\n * - delegated auth issuer openid-configuration is reachable\n * - delegated auth issuer openid-configuration is configured correctly for us\n * When successful, validated authentication metadata and optionally signing keys will be returned\n * Any errors are caught, and AutoDiscoveryState returned with error\n * @param wellKnown - configuration object as returned\n * by the .well-known auto-discovery endpoint\n * @returns Config or failure result\n */\n public static async discoverAndValidateAuthenticationConfig(\n wellKnown: IClientWellKnown,\n ): Promise<(OidcClientConfig & AutoDiscoveryState) | AutoDiscoveryState> {\n try {\n const authentication = M_AUTHENTICATION.findIn<IDelegatedAuthConfig>(wellKnown) || undefined;\n const result = await discoverAndValidateAuthenticationConfig(authentication);\n\n // include this for backwards compatibility\n const validatedIssuerConfig = validateOIDCIssuerWellKnown(result.metadata);\n\n const response = {\n state: AutoDiscoveryAction.SUCCESS,\n error: null,\n ...validatedIssuerConfig,\n ...result,\n };\n return response;\n } catch (error) {\n const errorMessage = (error as Error).message as unknown as OidcError;\n const errorType = Object.values(OidcError).includes(errorMessage) ? errorMessage : OidcError.General;\n\n const state =\n errorType === OidcError.NotSupported ? AutoDiscoveryAction.IGNORE : AutoDiscoveryAction.FAIL_ERROR;\n\n return {\n state,\n error: errorType,\n };\n }\n }\n\n /**\n * Attempts to automatically discover client configuration information\n * prior to logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be discovered, and will be transparently included in the\n * response object unaltered.\n * @param domain - The homeserver domain to perform discovery\n * on. For example, \"matrix.org\".\n * @returns Promise which resolves to the discovered\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when discovery fails.\n */\n public static async findClientConfig(domain: string): Promise<ClientConfig> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n // We use a .well-known lookup for all cases. According to the spec, we\n // can do other discovery mechanisms if we want such as custom lookups\n // however we won't bother with that here (mostly because the spec only\n // supports .well-known right now).\n //\n // By using .well-known, we need to ensure we at least pull out a URL\n // for the homeserver. We don't really need an identity server configuration\n // but will return one anyways (with state PROMPT) to make development\n // easier for clients. If we can't get a homeserver URL, all bets are\n // off on the rest of the config and we'll assume it is invalid too.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n // Step 1: Actually request the .well-known JSON file and make sure it\n // at least has a homeserver definition.\n const domainWithProtocol = domain.includes(\"://\") ? domain : `https://${domain}`;\n const wellknown = await this.fetchWellKnownObject(`${domainWithProtocol}/.well-known/matrix/client`);\n if (!wellknown || wellknown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"No response or error when parsing .well-known\");\n if (wellknown.reason) logger.error(wellknown.reason);\n if (wellknown.action === AutoDiscoveryAction.IGNORE) {\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n };\n } else {\n // this can only ever be FAIL_PROMPT at this point.\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n }\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Validate and parse the config\n return AutoDiscovery.fromDiscoveryConfig(wellknown.raw!);\n }\n\n /**\n * Gets the raw discovery client configuration for the given domain name.\n * Should only be used if there's no validation to be done on the resulting\n * object, otherwise use findClientConfig().\n * @param domain - The domain to get the client config for.\n * @returns Promise which resolves to the domain's client config. Can\n * be an empty object.\n */\n public static async getRawClientConfig(domain?: string): Promise<IClientWellKnown> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n const response = await this.fetchWellKnownObject(`https://${domain}/.well-known/matrix/client`);\n if (!response) return {};\n return response.raw ?? {};\n }\n\n /**\n * Sanitizes a given URL to ensure it is either an HTTP or HTTP URL and\n * is suitable for the requirements laid out by .well-known auto discovery.\n * If valid, the URL will also be stripped of any trailing slashes.\n * @param url - The potentially invalid URL to sanitize.\n * @returns The sanitized URL or a falsey value if the URL is invalid.\n * @internal\n */\n private static sanitizeWellKnownUrl(url?: string | null): string | false {\n if (!url) return false;\n\n try {\n let parsed: URL | undefined;\n try {\n parsed = new URL(url);\n } catch (e) {\n logger.error(\"Could not parse url\", e);\n }\n\n if (!parsed?.hostname) return false;\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false;\n\n const port = parsed.port ? `:${parsed.port}` : \"\";\n const path = parsed.pathname ? parsed.pathname : \"\";\n let saferUrl = `${parsed.protocol}//${parsed.hostname}${port}${path}`;\n if (saferUrl.endsWith(\"/\")) {\n saferUrl = saferUrl.substring(0, saferUrl.length - 1);\n }\n return saferUrl;\n } catch (e) {\n logger.error(e);\n return false;\n }\n }\n\n private static fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof global.fetch> {\n if (this.fetchFn) {\n return this.fetchFn(resource, options);\n }\n return global.fetch(resource, options);\n }\n\n private static fetchFn?: typeof global.fetch;\n\n public static setFetchFn(fetchFn: typeof global.fetch): void {\n AutoDiscovery.fetchFn = fetchFn;\n }\n\n /**\n * Fetches a JSON object from a given URL, as expected by all .well-known\n * related lookups. If the server gives a 404 then the `action` will be\n * IGNORE. If the server returns something that isn't JSON, the `action`\n * will be FAIL_PROMPT. For any other failure the `action` will be FAIL_PROMPT.\n *\n * The returned object will be a result of the call in object form with\n * the following properties:\n * raw: The JSON object returned by the server.\n * action: One of SUCCESS, IGNORE, or FAIL_PROMPT.\n * reason: Relatively human-readable description of what went wrong.\n * error: The actual Error, if one exists.\n * @param url - The URL to fetch a JSON object from.\n * @returns Promise which resolves to the returned state.\n * @internal\n */\n private static async fetchWellKnownObject<T = IWellKnownConfig>(\n url: string,\n ): Promise<IWellKnownConfig<Partial<T>>> {\n let response: Response;\n\n try {\n response = await AutoDiscovery.fetch(url, {\n method: Method.Get,\n signal: timeoutSignal(5000),\n });\n\n if (response.status === 404) {\n return {\n raw: {},\n action: AutoDiscoveryAction.IGNORE,\n reason: AutoDiscovery.ERROR_MISSING_WELLKNOWN,\n };\n }\n\n if (!response.ok) {\n return {\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: \"General failure\",\n };\n }\n } catch (err) {\n const error = err as AutoDiscoveryError | string | undefined;\n let reason = \"\";\n if (typeof error === \"object\") {\n reason = (<Error>error)?.message;\n }\n\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: reason || \"General failure\",\n };\n }\n\n try {\n return {\n raw: await response.json(),\n action: AutoDiscoveryAction.SUCCESS,\n };\n } catch (err) {\n const error = err as Error;\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_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5EO,aAAa,gBA0BczB,MAAM,CAACD,IAAI,CAACyB,kBAAkB,CAAC;AAEnE;AACJ;AACA;AACA;AAHI,IAAAP,gBAAA,CAAAC,OAAA,EA5BSO,aAAa,gBAgCcH,mBAAmB,CAACS,UAAU;AAElE;AACJ;AACA;AACA;AACA;AACA;AACA;AANI,IAAAd,gBAAA,CAAAC,OAAA,EAlCSO,aAAa,iBAyCeH,mBAAmB,CAACe,WAAW;AAEpE;AACJ;AACA;AACA;AACA;AAJI,IAAApB,gBAAA,CAAAC,OAAA,EA3CSO,aAAa,YAgDUH,mBAAmB,CAACa,MAAM;AAE1D;AACJ;AACA;AAFI,IAAAlB,gBAAA,CAAAC,OAAA,EAlDSO,aAAa,aAqDWH,mBAAmB,CAAC8B,OAAO;AAAA,IAAAnC,gBAAA,CAAAC,OAAA,EArDnDO,aAAa"}
package/lib/client.d.ts CHANGED
@@ -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, IAddThreePidBody, KnockRoomOpts } from "./@types/requests";
40
+ import { IAddThreePidOnlyBody, IBindThreePidBody, ICreateRoomOpts, IEventSearchOpts, IGuestAccessOpts, IJoinRoomOpts, IPaginateOpts, IPresenceOpts, IRedactOpts, IRelationsRequestOpts, IRelationsResponse, IRoomDirectoryOptions, ISearchOpts, ISendEventResponse, ITagsResponse, IStatusResponse, KnockRoomOpts } from "./@types/requests";
41
41
  import { EventType, RelationType, RoomType } from "./@types/event";
42
42
  import { IdServerUnbindResult, IImageInfo, Preset, Visibility } from "./@types/partials";
43
43
  import { EventMapper, MapperOpts } from "./event-mapper";
@@ -1263,6 +1263,8 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
1263
1263
  *
1264
1264
  * @returns resolves to a VerificationRequest
1265
1265
  * when the request has been sent to the other party.
1266
+ *
1267
+ * @deprecated Prefer {@link CryptoApi.requestVerificationDM}.
1266
1268
  */
1267
1269
  requestVerificationDM(userId: string, roomId: string): Promise<VerificationRequest>;
1268
1270
  /**
@@ -1772,6 +1774,8 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
1772
1774
  * getKeyBackupVersion) in backupInfo and
1773
1775
  * trust information (as returned by isKeyBackupTrusted)
1774
1776
  * in trustInfo.
1777
+ *
1778
+ * @deprecated Prefer {@link CryptoApi.checkKeyBackupAndEnable}.
1775
1779
  */
1776
1780
  checkKeyBackup(): Promise<IKeyBackupCheck | null>;
1777
1781
  /**
@@ -1803,6 +1807,8 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
1803
1807
  *
1804
1808
  * @param info - Backup information object as returned by getKeyBackupVersion
1805
1809
  * @returns Promise which resolves when complete.
1810
+ *
1811
+ * @deprecated Do not call this directly. Instead call {@link CryptoApi.checkKeyBackupAndEnable}.
1806
1812
  */
1807
1813
  enableKeyBackup(info: IKeyBackupInfo): Promise<void>;
1808
1814
  /**
@@ -2831,31 +2837,6 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
2831
2837
  * @returns Whether it is supported
2832
2838
  */
2833
2839
  isVersionSupported(version: string): Promise<boolean>;
2834
- /**
2835
- * Query the server to see if it supports members lazy loading
2836
- * @returns true if server supports lazy loading
2837
- */
2838
- doesServerSupportLazyLoading(): Promise<boolean>;
2839
- /**
2840
- * Query the server to see if the `id_server` parameter is required
2841
- * when registering with an 3pid, adding a 3pid or resetting password.
2842
- * @returns true if id_server parameter is required
2843
- */
2844
- doesServerRequireIdServerParam(): Promise<boolean>;
2845
- /**
2846
- * Query the server to see if the `id_access_token` parameter can be safely
2847
- * passed to the homeserver. Some homeservers may trigger errors if they are not
2848
- * prepared for the new parameter.
2849
- * @returns true if id_access_token can be sent
2850
- */
2851
- doesServerAcceptIdentityAccessToken(): Promise<boolean>;
2852
- /**
2853
- * Query the server to see if it supports separate 3PID add and bind functions.
2854
- * This affects the sequence of API calls clients should use for these operations,
2855
- * so it's helpful to be able to check for support.
2856
- * @returns true if separate functions are supported
2857
- */
2858
- doesServerSupportSeparateAddAndBind(): Promise<boolean>;
2859
2840
  /**
2860
2841
  * Query the server to see if it lists support for an unstable feature
2861
2842
  * in the /versions response
@@ -2876,11 +2857,6 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
2876
2857
  list: FeatureSupport;
2877
2858
  fwdPagination: FeatureSupport;
2878
2859
  }>;
2879
- /**
2880
- * Query the server to see if it supports the MSC2457 `logout_devices` parameter when setting password
2881
- * @returns true if server supports the `logout_devices` parameter
2882
- */
2883
- doesServerSupportLogoutDevices(): Promise<boolean>;
2884
2860
  /**
2885
2861
  * Get if lazy loading members is being used.
2886
2862
  * @returns Whether or not members are lazy loaded by this client
@@ -3051,13 +3027,6 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
3051
3027
  * @returns Rejects: with an error response.
3052
3028
  */
3053
3029
  loginWithPassword(user: string, password: string): Promise<LoginResponse>;
3054
- /**
3055
- * @param relayState - URL Callback after SAML2 Authentication
3056
- * @returns Promise which resolves to a LoginResponse object
3057
- * @returns Rejects: with an error response.
3058
- * @deprecated this isn't in the Matrix spec anymore
3059
- */
3060
- loginWithSAML2(relayState: string): Promise<LoginResponse>;
3061
3030
  /**
3062
3031
  * @param redirectUrl - The URL to redirect to after the HS
3063
3032
  * authenticates with CAS.
@@ -3292,19 +3261,6 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
3292
3261
  * @returns Rejects: with an error response.
3293
3262
  */
3294
3263
  setRoomDirectoryVisibility(roomId: string, visibility: Visibility): Promise<{}>;
3295
- /**
3296
- * Set the visbility of a room bridged to a 3rd party network in
3297
- * the current HS's room directory.
3298
- * @param networkId - the network ID of the 3rd party
3299
- * instance under which this room is published under.
3300
- * @param visibility - "public" to make the room visible
3301
- * in the public directory, or "private" to make
3302
- * it invisible.
3303
- * @returns Promise which resolves: result object
3304
- * @returns Rejects: with an error response.
3305
- * @deprecated missing from the spec
3306
- */
3307
- setRoomDirectoryVisibilityAppService(networkId: string, roomId: string, visibility: "public" | "private"): Promise<any>;
3308
3264
  /**
3309
3265
  * Query the user directory with a term matching user IDs, display names and domains.
3310
3266
  * @param term - the term with which to search.
@@ -3362,25 +3318,10 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
3362
3318
  getThreePids(): Promise<{
3363
3319
  threepids: IThreepid[];
3364
3320
  }>;
3365
- /**
3366
- * Add a 3PID to your homeserver account and optionally bind it to an identity
3367
- * server as well. An identity server is required as part of the `creds` object.
3368
- *
3369
- * @deprecated this API is deprecated, and you should instead use `addThreePidOnly` for homeservers that support it.
3370
- *
3371
- * @returns Promise which resolves: on success
3372
- * @returns Rejects: with an error response.
3373
- */
3374
- addThreePid(creds: IAddThreePidBody, bind: boolean): Promise<{
3375
- submit_url?: string;
3376
- }>;
3377
3321
  /**
3378
3322
  * Add a 3PID to your homeserver account. This API does not use an identity
3379
3323
  * server, as the homeserver is expected to handle 3PID ownership validation.
3380
3324
  *
3381
- * You can check whether a homeserver supports this API via
3382
- * `doesServerSupportSeparateAddAndBind`.
3383
- *
3384
3325
  * @param data - A object with 3PID validation data from having called
3385
3326
  * `account/3pid/<medium>/requestToken` on the homeserver.
3386
3327
  * @returns Promise which resolves: to an empty object `{}`
@@ -3392,9 +3333,6 @@ export declare class MatrixClient extends TypedEventEmitter<EmittedEvents, Clien
3392
3333
  * identity server handles 3PID ownership validation and the homeserver records
3393
3334
  * the new binding to track where all 3PIDs for the account are bound.
3394
3335
  *
3395
- * You can check whether a homeserver supports this API via
3396
- * `doesServerSupportSeparateAddAndBind`.
3397
- *
3398
3336
  * @param data - A object with 3PID validation data from having called
3399
3337
  * `validate/<medium>/requestToken` on the identity server. It should also
3400
3338
  * contain `id_server` and `id_access_token` fields as well.