@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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatrixBridge = exports.REMOTE_ROOM_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX = exports.REMOTE_USER_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX = exports.REMOTE_ROOM_INFO_ACCOUNT_DATA_EVENT_TYPE = exports.REMOTE_USER_INFO_ACCOUNT_DATA_EVENT_TYPE = void 0;
|
|
4
|
+
exports.REMOTE_USER_INFO_ACCOUNT_DATA_EVENT_TYPE = "io.t2bot.sdk.bot.remote_user_info";
|
|
5
|
+
exports.REMOTE_ROOM_INFO_ACCOUNT_DATA_EVENT_TYPE = "io.t2bot.sdk.bot.remote_room_info";
|
|
6
|
+
exports.REMOTE_USER_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX = "io.t2bot.sdk.bot.remote_user_map";
|
|
7
|
+
exports.REMOTE_ROOM_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX = "io.t2bot.sdk.bot.remote_room_map";
|
|
8
|
+
/**
|
|
9
|
+
* Utility class for common operations performed by bridges (represented
|
|
10
|
+
* as appservices).
|
|
11
|
+
*
|
|
12
|
+
* The storage utilities are not intended for bridges which allow 1:many
|
|
13
|
+
* relationships with the remote network.
|
|
14
|
+
*
|
|
15
|
+
* Bridges are generally expected to create their own classes which extend
|
|
16
|
+
* the IRemoteRoomInfo and IRemoteUserInfo interfaces and serialize to JSON
|
|
17
|
+
* cleanly. The serialized version of these classes is persisted in various
|
|
18
|
+
* account data locations for future lookups.
|
|
19
|
+
* @category Application services
|
|
20
|
+
*/
|
|
21
|
+
class MatrixBridge {
|
|
22
|
+
constructor(appservice) {
|
|
23
|
+
this.appservice = appservice;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets information about a remote user.
|
|
27
|
+
* @param {Intent} userIntent The Matrix user intent to get information on.
|
|
28
|
+
* @returns {Promise<IRemoteUserInfo>} Resolves to the remote user information.
|
|
29
|
+
*/
|
|
30
|
+
async getRemoteUserInfo(userIntent) {
|
|
31
|
+
await userIntent.ensureRegistered();
|
|
32
|
+
return userIntent.underlyingClient.getAccountData(exports.REMOTE_USER_INFO_ACCOUNT_DATA_EVENT_TYPE);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets information about a remote user. Calling this function will map the
|
|
36
|
+
* provided remote user ID to the intent's owner.
|
|
37
|
+
* @param {Intent} userIntent The Matrix user intent to store information on.
|
|
38
|
+
* @param {IRemoteUserInfo} remoteInfo The remote user information to store
|
|
39
|
+
* @returns {Promise<any>} Resolves when the information has been updated.
|
|
40
|
+
*/
|
|
41
|
+
async setRemoteUserInfo(userIntent, remoteInfo) {
|
|
42
|
+
await userIntent.ensureRegistered();
|
|
43
|
+
await userIntent.underlyingClient.setAccountData(exports.REMOTE_USER_INFO_ACCOUNT_DATA_EVENT_TYPE, remoteInfo);
|
|
44
|
+
await this.updateRemoteUserMapping(userIntent.userId, remoteInfo.id);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets information about a remote room.
|
|
48
|
+
* @param {string} matrixRoomId The Matrix room ID to get information on.
|
|
49
|
+
* @returns {Promise<IRemoteRoomInfo>} Resolves to the remote room information.
|
|
50
|
+
*/
|
|
51
|
+
async getRemoteRoomInfo(matrixRoomId) {
|
|
52
|
+
const bridgeBot = this.appservice.botIntent;
|
|
53
|
+
await bridgeBot.ensureRegistered();
|
|
54
|
+
// We do not need to ensure the user is joined to the room because we can associate
|
|
55
|
+
// room account data with any arbitrary room.
|
|
56
|
+
return bridgeBot.underlyingClient.getRoomAccountData(exports.REMOTE_ROOM_INFO_ACCOUNT_DATA_EVENT_TYPE, matrixRoomId);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sets information about a remote room. Calling this function will map the
|
|
60
|
+
* provided remote room ID to the matrix room ID.
|
|
61
|
+
* @param {string} matrixRoomId The Matrix room ID to store information on.
|
|
62
|
+
* @param {IRemoteRoomInfo} remoteInfo The remote room information to store
|
|
63
|
+
* @returns {Promise<any>} Resolves when the information has been updated.
|
|
64
|
+
*/
|
|
65
|
+
async setRemoteRoomInfo(matrixRoomId, remoteInfo) {
|
|
66
|
+
const bridgeBot = this.appservice.botIntent;
|
|
67
|
+
await bridgeBot.ensureRegistered();
|
|
68
|
+
// We do not need to ensure the user is joined to the room because we can associate
|
|
69
|
+
// room account data with any arbitrary room.
|
|
70
|
+
await bridgeBot.underlyingClient.setRoomAccountData(exports.REMOTE_ROOM_INFO_ACCOUNT_DATA_EVENT_TYPE, matrixRoomId, remoteInfo);
|
|
71
|
+
await this.updateRemoteRoomMapping(matrixRoomId, remoteInfo.id);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the Matrix room ID for the provided remote room ID.
|
|
75
|
+
* @param {string} remoteRoomId The remote room ID to look up.
|
|
76
|
+
* @returns {Promise<string>} Resolves to the Matrix room ID.
|
|
77
|
+
*/
|
|
78
|
+
async getMatrixRoomIdForRemote(remoteRoomId) {
|
|
79
|
+
const eventType = `${exports.REMOTE_ROOM_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX}.${remoteRoomId}`;
|
|
80
|
+
const bridgeBot = this.appservice.botIntent;
|
|
81
|
+
await bridgeBot.ensureRegistered();
|
|
82
|
+
const result = await bridgeBot.underlyingClient.getAccountData(eventType);
|
|
83
|
+
return result['id'];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Gets a Matrix user intent for the provided remote user ID.
|
|
87
|
+
* @param {string} remoteUserId The remote user ID to look up.
|
|
88
|
+
* @returns {Promise<Intent>} Resolves to the Matrix user intent.
|
|
89
|
+
*/
|
|
90
|
+
async getIntentForRemote(remoteUserId) {
|
|
91
|
+
const eventType = `${exports.REMOTE_USER_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX}.${remoteUserId}`;
|
|
92
|
+
const bridgeBot = this.appservice.botIntent;
|
|
93
|
+
await bridgeBot.ensureRegistered();
|
|
94
|
+
const result = await bridgeBot.underlyingClient.getAccountData(eventType);
|
|
95
|
+
return this.appservice.getIntentForUserId(result['id']);
|
|
96
|
+
}
|
|
97
|
+
async updateRemoteUserMapping(matrixUserId, remoteUserId) {
|
|
98
|
+
const eventType = `${exports.REMOTE_USER_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX}.${remoteUserId}`;
|
|
99
|
+
const bridgeBot = this.appservice.botIntent;
|
|
100
|
+
await bridgeBot.ensureRegistered();
|
|
101
|
+
await bridgeBot.underlyingClient.setAccountData(eventType, { id: matrixUserId });
|
|
102
|
+
}
|
|
103
|
+
async updateRemoteRoomMapping(matrixRoomId, remoteRoomId) {
|
|
104
|
+
const eventType = `${exports.REMOTE_ROOM_MAP_ACCOUNT_DATA_EVENT_TYPE_PREFIX}.${remoteRoomId}`;
|
|
105
|
+
const bridgeBot = this.appservice.botIntent;
|
|
106
|
+
await bridgeBot.ensureRegistered();
|
|
107
|
+
await bridgeBot.underlyingClient.setAccountData(eventType, { id: matrixRoomId });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.MatrixBridge = MatrixBridge;
|
|
111
|
+
//# sourceMappingURL=MatrixBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MatrixBridge.js","sourceRoot":"","sources":["../../src/appservice/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,CAAC;QACnC,MAAM,SAAS,CAAC,gBAAgB,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IACrF,CAAC;IAEO,KAAK,CAAC,uBAAuB,CAAC,YAAoB,EAAE,YAAoB;QAC5E,MAAM,SAAS,GAAG,GAAG,sDAA8C,IAAI,YAAY,EAAE,CAAC;QACtF,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAC5C,MAAM,SAAS,CAAC,gBAAgB,EAAE,CAAC;QACnC,MAAM,SAAS,CAAC,gBAAgB,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IACrF,CAAC;CACJ;AA/FD,oCA+FC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MatrixClient } from "../MatrixClient";
|
|
2
|
+
import { MSC2716BatchSendResponse } from "../models/MSC2176";
|
|
3
|
+
/**
|
|
4
|
+
* Unstable APIs that shouldn't be used in most circumstances for appservices.
|
|
5
|
+
* @category Unstable APIs
|
|
6
|
+
*/
|
|
7
|
+
export declare class UnstableAppserviceApis {
|
|
8
|
+
private client;
|
|
9
|
+
private requestId;
|
|
10
|
+
constructor(client: MatrixClient);
|
|
11
|
+
/**
|
|
12
|
+
* Send several historical events into a room.
|
|
13
|
+
* @see https://github.com/matrix-org/matrix-doc/pull/2716
|
|
14
|
+
* @param {string} roomId The roomID to send to.
|
|
15
|
+
* @param {string} prevEventId The event ID where this batch will be inserted
|
|
16
|
+
* @param {string} chunkId The chunk ID returned from a previous call. Set falsy to start at the beginning.
|
|
17
|
+
* @param {any[]} events A set of event contents for events to be inserted into the room.
|
|
18
|
+
* @param {any[]} stateEventsAtStart A set of state events to be inserted into the room. Defaults to empty.
|
|
19
|
+
* @returns A set of eventIds and the next chunk ID
|
|
20
|
+
*/
|
|
21
|
+
sendHistoricalEventBatch(roomId: string, prevEventId: string, events: any[], stateEventsAtStart?: any[], chunkId?: string): Promise<MSC2716BatchSendResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Sends an event to the given room with a given timestamp.
|
|
24
|
+
* @param {string} roomId the room ID to send the event to
|
|
25
|
+
* @param {string} eventType the type of event to send
|
|
26
|
+
* @param {string} content the event body to send
|
|
27
|
+
* @param {number} ts The origin_server_ts of the new event
|
|
28
|
+
* @returns {Promise<string>} resolves to the event ID that represents the event
|
|
29
|
+
*/
|
|
30
|
+
sendEventWithTimestamp(roomId: string, eventType: string, content: any, ts: number): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Sends a state event to the given room with a given timestamp.
|
|
33
|
+
* @param {string} roomId the room ID to send the event to
|
|
34
|
+
* @param {string} type the event type to send
|
|
35
|
+
* @param {string} stateKey the state key to send, should not be null
|
|
36
|
+
* @param {string} content the event body to send
|
|
37
|
+
* @param {number} ts The origin_server_ts of the new event
|
|
38
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
39
|
+
*/
|
|
40
|
+
sendStateEventWithTimestamp(roomId: string, type: string, stateKey: string, content: any, ts: number): Promise<string>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnstableAppserviceApis = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Unstable APIs that shouldn't be used in most circumstances for appservices.
|
|
6
|
+
* @category Unstable APIs
|
|
7
|
+
*/
|
|
8
|
+
class UnstableAppserviceApis {
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
this.requestId = 0;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Send several historical events into a room.
|
|
15
|
+
* @see https://github.com/matrix-org/matrix-doc/pull/2716
|
|
16
|
+
* @param {string} roomId The roomID to send to.
|
|
17
|
+
* @param {string} prevEventId The event ID where this batch will be inserted
|
|
18
|
+
* @param {string} chunkId The chunk ID returned from a previous call. Set falsy to start at the beginning.
|
|
19
|
+
* @param {any[]} events A set of event contents for events to be inserted into the room.
|
|
20
|
+
* @param {any[]} stateEventsAtStart A set of state events to be inserted into the room. Defaults to empty.
|
|
21
|
+
* @returns A set of eventIds and the next chunk ID
|
|
22
|
+
*/
|
|
23
|
+
async sendHistoricalEventBatch(roomId, prevEventId, events, stateEventsAtStart = [], chunkId) {
|
|
24
|
+
return this.client.doRequest("POST", `/_matrix/client/unstable/org.matrix.msc2716/rooms/${encodeURIComponent(roomId)}/batch_send`, {
|
|
25
|
+
prev_event: prevEventId,
|
|
26
|
+
chunk_id: chunkId,
|
|
27
|
+
}, {
|
|
28
|
+
events,
|
|
29
|
+
state_events_at_start: stateEventsAtStart,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sends an event to the given room with a given timestamp.
|
|
34
|
+
* @param {string} roomId the room ID to send the event to
|
|
35
|
+
* @param {string} eventType the type of event to send
|
|
36
|
+
* @param {string} content the event body to send
|
|
37
|
+
* @param {number} ts The origin_server_ts of the new event
|
|
38
|
+
* @returns {Promise<string>} resolves to the event ID that represents the event
|
|
39
|
+
*/
|
|
40
|
+
async sendEventWithTimestamp(roomId, eventType, content, ts) {
|
|
41
|
+
const txnId = `${(new Date().getTime())}__inc_appts${++this.requestId}`;
|
|
42
|
+
const path = `/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/send/${encodeURIComponent(eventType)}/${encodeURIComponent(txnId)}`;
|
|
43
|
+
const response = await this.client.doRequest("PUT", path, { ts }, content);
|
|
44
|
+
return response.event_id;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends a state event to the given room with a given timestamp.
|
|
48
|
+
* @param {string} roomId the room ID to send the event to
|
|
49
|
+
* @param {string} type the event type to send
|
|
50
|
+
* @param {string} stateKey the state key to send, should not be null
|
|
51
|
+
* @param {string} content the event body to send
|
|
52
|
+
* @param {number} ts The origin_server_ts of the new event
|
|
53
|
+
* @returns {Promise<string>} resolves to the event ID that represents the message
|
|
54
|
+
*/
|
|
55
|
+
async sendStateEventWithTimestamp(roomId, type, stateKey, content, ts) {
|
|
56
|
+
const path = `/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(type)}/${encodeURIComponent(stateKey)}`;
|
|
57
|
+
const response = await this.client.doRequest("PUT", path, { ts }, content);
|
|
58
|
+
return response.event_id;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.UnstableAppserviceApis = UnstableAppserviceApis;
|
|
62
|
+
//# sourceMappingURL=UnstableAppserviceApis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnstableAppserviceApis.js","sourceRoot":"","sources":["../../src/appservice/UnstableAppserviceApis.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAa,sBAAsB;IAG/B,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;QAFhC,cAAS,GAAG,CAAC,CAAC;IAGtB,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,wBAAwB,CAAC,MAAc,EAAE,WAAmB,EAAE,MAAa,EAAE,qBAA4B,EAAE,EAAE,OAAgB;QACtI,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,qDAAqD,kBAAkB,CAAC,MAAM,CAAC,aAAa,EAAE;YAC/H,UAAU,EAAE,WAAW;YACvB,QAAQ,EAAE,OAAO;SACpB,EAAE;YACC,MAAM;YACN,qBAAqB,EAAE,kBAAkB;SAC5C,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,sBAAsB,CAAC,MAAc,EAAE,SAAiB,EAAE,OAAY,EAAE,EAAU;QAC3F,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;QACxE,MAAM,IAAI,GAAG,4BAA4B,kBAAkB,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QACzI,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,2BAA2B,CAAC,MAAc,EAAE,IAAY,EAAE,QAAgB,EAAE,OAAY,EAAE,EAAU;QAC7G,MAAM,IAAI,GAAG,4BAA4B,kBAAkB,CAAC,MAAM,CAAC,UAAU,kBAAkB,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxI,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAvDD,wDAuDC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the response format documented in
|
|
3
|
+
* https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-thirdparty-protocol-protocol
|
|
4
|
+
* @category Application services
|
|
5
|
+
*/
|
|
6
|
+
export interface IApplicationServiceProtocol {
|
|
7
|
+
user_fields: string[];
|
|
8
|
+
location_fields: string[];
|
|
9
|
+
icon: string;
|
|
10
|
+
field_types: {
|
|
11
|
+
[field: string]: IFieldType;
|
|
12
|
+
};
|
|
13
|
+
instances: {
|
|
14
|
+
[name: string]: IProtocolInstance;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface IFieldType {
|
|
18
|
+
regexp: string;
|
|
19
|
+
placeholder: string;
|
|
20
|
+
}
|
|
21
|
+
interface IProtocolInstance {
|
|
22
|
+
desc: string;
|
|
23
|
+
icon: string;
|
|
24
|
+
fields: {
|
|
25
|
+
[field: string]: string;
|
|
26
|
+
};
|
|
27
|
+
network_id: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This is the response format for an MSC3983 `/keys/claim` request.
|
|
31
|
+
* See https://github.com/matrix-org/matrix-spec-proposals/pull/3983
|
|
32
|
+
* @deprecated This can be removed at any time without notice as it is unstable functionality.
|
|
33
|
+
* @category Application services
|
|
34
|
+
*/
|
|
35
|
+
export interface MSC3983KeyClaimResponse {
|
|
36
|
+
[userId: string]: {
|
|
37
|
+
[deviceId: string]: {
|
|
38
|
+
[keyId: string]: {
|
|
39
|
+
key: string;
|
|
40
|
+
signatures: {
|
|
41
|
+
[userId: string]: {
|
|
42
|
+
[keyId: string]: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* This is the response format for an MSC3984 `/keys/query` request.
|
|
51
|
+
* See https://github.com/matrix-org/matrix-spec-proposals/pull/3984
|
|
52
|
+
* @deprecated This can be removed at any time without notice as it is unstable functionality.
|
|
53
|
+
* @category Application services
|
|
54
|
+
*/
|
|
55
|
+
export interface MSC3984KeyQueryResponse {
|
|
56
|
+
device_keys: {
|
|
57
|
+
[userId: string]: {
|
|
58
|
+
[deviceId: string]: {
|
|
59
|
+
algorithms: string[];
|
|
60
|
+
device_id: string;
|
|
61
|
+
user_id: string;
|
|
62
|
+
keys: {
|
|
63
|
+
[keyId: string]: string;
|
|
64
|
+
};
|
|
65
|
+
signatures: {
|
|
66
|
+
[userId: string]: {
|
|
67
|
+
[keyId: string]: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
unsigned?: {
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http_responses.js","sourceRoot":"","sources":["../../src/appservice/http_responses.ts"],"names":[],"mappings":""}
|
package/lib/b64.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encodes Base64.
|
|
3
|
+
* @category Utilities
|
|
4
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
5
|
+
* @returns {string} The Base64 string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function encodeBase64(b: ArrayBuffer | Uint8Array): string;
|
|
8
|
+
/**
|
|
9
|
+
* Encodes Unpadded Base64.
|
|
10
|
+
* @category Utilities
|
|
11
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
12
|
+
* @returns {string} The Base64 string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function encodeUnpaddedBase64(b: ArrayBuffer | Uint8Array): string;
|
|
15
|
+
/**
|
|
16
|
+
* Encodes URL-Safe Unpadded Base64.
|
|
17
|
+
* @category Utilities
|
|
18
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
19
|
+
* @returns {string} The Base64 string.
|
|
20
|
+
*/
|
|
21
|
+
export declare function encodeUnpaddedUrlSafeBase64(b: ArrayBuffer | Uint8Array): string;
|
|
22
|
+
/**
|
|
23
|
+
* Decodes Base64.
|
|
24
|
+
* @category Utilities
|
|
25
|
+
* @param {string} s The Base64 string.
|
|
26
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
27
|
+
*/
|
|
28
|
+
export declare function decodeBase64(s: string): Uint8Array;
|
|
29
|
+
/**
|
|
30
|
+
* Decodes Unpadded Base64.
|
|
31
|
+
* @category Utilities
|
|
32
|
+
* @param {string} s The Base64 string.
|
|
33
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
34
|
+
*/
|
|
35
|
+
export declare function decodeUnpaddedBase64(s: string): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* Decodes URL-Safe Unpadded Base64.
|
|
38
|
+
* @category Utilities
|
|
39
|
+
* @param {string} s The Base64 string.
|
|
40
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
41
|
+
*/
|
|
42
|
+
export declare function decodeUnpaddedUrlSafeBase64(s: string): Uint8Array;
|
package/lib/b64.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeBase64 = encodeBase64;
|
|
4
|
+
exports.encodeUnpaddedBase64 = encodeUnpaddedBase64;
|
|
5
|
+
exports.encodeUnpaddedUrlSafeBase64 = encodeUnpaddedUrlSafeBase64;
|
|
6
|
+
exports.decodeBase64 = decodeBase64;
|
|
7
|
+
exports.decodeUnpaddedBase64 = decodeUnpaddedBase64;
|
|
8
|
+
exports.decodeUnpaddedUrlSafeBase64 = decodeUnpaddedUrlSafeBase64;
|
|
9
|
+
/**
|
|
10
|
+
* Encodes Base64.
|
|
11
|
+
* @category Utilities
|
|
12
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
13
|
+
* @returns {string} The Base64 string.
|
|
14
|
+
*/
|
|
15
|
+
function encodeBase64(b) {
|
|
16
|
+
if (b instanceof ArrayBuffer) {
|
|
17
|
+
return Buffer.from(b).toString('base64');
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString('base64');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Encodes Unpadded Base64.
|
|
25
|
+
* @category Utilities
|
|
26
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
27
|
+
* @returns {string} The Base64 string.
|
|
28
|
+
*/
|
|
29
|
+
function encodeUnpaddedBase64(b) {
|
|
30
|
+
return encodeBase64(b).replace(/=+/g, '');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Encodes URL-Safe Unpadded Base64.
|
|
34
|
+
* @category Utilities
|
|
35
|
+
* @param {ArrayBuffer | Uint8Array} b The buffer to encode.
|
|
36
|
+
* @returns {string} The Base64 string.
|
|
37
|
+
*/
|
|
38
|
+
function encodeUnpaddedUrlSafeBase64(b) {
|
|
39
|
+
return encodeUnpaddedBase64(b).replace(/\+/g, '-').replace(/\//g, '_');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Decodes Base64.
|
|
43
|
+
* @category Utilities
|
|
44
|
+
* @param {string} s The Base64 string.
|
|
45
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
46
|
+
*/
|
|
47
|
+
function decodeBase64(s) {
|
|
48
|
+
return Buffer.from(s, 'base64');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Decodes Unpadded Base64.
|
|
52
|
+
* @category Utilities
|
|
53
|
+
* @param {string} s The Base64 string.
|
|
54
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
55
|
+
*/
|
|
56
|
+
function decodeUnpaddedBase64(s) {
|
|
57
|
+
return decodeBase64(s); // yay, it's the same
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decodes URL-Safe Unpadded Base64.
|
|
61
|
+
* @category Utilities
|
|
62
|
+
* @param {string} s The Base64 string.
|
|
63
|
+
* @returns {Uint8Array} The encoded data as a buffer.
|
|
64
|
+
*/
|
|
65
|
+
function decodeUnpaddedUrlSafeBase64(s) {
|
|
66
|
+
return decodeUnpaddedBase64(s.replace(/-/g, '+').replace(/_/g, '/'));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=b64.js.map
|
package/lib/b64.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"b64.js","sourceRoot":"","sources":["../src/b64.ts"],"names":[],"mappings":";;AAMA,oCAMC;AAQD,oDAEC;AAQD,kEAEC;AAQD,oCAEC;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Client";
|
|
2
|
+
import { UIACallback } from "./RustEngine";
|
|
3
|
+
export type { UIACallback };
|
|
4
|
+
/**
|
|
5
|
+
* The subset of RustEngine used by the cross-signing helpers below.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface CrossSigningEngine {
|
|
9
|
+
bootstrapCrossSigning(uiaCallback: UIACallback, reset?: boolean): Promise<void>;
|
|
10
|
+
bootstrapSecretStorageFromPassphrase(passphrase: string, opts?: {
|
|
11
|
+
withKeyBackup?: boolean;
|
|
12
|
+
reset?: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
restoreSecretsFromSecretStorage(passphrase: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of {@link CryptoClient.ensureCrossSigning}.
|
|
18
|
+
* - `already-signed`: our device was already signed by the account's self-signing key.
|
|
19
|
+
* - `restored`: the cross-signing keys were restored from secret storage (no reset).
|
|
20
|
+
* - `bootstrapped`: a new cross-signing identity was created and uploaded (reset).
|
|
21
|
+
* - `skipped-no-auth`: bootstrapping was needed, but no UIA callback was given.
|
|
22
|
+
* @category Encryption
|
|
23
|
+
*/
|
|
24
|
+
export type EnsureCrossSigningResult = "already-signed" | "restored" | "bootstrapped" | "skipped-no-auth";
|
|
25
|
+
/**
|
|
26
|
+
* Result of {@link CryptoClient.ensureSecretStorage}.
|
|
27
|
+
* @category Encryption
|
|
28
|
+
*/
|
|
29
|
+
export type EnsureSecretStorageResult = "already-configured" | "bootstrapped";
|
|
30
|
+
/**
|
|
31
|
+
* Options for {@link CryptoClient.ensureCrossSigning}.
|
|
32
|
+
* @category Encryption
|
|
33
|
+
*/
|
|
34
|
+
export interface EnsureCrossSigningOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Answers the UIA challenge when uploading new cross-signing keys. Without it,
|
|
37
|
+
* bootstrapping is skipped. See {@link passwordUiaCallback}.
|
|
38
|
+
*/
|
|
39
|
+
uiaCallback?: UIACallback;
|
|
40
|
+
/**
|
|
41
|
+
* Secret storage passphrase. When set and the account has secret storage, the
|
|
42
|
+
* existing cross-signing keys are restored from it before falling back to a reset.
|
|
43
|
+
*/
|
|
44
|
+
recoveryPassphrase?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Builds a UIA callback that answers with an `m.login.password` stage.
|
|
48
|
+
* @category Encryption
|
|
49
|
+
*/
|
|
50
|
+
export declare function passwordUiaCallback(userId: string, password: string): UIACallback;
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether the given device is signed by the account's self-signing key.
|
|
53
|
+
*
|
|
54
|
+
* This deliberately checks our device, not just whether the account has a master
|
|
55
|
+
* key: another client may have set up cross-signing without ever signing us.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare function isOwnDeviceCrossSigned(client: MatrixClient, deviceId: string): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether the account has a default secret storage key configured.
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export declare function hasSecretStorage(client: MatrixClient): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare function ensureCrossSigning(client: MatrixClient, engine: CrossSigningEngine, deviceId: string, opts: EnsureCrossSigningOptions): Promise<EnsureCrossSigningResult>;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function ensureSecretStorage(client: MatrixClient, engine: CrossSigningEngine, passphrase: string, opts: {
|
|
72
|
+
withKeyBackup?: boolean;
|
|
73
|
+
}): Promise<EnsureSecretStorageResult>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.passwordUiaCallback = passwordUiaCallback;
|
|
4
|
+
exports.isOwnDeviceCrossSigned = isOwnDeviceCrossSigned;
|
|
5
|
+
exports.hasSecretStorage = hasSecretStorage;
|
|
6
|
+
exports.ensureCrossSigning = ensureCrossSigning;
|
|
7
|
+
exports.ensureSecretStorage = ensureSecretStorage;
|
|
8
|
+
const LogService_1 = require("../logging/LogService");
|
|
9
|
+
/**
|
|
10
|
+
* Builds a UIA callback that answers with an `m.login.password` stage.
|
|
11
|
+
* @category Encryption
|
|
12
|
+
*/
|
|
13
|
+
function passwordUiaCallback(userId, password) {
|
|
14
|
+
return async (uia) => ({
|
|
15
|
+
type: "m.login.password",
|
|
16
|
+
identifier: { type: "m.id.user", user: userId },
|
|
17
|
+
password,
|
|
18
|
+
session: uia.session,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether the given device is signed by the account's self-signing key.
|
|
23
|
+
*
|
|
24
|
+
* This deliberately checks our device, not just whether the account has a master
|
|
25
|
+
* key: another client may have set up cross-signing without ever signing us.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
async function isOwnDeviceCrossSigned(client, deviceId) {
|
|
29
|
+
const userId = await client.getUserId();
|
|
30
|
+
const resp = await client.doRequest("POST", "/_matrix/client/v3/keys/query", null, {
|
|
31
|
+
device_keys: { [userId]: [] },
|
|
32
|
+
});
|
|
33
|
+
const selfSigningKeyIds = Object.keys(resp?.["self_signing_keys"]?.[userId]?.["keys"] ?? {});
|
|
34
|
+
const deviceSignatures = resp?.["device_keys"]?.[userId]?.[deviceId]?.["signatures"]?.[userId] ?? {};
|
|
35
|
+
return selfSigningKeyIds.some((keyId) => keyId in deviceSignatures);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether the account has a default secret storage key configured.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
async function hasSecretStorage(client) {
|
|
42
|
+
try {
|
|
43
|
+
const data = await client.getAccountData("m.secret_storage.default_key");
|
|
44
|
+
return Boolean(data?.key);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// getAccountData throws (404) when the event doesn't exist.
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
async function ensureCrossSigning(client, engine, deviceId, opts) {
|
|
55
|
+
if (await isOwnDeviceCrossSigned(client, deviceId)) {
|
|
56
|
+
return "already-signed";
|
|
57
|
+
}
|
|
58
|
+
if (opts.recoveryPassphrase && await hasSecretStorage(client)) {
|
|
59
|
+
try {
|
|
60
|
+
await engine.restoreSecretsFromSecretStorage(opts.recoveryPassphrase);
|
|
61
|
+
return "restored";
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
LogService_1.LogService.warn("CryptoClient", "Restoring cross-signing keys from secret storage failed, falling back to a reset:", e);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!opts.uiaCallback) {
|
|
68
|
+
return "skipped-no-auth";
|
|
69
|
+
}
|
|
70
|
+
// Neither signed nor restorable: create a fresh identity. This replaces any
|
|
71
|
+
// existing cross-signing keys on the account, so other devices' trust in the
|
|
72
|
+
// old identity is lost.
|
|
73
|
+
await engine.bootstrapCrossSigning(opts.uiaCallback, true);
|
|
74
|
+
return "bootstrapped";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
async function ensureSecretStorage(client, engine, passphrase, opts) {
|
|
80
|
+
if (await hasSecretStorage(client)) {
|
|
81
|
+
return "already-configured";
|
|
82
|
+
}
|
|
83
|
+
await engine.bootstrapSecretStorageFromPassphrase(passphrase, { withKeyBackup: opts.withKeyBackup ?? true });
|
|
84
|
+
return "bootstrapped";
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=CrossSigningBootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CrossSigningBootstrap.js","sourceRoot":"","sources":["../../src/e2ee/CrossSigningBootstrap.ts"],"names":[],"mappings":";;AAqDA,kDAOC;AASD,wDAQC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