@jeongsu816/matrix-bot-sdk 0.0.0-stage → 0.8.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.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/lib/AdminApis.d.ts +52 -0
- package/lib/AdminApis.js +29 -0
- package/lib/AdminApis.js.map +1 -0
- package/lib/DMs.d.ts +48 -0
- package/lib/DMs.js +160 -0
- package/lib/DMs.js.map +1 -0
- package/lib/IFilter.d.ts +7 -0
- package/lib/IFilter.js +3 -0
- package/lib/IFilter.js.map +1 -0
- package/lib/MatrixAuth.d.ts +45 -0
- package/lib/MatrixAuth.js +125 -0
- package/lib/MatrixAuth.js.map +1 -0
- package/lib/MatrixClient.d.ts +834 -0
- package/lib/MatrixClient.js +2268 -0
- package/lib/MatrixClient.js.map +1 -0
- package/lib/PantalaimonClient.d.ts +42 -0
- package/lib/PantalaimonClient.js +44 -0
- package/lib/PantalaimonClient.js.map +1 -0
- package/lib/SynapseAdminApis.d.ts +350 -0
- package/lib/SynapseAdminApis.js +244 -0
- package/lib/SynapseAdminApis.js.map +1 -0
- package/lib/SynchronousMatrixClient.d.ts +82 -0
- package/lib/SynchronousMatrixClient.js +130 -0
- package/lib/SynchronousMatrixClient.js.map +1 -0
- package/lib/UnstableApis.d.ts +43 -0
- package/lib/UnstableApis.js +74 -0
- package/lib/UnstableApis.js.map +1 -0
- package/lib/appservice/Appservice.d.ts +328 -0
- package/lib/appservice/Appservice.js +803 -0
- package/lib/appservice/Appservice.js.map +1 -0
- package/lib/appservice/Intent.d.ts +113 -0
- package/lib/appservice/Intent.js +363 -0
- package/lib/appservice/Intent.js.map +1 -0
- package/lib/appservice/MatrixBridge.d.ts +85 -0
- package/lib/appservice/MatrixBridge.js +111 -0
- package/lib/appservice/MatrixBridge.js.map +1 -0
- package/lib/appservice/UnstableAppserviceApis.d.ts +41 -0
- package/lib/appservice/UnstableAppserviceApis.js +62 -0
- package/lib/appservice/UnstableAppserviceApis.js.map +1 -0
- package/lib/appservice/http_responses.d.ts +77 -0
- package/lib/appservice/http_responses.js +3 -0
- package/lib/appservice/http_responses.js.map +1 -0
- package/lib/b64.d.ts +42 -0
- package/lib/b64.js +68 -0
- package/lib/b64.js.map +1 -0
- package/lib/e2ee/CrossSigningBootstrap.d.ts +73 -0
- package/lib/e2ee/CrossSigningBootstrap.js +86 -0
- package/lib/e2ee/CrossSigningBootstrap.js.map +1 -0
- package/lib/e2ee/CryptoClient.d.ts +163 -0
- package/lib/e2ee/CryptoClient.js +382 -0
- package/lib/e2ee/CryptoClient.js.map +1 -0
- package/lib/e2ee/ICryptoRoomInformation.d.ts +8 -0
- package/lib/e2ee/ICryptoRoomInformation.js +3 -0
- package/lib/e2ee/ICryptoRoomInformation.js.map +1 -0
- package/lib/e2ee/RoomTracker.d.ts +41 -0
- package/lib/e2ee/RoomTracker.js +96 -0
- package/lib/e2ee/RoomTracker.js.map +1 -0
- package/lib/e2ee/RustEngine.d.ts +149 -0
- package/lib/e2ee/RustEngine.js +467 -0
- package/lib/e2ee/RustEngine.js.map +1 -0
- package/lib/e2ee/decorators.d.ts +10 -0
- package/lib/e2ee/decorators.js +37 -0
- package/lib/e2ee/decorators.js.map +1 -0
- package/lib/helpers/MatrixEntity.d.ts +37 -0
- package/lib/helpers/MatrixEntity.js +67 -0
- package/lib/helpers/MatrixEntity.js.map +1 -0
- package/lib/helpers/MatrixGlob.d.ts +22 -0
- package/lib/helpers/MatrixGlob.js +35 -0
- package/lib/helpers/MatrixGlob.js.map +1 -0
- package/lib/helpers/MentionPill.d.ts +40 -0
- package/lib/helpers/MentionPill.js +91 -0
- package/lib/helpers/MentionPill.js.map +1 -0
- package/lib/helpers/Permalinks.d.ts +58 -0
- package/lib/helpers/Permalinks.js +73 -0
- package/lib/helpers/Permalinks.js.map +1 -0
- package/lib/helpers/ProfileCache.d.ts +48 -0
- package/lib/helpers/ProfileCache.js +114 -0
- package/lib/helpers/ProfileCache.js.map +1 -0
- package/lib/helpers/RichReply.d.ts +17 -0
- package/lib/helpers/RichReply.js +47 -0
- package/lib/helpers/RichReply.js.map +1 -0
- package/lib/helpers/UnpaddedBase64.d.ts +31 -0
- package/lib/helpers/UnpaddedBase64.js +45 -0
- package/lib/helpers/UnpaddedBase64.js.map +1 -0
- package/lib/http.d.ts +17 -0
- package/lib/http.js +147 -0
- package/lib/http.js.map +1 -0
- package/lib/identity/IdentityClient.d.ts +93 -0
- package/lib/identity/IdentityClient.js +248 -0
- package/lib/identity/IdentityClient.js.map +1 -0
- package/lib/index.d.ts +91 -0
- package/lib/index.js +125 -0
- package/lib/index.js.map +1 -0
- package/lib/logging/ConsoleLogger.d.ts +12 -0
- package/lib/logging/ConsoleLogger.js +28 -0
- package/lib/logging/ConsoleLogger.js.map +1 -0
- package/lib/logging/ILogger.d.ts +36 -0
- package/lib/logging/ILogger.js +3 -0
- package/lib/logging/ILogger.js.map +1 -0
- package/lib/logging/LogService.d.ts +100 -0
- package/lib/logging/LogService.js +169 -0
- package/lib/logging/LogService.js.map +1 -0
- package/lib/logging/RichConsoleLogger.d.ts +20 -0
- package/lib/logging/RichConsoleLogger.js +41 -0
- package/lib/logging/RichConsoleLogger.js.map +1 -0
- package/lib/metrics/IMetricListener.d.ts +52 -0
- package/lib/metrics/IMetricListener.js +3 -0
- package/lib/metrics/IMetricListener.js.map +1 -0
- package/lib/metrics/Metrics.d.ts +66 -0
- package/lib/metrics/Metrics.js +128 -0
- package/lib/metrics/Metrics.js.map +1 -0
- package/lib/metrics/contexts.d.ts +51 -0
- package/lib/metrics/contexts.js +3 -0
- package/lib/metrics/contexts.js.map +1 -0
- package/lib/metrics/decorators.d.ts +15 -0
- package/lib/metrics/decorators.js +92 -0
- package/lib/metrics/decorators.js.map +1 -0
- package/lib/metrics/names.d.ts +45 -0
- package/lib/metrics/names.js +49 -0
- package/lib/metrics/names.js.map +1 -0
- package/lib/mixins/AutojoinRoomsMixin.d.ts +10 -0
- package/lib/mixins/AutojoinRoomsMixin.js +25 -0
- package/lib/mixins/AutojoinRoomsMixin.js.map +1 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.d.ts +10 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.js +40 -0
- package/lib/mixins/AutojoinUpgradedRoomsMixin.js.map +1 -0
- package/lib/models/Account.d.ts +8 -0
- package/lib/models/Account.js +3 -0
- package/lib/models/Account.js.map +1 -0
- package/lib/models/CreateRoom.d.ts +125 -0
- package/lib/models/CreateRoom.js +3 -0
- package/lib/models/CreateRoom.js.map +1 -0
- package/lib/models/Crypto.d.ts +167 -0
- package/lib/models/Crypto.js +31 -0
- package/lib/models/Crypto.js.map +1 -0
- package/lib/models/EventContext.d.ts +19 -0
- package/lib/models/EventContext.js +3 -0
- package/lib/models/EventContext.js.map +1 -0
- package/lib/models/IdentityServerModels.d.ts +20 -0
- package/lib/models/IdentityServerModels.js +3 -0
- package/lib/models/IdentityServerModels.js.map +1 -0
- package/lib/models/MSC2176.d.ts +42 -0
- package/lib/models/MSC2176.js +3 -0
- package/lib/models/MSC2176.js.map +1 -0
- package/lib/models/MatrixError.d.ts +38 -0
- package/lib/models/MatrixError.js +30 -0
- package/lib/models/MatrixError.js.map +1 -0
- package/lib/models/MatrixProfile.d.ts +43 -0
- package/lib/models/MatrixProfile.js +43 -0
- package/lib/models/MatrixProfile.js.map +1 -0
- package/lib/models/OpenIDConnect.d.ts +10 -0
- package/lib/models/OpenIDConnect.js +3 -0
- package/lib/models/OpenIDConnect.js.map +1 -0
- package/lib/models/Policies.d.ts +25 -0
- package/lib/models/Policies.js +3 -0
- package/lib/models/Policies.js.map +1 -0
- package/lib/models/PowerLevelAction.d.ts +27 -0
- package/lib/models/PowerLevelAction.js +32 -0
- package/lib/models/PowerLevelAction.js.map +1 -0
- package/lib/models/PowerLevelBounds.d.ts +15 -0
- package/lib/models/PowerLevelBounds.js +3 -0
- package/lib/models/PowerLevelBounds.js.map +1 -0
- package/lib/models/Presence.d.ts +25 -0
- package/lib/models/Presence.js +38 -0
- package/lib/models/Presence.js.map +1 -0
- package/lib/models/ServerVersions.d.ts +8 -0
- package/lib/models/ServerVersions.js +3 -0
- package/lib/models/ServerVersions.js.map +1 -0
- package/lib/models/Spaces.d.ts +116 -0
- package/lib/models/Spaces.js +91 -0
- package/lib/models/Spaces.js.map +1 -0
- package/lib/models/Threepid.d.ts +8 -0
- package/lib/models/Threepid.js +3 -0
- package/lib/models/Threepid.js.map +1 -0
- package/lib/models/events/AliasesEvent.d.ts +27 -0
- package/lib/models/events/AliasesEvent.js +27 -0
- package/lib/models/events/AliasesEvent.js.map +1 -0
- package/lib/models/events/CanonicalAliasEvent.d.ts +23 -0
- package/lib/models/events/CanonicalAliasEvent.js +21 -0
- package/lib/models/events/CanonicalAliasEvent.js.map +1 -0
- package/lib/models/events/CreateEvent.d.ts +63 -0
- package/lib/models/events/CreateEvent.js +33 -0
- package/lib/models/events/CreateEvent.js.map +1 -0
- package/lib/models/events/EncryptedRoomEvent.d.ts +42 -0
- package/lib/models/events/EncryptedRoomEvent.js +28 -0
- package/lib/models/events/EncryptedRoomEvent.js.map +1 -0
- package/lib/models/events/EncryptionEvent.d.ts +47 -0
- package/lib/models/events/EncryptionEvent.js +42 -0
- package/lib/models/events/EncryptionEvent.js.map +1 -0
- package/lib/models/events/Event.d.ts +26 -0
- package/lib/models/events/Event.js +40 -0
- package/lib/models/events/Event.js.map +1 -0
- package/lib/models/events/EventKind.d.ts +15 -0
- package/lib/models/events/EventKind.js +20 -0
- package/lib/models/events/EventKind.js.map +1 -0
- package/lib/models/events/InvalidEventError.d.ts +14 -0
- package/lib/models/events/InvalidEventError.js +24 -0
- package/lib/models/events/InvalidEventError.js.map +1 -0
- package/lib/models/events/JoinRulesEvent.d.ts +29 -0
- package/lib/models/events/JoinRulesEvent.js +21 -0
- package/lib/models/events/JoinRulesEvent.js.map +1 -0
- package/lib/models/events/MembershipEvent.d.ts +54 -0
- package/lib/models/events/MembershipEvent.js +49 -0
- package/lib/models/events/MembershipEvent.js.map +1 -0
- package/lib/models/events/MessageEvent.d.ts +233 -0
- package/lib/models/events/MessageEvent.js +49 -0
- package/lib/models/events/MessageEvent.js.map +1 -0
- package/lib/models/events/PinnedEventsEvent.d.ts +23 -0
- package/lib/models/events/PinnedEventsEvent.js +21 -0
- package/lib/models/events/PinnedEventsEvent.js.map +1 -0
- package/lib/models/events/PowerLevelsEvent.d.ts +96 -0
- package/lib/models/events/PowerLevelsEvent.js +70 -0
- package/lib/models/events/PowerLevelsEvent.js.map +1 -0
- package/lib/models/events/PresenceEvent.d.ts +56 -0
- package/lib/models/events/PresenceEvent.js +21 -0
- package/lib/models/events/PresenceEvent.js.map +1 -0
- package/lib/models/events/RedactionEvent.d.ts +28 -0
- package/lib/models/events/RedactionEvent.js +36 -0
- package/lib/models/events/RedactionEvent.js.map +1 -0
- package/lib/models/events/RoomAvatarEvent.d.ts +28 -0
- package/lib/models/events/RoomAvatarEvent.js +21 -0
- package/lib/models/events/RoomAvatarEvent.js.map +1 -0
- package/lib/models/events/RoomEvent.d.ts +58 -0
- package/lib/models/events/RoomEvent.js +57 -0
- package/lib/models/events/RoomEvent.js.map +1 -0
- package/lib/models/events/RoomNameEvent.d.ts +20 -0
- package/lib/models/events/RoomNameEvent.js +21 -0
- package/lib/models/events/RoomNameEvent.js.map +1 -0
- package/lib/models/events/RoomTopicEvent.d.ts +20 -0
- package/lib/models/events/RoomTopicEvent.js +21 -0
- package/lib/models/events/RoomTopicEvent.js.map +1 -0
- package/lib/models/events/SpaceChildEvent.d.ts +53 -0
- package/lib/models/events/SpaceChildEvent.js +49 -0
- package/lib/models/events/SpaceChildEvent.js.map +1 -0
- package/lib/models/events/converter.d.ts +8 -0
- package/lib/models/events/converter.js +50 -0
- package/lib/models/events/converter.js.map +1 -0
- package/lib/models/unstable/MediaInfo.d.ts +16 -0
- package/lib/models/unstable/MediaInfo.js +3 -0
- package/lib/models/unstable/MediaInfo.js.map +1 -0
- package/lib/preprocessors/IPreprocessor.d.ts +22 -0
- package/lib/preprocessors/IPreprocessor.js +3 -0
- package/lib/preprocessors/IPreprocessor.js.map +1 -0
- package/lib/preprocessors/RichRepliesPreprocessor.d.ts +67 -0
- package/lib/preprocessors/RichRepliesPreprocessor.js +112 -0
- package/lib/preprocessors/RichRepliesPreprocessor.js.map +1 -0
- package/lib/request.d.ts +13 -0
- package/lib/request.js +23 -0
- package/lib/request.js.map +1 -0
- package/lib/simple-validation.d.ts +10 -0
- package/lib/simple-validation.js +30 -0
- package/lib/simple-validation.js.map +1 -0
- package/lib/storage/IAppserviceStorageProvider.d.ts +48 -0
- package/lib/storage/IAppserviceStorageProvider.js +3 -0
- package/lib/storage/IAppserviceStorageProvider.js.map +1 -0
- package/lib/storage/ICryptoStorageProvider.d.ts +32 -0
- package/lib/storage/ICryptoStorageProvider.js +3 -0
- package/lib/storage/ICryptoStorageProvider.js.map +1 -0
- package/lib/storage/IStorageProvider.d.ts +47 -0
- package/lib/storage/IStorageProvider.js +3 -0
- package/lib/storage/IStorageProvider.js.map +1 -0
- package/lib/storage/MemoryStorageProvider.d.ts +26 -0
- package/lib/storage/MemoryStorageProvider.js +55 -0
- package/lib/storage/MemoryStorageProvider.js.map +1 -0
- package/lib/storage/RustSdkCryptoStorageProvider.d.ts +38 -0
- package/lib/storage/RustSdkCryptoStorageProvider.js +69 -0
- package/lib/storage/RustSdkCryptoStorageProvider.js.map +1 -0
- package/lib/storage/SimpleFsStorageProvider.d.ts +31 -0
- package/lib/storage/SimpleFsStorageProvider.js +122 -0
- package/lib/storage/SimpleFsStorageProvider.js.map +1 -0
- package/lib/storage/SimplePostgresStorageProvider.d.ts +32 -0
- package/lib/storage/SimplePostgresStorageProvider.js +148 -0
- package/lib/storage/SimplePostgresStorageProvider.js.map +1 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.d.ts +14 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.js +54 -0
- package/lib/strategies/AppserviceJoinRoomStrategy.js.map +1 -0
- package/lib/strategies/JoinRoomStrategy.d.ts +11 -0
- package/lib/strategies/JoinRoomStrategy.js +44 -0
- package/lib/strategies/JoinRoomStrategy.js.map +1 -0
- package/package.json +136 -4
- package/src/AdminApis.ts +60 -0
- package/src/DMs.ts +164 -0
- package/src/IFilter.ts +7 -0
- package/src/MatrixAuth.ts +129 -0
- package/src/MatrixClient.ts +2046 -0
- package/src/PantalaimonClient.ts +62 -0
- package/src/SynapseAdminApis.ts +482 -0
- package/src/SynchronousMatrixClient.ts +129 -0
- package/src/UnstableApis.ts +75 -0
- package/src/appservice/Appservice.ts +1089 -0
- package/src/appservice/Intent.ts +342 -0
- package/src/appservice/MatrixBridge.ts +139 -0
- package/src/appservice/UnstableAppserviceApis.ts +63 -0
- package/src/appservice/http_responses.ts +77 -0
- package/src/b64.ts +63 -0
- package/src/e2ee/CrossSigningBootstrap.ts +141 -0
- package/src/e2ee/CryptoClient.ts +378 -0
- package/src/e2ee/ICryptoRoomInformation.ts +9 -0
- package/src/e2ee/RoomTracker.ts +99 -0
- package/src/e2ee/RustEngine.ts +580 -0
- package/src/e2ee/decorators.ts +38 -0
- package/src/helpers/MatrixEntity.ts +65 -0
- package/src/helpers/MatrixGlob.ts +38 -0
- package/src/helpers/MentionPill.ts +95 -0
- package/src/helpers/Permalinks.ts +101 -0
- package/src/helpers/ProfileCache.ts +119 -0
- package/src/helpers/RichReply.ts +46 -0
- package/src/helpers/UnpaddedBase64.ts +44 -0
- package/src/http.ts +166 -0
- package/src/identity/IdentityClient.ts +225 -0
- package/src/index.ts +125 -0
- package/src/logging/ConsoleLogger.ts +31 -0
- package/src/logging/ILogger.ts +40 -0
- package/src/logging/LogService.ts +167 -0
- package/src/logging/RichConsoleLogger.ts +70 -0
- package/src/metrics/IMetricListener.ts +57 -0
- package/src/metrics/Metrics.ts +134 -0
- package/src/metrics/contexts.ts +56 -0
- package/src/metrics/decorators.ts +94 -0
- package/src/metrics/names.ts +53 -0
- package/src/mixins/AutojoinRoomsMixin.ts +24 -0
- package/src/mixins/AutojoinUpgradedRoomsMixin.ts +37 -0
- package/src/models/Account.ts +8 -0
- package/src/models/CreateRoom.ts +144 -0
- package/src/models/Crypto.ts +188 -0
- package/src/models/EventContext.ts +23 -0
- package/src/models/IdentityServerModels.ts +18 -0
- package/src/models/MSC2176.ts +47 -0
- package/src/models/MatrixError.ts +39 -0
- package/src/models/MatrixProfile.ts +55 -0
- package/src/models/OpenIDConnect.ts +10 -0
- package/src/models/Policies.ts +28 -0
- package/src/models/PowerLevelAction.ts +31 -0
- package/src/models/PowerLevelBounds.ts +16 -0
- package/src/models/Presence.ts +38 -0
- package/src/models/ServerVersions.ts +8 -0
- package/src/models/Spaces.ts +167 -0
- package/src/models/Threepid.ts +8 -0
- package/src/models/events/AliasesEvent.ts +37 -0
- package/src/models/events/CanonicalAliasEvent.ts +30 -0
- package/src/models/events/CreateEvent.ts +82 -0
- package/src/models/events/EncryptedRoomEvent.ts +58 -0
- package/src/models/events/EncryptionEvent.ts +63 -0
- package/src/models/events/Event.ts +38 -0
- package/src/models/events/EventKind.ts +16 -0
- package/src/models/events/InvalidEventError.ts +19 -0
- package/src/models/events/JoinRulesEvent.ts +37 -0
- package/src/models/events/MembershipEvent.ts +77 -0
- package/src/models/events/MessageEvent.ts +292 -0
- package/src/models/events/PinnedEventsEvent.ts +30 -0
- package/src/models/events/PowerLevelsEvent.ts +135 -0
- package/src/models/events/PresenceEvent.ts +69 -0
- package/src/models/events/RedactionEvent.ts +44 -0
- package/src/models/events/RoomAvatarEvent.ts +36 -0
- package/src/models/events/RoomEvent.ts +83 -0
- package/src/models/events/RoomNameEvent.ts +27 -0
- package/src/models/events/RoomTopicEvent.ts +27 -0
- package/src/models/events/SpaceChildEvent.ts +74 -0
- package/src/models/events/_MissingEvents.md +35 -0
- package/src/models/events/converter.ts +47 -0
- package/src/models/unstable/MediaInfo.ts +16 -0
- package/src/preprocessors/IPreprocessor.ts +24 -0
- package/src/preprocessors/RichRepliesPreprocessor.ts +159 -0
- package/src/request.ts +21 -0
- package/src/simple-validation.ts +30 -0
- package/src/storage/IAppserviceStorageProvider.ts +54 -0
- package/src/storage/ICryptoStorageProvider.ts +36 -0
- package/src/storage/IStorageProvider.ts +53 -0
- package/src/storage/MemoryStorageProvider.ts +65 -0
- package/src/storage/RustSdkCryptoStorageProvider.ts +81 -0
- package/src/storage/SimpleFsStorageProvider.ts +142 -0
- package/src/storage/SimplePostgresStorageProvider.ts +168 -0
- package/src/strategies/AppserviceJoinRoomStrategy.ts +47 -0
- package/src/strategies/JoinRoomStrategy.ts +45 -0
- package/tsconfig.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 - 2023 Travis Ralston
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# matrix-bot-sdk
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
> **This is a fork**, published as [`@jeongsu816/matrix-bot-sdk`](https://www.npmjs.com/package/@jeongsu816/matrix-bot-sdk).
|
|
4
|
+
> It is based on upstream [`turt2live/matrix-bot-sdk`](https://github.com/turt2live/matrix-bot-sdk) `main` and adds:
|
|
5
|
+
>
|
|
6
|
+
> - Cross-signing, secret storage (4S) and key backup from upstream PR
|
|
7
|
+
> [#396](https://github.com/turt2live/matrix-bot-sdk/pull/396), exposed as public `CryptoClient` methods.
|
|
8
|
+
> - Idempotent startup helpers: `client.crypto.ensureCrossSigning()` and `client.crypto.ensureSecretStorage()`.
|
|
9
|
+
> - `@matrix-org/matrix-sdk-crypto-nodejs` pinned to `0.6.1` (required for 4S).
|
|
10
|
+
> - Dependency security fixes: `request` replaced by `@cypress/request`, `sanitize-html` ≥ 2.18.1.
|
|
11
|
+
> Requires Node.js ≥ 22.12.
|
|
12
|
+
>
|
|
13
|
+
> ```ts
|
|
14
|
+
> import { passwordUiaCallback } from "@jeongsu816/matrix-bot-sdk";
|
|
15
|
+
>
|
|
16
|
+
> // "already-signed" | "restored" | "bootstrapped" | "skipped-no-auth"
|
|
17
|
+
> const result = await client.crypto.ensureCrossSigning({
|
|
18
|
+
> uiaCallback: password ? passwordUiaCallback(userId, password) : undefined,
|
|
19
|
+
> recoveryPassphrase,
|
|
20
|
+
> });
|
|
21
|
+
> if (recoveryPassphrase) {
|
|
22
|
+
> await client.crypto.ensureSecretStorage(recoveryPassphrase); // also sets up key backup
|
|
23
|
+
> }
|
|
24
|
+
> ```
|
|
25
|
+
>
|
|
26
|
+
> `ensureCrossSigning` creates a new identity (replacing the account's existing cross-signing keys) only when
|
|
27
|
+
> this device is not signed and the keys can't be restored from secret storage. Errors are thrown, so wrap it
|
|
28
|
+
> if cross-signing should not be fatal for your bot.
|
|
29
|
+
>
|
|
30
|
+
> The rest of this README is from upstream.
|
|
31
|
+
|
|
32
|
+
[](https://www.npmjs.com/package/matrix-bot-sdk)
|
|
33
|
+
|
|
34
|
+
TypeScript/JavaScript SDK for Matrix bots. For help and support, visit [#matrix-bot-sdk:t2bot.io](https://matrix.to/#/#matrix-bot-sdk:t2bot.io)
|
|
35
|
+
|
|
36
|
+
# Documentation
|
|
37
|
+
|
|
38
|
+
Documentation for the project is available [here](https://turt2live.github.io/matrix-bot-sdk/index.html).
|
|
39
|
+
|
|
40
|
+
# Matrix version support
|
|
41
|
+
|
|
42
|
+
The Matrix protocol is [versioned](https://spec.matrix.org/latest/#specification-versions) to ensure endpoints and
|
|
43
|
+
functionality can safely rotate in and out of the ecosystem. The bot-sdk will assume it is connected to a homeserver
|
|
44
|
+
with support for at least one of the last 2 versions, at the time of the bot-sdk's release. This means that if you
|
|
45
|
+
connect the bot-sdk to a homeserver which is 3 or more Matrix versions out of date, things might not work for you.
|
|
46
|
+
|
|
47
|
+
It is recommended to update the bot-sdk as frequently as spec releases themselves (or faster) to avoid this situation,
|
|
48
|
+
and watch the repo for updates in the event a release is delayed.
|
|
49
|
+
|
|
50
|
+
**Note**: Currently the bot-sdk does not throw an error if the server appears to be incompatible, however this might
|
|
51
|
+
change in the future.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { MatrixClient } from "./MatrixClient";
|
|
2
|
+
import { SynapseAdminApis } from "./SynapseAdminApis";
|
|
3
|
+
/**
|
|
4
|
+
* Whois information about a user.
|
|
5
|
+
* See https://matrix.org/docs/spec/client_server/r0.5.0#get-matrix-client-r0-admin-whois-userid for more information.
|
|
6
|
+
* @category Admin APIs
|
|
7
|
+
*/
|
|
8
|
+
export interface WhoisInfo {
|
|
9
|
+
user_id: string;
|
|
10
|
+
devices: {
|
|
11
|
+
[device_id: string]: {
|
|
12
|
+
sessions: [
|
|
13
|
+
{
|
|
14
|
+
connections: WhoisConnectionInfo[];
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface WhoisConnectionInfo {
|
|
21
|
+
/**
|
|
22
|
+
* Most recently seen IP address of the session.
|
|
23
|
+
*/
|
|
24
|
+
ip: string;
|
|
25
|
+
/**
|
|
26
|
+
* Unix timestamp that the session was last active.
|
|
27
|
+
*/
|
|
28
|
+
last_seen: number;
|
|
29
|
+
/**
|
|
30
|
+
* User agent string last seen in the session.
|
|
31
|
+
*/
|
|
32
|
+
user_agent: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Access to various administrative APIs.
|
|
36
|
+
* @category Admin APIs
|
|
37
|
+
*/
|
|
38
|
+
export declare class AdminApis {
|
|
39
|
+
private client;
|
|
40
|
+
constructor(client: MatrixClient);
|
|
41
|
+
/**
|
|
42
|
+
* Gets access to the Synapse administrative APIs object.
|
|
43
|
+
*/
|
|
44
|
+
get synapse(): SynapseAdminApis;
|
|
45
|
+
/**
|
|
46
|
+
* Gets information about a particular user.
|
|
47
|
+
* @param {string} userId the user ID to lookup
|
|
48
|
+
* @returns {Promise<WhoisInfo>} resolves to the whois information
|
|
49
|
+
*/
|
|
50
|
+
whoisUser(userId: string): Promise<WhoisInfo>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
package/lib/AdminApis.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminApis = void 0;
|
|
4
|
+
const SynapseAdminApis_1 = require("./SynapseAdminApis");
|
|
5
|
+
/**
|
|
6
|
+
* Access to various administrative APIs.
|
|
7
|
+
* @category Admin APIs
|
|
8
|
+
*/
|
|
9
|
+
class AdminApis {
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets access to the Synapse administrative APIs object.
|
|
15
|
+
*/
|
|
16
|
+
get synapse() {
|
|
17
|
+
return new SynapseAdminApis_1.SynapseAdminApis(this.client);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets information about a particular user.
|
|
21
|
+
* @param {string} userId the user ID to lookup
|
|
22
|
+
* @returns {Promise<WhoisInfo>} resolves to the whois information
|
|
23
|
+
*/
|
|
24
|
+
whoisUser(userId) {
|
|
25
|
+
return this.client.doRequest("GET", "/_matrix/client/v3/admin/whois/" + encodeURIComponent(userId));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AdminApis = AdminApis;
|
|
29
|
+
//# sourceMappingURL=AdminApis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminApis.js","sourceRoot":"","sources":["../src/AdminApis.ts"],"names":[],"mappings":";;;AACA,yDAAsD;AAmCtD;;;GAGG;AACH,MAAa,SAAS;IAClB,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IACxC,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,mCAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,iCAAiC,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxG,CAAC;CACJ;AAnBD,8BAmBC"}
|
package/lib/DMs.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MatrixClient } from "./MatrixClient";
|
|
2
|
+
/**
|
|
3
|
+
* Handles DM (direct messages) matching between users. Note that bots which
|
|
4
|
+
* existed prior to this might not have DM rooms populated correctly - the
|
|
5
|
+
* account data can be populated externally and that will be reflected here.
|
|
6
|
+
*
|
|
7
|
+
* Note that DM status is persisted across all access tokens for a user and
|
|
8
|
+
* is not persisted with the regular stores. The DM map is instead tracked
|
|
9
|
+
* on the homeserver as account data and thus survives the bot's own storage
|
|
10
|
+
* being wiped.
|
|
11
|
+
* @category Utilities
|
|
12
|
+
*/
|
|
13
|
+
export declare class DMs {
|
|
14
|
+
private client;
|
|
15
|
+
private cached;
|
|
16
|
+
private ready;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new DM map.
|
|
19
|
+
* @param {MatrixClient} client The client the DM map is for.
|
|
20
|
+
*/
|
|
21
|
+
constructor(client: MatrixClient);
|
|
22
|
+
private updateFromAccountData;
|
|
23
|
+
private handleInvite;
|
|
24
|
+
private persistCache;
|
|
25
|
+
private fixDms;
|
|
26
|
+
/**
|
|
27
|
+
* Forces an update of the DM cache.
|
|
28
|
+
* @returns {Promise<void>} Resolves when complete.
|
|
29
|
+
*/
|
|
30
|
+
update(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets or creates a DM with a given user. If a DM needs to be created, it will
|
|
33
|
+
* be created as an encrypted DM (if both the MatrixClient and target user support
|
|
34
|
+
* crypto). Otherwise, the createFn can be used to override the call. Note that
|
|
35
|
+
* when creating a DM room the room should have `is_direct: true` set.
|
|
36
|
+
* @param {string} userId The user ID to get/create a DM for.
|
|
37
|
+
* @param {Function} createFn Optional function to use to create the room. Resolves
|
|
38
|
+
* to the created room ID.
|
|
39
|
+
* @returns {Promise<string>} Resolves to the DM room ID.
|
|
40
|
+
*/
|
|
41
|
+
getOrCreateDm(userId: string, createFn?: (targetUserId: string) => Promise<string>): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Determines if a given room is a DM according to the cache.
|
|
44
|
+
* @param {string} roomId The room ID.
|
|
45
|
+
* @returns {boolean} True if the room ID is a cached DM room ID.
|
|
46
|
+
*/
|
|
47
|
+
isDm(roomId: string): boolean;
|
|
48
|
+
}
|
package/lib/DMs.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DMs = void 0;
|
|
4
|
+
const Crypto_1 = require("./models/Crypto");
|
|
5
|
+
const LogService_1 = require("./logging/LogService");
|
|
6
|
+
/**
|
|
7
|
+
* Handles DM (direct messages) matching between users. Note that bots which
|
|
8
|
+
* existed prior to this might not have DM rooms populated correctly - the
|
|
9
|
+
* account data can be populated externally and that will be reflected here.
|
|
10
|
+
*
|
|
11
|
+
* Note that DM status is persisted across all access tokens for a user and
|
|
12
|
+
* is not persisted with the regular stores. The DM map is instead tracked
|
|
13
|
+
* on the homeserver as account data and thus survives the bot's own storage
|
|
14
|
+
* being wiped.
|
|
15
|
+
* @category Utilities
|
|
16
|
+
*/
|
|
17
|
+
class DMs {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new DM map.
|
|
20
|
+
* @param {MatrixClient} client The client the DM map is for.
|
|
21
|
+
*/
|
|
22
|
+
constructor(client) {
|
|
23
|
+
this.client = client;
|
|
24
|
+
this.cached = new Map();
|
|
25
|
+
this.client.on("account_data", (ev) => {
|
|
26
|
+
if (ev['type'] !== 'm.direct')
|
|
27
|
+
return;
|
|
28
|
+
// noinspection JSIgnoredPromiseFromCall
|
|
29
|
+
this.updateFromAccountData();
|
|
30
|
+
});
|
|
31
|
+
this.client.on("room.invite", (rid, ev) => this.handleInvite(rid, ev));
|
|
32
|
+
}
|
|
33
|
+
async updateFromAccountData() {
|
|
34
|
+
// Don't trust the sync update
|
|
35
|
+
let map = {};
|
|
36
|
+
try {
|
|
37
|
+
map = await this.client.getAccountData("m.direct");
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e.body?.errcode !== "M_NOT_FOUND" && e.statusCode !== 404) {
|
|
41
|
+
LogService_1.LogService.warn("DMs", "Error getting m.direct account data: ", e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
this.cached = new Map();
|
|
45
|
+
for (const [userId, roomIds] of Object.entries(map)) {
|
|
46
|
+
this.cached.set(userId, roomIds);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async handleInvite(roomId, ev) {
|
|
50
|
+
if (ev['content']?.['is_direct'] === true) {
|
|
51
|
+
const userId = ev['sender'];
|
|
52
|
+
if (!this.cached.has(userId))
|
|
53
|
+
this.cached.set(userId, []);
|
|
54
|
+
this.cached.set(userId, [roomId, ...this.cached.get(userId)]);
|
|
55
|
+
await this.persistCache();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async persistCache() {
|
|
59
|
+
const obj = {};
|
|
60
|
+
for (const [uid, rids] of this.cached.entries()) {
|
|
61
|
+
obj[uid] = rids;
|
|
62
|
+
}
|
|
63
|
+
await this.client.setAccountData("m.direct", obj);
|
|
64
|
+
}
|
|
65
|
+
async fixDms(userId) {
|
|
66
|
+
const currentRooms = this.cached.get(userId);
|
|
67
|
+
if (!currentRooms)
|
|
68
|
+
return;
|
|
69
|
+
const toKeep = [];
|
|
70
|
+
for (const roomId of currentRooms) {
|
|
71
|
+
try {
|
|
72
|
+
const members = await this.client.getAllRoomMembers(roomId);
|
|
73
|
+
const joined = members.filter(m => m.effectiveMembership === "join" || m.effectiveMembership === "invite");
|
|
74
|
+
if (joined.some(m => m.membershipFor === userId)) {
|
|
75
|
+
toKeep.push(roomId);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
LogService_1.LogService.warn("DMs", `Unable to check ${roomId} for room members - assuming invalid DM`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (toKeep.length === currentRooms.length)
|
|
83
|
+
return; // no change
|
|
84
|
+
if (toKeep.length > 0) {
|
|
85
|
+
this.cached.set(userId, toKeep);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.cached.delete(userId);
|
|
89
|
+
}
|
|
90
|
+
await this.persistCache();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Forces an update of the DM cache.
|
|
94
|
+
* @returns {Promise<void>} Resolves when complete.
|
|
95
|
+
*/
|
|
96
|
+
async update() {
|
|
97
|
+
await this.ready; // finish the existing call if present
|
|
98
|
+
this.ready = this.updateFromAccountData();
|
|
99
|
+
return this.ready;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets or creates a DM with a given user. If a DM needs to be created, it will
|
|
103
|
+
* be created as an encrypted DM (if both the MatrixClient and target user support
|
|
104
|
+
* crypto). Otherwise, the createFn can be used to override the call. Note that
|
|
105
|
+
* when creating a DM room the room should have `is_direct: true` set.
|
|
106
|
+
* @param {string} userId The user ID to get/create a DM for.
|
|
107
|
+
* @param {Function} createFn Optional function to use to create the room. Resolves
|
|
108
|
+
* to the created room ID.
|
|
109
|
+
* @returns {Promise<string>} Resolves to the DM room ID.
|
|
110
|
+
*/
|
|
111
|
+
async getOrCreateDm(userId, createFn) {
|
|
112
|
+
await this.ready;
|
|
113
|
+
await this.fixDms(userId);
|
|
114
|
+
const rooms = this.cached.get(userId);
|
|
115
|
+
if (rooms?.length)
|
|
116
|
+
return rooms[0];
|
|
117
|
+
let roomId;
|
|
118
|
+
if (createFn) {
|
|
119
|
+
roomId = await createFn(userId);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
let hasKeys = false;
|
|
123
|
+
if (!!this.client.crypto) {
|
|
124
|
+
const keys = await this.client.getUserDevices([userId]);
|
|
125
|
+
const userKeys = keys?.device_keys?.[userId] ?? {};
|
|
126
|
+
hasKeys = Object.values(userKeys).filter(device => Object.values(device).length > 0).length > 0;
|
|
127
|
+
}
|
|
128
|
+
roomId = await this.client.createRoom({
|
|
129
|
+
invite: [userId],
|
|
130
|
+
is_direct: true,
|
|
131
|
+
preset: "trusted_private_chat",
|
|
132
|
+
initial_state: hasKeys ? [{
|
|
133
|
+
type: "m.room.encryption",
|
|
134
|
+
state_key: "",
|
|
135
|
+
content: { algorithm: Crypto_1.EncryptionAlgorithm.MegolmV1AesSha2 },
|
|
136
|
+
}] : [],
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (!this.cached.has(userId))
|
|
140
|
+
this.cached.set(userId, []);
|
|
141
|
+
this.cached.set(userId, [roomId, ...this.cached.get(userId)]);
|
|
142
|
+
await this.persistCache();
|
|
143
|
+
return roomId;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Determines if a given room is a DM according to the cache.
|
|
147
|
+
* @param {string} roomId The room ID.
|
|
148
|
+
* @returns {boolean} True if the room ID is a cached DM room ID.
|
|
149
|
+
*/
|
|
150
|
+
isDm(roomId) {
|
|
151
|
+
for (const val of this.cached.values()) {
|
|
152
|
+
if (val.includes(roomId)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.DMs = DMs;
|
|
160
|
+
//# sourceMappingURL=DMs.js.map
|
package/lib/DMs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DMs.js","sourceRoot":"","sources":["../src/DMs.ts"],"names":[],"mappings":";;;AACA,4CAAsD;AACtD,qDAAkD;AAElD;;;;;;;;;;GAUG;AACH,MAAa,GAAG;IAIZ;;;OAGG;IACH,YAA2B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;QAPvC,WAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;QAQzC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE;YAClC,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,UAAU;gBAAE,OAAO;YAEtC,wCAAwC;YACxC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;IAEO,KAAK,CAAC,qBAA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":3,"file":"IFilter.js","sourceRoot":"","sources":["../src/IFilter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MatrixClient } from "./MatrixClient";
|
|
2
|
+
/**
|
|
3
|
+
* Functions for interacting with Matrix prior to having an access token. Intended
|
|
4
|
+
* to be used for logging in/registering to get a MatrixClient instance.
|
|
5
|
+
*
|
|
6
|
+
* By design, this limits the options used to create the MatrixClient. To specify
|
|
7
|
+
* custom elements to the client, get the access token from the returned client
|
|
8
|
+
* and create a new MatrixClient instance. Due to the nature of Matrix, it is
|
|
9
|
+
* also recommended to use the homeserverUrl from the generated MatrixClient as
|
|
10
|
+
* it may be different from that given to the MatrixAuth class.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MatrixAuth {
|
|
13
|
+
private homeserverUrl;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new MatrixAuth class for creating a MatrixClient
|
|
16
|
+
* @param {string} homeserverUrl The homeserver URL to authenticate against.
|
|
17
|
+
*/
|
|
18
|
+
constructor(homeserverUrl: string);
|
|
19
|
+
/**
|
|
20
|
+
* Generate a client with no access token so we can reuse the doRequest
|
|
21
|
+
* logic already written.
|
|
22
|
+
*/
|
|
23
|
+
private createTemplateClient;
|
|
24
|
+
/**
|
|
25
|
+
* Performs simple registration using a password for the account. This will
|
|
26
|
+
* assume the server supports the m.login.password flow for registration, and
|
|
27
|
+
* will attempt to complete only that stage. The caller is expected to determine
|
|
28
|
+
* if the homeserver supports registration prior to invocation.
|
|
29
|
+
* @param {string} localpart The localpart (username) to register
|
|
30
|
+
* @param {string} password The password to register with
|
|
31
|
+
* @param {string} deviceName The name of the newly created device. Optional.
|
|
32
|
+
* @returns {Promise<MatrixClient>} Resolves to a logged-in MatrixClient
|
|
33
|
+
*/
|
|
34
|
+
passwordRegister(localpart: string, password: string, deviceName?: string): Promise<MatrixClient>;
|
|
35
|
+
/**
|
|
36
|
+
* Performs simple password login with the homeserver. The caller is
|
|
37
|
+
* expected to confirm if the homeserver supports this login flow prior
|
|
38
|
+
* to invocation.
|
|
39
|
+
* @param {string} username The username (localpart or user ID) to log in with
|
|
40
|
+
* @param {string} password The password for the account
|
|
41
|
+
* @param {string} deviceName The name of the newly created device. Optional.
|
|
42
|
+
* @returns {Promise<MatrixClient>} Resolves to a logged-in MatrixClient
|
|
43
|
+
*/
|
|
44
|
+
passwordLogin(username: string, password: string, deviceName?: string): Promise<MatrixClient>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatrixAuth = void 0;
|
|
4
|
+
const MatrixClient_1 = require("./MatrixClient");
|
|
5
|
+
/**
|
|
6
|
+
* Functions for interacting with Matrix prior to having an access token. Intended
|
|
7
|
+
* to be used for logging in/registering to get a MatrixClient instance.
|
|
8
|
+
*
|
|
9
|
+
* By design, this limits the options used to create the MatrixClient. To specify
|
|
10
|
+
* custom elements to the client, get the access token from the returned client
|
|
11
|
+
* and create a new MatrixClient instance. Due to the nature of Matrix, it is
|
|
12
|
+
* also recommended to use the homeserverUrl from the generated MatrixClient as
|
|
13
|
+
* it may be different from that given to the MatrixAuth class.
|
|
14
|
+
*/
|
|
15
|
+
class MatrixAuth {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new MatrixAuth class for creating a MatrixClient
|
|
18
|
+
* @param {string} homeserverUrl The homeserver URL to authenticate against.
|
|
19
|
+
*/
|
|
20
|
+
constructor(homeserverUrl) {
|
|
21
|
+
this.homeserverUrl = homeserverUrl;
|
|
22
|
+
// nothing to do
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate a client with no access token so we can reuse the doRequest
|
|
26
|
+
* logic already written.
|
|
27
|
+
*/
|
|
28
|
+
createTemplateClient() {
|
|
29
|
+
return new MatrixClient_1.MatrixClient(this.homeserverUrl, "");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Performs simple registration using a password for the account. This will
|
|
33
|
+
* assume the server supports the m.login.password flow for registration, and
|
|
34
|
+
* will attempt to complete only that stage. The caller is expected to determine
|
|
35
|
+
* if the homeserver supports registration prior to invocation.
|
|
36
|
+
* @param {string} localpart The localpart (username) to register
|
|
37
|
+
* @param {string} password The password to register with
|
|
38
|
+
* @param {string} deviceName The name of the newly created device. Optional.
|
|
39
|
+
* @returns {Promise<MatrixClient>} Resolves to a logged-in MatrixClient
|
|
40
|
+
*/
|
|
41
|
+
async passwordRegister(localpart, password, deviceName) {
|
|
42
|
+
// First try and complete the stage without UIA in hopes the server is kind to us:
|
|
43
|
+
const body = {
|
|
44
|
+
username: localpart,
|
|
45
|
+
password: password,
|
|
46
|
+
initial_device_display_name: deviceName,
|
|
47
|
+
};
|
|
48
|
+
let response;
|
|
49
|
+
try {
|
|
50
|
+
response = await this.createTemplateClient().doRequest("POST", "/_matrix/client/v3/register", null, body);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
if (e.statusCode === 401) {
|
|
54
|
+
if (typeof (e.body) === "string")
|
|
55
|
+
e.body = JSON.parse(e.body);
|
|
56
|
+
if (!e.body)
|
|
57
|
+
throw new Error(JSON.stringify(Object.keys(e)));
|
|
58
|
+
// 401 means we need to do UIA, so try and complete a stage
|
|
59
|
+
const sessionId = e.body['session'];
|
|
60
|
+
const expectedFlow = ["m.login.dummy"];
|
|
61
|
+
let hasFlow = false;
|
|
62
|
+
for (const flow of e.body['flows']) {
|
|
63
|
+
const stages = flow['stages'];
|
|
64
|
+
if (stages.length !== expectedFlow.length)
|
|
65
|
+
continue;
|
|
66
|
+
let stagesMatch = true;
|
|
67
|
+
for (let i = 0; i < stages.length; i++) {
|
|
68
|
+
if (stages[i] !== expectedFlow[i]) {
|
|
69
|
+
stagesMatch = false;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (stagesMatch) {
|
|
74
|
+
hasFlow = true;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!hasFlow)
|
|
79
|
+
throw new Error("Failed to find appropriate login flow in User-Interactive Authentication");
|
|
80
|
+
body['auth'] = {
|
|
81
|
+
type: expectedFlow[0], // HACK: We assume we only have one entry here
|
|
82
|
+
session: sessionId,
|
|
83
|
+
};
|
|
84
|
+
response = await this.createTemplateClient().doRequest("POST", "/_matrix/client/v3/register", null, body);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!response)
|
|
88
|
+
throw new Error("Failed to register");
|
|
89
|
+
const accessToken = response['access_token'];
|
|
90
|
+
if (!accessToken)
|
|
91
|
+
throw new Error("No access token returned");
|
|
92
|
+
return new MatrixClient_1.MatrixClient(this.homeserverUrl, accessToken);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Performs simple password login with the homeserver. The caller is
|
|
96
|
+
* expected to confirm if the homeserver supports this login flow prior
|
|
97
|
+
* to invocation.
|
|
98
|
+
* @param {string} username The username (localpart or user ID) to log in with
|
|
99
|
+
* @param {string} password The password for the account
|
|
100
|
+
* @param {string} deviceName The name of the newly created device. Optional.
|
|
101
|
+
* @returns {Promise<MatrixClient>} Resolves to a logged-in MatrixClient
|
|
102
|
+
*/
|
|
103
|
+
async passwordLogin(username, password, deviceName) {
|
|
104
|
+
const body = {
|
|
105
|
+
type: "m.login.password",
|
|
106
|
+
identifier: {
|
|
107
|
+
type: "m.id.user",
|
|
108
|
+
user: username,
|
|
109
|
+
},
|
|
110
|
+
password: password,
|
|
111
|
+
initial_device_display_name: deviceName,
|
|
112
|
+
};
|
|
113
|
+
const response = await this.createTemplateClient().doRequest("POST", "/_matrix/client/v3/login", null, body);
|
|
114
|
+
const accessToken = response["access_token"];
|
|
115
|
+
if (!accessToken)
|
|
116
|
+
throw new Error("Expected access token in response - got nothing");
|
|
117
|
+
let homeserverUrl = this.homeserverUrl;
|
|
118
|
+
if (response['well_known'] && response['well_known']['m.homeserver'] && response['well_known']['m.homeserver']['base_url']) {
|
|
119
|
+
homeserverUrl = response['well_known']['m.homeserver']['base_url'];
|
|
120
|
+
}
|
|
121
|
+
return new MatrixClient_1.MatrixClient(homeserverUrl, accessToken);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.MatrixAuth = MatrixAuth;
|
|
125
|
+
//# sourceMappingURL=MatrixAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatrixAuth.js","sourceRoot":"","sources":["../src/MatrixAuth.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C;;;;;;;;;GASG;AACH,MAAa,UAAU;IACnB;;;OAGG;IACH,YAA2B,aAAqB;QAArB,kBAAa,GAAb,aAAa,CAAQ;QAC5C,gBAAgB;IACpB,CAAC;IAED;;;OAGG;IACK,oBAAoB;QACxB,OAAO,IAAI,2BAAY,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,gBAAgB,CAAC,SAAiB,EAAE,QAAgB,EAAE,UAAmB;QAClF,kFAAkF;QAClF,MAAM,IAAI,GAAG;YACT,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,QAAQ;YAClB,2BAA2B,EAAE,UAAU;SAC1C,CAAC;QAEF,IAAI,QAAQ,CAAC;QAEb,IAAI,CAAC;YACD,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,6BAA6B,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9G,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ;oBAAE,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC9D,IAA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