1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-05 00:42:10 +03:00

Change imports for Node.js compatibility (#4377)

* Change imports for Node.js compatibility

Fixes: #4287
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>

* Run prettier

* Run prettier (again)

* Add comment

* Update babel.config.cjs

---------

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Johannes Marbach
2024-08-29 17:56:32 +02:00
committed by GitHub
parent e6acfdf275
commit 05ba27f36b
192 changed files with 1443 additions and 1385 deletions

View File

@@ -14,7 +14,16 @@ module.exports = {
modules: process.env.NODE_ENV === "test" ? "commonjs" : false, modules: process.env.NODE_ENV === "test" ? "commonjs" : false,
}, },
], ],
[
"@babel/preset-typescript", "@babel/preset-typescript",
{
// When using the transpiled javascript in `lib`, Node.js requires `.js` extensions on any `import`
// specifiers. However, Jest uses the TS source (via babel) and fails to resolve the `.js` names.
// To resolve this,we use the `.ts` names in the source, and rewrite the `import` specifiers to use
// `.js` during transpilation, *except* when we are targetting Jest.
rewriteImportExtensions: process.env.NODE_ENV !== "test",
},
],
], ],
plugins: [ plugins: [
"@babel/plugin-transform-numeric-separator", "@babel/plugin-transform-numeric-separator",

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { UnstableValue } from "../NamespacedValue"; import { UnstableValue } from "../NamespacedValue.ts";
import { IClientWellKnown } from "../client"; import { IClientWellKnown } from "../client.ts";
// disable lint because these are wire responses // disable lint because these are wire responses
/* eslint-disable camelcase */ /* eslint-disable camelcase */

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { RelatesToRelationship, REFERENCE_RELATION } from "./extensible_events"; import { RelatesToRelationship, REFERENCE_RELATION } from "./extensible_events.ts";
import { UnstableValue } from "../NamespacedValue"; import { UnstableValue } from "../NamespacedValue.ts";
import { MAssetEvent, MLocationEvent, MTimestampEvent } from "./location"; import { MAssetEvent, MLocationEvent, MTimestampEvent } from "./location.ts";
/** /**
* Beacon info and beacon event types as described in MSC3672 * Beacon info and beacon event types as described in MSC3672

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import type { ISignatures } from "./signed"; import type { ISignatures } from "./signed.ts";
export type OlmGroupSessionExtraData = { export type OlmGroupSessionExtraData = {
untrusted?: boolean; untrusted?: boolean;
@@ -22,7 +22,7 @@ export type OlmGroupSessionExtraData = {
}; };
// Backwards compatible re-export // Backwards compatible re-export
export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend"; export type { EventDecryptionResult as IEventDecryptionResult } from "../common-crypto/CryptoBackend.ts";
interface Extensible { interface Extensible {
[key: string]: any; [key: string]: any;

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { NamespacedValue, UnstableValue } from "../NamespacedValue"; import { NamespacedValue, UnstableValue } from "../NamespacedValue.ts";
import { import {
PolicyRuleEventContent, PolicyRuleEventContent,
RoomAvatarEventContent, RoomAvatarEventContent,
@@ -34,16 +34,16 @@ import {
RoomTopicEventContent, RoomTopicEventContent,
SpaceChildEventContent, SpaceChildEventContent,
SpaceParentEventContent, SpaceParentEventContent,
} from "./state_events"; } from "./state_events.ts";
import { import {
ExperimentalGroupCallRoomMemberState, ExperimentalGroupCallRoomMemberState,
IGroupCallRoomMemberState, IGroupCallRoomMemberState,
IGroupCallRoomState, IGroupCallRoomState,
} from "../webrtc/groupCall"; } from "../webrtc/groupCall.ts";
import { MSC3089EventContent } from "../models/MSC3089Branch"; import { MSC3089EventContent } from "../models/MSC3089Branch.ts";
import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon"; import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon.ts";
import { XOR } from "./common"; import { XOR } from "./common.ts";
import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events"; import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events.ts";
import { import {
MCallAnswer, MCallAnswer,
MCallBase, MCallBase,
@@ -54,10 +54,10 @@ import {
MCallSelectAnswer, MCallSelectAnswer,
SDPStreamMetadata, SDPStreamMetadata,
SDPStreamMetadataKey, SDPStreamMetadataKey,
} from "../webrtc/callEventTypes"; } from "../webrtc/callEventTypes.ts";
import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types"; import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types.ts";
import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls"; import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls.ts";
import { SessionMembershipData } from "../matrixrtc/CallMembership"; import { SessionMembershipData } from "../matrixrtc/CallMembership.ts";
export enum EventType { export enum EventType {
// Room state events // Room state events

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MsgType, RelationType } from "./event"; import { MsgType, RelationType } from "./event.ts";
import { FileInfo, ImageInfo, MediaEventContent } from "./media"; import { FileInfo, ImageInfo, MediaEventContent } from "./media.ts";
import { XOR } from "./common"; import { XOR } from "./common.ts";
interface BaseTimelineEvent { interface BaseTimelineEvent {
"body": string; "body": string;

View File

@@ -16,7 +16,7 @@ limitations under the License.
import { EitherAnd, NamespacedValue, Optional, UnstableValue } from "matrix-events-sdk"; import { EitherAnd, NamespacedValue, Optional, UnstableValue } from "matrix-events-sdk";
import { isProvided } from "../extensible_events_v1/utilities"; import { isProvided } from "../extensible_events_v1/utilities.ts";
// Types and utilities for MSC1767: Extensible events (version 1) in Matrix // Types and utilities for MSC1767: Extensible events (version 1) in Matrix

View File

@@ -17,8 +17,8 @@ limitations under the License.
// Types for MSC3488 - m.location: Extending events with location data // Types for MSC3488 - m.location: Extending events with location data
import { EitherAnd } from "matrix-events-sdk"; import { EitherAnd } from "matrix-events-sdk";
import { UnstableValue } from "../NamespacedValue"; import { UnstableValue } from "../NamespacedValue.ts";
import { M_TEXT } from "./extensible_events"; import { M_TEXT } from "./extensible_events.ts";
export enum LocationAssetType { export enum LocationAssetType {
Self = "m.self", Self = "m.self",

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MsgType } from "../@types/event"; import { MsgType } from "../@types/event.ts";
/** /**
* Information on encrypted media attachments. * Information on encrypted media attachments.

View File

@@ -21,7 +21,7 @@ import {
REFERENCE_RELATION, REFERENCE_RELATION,
RelatesToRelationship, RelatesToRelationship,
TSNamespace, TSNamespace,
} from "./extensible_events"; } from "./extensible_events.ts";
/** /**
* Identifier for a disclosed poll. * Identifier for a disclosed poll.

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { AuthDict } from "../interactive-auth"; import { AuthDict } from "../interactive-auth.ts";
/** /**
* The request body of a call to `POST /_matrix/client/v3/register`. * The request body of a call to `POST /_matrix/client/v3/register`.

View File

@@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IContent, IEvent } from "../models/event"; import { IContent, IEvent } from "../models/event.ts";
import { Preset, Visibility } from "./partials"; import { Preset, Visibility } from "./partials.ts";
import { IEventWithRoomId, SearchKey } from "./search"; import { IEventWithRoomId, SearchKey } from "./search.ts";
import { IRoomEventFilter } from "../filter"; import { IRoomEventFilter } from "../filter.ts";
import { Direction } from "../models/event-timeline"; import { Direction } from "../models/event-timeline.ts";
import { PushRuleAction } from "./PushRules"; import { PushRuleAction } from "./PushRules.ts";
import { IRoomEvent } from "../sync-accumulator"; import { IRoomEvent } from "../sync-accumulator.ts";
import { EventType, RelationType, RoomType } from "./event"; import { EventType, RelationType, RoomType } from "./event.ts";
// allow camelcase as these are things that go onto the wire // allow camelcase as these are things that go onto the wire
/* eslint-disable camelcase */ /* eslint-disable camelcase */

View File

@@ -16,9 +16,9 @@ limitations under the License.
// Types relating to the /search API // Types relating to the /search API
import { IRoomEvent, IStateEvent } from "../sync-accumulator"; import { IRoomEvent, IStateEvent } from "../sync-accumulator.ts";
import { IRoomEventFilter } from "../filter"; import { IRoomEventFilter } from "../filter.ts";
import { SearchResult } from "../models/search-result"; import { SearchResult } from "../models/search-result.ts";
/* eslint-disable camelcase */ /* eslint-disable camelcase */
export interface IEventWithRoomId extends IRoomEvent { export interface IEventWithRoomId extends IRoomEvent {

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IPublicRoomsChunkRoom } from "../client"; import { IPublicRoomsChunkRoom } from "../client.ts";
import { RoomType } from "./event"; import { RoomType } from "./event.ts";
import { IStrippedState } from "../sync-accumulator"; import { IStrippedState } from "../sync-accumulator.ts";
// Types relating to Rooms of type `m.space` and related APIs // Types relating to Rooms of type `m.space` and related APIs

View File

@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { RoomType } from "./event"; import { RoomType } from "./event.ts";
import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "./partials"; import { GuestAccess, HistoryVisibility, JoinRule, RestrictedAllowType } from "./partials.ts";
import { ImageInfo } from "./media"; import { ImageInfo } from "./media.ts";
import { PolicyRecommendation } from "../models/invites-ignorer"; import { PolicyRecommendation } from "../models/invites-ignorer.ts";
export interface RoomCanonicalAliasEventContent { export interface RoomCanonicalAliasEventContent {
alias?: string; alias?: string;

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IdServerUnbindResult } from "./partials"; import { IdServerUnbindResult } from "./partials.ts";
// Types relating to Synapse Admin APIs // Types relating to Synapse Admin APIs

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ServerControlledNamespacedValue } from "../NamespacedValue"; import { ServerControlledNamespacedValue } from "../NamespacedValue.ts";
/** /**
* https://github.com/matrix-org/matrix-doc/pull/3773 * https://github.com/matrix-org/matrix-doc/pull/3773

View File

@@ -16,8 +16,8 @@ limitations under the License.
import { EitherAnd } from "matrix-events-sdk"; import { EitherAnd } from "matrix-events-sdk";
import { UnstableValue } from "../NamespacedValue"; import { UnstableValue } from "../NamespacedValue.ts";
import { IMessageRendering } from "./extensible_events"; import { IMessageRendering } from "./extensible_events.ts";
/** /**
* Extensible topic event type based on MSC3765 * Extensible topic event type based on MSC3765

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { AuthDict, IAuthData } from "../interactive-auth"; import { AuthDict, IAuthData } from "../interactive-auth.ts";
/** /**
* Helper type to represent HTTP request body for a UIA enabled endpoint * Helper type to represent HTTP request body for a UIA enabled endpoint

View File

@@ -19,7 +19,7 @@ limitations under the License.
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import { ListenerMap, TypedEventEmitter } from "./models/typed-event-emitter"; import { ListenerMap, TypedEventEmitter } from "./models/typed-event-emitter.ts";
export class ReEmitter { export class ReEmitter {
public constructor(private readonly target: EventEmitter) {} public constructor(private readonly target: EventEmitter) {}

View File

@@ -14,14 +14,19 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ToDeviceMessageId } from "./@types/event"; import { ToDeviceMessageId } from "./@types/event.ts";
import { logger } from "./logger"; import { logger } from "./logger.ts";
import { MatrixClient, ClientEvent } from "./client"; import { MatrixClient, ClientEvent } from "./client.ts";
import { MatrixError } from "./http-api"; import { MatrixError } from "./http-api/index.ts";
import { IndexedToDeviceBatch, ToDeviceBatch, ToDeviceBatchWithTxnId, ToDevicePayload } from "./models/ToDeviceMessage"; import {
import { MatrixScheduler } from "./scheduler"; IndexedToDeviceBatch,
import { SyncState } from "./sync"; ToDeviceBatch,
import { MapWithDefault } from "./utils"; ToDeviceBatchWithTxnId,
ToDevicePayload,
} from "./models/ToDeviceMessage.ts";
import { MatrixScheduler } from "./scheduler.ts";
import { SyncState } from "./sync.ts";
import { MapWithDefault } from "./utils.ts";
const MAX_BATCH_SIZE = 20; const MAX_BATCH_SIZE = 20;

View File

@@ -15,10 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client"; import { IClientWellKnown, IWellKnownConfig, IServerVersions } from "./client.ts";
import { logger } from "./logger"; import { logger } from "./logger.ts";
import { MatrixError, Method, timeoutSignal } from "./http-api"; import { MatrixError, Method, timeoutSignal } from "./http-api/index.ts";
import { SUPPORTED_MATRIX_VERSIONS } from "./version-support"; import { SUPPORTED_MATRIX_VERSIONS } from "./version-support.ts";
// Dev note: Auto discovery is part of the spec. // Dev note: Auto discovery is part of the spec.
// See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery // See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as matrixcs from "./matrix"; import * as matrixcs from "./matrix.ts";
type BrowserMatrix = typeof matrixcs; type BrowserMatrix = typeof matrixcs;
declare global { declare global {
@@ -40,5 +40,5 @@ if (indexedDB) {
matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB!, "matrix-js-sdk:crypto")); matrixcs.setCryptoStoreFactory(() => new matrixcs.IndexedDBCryptoStore(indexedDB!, "matrix-js-sdk:crypto"));
} }
export * from "./matrix"; export * from "./matrix.ts";
globalThis.matrixcs = matrixcs; globalThis.matrixcs = matrixcs;

View File

@@ -20,8 +20,8 @@ limitations under the License.
import { Optional } from "matrix-events-sdk"; import { Optional } from "matrix-events-sdk";
import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto"; import type { IDeviceKeys, IMegolmSessionData, IOneTimeKey } from "./@types/crypto.ts";
import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync"; import { ISyncStateData, SetPresence, SyncApi, SyncApiOptions, SyncState } from "./sync.ts";
import { import {
EventStatus, EventStatus,
IContent, IContent,
@@ -31,29 +31,29 @@ import {
MatrixEventEvent, MatrixEventEvent,
MatrixEventHandlerMap, MatrixEventHandlerMap,
PushDetails, PushDetails,
} from "./models/event"; } from "./models/event.ts";
import { StubStore } from "./store/stub"; import { StubStore } from "./store/stub.ts";
import { CallEvent, CallEventHandlerMap, createNewMatrixCall, MatrixCall, supportsMatrixCall } from "./webrtc/call"; import { CallEvent, CallEventHandlerMap, createNewMatrixCall, MatrixCall, supportsMatrixCall } from "./webrtc/call.ts";
import { Filter, IFilterDefinition, IRoomEventFilter } from "./filter"; import { Filter, IFilterDefinition, IRoomEventFilter } from "./filter.ts";
import { CallEventHandler, CallEventHandlerEvent, CallEventHandlerEventHandlerMap } from "./webrtc/callEventHandler"; import { CallEventHandler, CallEventHandlerEvent, CallEventHandlerEventHandlerMap } from "./webrtc/callEventHandler.ts";
import { import {
GroupCallEventHandler, GroupCallEventHandler,
GroupCallEventHandlerEvent, GroupCallEventHandlerEvent,
GroupCallEventHandlerEventHandlerMap, GroupCallEventHandlerEventHandlerMap,
} from "./webrtc/groupCallEventHandler"; } from "./webrtc/groupCallEventHandler.ts";
import * as utils from "./utils"; import * as utils from "./utils.ts";
import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./utils"; import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./utils.ts";
import { Direction, EventTimeline } from "./models/event-timeline"; import { Direction, EventTimeline } from "./models/event-timeline.ts";
import { IActionsObject, PushProcessor } from "./pushprocessor"; import { IActionsObject, PushProcessor } from "./pushprocessor.ts";
import { AutoDiscovery, AutoDiscoveryAction } from "./autodiscovery"; import { AutoDiscovery, AutoDiscoveryAction } from "./autodiscovery.ts";
import * as olmlib from "./crypto/olmlib"; import * as olmlib from "./crypto/olmlib.ts";
import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64"; import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64.ts";
import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice"; import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice.ts";
import { IOlmDevice } from "./crypto/algorithms/megolm"; import { IOlmDevice } from "./crypto/algorithms/megolm.ts";
import { TypedReEmitter } from "./ReEmitter"; import { TypedReEmitter } from "./ReEmitter.ts";
import { IRoomEncryption } from "./crypto/RoomList"; import { IRoomEncryption } from "./crypto/RoomList.ts";
import { logger, Logger } from "./logger"; import { logger, Logger } from "./logger.ts";
import { SERVICE_TYPES } from "./service-types"; import { SERVICE_TYPES } from "./service-types.ts";
import { import {
Body, Body,
ClientPrefix, ClientPrefix,
@@ -73,7 +73,7 @@ import {
Upload, Upload,
UploadOpts, UploadOpts,
UploadResponse, UploadResponse,
} from "./http-api"; } from "./http-api/index.ts";
import { import {
Crypto, Crypto,
CryptoEvent, CryptoEvent,
@@ -83,14 +83,14 @@ import {
ICryptoCallbacks, ICryptoCallbacks,
IRoomKeyRequestBody, IRoomKeyRequestBody,
isCryptoAvailable, isCryptoAvailable,
} from "./crypto"; } from "./crypto/index.ts";
import { DeviceInfo } from "./crypto/deviceinfo"; import { DeviceInfo } from "./crypto/deviceinfo.ts";
import { decodeRecoveryKey } from "./crypto/recoverykey"; import { decodeRecoveryKey } from "./crypto/recoverykey.ts";
import { keyFromAuthData } from "./crypto/key_passphrase"; import { keyFromAuthData } from "./crypto/key_passphrase.ts";
import { User, UserEvent, UserEventHandlerMap } from "./models/user"; import { User, UserEvent, UserEventHandlerMap } from "./models/user.ts";
import { getHttpUriForMxc } from "./content-repo"; import { getHttpUriForMxc } from "./content-repo.ts";
import { SearchResult } from "./models/search-result"; import { SearchResult } from "./models/search-result.ts";
import { DEHYDRATION_ALGORITHM, IDehydratedDevice, IDehydratedDeviceKeyInfo } from "./crypto/dehydration"; import { DEHYDRATION_ALGORITHM, IDehydratedDevice, IDehydratedDeviceKeyInfo } from "./crypto/dehydration.ts";
import { import {
IKeyBackupInfo, IKeyBackupInfo,
IKeyBackupPrepareOpts, IKeyBackupPrepareOpts,
@@ -98,21 +98,21 @@ import {
IKeyBackupRestoreResult, IKeyBackupRestoreResult,
IKeyBackupRoomSessions, IKeyBackupRoomSessions,
IKeyBackupSession, IKeyBackupSession,
} from "./crypto/keybackup"; } from "./crypto/keybackup.ts";
import { IIdentityServerProvider } from "./@types/IIdentityServerProvider"; import { IIdentityServerProvider } from "./@types/IIdentityServerProvider.ts";
import { MatrixScheduler } from "./scheduler"; import { MatrixScheduler } from "./scheduler.ts";
import { BeaconEvent, BeaconEventHandlerMap } from "./models/beacon"; import { BeaconEvent, BeaconEventHandlerMap } from "./models/beacon.ts";
import { AuthDict } from "./interactive-auth"; import { AuthDict } from "./interactive-auth.ts";
import { IMinimalEvent, IRoomEvent, IStateEvent } from "./sync-accumulator"; import { IMinimalEvent, IRoomEvent, IStateEvent } from "./sync-accumulator.ts";
import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./crypto/api"; import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./crypto/api.ts";
import { EventTimelineSet } from "./models/event-timeline-set"; import { EventTimelineSet } from "./models/event-timeline-set.ts";
import { VerificationRequest } from "./crypto/verification/request/VerificationRequest"; import { VerificationRequest } from "./crypto/verification/request/VerificationRequest.ts";
import { VerificationBase as Verification } from "./crypto/verification/Base"; import { VerificationBase as Verification } from "./crypto/verification/Base.ts";
import * as ContentHelpers from "./content-helpers"; import * as ContentHelpers from "./content-helpers.ts";
import { CrossSigningInfo, DeviceTrustLevel, ICacheCallbacks, UserTrustLevel } from "./crypto/CrossSigning"; import { CrossSigningInfo, DeviceTrustLevel, ICacheCallbacks, UserTrustLevel } from "./crypto/CrossSigning.ts";
import { NotificationCountType, Room, RoomEvent, RoomEventHandlerMap, RoomNameState } from "./models/room"; import { NotificationCountType, Room, RoomEvent, RoomEventHandlerMap, RoomNameState } from "./models/room.ts";
import { RoomMemberEvent, RoomMemberEventHandlerMap } from "./models/room-member"; import { RoomMemberEvent, RoomMemberEventHandlerMap } from "./models/room-member.ts";
import { IPowerLevelsContent, RoomStateEvent, RoomStateEventHandlerMap } from "./models/room-state"; import { IPowerLevelsContent, RoomStateEvent, RoomStateEventHandlerMap } from "./models/room-state.ts";
import { import {
DelayedEventInfo, DelayedEventInfo,
IAddThreePidOnlyBody, IAddThreePidOnlyBody,
@@ -138,7 +138,7 @@ import {
SendDelayedEventRequestOpts, SendDelayedEventRequestOpts,
SendDelayedEventResponse, SendDelayedEventResponse,
UpdateDelayedEventAction, UpdateDelayedEventAction,
} from "./@types/requests"; } from "./@types/requests.ts";
import { import {
EventType, EventType,
LOCAL_NOTIFICATION_SETTINGS_PREFIX, LOCAL_NOTIFICATION_SETTINGS_PREFIX,
@@ -153,15 +153,22 @@ import {
UNSTABLE_MSC3088_ENABLED, UNSTABLE_MSC3088_ENABLED,
UNSTABLE_MSC3088_PURPOSE, UNSTABLE_MSC3088_PURPOSE,
UNSTABLE_MSC3089_TREE_SUBTYPE, UNSTABLE_MSC3089_TREE_SUBTYPE,
} from "./@types/event"; } from "./@types/event.ts";
import { GuestAccess, HistoryVisibility, IdServerUnbindResult, JoinRule, Preset, Visibility } from "./@types/partials"; import {
import { EventMapper, eventMapperFor, MapperOpts } from "./event-mapper"; GuestAccess,
import { randomString } from "./randomstring"; HistoryVisibility,
import { BackupManager, IKeyBackup, IKeyBackupCheck, IPreparedKeyBackupVersion, TrustInfo } from "./crypto/backup"; IdServerUnbindResult,
import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace"; JoinRule,
import { ISignatures } from "./@types/signed"; Preset,
import { IStore } from "./store"; Visibility,
import { ISecretRequest } from "./crypto/SecretStorage"; } from "./@types/partials.ts";
import { EventMapper, eventMapperFor, MapperOpts } from "./event-mapper.ts";
import { randomString } from "./randomstring.ts";
import { BackupManager, IKeyBackup, IKeyBackupCheck, IPreparedKeyBackupVersion, TrustInfo } from "./crypto/backup.ts";
import { DEFAULT_TREE_POWER_LEVELS_TEMPLATE, MSC3089TreeSpace } from "./models/MSC3089TreeSpace.ts";
import { ISignatures } from "./@types/signed.ts";
import { IStore } from "./store/index.ts";
import { ISecretRequest } from "./crypto/SecretStorage.ts";
import { import {
IEventWithRoomId, IEventWithRoomId,
ISearchRequestBody, ISearchRequestBody,
@@ -169,9 +176,9 @@ import {
ISearchResults, ISearchResults,
IStateEventWithRoomId, IStateEventWithRoomId,
SearchOrderBy, SearchOrderBy,
} from "./@types/search"; } from "./@types/search.ts";
import { ISynapseAdminDeactivateResponse, ISynapseAdminWhoisResponse } from "./@types/synapse"; import { ISynapseAdminDeactivateResponse, ISynapseAdminWhoisResponse } from "./@types/synapse.ts";
import { IHierarchyRoom } from "./@types/spaces"; import { IHierarchyRoom } from "./@types/spaces.ts";
import { import {
IPusher, IPusher,
IPusherRequest, IPusherRequest,
@@ -181,11 +188,11 @@ import {
PushRuleActionName, PushRuleActionName,
PushRuleKind, PushRuleKind,
RuleId, RuleId,
} from "./@types/PushRules"; } from "./@types/PushRules.ts";
import { IThreepid } from "./@types/threepids"; import { IThreepid } from "./@types/threepids.ts";
import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base"; import { CryptoStore, OutgoingRoomKeyRequest } from "./crypto/store/base.ts";
import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall"; import { GroupCall, GroupCallIntent, GroupCallType, IGroupCallDataChannelOptions } from "./webrtc/groupCall.ts";
import { MediaHandler } from "./webrtc/mediaHandler"; import { MediaHandler } from "./webrtc/mediaHandler.ts";
import { import {
ILoginFlowsResponse, ILoginFlowsResponse,
IRefreshTokenResponse, IRefreshTokenResponse,
@@ -193,11 +200,11 @@ import {
LoginResponse, LoginResponse,
LoginTokenPostResponse, LoginTokenPostResponse,
SSOAction, SSOAction,
} from "./@types/auth"; } from "./@types/auth.ts";
import { TypedEventEmitter } from "./models/typed-event-emitter"; import { TypedEventEmitter } from "./models/typed-event-emitter.ts";
import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts"; import { MAIN_ROOM_TIMELINE, ReceiptType } from "./@types/read_receipts.ts";
import { MSC3575SlidingSyncRequest, MSC3575SlidingSyncResponse, SlidingSync } from "./sliding-sync"; import { MSC3575SlidingSyncRequest, MSC3575SlidingSyncResponse, SlidingSync } from "./sliding-sync.ts";
import { SlidingSyncSdk } from "./sliding-sync-sdk"; import { SlidingSyncSdk } from "./sliding-sync-sdk.ts";
import { import {
determineFeatureSupport, determineFeatureSupport,
FeatureSupport, FeatureSupport,
@@ -205,33 +212,33 @@ import {
THREAD_RELATION_TYPE, THREAD_RELATION_TYPE,
ThreadFilterType, ThreadFilterType,
threadFilterTypeToFilter, threadFilterTypeToFilter,
} from "./models/thread"; } from "./models/thread.ts";
import { M_BEACON_INFO, MBeaconInfoEventContent } from "./@types/beacon"; import { M_BEACON_INFO, MBeaconInfoEventContent } from "./@types/beacon.ts";
import { NamespacedValue, UnstableValue } from "./NamespacedValue"; import { NamespacedValue, UnstableValue } from "./NamespacedValue.ts";
import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue"; import { ToDeviceMessageQueue } from "./ToDeviceMessageQueue.ts";
import { ToDeviceBatch } from "./models/ToDeviceMessage"; import { ToDeviceBatch } from "./models/ToDeviceMessage.ts";
import { IgnoredInvites } from "./models/invites-ignorer"; import { IgnoredInvites } from "./models/invites-ignorer.ts";
import { UIARequest, UIAResponse } from "./@types/uia"; import { UIARequest, UIAResponse } from "./@types/uia.ts";
import { LocalNotificationSettings } from "./@types/local_notifications"; import { LocalNotificationSettings } from "./@types/local_notifications.ts";
import { buildFeatureSupportMap, Feature, ServerSupport } from "./feature"; import { buildFeatureSupportMap, Feature, ServerSupport } from "./feature.ts";
import { BackupDecryptor, CryptoBackend } from "./common-crypto/CryptoBackend"; import { BackupDecryptor, CryptoBackend } from "./common-crypto/CryptoBackend.ts";
import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants"; import { RUST_SDK_STORE_PREFIX } from "./rust-crypto/constants.ts";
import { BootstrapCrossSigningOpts, CrossSigningKeyInfo, CryptoApi, ImportRoomKeysOpts } from "./crypto-api"; import { BootstrapCrossSigningOpts, CrossSigningKeyInfo, CryptoApi, ImportRoomKeysOpts } from "./crypto-api/index.ts";
import { DeviceInfoMap } from "./crypto/DeviceList"; import { DeviceInfoMap } from "./crypto/DeviceList.ts";
import { import {
AddSecretStorageKeyOpts, AddSecretStorageKeyOpts,
SecretStorageKeyDescription, SecretStorageKeyDescription,
ServerSideSecretStorage, ServerSideSecretStorage,
ServerSideSecretStorageImpl, ServerSideSecretStorageImpl,
} from "./secret-storage"; } from "./secret-storage.ts";
import { RegisterRequest, RegisterResponse } from "./@types/registration"; import { RegisterRequest, RegisterResponse } from "./@types/registration.ts";
import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager"; import { MatrixRTCSessionManager } from "./matrixrtc/MatrixRTCSessionManager.ts";
import { getRelationsThreadFilter } from "./thread-utils"; import { getRelationsThreadFilter } from "./thread-utils.ts";
import { KnownMembership, Membership } from "./@types/membership"; import { KnownMembership, Membership } from "./@types/membership.ts";
import { RoomMessageEventContent, StickerEventContent } from "./@types/events"; import { RoomMessageEventContent, StickerEventContent } from "./@types/events.ts";
import { ImageInfo } from "./@types/media"; import { ImageInfo } from "./@types/media.ts";
import { Capabilities, ServerCapabilities } from "./serverCapabilities"; import { Capabilities, ServerCapabilities } from "./serverCapabilities.ts";
import { sha256 } from "./digest"; import { sha256 } from "./digest.ts";
export type Store = IStore; export type Store = IStore;

View File

@@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator"; import type { IDeviceLists, IToDeviceEvent } from "../sync-accumulator.ts";
import { IClearEvent, MatrixEvent } from "../models/event"; import { IClearEvent, MatrixEvent } from "../models/event.ts";
import { Room } from "../models/room"; import { Room } from "../models/room.ts";
import { CryptoApi, DecryptionFailureCode, ImportRoomKeysOpts } from "../crypto-api"; import { CryptoApi, DecryptionFailureCode, ImportRoomKeysOpts } from "../crypto-api/index.ts";
import { CrossSigningInfo, UserTrustLevel } from "../crypto/CrossSigning"; import { CrossSigningInfo, UserTrustLevel } from "../crypto/CrossSigning.ts";
import { IEncryptedEventInfo } from "../crypto/api"; import { IEncryptedEventInfo } from "../crypto/api.ts";
import { KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup"; import { KeyBackupInfo, KeyBackupSession } from "../crypto-api/keybackup.ts";
import { IMegolmSessionData } from "../@types/crypto"; import { IMegolmSessionData } from "../@types/crypto.ts";
/** /**
* Common interface for the crypto implementations * Common interface for the crypto implementations

View File

@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MBeaconEventContent, MBeaconInfoContent, MBeaconInfoEventContent } from "./@types/beacon"; import { MBeaconEventContent, MBeaconInfoContent, MBeaconInfoEventContent } from "./@types/beacon.ts";
import { MsgType } from "./@types/event"; import { MsgType } from "./@types/event.ts";
import { M_TEXT, REFERENCE_RELATION } from "./@types/extensible_events"; import { M_TEXT, REFERENCE_RELATION } from "./@types/extensible_events.ts";
import { isProvided } from "./extensible_events_v1/utilities"; import { isProvided } from "./extensible_events_v1/utilities.ts";
import { import {
M_ASSET, M_ASSET,
LocationAssetType, LocationAssetType,
@@ -28,9 +28,9 @@ import {
MLocationContent, MLocationContent,
MAssetContent, MAssetContent,
LegacyLocationEventContent, LegacyLocationEventContent,
} from "./@types/location"; } from "./@types/location.ts";
import { MRoomTopicEventContent, MTopicContent, M_TOPIC } from "./@types/topic"; import { MRoomTopicEventContent, MTopicContent, M_TOPIC } from "./@types/topic.ts";
import { RoomMessageEventContent } from "./@types/events"; import { RoomMessageEventContent } from "./@types/events.ts";
/** /**
* Generates the content for a HTML Message event * Generates the content for a HTML Message event

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { encodeParams } from "./utils"; import { encodeParams } from "./utils.ts";
/** /**
* Get the HTTP URL for an MXC URI. * Get the HTTP URL for an MXC URI.

View File

@@ -15,15 +15,15 @@ limitations under the License.
*/ */
import type { SecretsBundle } from "@matrix-org/matrix-sdk-crypto-wasm"; import type { SecretsBundle } from "@matrix-org/matrix-sdk-crypto-wasm";
import type { IMegolmSessionData } from "../@types/crypto"; import type { IMegolmSessionData } from "../@types/crypto.ts";
import { Room } from "../models/room"; import { Room } from "../models/room.ts";
import { DeviceMap } from "../models/device"; import { DeviceMap } from "../models/device.ts";
import { UIAuthCallback } from "../interactive-auth"; import { UIAuthCallback } from "../interactive-auth.ts";
import { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from "../secret-storage"; import { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from "../secret-storage.ts";
import { VerificationRequest } from "./verification"; import { VerificationRequest } from "./verification.ts";
import { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from "./keybackup"; import { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from "./keybackup.ts";
import { ISignatures } from "../@types/signed"; import { ISignatures } from "../@types/signed.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
/** /**
* Public interface to the cryptography parts of the js-sdk * Public interface to the cryptography parts of the js-sdk
@@ -965,5 +965,5 @@ export interface OwnDeviceKeys {
curve25519: string; curve25519: string;
} }
export * from "./verification"; export * from "./verification.ts";
export * from "./keybackup"; export * from "./keybackup.ts";

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ISigned } from "../@types/signed"; import { ISigned } from "../@types/signed.ts";
import { IEncryptedPayload } from "../crypto/aes"; import { IEncryptedPayload } from "../crypto/aes.ts";
export interface Curve25519AuthData { export interface Curve25519AuthData {
public_key: string; public_key: string;

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
/** /**
* An incoming, or outgoing, request to verify a user or a device via cross-signing. * An incoming, or outgoing, request to verify a user or a device via cross-signing.

View File

@@ -19,19 +19,23 @@ limitations under the License.
*/ */
import type { PkSigning } from "@matrix-org/olm"; import type { PkSigning } from "@matrix-org/olm";
import { IObject, pkSign, pkVerify } from "./olmlib"; import { IObject, pkSign, pkVerify } from "./olmlib.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts";
import { decryptAES, encryptAES } from "./aes"; import { decryptAES, encryptAES } from "./aes.ts";
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo.ts";
import { ISignedKey, MatrixClient } from "../client"; import { ISignedKey, MatrixClient } from "../client.ts";
import { OlmDevice } from "./OlmDevice"; import { OlmDevice } from "./OlmDevice.ts";
import { ICryptoCallbacks } from "."; import { ICryptoCallbacks } from "./index.ts";
import { ISignatures } from "../@types/signed"; import { ISignatures } from "../@types/signed.ts";
import { CryptoStore, SecretStorePrivateKeys } from "./store/base"; import { CryptoStore, SecretStorePrivateKeys } from "./store/base.ts";
import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage"; import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage.ts";
import { CrossSigningKeyInfo, DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api"; import {
import { decodeBase64, encodeBase64 } from "../base64"; CrossSigningKeyInfo,
DeviceVerificationStatus,
UserVerificationStatus as UserTrustLevel,
} from "../crypto-api/index.ts";
import { decodeBase64, encodeBase64 } from "../base64.ts";
// backwards-compatibility re-exports // backwards-compatibility re-exports
export { UserTrustLevel }; export { UserTrustLevel };

View File

@@ -18,17 +18,17 @@ limitations under the License.
* Manages the list of other users' devices * Manages the list of other users' devices
*/ */
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { DeviceInfo, IDevice } from "./deviceinfo"; import { DeviceInfo, IDevice } from "./deviceinfo.ts";
import { CrossSigningInfo, ICrossSigningInfo } from "./CrossSigning"; import { CrossSigningInfo, ICrossSigningInfo } from "./CrossSigning.ts";
import * as olmlib from "./olmlib"; import * as olmlib from "./olmlib.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
import { chunkPromises, defer, IDeferred, sleep } from "../utils"; import { chunkPromises, defer, IDeferred, sleep } from "../utils.ts";
import { DeviceKeys, IDownloadKeyResult, Keys, MatrixClient, SigningKeys } from "../client"; import { DeviceKeys, IDownloadKeyResult, Keys, MatrixClient, SigningKeys } from "../client.ts";
import { OlmDevice } from "./OlmDevice"; import { OlmDevice } from "./OlmDevice.ts";
import { CryptoStore } from "./store/base"; import { CryptoStore } from "./store/base.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { CryptoEvent, CryptoEventHandlerMap } from "./index"; import { CryptoEvent, CryptoEventHandlerMap } from "./index.ts";
/* State transition diagram for DeviceList.deviceTrackingStatus /* State transition diagram for DeviceList.deviceTrackingStatus
* *

View File

@@ -14,17 +14,17 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning"; import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
import { Method, ClientPrefix } from "../http-api"; import { Method, ClientPrefix } from "../http-api/index.ts";
import { Crypto, ICryptoCallbacks } from "./index"; import { Crypto, ICryptoCallbacks } from "./index.ts";
import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client"; import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client.ts";
import { IKeyBackupInfo } from "./keybackup"; import { IKeyBackupInfo } from "./keybackup.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage"; import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage.ts";
import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api"; import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api/index.ts";
interface ICrossSigningKeys { interface ICrossSigningKeys {
authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"]; authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"];

View File

@@ -16,14 +16,14 @@ limitations under the License.
import { Account, InboundGroupSession, OutboundGroupSession, Session, Utility } from "@matrix-org/olm"; import { Account, InboundGroupSession, OutboundGroupSession, Session, Utility } from "@matrix-org/olm";
import { logger, Logger } from "../logger"; import { logger, Logger } from "../logger.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
import { CryptoStore, IProblem, ISessionInfo, IWithheld } from "./store/base"; import { CryptoStore, IProblem, ISessionInfo, IWithheld } from "./store/base.ts";
import { IOlmDevice, IOutboundGroupSessionKey } from "./algorithms/megolm"; import { IOlmDevice, IOutboundGroupSessionKey } from "./algorithms/megolm.ts";
import { IMegolmSessionData, OlmGroupSessionExtraData } from "../@types/crypto"; import { IMegolmSessionData, OlmGroupSessionExtraData } from "../@types/crypto.ts";
import { IMessage } from "./algorithms/olm"; import { IMessage } from "./algorithms/olm.ts";
import { DecryptionFailureCode } from "../crypto-api"; import { DecryptionFailureCode } from "../crypto-api/index.ts";
import { DecryptionError } from "../common-crypto/CryptoBackend"; import { DecryptionError } from "../common-crypto/CryptoBackend.ts";
// The maximum size of an event is 65K, and we base64 the content, so this is a // The maximum size of an event is 65K, and we base64 the content, so this is a
// reasonable approximation to the biggest plaintext we can encrypt. // reasonable approximation to the biggest plaintext we can encrypt.

View File

@@ -16,12 +16,12 @@ limitations under the License.
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "./index"; import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "./index.ts";
import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base"; import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base.ts";
import { EventType, ToDeviceMessageId } from "../@types/event"; import { EventType, ToDeviceMessageId } from "../@types/event.ts";
import { MapWithDefault } from "../utils"; import { MapWithDefault } from "../utils.ts";
/** /**
* Internal module. Management of outgoing room key requests. * Internal module. Management of outgoing room key requests.

View File

@@ -18,8 +18,8 @@ limitations under the License.
* Manages the list of encrypted rooms * Manages the list of encrypted rooms
*/ */
import { CryptoStore } from "./store/base"; import { CryptoStore } from "./store/base.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
/* eslint-disable camelcase */ /* eslint-disable camelcase */
export interface IRoomEncryption { export interface IRoomEncryption {

View File

@@ -15,13 +15,13 @@ limitations under the License.
*/ */
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { ICryptoCallbacks, IEncryptedContent } from "./index"; import { ICryptoCallbacks, IEncryptedContent } from "./index.ts";
import { defer, IDeferred } from "../utils"; import { defer, IDeferred } from "../utils.ts";
import { ToDeviceMessageId } from "../@types/event"; import { ToDeviceMessageId } from "../@types/event.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import * as olmlib from "./olmlib"; import * as olmlib from "./olmlib.ts";
export interface ISecretRequest { export interface ISecretRequest {
requestId: string; requestId: string;

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ICryptoCallbacks } from "."; import { ICryptoCallbacks } from "./index.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { import {
SecretStorageKeyDescription, SecretStorageKeyDescription,
SecretStorageKeyTuple, SecretStorageKeyTuple,
@@ -25,8 +25,8 @@ import {
AccountDataClient, AccountDataClient,
ServerSideSecretStorage, ServerSideSecretStorage,
ServerSideSecretStorageImpl, ServerSideSecretStorageImpl,
} from "../secret-storage"; } from "../secret-storage.ts";
import { ISecretRequest, SecretSharing } from "./SecretSharing"; import { ISecretRequest, SecretSharing } from "./SecretSharing.ts";
/* re-exports for backwards compatibility */ /* re-exports for backwards compatibility */
export type { export type {
@@ -34,9 +34,9 @@ export type {
SecretStorageKeyTuple, SecretStorageKeyTuple,
SecretStorageKeyObject, SecretStorageKeyObject,
SECRET_STORAGE_ALGORITHM_V1_AES, SECRET_STORAGE_ALGORITHM_V1_AES,
} from "../secret-storage"; } from "../secret-storage.ts";
export type { ISecretRequest } from "./SecretSharing"; export type { ISecretRequest } from "./SecretSharing.ts";
/** /**
* Implements Secure Secret Storage and Sharing (MSC1946) * Implements Secure Secret Storage and Sharing (MSC1946)

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { decodeBase64, encodeBase64 } from "../base64"; import { decodeBase64, encodeBase64 } from "../base64.ts";
// salt for HKDF, with 8 bytes of zeros // salt for HKDF, with 8 bytes of zeros
const zeroSalt = new Uint8Array(8); const zeroSalt = new Uint8Array(8);

View File

@@ -18,15 +18,15 @@ limitations under the License.
* Internal module. Defines the base classes of the encryption implementations * Internal module. Defines the base classes of the encryption implementations
*/ */
import type { IMegolmSessionData } from "../../@types/crypto"; import type { IMegolmSessionData } from "../../@types/crypto.ts";
import { MatrixClient } from "../../client"; import { MatrixClient } from "../../client.ts";
import { Room } from "../../models/room"; import { Room } from "../../models/room.ts";
import { OlmDevice } from "../OlmDevice"; import { OlmDevice } from "../OlmDevice.ts";
import { IContent, MatrixEvent, RoomMember } from "../../matrix"; import { IContent, MatrixEvent, RoomMember } from "../../matrix.ts";
import { Crypto, IEncryptedContent, IEventDecryptionResult, IncomingRoomKeyRequest } from ".."; import { Crypto, IEncryptedContent, IEventDecryptionResult, IncomingRoomKeyRequest } from "../index.ts";
import { DeviceInfo } from "../deviceinfo"; import { DeviceInfo } from "../deviceinfo.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { DeviceInfoMap } from "../DeviceList"; import { DeviceInfoMap } from "../DeviceList.ts";
/** /**
* Map of registered encryption algorithm classes. A map from string to {@link EncryptionAlgorithm} class * Map of registered encryption algorithm classes. A map from string to {@link EncryptionAlgorithm} class
@@ -233,4 +233,4 @@ export function registerAlgorithm<P extends IParams = IParams>(
} }
/* Re-export for backwards compatibility. Deprecated: this is an internal class. */ /* Re-export for backwards compatibility. Deprecated: this is an internal class. */
export { DecryptionError } from "../../common-crypto/CryptoBackend"; export { DecryptionError } from "../../common-crypto/CryptoBackend.ts";

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import "./olm"; import "./olm.ts";
import "./megolm"; import "./megolm.ts";
export * from "./base"; export * from "./base.ts";

View File

@@ -20,9 +20,9 @@ limitations under the License.
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import type { IEventDecryptionResult, IMegolmSessionData } from "../../@types/crypto"; import type { IEventDecryptionResult, IMegolmSessionData } from "../../@types/crypto.ts";
import { logger, Logger } from "../../logger"; import { logger, Logger } from "../../logger.ts";
import * as olmlib from "../olmlib"; import * as olmlib from "../olmlib.ts";
import { import {
DecryptionAlgorithm, DecryptionAlgorithm,
DecryptionClassParams, DecryptionClassParams,
@@ -30,22 +30,22 @@ import {
IParams, IParams,
registerAlgorithm, registerAlgorithm,
UnknownDeviceError, UnknownDeviceError,
} from "./base"; } from "./base.ts";
import { IDecryptedGroupMessage, WITHHELD_MESSAGES } from "../OlmDevice"; import { IDecryptedGroupMessage, WITHHELD_MESSAGES } from "../OlmDevice.ts";
import { Room } from "../../models/room"; import { Room } from "../../models/room.ts";
import { DeviceInfo } from "../deviceinfo"; import { DeviceInfo } from "../deviceinfo.ts";
import { IOlmSessionResult } from "../olmlib"; import { IOlmSessionResult } from "../olmlib.ts";
import { DeviceInfoMap } from "../DeviceList"; import { DeviceInfoMap } from "../DeviceList.ts";
import { IContent, MatrixEvent } from "../../models/event"; import { IContent, MatrixEvent } from "../../models/event.ts";
import { EventType, MsgType, ToDeviceMessageId } from "../../@types/event"; import { EventType, MsgType, ToDeviceMessageId } from "../../@types/event.ts";
import { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from "../index"; import { IMegolmEncryptedContent, IncomingRoomKeyRequest, IEncryptedContent } from "../index.ts";
import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager"; import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts";
import { OlmGroupSessionExtraData } from "../../@types/crypto"; import { OlmGroupSessionExtraData } from "../../@types/crypto.ts";
import { MatrixError } from "../../http-api"; import { MatrixError } from "../../http-api/index.ts";
import { immediate, MapWithDefault } from "../../utils"; import { immediate, MapWithDefault } from "../../utils.ts";
import { KnownMembership } from "../../@types/membership"; import { KnownMembership } from "../../@types/membership.ts";
import { DecryptionFailureCode } from "../../crypto-api"; import { DecryptionFailureCode } from "../../crypto-api/index.ts";
import { DecryptionError } from "../../common-crypto/CryptoBackend"; import { DecryptionError } from "../../common-crypto/CryptoBackend.ts";
// determine whether the key can be shared with invitees // determine whether the key can be shared with invitees
export function isRoomSharedHistory(room: Room): boolean { export function isRoomSharedHistory(room: Room): boolean {

View File

@@ -18,17 +18,17 @@ limitations under the License.
* Defines m.olm encryption/decryption * Defines m.olm encryption/decryption
*/ */
import type { IEventDecryptionResult } from "../../@types/crypto"; import type { IEventDecryptionResult } from "../../@types/crypto.ts";
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import * as olmlib from "../olmlib"; import * as olmlib from "../olmlib.ts";
import { DeviceInfo } from "../deviceinfo"; import { DeviceInfo } from "../deviceinfo.ts";
import { DecryptionAlgorithm, EncryptionAlgorithm, registerAlgorithm } from "./base"; import { DecryptionAlgorithm, EncryptionAlgorithm, registerAlgorithm } from "./base.ts";
import { Room } from "../../models/room"; import { Room } from "../../models/room.ts";
import { IContent, MatrixEvent } from "../../models/event"; import { IContent, MatrixEvent } from "../../models/event.ts";
import { IEncryptedContent, IOlmEncryptedContent } from "../index"; import { IEncryptedContent, IOlmEncryptedContent } from "../index.ts";
import { IInboundSession } from "../OlmDevice"; import { IInboundSession } from "../OlmDevice.ts";
import { DecryptionFailureCode } from "../../crypto-api"; import { DecryptionFailureCode } from "../../crypto-api/index.ts";
import { DecryptionError } from "../../common-crypto/CryptoBackend"; import { DecryptionError } from "../../common-crypto/CryptoBackend.ts";
const DeviceVerification = DeviceInfo.DeviceVerification; const DeviceVerification = DeviceInfo.DeviceVerification;

View File

@@ -14,26 +14,26 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo.ts";
/* re-exports for backwards compatibility. */ /* re-exports for backwards compatibility. */
// CrossSigningKey is used as a value in `client.ts`, we can't export it as a type // CrossSigningKey is used as a value in `client.ts`, we can't export it as a type
export { CrossSigningKey } from "../crypto-api"; export { CrossSigningKey } from "../crypto-api/index.ts";
export type { export type {
GeneratedSecretStorageKey as IRecoveryKey, GeneratedSecretStorageKey as IRecoveryKey,
CreateSecretStorageOpts as ICreateSecretStorageOpts, CreateSecretStorageOpts as ICreateSecretStorageOpts,
} from "../crypto-api"; } from "../crypto-api/index.ts";
export type { export type {
ImportRoomKeyProgressData as IImportOpts, ImportRoomKeyProgressData as IImportOpts,
ImportRoomKeysOpts as IImportRoomKeysOpts, ImportRoomKeysOpts as IImportRoomKeysOpts,
} from "../crypto-api"; } from "../crypto-api/index.ts";
export type { export type {
AddSecretStorageKeyOpts as IAddSecretStorageKeyOpts, AddSecretStorageKeyOpts as IAddSecretStorageKeyOpts,
PassphraseInfo as IPassphraseInfo, PassphraseInfo as IPassphraseInfo,
SecretStorageKeyDescription as ISecretStorageKeyInfo, SecretStorageKeyDescription as ISecretStorageKeyInfo,
} from "../secret-storage"; } from "../secret-storage.ts";
// TODO: Merge this with crypto.js once converted // TODO: Merge this with crypto.js once converted

View File

@@ -18,29 +18,29 @@ limitations under the License.
* Classes for dealing with key backup. * Classes for dealing with key backup.
*/ */
import type { IMegolmSessionData } from "../@types/crypto"; import type { IMegolmSessionData } from "../@types/crypto.ts";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { MEGOLM_ALGORITHM, verifySignature } from "./olmlib"; import { MEGOLM_ALGORITHM, verifySignature } from "./olmlib.ts";
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo.ts";
import { DeviceTrustLevel } from "./CrossSigning"; import { DeviceTrustLevel } from "./CrossSigning.ts";
import { keyFromPassphrase } from "./key_passphrase"; import { keyFromPassphrase } from "./key_passphrase.ts";
import { encodeUri, safeSet, sleep } from "../utils"; import { encodeUri, safeSet, sleep } from "../utils.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
import { encodeRecoveryKey } from "./recoverykey"; import { encodeRecoveryKey } from "./recoverykey.ts";
import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes"; import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes.ts";
import { import {
Curve25519SessionData, Curve25519SessionData,
IAes256AuthData, IAes256AuthData,
ICurve25519AuthData, ICurve25519AuthData,
IKeyBackupInfo, IKeyBackupInfo,
IKeyBackupSession, IKeyBackupSession,
} from "./keybackup"; } from "./keybackup.ts";
import { UnstableValue } from "../NamespacedValue"; import { UnstableValue } from "../NamespacedValue.ts";
import { CryptoEvent } from "./index"; import { CryptoEvent } from "./index.ts";
import { ClientPrefix, HTTPError, MatrixError, Method } from "../http-api"; import { ClientPrefix, HTTPError, MatrixError, Method } from "../http-api/index.ts";
import { BackupTrustInfo } from "../crypto-api/keybackup"; import { BackupTrustInfo } from "../crypto-api/keybackup.ts";
import { BackupDecryptor } from "../common-crypto/CryptoBackend"; import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
const KEY_BACKUP_KEYS_PER_REQUEST = 200; const KEY_BACKUP_KEYS_PER_REQUEST = 200;
const KEY_BACKUP_CHECK_RATE_LIMIT = 5000; // ms const KEY_BACKUP_CHECK_RATE_LIMIT = 5000; // ms

View File

@@ -16,14 +16,14 @@ limitations under the License.
import anotherjson from "another-json"; import anotherjson from "another-json";
import type { IDeviceKeys, IOneTimeKey } from "../@types/crypto"; import type { IDeviceKeys, IOneTimeKey } from "../@types/crypto.ts";
import { decodeBase64, encodeBase64 } from "../base64"; import { decodeBase64, encodeBase64 } from "../base64.ts";
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts";
import { decryptAES, encryptAES } from "./aes"; import { decryptAES, encryptAES } from "./aes.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { Crypto } from "./index"; import { Crypto } from "./index.ts";
import { Method } from "../http-api"; import { Method } from "../http-api/index.ts";
import { SecretStorageKeyDescription } from "../secret-storage"; import { SecretStorageKeyDescription } from "../secret-storage.ts";
export interface IDehydratedDevice { export interface IDehydratedDevice {
device_id: string; // eslint-disable-line camelcase device_id: string; // eslint-disable-line camelcase

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { Device } from "../models/device"; import { Device } from "../models/device.ts";
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo.ts";
/** /**
* Convert a {@link DeviceInfo} to a {@link Device}. * Convert a {@link DeviceInfo} to a {@link Device}.

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ISignatures } from "../@types/signed"; import { ISignatures } from "../@types/signed.ts";
import { DeviceVerification } from "../models/device"; import { DeviceVerification } from "../models/device.ts";
export interface IDevice { export interface IDevice {
keys: Record<string, string>; keys: Record<string, string>;

View File

@@ -20,55 +20,60 @@ limitations under the License.
import anotherjson from "another-json"; import anotherjson from "another-json";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import type { IDeviceKeys, IEventDecryptionResult, IMegolmSessionData, IOneTimeKey } from "../@types/crypto"; import type { IDeviceKeys, IEventDecryptionResult, IMegolmSessionData, IOneTimeKey } from "../@types/crypto.ts";
import type { PkDecryption, PkSigning } from "@matrix-org/olm"; import type { PkDecryption, PkSigning } from "@matrix-org/olm";
import { EventType, ToDeviceMessageId } from "../@types/event"; import { EventType, ToDeviceMessageId } from "../@types/event.ts";
import { TypedReEmitter } from "../ReEmitter"; import { TypedReEmitter } from "../ReEmitter.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { IExportedDevice, OlmDevice } from "./OlmDevice"; import { IExportedDevice, OlmDevice } from "./OlmDevice.ts";
import { IOlmDevice } from "./algorithms/megolm"; import { IOlmDevice } from "./algorithms/megolm.ts";
import * as olmlib from "./olmlib"; import * as olmlib from "./olmlib.ts";
import { DeviceInfoMap, DeviceList } from "./DeviceList"; import { DeviceInfoMap, DeviceList } from "./DeviceList.ts";
import { DeviceInfo, IDevice } from "./deviceinfo"; import { DeviceInfo, IDevice } from "./deviceinfo.ts";
import type { DecryptionAlgorithm, EncryptionAlgorithm } from "./algorithms"; import type { DecryptionAlgorithm, EncryptionAlgorithm } from "./algorithms/index.ts";
import * as algorithms from "./algorithms"; import * as algorithms from "./algorithms/index.ts";
import { createCryptoStoreCacheCallbacks, CrossSigningInfo, DeviceTrustLevel, UserTrustLevel } from "./CrossSigning"; import { createCryptoStoreCacheCallbacks, CrossSigningInfo, DeviceTrustLevel, UserTrustLevel } from "./CrossSigning.ts";
import { EncryptionSetupBuilder } from "./EncryptionSetup"; import { EncryptionSetupBuilder } from "./EncryptionSetup.ts";
import { SecretStorage as LegacySecretStorage } from "./SecretStorage"; import { SecretStorage as LegacySecretStorage } from "./SecretStorage.ts";
import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./api"; import { CrossSigningKey, ICreateSecretStorageOpts, IEncryptedEventInfo, IRecoveryKey } from "./api.ts";
import { OutgoingRoomKeyRequestManager } from "./OutgoingRoomKeyRequestManager"; import { OutgoingRoomKeyRequestManager } from "./OutgoingRoomKeyRequestManager.ts";
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store.ts";
import { VerificationBase } from "./verification/Base"; import { VerificationBase } from "./verification/Base.ts";
import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from "./verification/QRCode"; import { ReciprocateQRCode, SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD } from "./verification/QRCode.ts";
import { SAS as SASVerification } from "./verification/SAS"; import { SAS as SASVerification } from "./verification/SAS.ts";
import { keyFromPassphrase } from "./key_passphrase"; import { keyFromPassphrase } from "./key_passphrase.ts";
import { decodeRecoveryKey, encodeRecoveryKey } from "./recoverykey"; import { decodeRecoveryKey, encodeRecoveryKey } from "./recoverykey.ts";
import { VerificationRequest } from "./verification/request/VerificationRequest"; import { VerificationRequest } from "./verification/request/VerificationRequest.ts";
import { InRoomChannel, InRoomRequests } from "./verification/request/InRoomChannel"; import { InRoomChannel, InRoomRequests } from "./verification/request/InRoomChannel.ts";
import { Request, ToDeviceChannel, ToDeviceRequests } from "./verification/request/ToDeviceChannel"; import { Request, ToDeviceChannel, ToDeviceRequests } from "./verification/request/ToDeviceChannel.ts";
import { IllegalMethod } from "./verification/IllegalMethod"; import { IllegalMethod } from "./verification/IllegalMethod.ts";
import { KeySignatureUploadError } from "../errors"; import { KeySignatureUploadError } from "../errors.ts";
import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes"; import { calculateKeyCheck, decryptAES, encryptAES, IEncryptedPayload } from "./aes.ts";
import { DehydrationManager } from "./dehydration"; import { DehydrationManager } from "./dehydration.ts";
import { BackupManager, LibOlmBackupDecryptor, backupTrustInfoFromLegacyTrustInfo } from "./backup"; import { BackupManager, LibOlmBackupDecryptor, backupTrustInfoFromLegacyTrustInfo } from "./backup.ts";
import { IStore } from "../store"; import { IStore } from "../store/index.ts";
import { Room, RoomEvent } from "../models/room"; import { Room, RoomEvent } from "../models/room.ts";
import { RoomMember, RoomMemberEvent } from "../models/room-member"; import { RoomMember, RoomMemberEvent } from "../models/room-member.ts";
import { EventStatus, IContent, IEvent, MatrixEvent, MatrixEventEvent } from "../models/event"; import { EventStatus, IContent, IEvent, MatrixEvent, MatrixEventEvent } from "../models/event.ts";
import { ToDeviceBatch } from "../models/ToDeviceMessage"; import { ToDeviceBatch } from "../models/ToDeviceMessage.ts";
import { ClientEvent, IKeysUploadResponse, ISignedKey, IUploadKeySignaturesResponse, MatrixClient } from "../client"; import { ClientEvent, IKeysUploadResponse, ISignedKey, IUploadKeySignaturesResponse, MatrixClient } from "../client.ts";
import { IRoomEncryption, RoomList } from "./RoomList"; import { IRoomEncryption, RoomList } from "./RoomList.ts";
import { IKeyBackupInfo } from "./keybackup"; import { IKeyBackupInfo } from "./keybackup.ts";
import { ISyncStateData } from "../sync"; import { ISyncStateData } from "../sync.ts";
import { CryptoStore } from "./store/base"; import { CryptoStore } from "./store/base.ts";
import { IVerificationChannel } from "./verification/request/Channel"; import { IVerificationChannel } from "./verification/request/Channel.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { IDeviceLists, ISyncResponse, IToDeviceEvent } from "../sync-accumulator"; import { IDeviceLists, ISyncResponse, IToDeviceEvent } from "../sync-accumulator.ts";
import { ISignatures } from "../@types/signed"; import { ISignatures } from "../@types/signed.ts";
import { IMessage } from "./algorithms/olm"; import { IMessage } from "./algorithms/olm.ts";
import { BackupDecryptor, CryptoBackend, DecryptionError, OnSyncCompletedData } from "../common-crypto/CryptoBackend"; import {
import { RoomState, RoomStateEvent } from "../models/room-state"; BackupDecryptor,
import { MapWithDefault, recursiveMapToObject } from "../utils"; CryptoBackend,
DecryptionError,
OnSyncCompletedData,
} from "../common-crypto/CryptoBackend.ts";
import { RoomState, RoomStateEvent } from "../models/room-state.ts";
import { MapWithDefault, recursiveMapToObject } from "../utils.ts";
import { import {
AccountDataClient, AccountDataClient,
AddSecretStorageKeyOpts, AddSecretStorageKeyOpts,
@@ -77,8 +82,8 @@ import {
SecretStorageKeyObject, SecretStorageKeyObject,
SecretStorageKeyTuple, SecretStorageKeyTuple,
ServerSideSecretStorageImpl, ServerSideSecretStorageImpl,
} from "../secret-storage"; } from "../secret-storage.ts";
import { ISecretRequest } from "./SecretSharing"; import { ISecretRequest } from "./SecretSharing.ts";
import { import {
BackupTrustInfo, BackupTrustInfo,
BootstrapCrossSigningOpts, BootstrapCrossSigningOpts,
@@ -94,18 +99,18 @@ import {
KeyBackupInfo, KeyBackupInfo,
OwnDeviceKeys, OwnDeviceKeys,
VerificationRequest as CryptoApiVerificationRequest, VerificationRequest as CryptoApiVerificationRequest,
} from "../crypto-api"; } from "../crypto-api/index.ts";
import { Device, DeviceMap } from "../models/device"; import { Device, DeviceMap } from "../models/device.ts";
import { deviceInfoToDevice } from "./device-converter"; import { deviceInfoToDevice } from "./device-converter.ts";
import { ClientPrefix, MatrixError, Method } from "../http-api"; import { ClientPrefix, MatrixError, Method } from "../http-api/index.ts";
import { decodeBase64, encodeBase64 } from "../base64"; import { decodeBase64, encodeBase64 } from "../base64.ts";
import { KnownMembership } from "../@types/membership"; import { KnownMembership } from "../@types/membership.ts";
/* re-exports for backwards compatibility */ /* re-exports for backwards compatibility */
export type { export type {
BootstrapCrossSigningOpts as IBootstrapCrossSigningOpts, BootstrapCrossSigningOpts as IBootstrapCrossSigningOpts,
CryptoCallbacks as ICryptoCallbacks, CryptoCallbacks as ICryptoCallbacks,
} from "../crypto-api"; } from "../crypto-api/index.ts";
const DeviceVerification = DeviceInfo.DeviceVerification; const DeviceVerification = DeviceInfo.DeviceVerification;
@@ -4374,4 +4379,4 @@ class IncomingRoomKeyRequestCancellation {
} }
// a number of types are re-exported for backwards compatibility, in case any applications are referencing it. // a number of types are re-exported for backwards compatibility, in case any applications are referencing it.
export type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto"; export type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto.ts";

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { randomString } from "../randomstring"; import { randomString } from "../randomstring.ts";
const DEFAULT_ITERATIONS = 500000; const DEFAULT_ITERATIONS = 500000;

View File

@@ -15,7 +15,7 @@ limitations under the License.
*/ */
// Export for backward compatibility // Export for backward compatibility
import { ImportRoomKeyProgressData } from "../crypto-api"; import { ImportRoomKeyProgressData } from "../crypto-api/index.ts";
export type { export type {
Curve25519AuthData as ICurve25519AuthData, Curve25519AuthData as ICurve25519AuthData,
@@ -24,7 +24,7 @@ export type {
Curve25519SessionData, Curve25519SessionData,
KeyBackupSession as IKeyBackupSession, KeyBackupSession as IKeyBackupSession,
KeyBackupRoomSessions as IKeyBackupRoomSessions, KeyBackupRoomSessions as IKeyBackupRoomSessions,
} from "../crypto-api/keybackup"; } from "../crypto-api/keybackup.ts";
/* eslint-enable camelcase */ /* eslint-enable camelcase */

View File

@@ -21,16 +21,16 @@ limitations under the License.
import anotherjson from "another-json"; import anotherjson from "another-json";
import type { PkSigning } from "@matrix-org/olm"; import type { PkSigning } from "@matrix-org/olm";
import type { IOneTimeKey } from "../@types/crypto"; import type { IOneTimeKey } from "../@types/crypto.ts";
import { OlmDevice } from "./OlmDevice"; import { OlmDevice } from "./OlmDevice.ts";
import { DeviceInfo } from "./deviceinfo"; import { DeviceInfo } from "./deviceinfo.ts";
import { Logger, logger } from "../logger"; import { Logger, logger } from "../logger.ts";
import { IClaimOTKsResult, MatrixClient } from "../client"; import { IClaimOTKsResult, MatrixClient } from "../client.ts";
import { ISignatures } from "../@types/signed"; import { ISignatures } from "../@types/signed.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { EventType } from "../@types/event"; import { EventType } from "../@types/event.ts";
import { IMessage } from "./algorithms/olm"; import { IMessage } from "./algorithms/olm.ts";
import { MapWithDefault } from "../utils"; import { MapWithDefault } from "../utils.ts";
enum Algorithm { enum Algorithm {
Olm = "m.olm.v1.curve25519-aes-sha2", Olm = "m.olm.v1.curve25519-aes-sha2",

View File

@@ -14,19 +14,19 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index"; import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index.ts";
import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager"; import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager.ts";
import { IOlmDevice } from "../algorithms/megolm"; import { IOlmDevice } from "../algorithms/megolm.ts";
import { TrackingStatus } from "../DeviceList"; import { TrackingStatus } from "../DeviceList.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { IDevice } from "../deviceinfo"; import { IDevice } from "../deviceinfo.ts";
import { ICrossSigningInfo } from "../CrossSigning"; import { ICrossSigningInfo } from "../CrossSigning.ts";
import { Logger } from "../../logger"; import { Logger } from "../../logger.ts";
import { InboundGroupSessionData } from "../OlmDevice"; import { InboundGroupSessionData } from "../OlmDevice.ts";
import { MatrixEvent } from "../../models/event"; import { MatrixEvent } from "../../models/event.ts";
import { DehydrationManager } from "../dehydration"; import { DehydrationManager } from "../dehydration.ts";
import { IEncryptedPayload } from "../aes"; import { IEncryptedPayload } from "../aes.ts";
import { CrossSigningKeyInfo } from "../../crypto-api"; import { CrossSigningKeyInfo } from "../../crypto-api/index.ts";
/** /**
* Internal module. Definitions for storage for the crypto module * Internal module. Definitions for storage for the crypto module

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { Logger, logger } from "../../logger"; import { Logger, logger } from "../../logger.ts";
import { deepCompare } from "../../utils"; import { deepCompare } from "../../utils.ts";
import { import {
CryptoStore, CryptoStore,
IDeviceData, IDeviceData,
@@ -31,13 +31,13 @@ import {
SecretStorePrivateKeys, SecretStorePrivateKeys,
SESSION_BATCH_SIZE, SESSION_BATCH_SIZE,
ACCOUNT_OBJECT_KEY_MIGRATION_STATE, ACCOUNT_OBJECT_KEY_MIGRATION_STATE,
} from "./base"; } from "./base.ts";
import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index"; import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index.ts";
import { IOlmDevice } from "../algorithms/megolm"; import { IOlmDevice } from "../algorithms/megolm.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { InboundGroupSessionData } from "../OlmDevice"; import { InboundGroupSessionData } from "../OlmDevice.ts";
import { IndexedDBCryptoStore } from "./indexeddb-crypto-store"; import { IndexedDBCryptoStore } from "./indexeddb-crypto-store.ts";
import { CrossSigningKeyInfo } from "../../crypto-api"; import { CrossSigningKeyInfo } from "../../crypto-api/index.ts";
const PROFILE_TRANSACTIONS = false; const PROFILE_TRANSACTIONS = false;

View File

@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger, Logger } from "../../logger"; import { logger, Logger } from "../../logger.ts";
import { LocalStorageCryptoStore } from "./localStorage-crypto-store"; import { LocalStorageCryptoStore } from "./localStorage-crypto-store.ts";
import { MemoryCryptoStore } from "./memory-crypto-store"; import { MemoryCryptoStore } from "./memory-crypto-store.ts";
import * as IndexedDBCryptoStoreBackend from "./indexeddb-crypto-store-backend"; import * as IndexedDBCryptoStoreBackend from "./indexeddb-crypto-store-backend.ts";
import { InvalidCryptoStoreError, InvalidCryptoStoreState } from "../../errors"; import { InvalidCryptoStoreError, InvalidCryptoStoreState } from "../../errors.ts";
import * as IndexedDBHelpers from "../../indexeddb-helpers"; import * as IndexedDBHelpers from "../../indexeddb-helpers.ts";
import { import {
CryptoStore, CryptoStore,
IDeviceData, IDeviceData,
@@ -34,12 +34,12 @@ import {
ParkedSharedHistory, ParkedSharedHistory,
SecretStorePrivateKeys, SecretStorePrivateKeys,
ACCOUNT_OBJECT_KEY_MIGRATION_STATE, ACCOUNT_OBJECT_KEY_MIGRATION_STATE,
} from "./base"; } from "./base.ts";
import { IRoomKeyRequestBody } from "../index"; import { IRoomKeyRequestBody } from "../index.ts";
import { IOlmDevice } from "../algorithms/megolm"; import { IOlmDevice } from "../algorithms/megolm.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { InboundGroupSessionData } from "../OlmDevice"; import { InboundGroupSessionData } from "../OlmDevice.ts";
import { CrossSigningKeyInfo } from "../../crypto-api"; import { CrossSigningKeyInfo } from "../../crypto-api/index.ts";
/* /*
* Internal module. indexeddb storage for e2e. * Internal module. indexeddb storage for e2e.

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import { MemoryCryptoStore } from "./memory-crypto-store"; import { MemoryCryptoStore } from "./memory-crypto-store.ts";
import { import {
CryptoStore, CryptoStore,
IDeviceData, IDeviceData,
@@ -28,12 +28,12 @@ import {
Mode, Mode,
SecretStorePrivateKeys, SecretStorePrivateKeys,
SESSION_BATCH_SIZE, SESSION_BATCH_SIZE,
} from "./base"; } from "./base.ts";
import { IOlmDevice } from "../algorithms/megolm"; import { IOlmDevice } from "../algorithms/megolm.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { InboundGroupSessionData } from "../OlmDevice"; import { InboundGroupSessionData } from "../OlmDevice.ts";
import { safeSet } from "../../utils"; import { safeSet } from "../../utils.ts";
import { CrossSigningKeyInfo } from "../../crypto-api"; import { CrossSigningKeyInfo } from "../../crypto-api/index.ts";
/** /**
* Internal module. Partial localStorage backed storage for e2e. * Internal module. Partial localStorage backed storage for e2e.

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import { deepCompare, promiseTry, safeSet } from "../../utils"; import { deepCompare, promiseTry, safeSet } from "../../utils.ts";
import { import {
CryptoStore, CryptoStore,
IDeviceData, IDeviceData,
@@ -30,12 +30,12 @@ import {
ParkedSharedHistory, ParkedSharedHistory,
SecretStorePrivateKeys, SecretStorePrivateKeys,
SESSION_BATCH_SIZE, SESSION_BATCH_SIZE,
} from "./base"; } from "./base.ts";
import { IRoomKeyRequestBody } from "../index"; import { IRoomKeyRequestBody } from "../index.ts";
import { IOlmDevice } from "../algorithms/megolm"; import { IOlmDevice } from "../algorithms/megolm.ts";
import { IRoomEncryption } from "../RoomList"; import { IRoomEncryption } from "../RoomList.ts";
import { InboundGroupSessionData } from "../OlmDevice"; import { InboundGroupSessionData } from "../OlmDevice.ts";
import { CrossSigningKeyInfo } from "../../crypto-api"; import { CrossSigningKeyInfo } from "../../crypto-api/index.ts";
function encodeSessionKey(senderCurve25519Key: string, sessionId: string): string { function encodeSessionKey(senderCurve25519Key: string, sessionId: string): string {
return encodeURIComponent(senderCurve25519Key) + "/" + encodeURIComponent(sessionId); return encodeURIComponent(senderCurve25519Key) + "/" + encodeURIComponent(sessionId);

View File

@@ -19,23 +19,23 @@ limitations under the License.
* Base class for verification methods. * Base class for verification methods.
*/ */
import { MatrixEvent } from "../../models/event"; import { MatrixEvent } from "../../models/event.ts";
import { EventType } from "../../@types/event"; import { EventType } from "../../@types/event.ts";
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import { DeviceInfo } from "../deviceinfo"; import { DeviceInfo } from "../deviceinfo.ts";
import { newTimeoutError } from "./Error"; import { newTimeoutError } from "./Error.ts";
import { KeysDuringVerification, requestKeysDuringVerification } from "../CrossSigning"; import { KeysDuringVerification, requestKeysDuringVerification } from "../CrossSigning.ts";
import { IVerificationChannel } from "./request/Channel"; import { IVerificationChannel } from "./request/Channel.ts";
import { MatrixClient } from "../../client"; import { MatrixClient } from "../../client.ts";
import { VerificationRequest } from "./request/VerificationRequest"; import { VerificationRequest } from "./request/VerificationRequest.ts";
import { TypedEventEmitter } from "../../models/typed-event-emitter"; import { TypedEventEmitter } from "../../models/typed-event-emitter.ts";
import { import {
ShowQrCodeCallbacks, ShowQrCodeCallbacks,
ShowSasCallbacks, ShowSasCallbacks,
Verifier, Verifier,
VerifierEvent, VerifierEvent,
VerifierEventHandlerMap, VerifierEventHandlerMap,
} from "../../crypto-api/verification"; } from "../../crypto-api/verification.ts";
const timeoutException = new Error("Verification timed out"); const timeoutException = new Error("Verification timed out");

View File

@@ -18,8 +18,8 @@ limitations under the License.
* Error messages. * Error messages.
*/ */
import { MatrixEvent } from "../../models/event"; import { MatrixEvent } from "../../models/event.ts";
import { EventType } from "../../@types/event"; import { EventType } from "../../@types/event.ts";
export function newVerificationError(code: string, reason: string, extraData?: Record<string, any>): MatrixEvent { export function newVerificationError(code: string, reason: string, extraData?: Record<string, any>): MatrixEvent {
const content = Object.assign({}, { code, reason }, extraData); const content = Object.assign({}, { code, reason }, extraData);

View File

@@ -19,11 +19,11 @@ limitations under the License.
* do verification with this method). * do verification with this method).
*/ */
import { VerificationBase as Base, VerificationEvent, VerificationEventHandlerMap } from "./Base"; import { VerificationBase as Base, VerificationEvent, VerificationEventHandlerMap } from "./Base.ts";
import { IVerificationChannel } from "./request/Channel"; import { IVerificationChannel } from "./request/Channel.ts";
import { MatrixClient } from "../../client"; import { MatrixClient } from "../../client.ts";
import { MatrixEvent } from "../../models/event"; import { MatrixEvent } from "../../models/event.ts";
import { VerificationRequest } from "./request/VerificationRequest"; import { VerificationRequest } from "./request/VerificationRequest.ts";
export class IllegalMethod extends Base<VerificationEvent, VerificationEventHandlerMap> { export class IllegalMethod extends Base<VerificationEvent, VerificationEventHandlerMap> {
public static factory( public static factory(

View File

@@ -18,16 +18,16 @@ limitations under the License.
* QR code key verification. * QR code key verification.
*/ */
import { VerificationBase as Base } from "./Base"; import { VerificationBase as Base } from "./Base.ts";
import { newKeyMismatchError, newUserCancelledError } from "./Error"; import { newKeyMismatchError, newUserCancelledError } from "./Error.ts";
import { decodeBase64, encodeUnpaddedBase64 } from "../../base64"; import { decodeBase64, encodeUnpaddedBase64 } from "../../base64.ts";
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import { VerificationRequest } from "./request/VerificationRequest"; import { VerificationRequest } from "./request/VerificationRequest.ts";
import { MatrixClient } from "../../client"; import { MatrixClient } from "../../client.ts";
import { IVerificationChannel } from "./request/Channel"; import { IVerificationChannel } from "./request/Channel.ts";
import { MatrixEvent } from "../../models/event"; import { MatrixEvent } from "../../models/event.ts";
import { ShowQrCodeCallbacks, VerifierEvent } from "../../crypto-api/verification"; import { ShowQrCodeCallbacks, VerifierEvent } from "../../crypto-api/verification.ts";
import { VerificationMethod } from "../../types"; import { VerificationMethod } from "../../types.ts";
export const SHOW_QR_CODE_METHOD = VerificationMethod.ShowQrCode; export const SHOW_QR_CODE_METHOD = VerificationMethod.ShowQrCode;
export const SCAN_QR_CODE_METHOD = VerificationMethod.ScanQrCode; export const SCAN_QR_CODE_METHOD = VerificationMethod.ScanQrCode;

View File

@@ -21,27 +21,27 @@ limitations under the License.
import anotherjson from "another-json"; import anotherjson from "another-json";
import { Utility, SAS as OlmSAS } from "@matrix-org/olm"; import { Utility, SAS as OlmSAS } from "@matrix-org/olm";
import { VerificationBase as Base, SwitchStartEventError } from "./Base"; import { VerificationBase as Base, SwitchStartEventError } from "./Base.ts";
import { import {
errorFactory, errorFactory,
newInvalidMessageError, newInvalidMessageError,
newKeyMismatchError, newKeyMismatchError,
newUnknownMethodError, newUnknownMethodError,
newUserCancelledError, newUserCancelledError,
} from "./Error"; } from "./Error.ts";
import { logger } from "../../logger"; import { logger } from "../../logger.ts";
import { IContent, MatrixEvent } from "../../models/event"; import { IContent, MatrixEvent } from "../../models/event.ts";
import { generateDecimalSas } from "./SASDecimal"; import { generateDecimalSas } from "./SASDecimal.ts";
import { EventType } from "../../@types/event"; import { EventType } from "../../@types/event.ts";
import { EmojiMapping, GeneratedSas, ShowSasCallbacks, VerifierEvent } from "../../crypto-api/verification"; import { EmojiMapping, GeneratedSas, ShowSasCallbacks, VerifierEvent } from "../../crypto-api/verification.ts";
import { VerificationMethod } from "../../types"; import { VerificationMethod } from "../../types.ts";
// backwards-compatibility exports // backwards-compatibility exports
export type { export type {
ShowSasCallbacks as ISasEvent, ShowSasCallbacks as ISasEvent,
GeneratedSas as IGeneratedSas, GeneratedSas as IGeneratedSas,
EmojiMapping, EmojiMapping,
} from "../../crypto-api/verification"; } from "../../crypto-api/verification.ts";
const START_TYPE = EventType.KeyVerificationStart; const START_TYPE = EventType.KeyVerificationStart;

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixEvent } from "../../../models/event"; import { MatrixEvent } from "../../../models/event.ts";
import { VerificationRequest } from "./VerificationRequest"; import { VerificationRequest } from "./VerificationRequest.ts";
export interface IVerificationChannel { export interface IVerificationChannel {
request?: VerificationRequest; request?: VerificationRequest;

View File

@@ -15,13 +15,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { VerificationRequest, REQUEST_TYPE, READY_TYPE, START_TYPE } from "./VerificationRequest"; import { VerificationRequest, REQUEST_TYPE, READY_TYPE, START_TYPE } from "./VerificationRequest.ts";
import { logger } from "../../../logger"; import { logger } from "../../../logger.ts";
import { IVerificationChannel } from "./Channel"; import { IVerificationChannel } from "./Channel.ts";
import { EventType, TimelineEvents } from "../../../@types/event"; import { EventType, TimelineEvents } from "../../../@types/event.ts";
import { MatrixClient } from "../../../client"; import { MatrixClient } from "../../../client.ts";
import { MatrixEvent } from "../../../models/event"; import { MatrixEvent } from "../../../models/event.ts";
import { IRequestsMap } from "../.."; import { IRequestsMap } from "../../index.ts";
const MESSAGE_TYPE = EventType.RoomMessage; const MESSAGE_TYPE = EventType.RoomMessage;
const M_REFERENCE = "m.reference"; const M_REFERENCE = "m.reference";

View File

@@ -15,8 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { randomString } from "../../../randomstring"; import { randomString } from "../../../randomstring.ts";
import { logger } from "../../../logger"; import { logger } from "../../../logger.ts";
import { import {
CANCEL_TYPE, CANCEL_TYPE,
PHASE_STARTED, PHASE_STARTED,
@@ -25,12 +25,12 @@ import {
READY_TYPE, READY_TYPE,
START_TYPE, START_TYPE,
VerificationRequest, VerificationRequest,
} from "./VerificationRequest"; } from "./VerificationRequest.ts";
import { errorFromEvent, newUnexpectedMessageError } from "../Error"; import { errorFromEvent, newUnexpectedMessageError } from "../Error.ts";
import { MatrixEvent } from "../../../models/event"; import { MatrixEvent } from "../../../models/event.ts";
import { IVerificationChannel } from "./Channel"; import { IVerificationChannel } from "./Channel.ts";
import { MatrixClient } from "../../../client"; import { MatrixClient } from "../../../client.ts";
import { IRequestsMap } from "../.."; import { IRequestsMap } from "../../index.ts";
export type Request = VerificationRequest<ToDeviceChannel>; export type Request = VerificationRequest<ToDeviceChannel>;

View File

@@ -14,16 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger } from "../../../logger"; import { logger } from "../../../logger.ts";
import { errorFactory, errorFromEvent, newUnexpectedMessageError, newUnknownMethodError } from "../Error"; import { errorFactory, errorFromEvent, newUnexpectedMessageError, newUnknownMethodError } from "../Error.ts";
import { QRCodeData, SCAN_QR_CODE_METHOD } from "../QRCode"; import { QRCodeData, SCAN_QR_CODE_METHOD } from "../QRCode.ts";
import { IVerificationChannel } from "./Channel"; import { IVerificationChannel } from "./Channel.ts";
import { MatrixClient } from "../../../client"; import { MatrixClient } from "../../../client.ts";
import { MatrixEvent } from "../../../models/event"; import { MatrixEvent } from "../../../models/event.ts";
import { EventType } from "../../../@types/event"; import { EventType } from "../../../@types/event.ts";
import { VerificationBase } from "../Base"; import { VerificationBase } from "../Base.ts";
import { VerificationMethod } from "../../index"; import { VerificationMethod } from "../../index.ts";
import { TypedEventEmitter } from "../../../models/typed-event-emitter"; import { TypedEventEmitter } from "../../../models/typed-event-emitter.ts";
import { import {
canAcceptVerificationRequest, canAcceptVerificationRequest,
VerificationPhase as Phase, VerificationPhase as Phase,
@@ -31,10 +31,10 @@ import {
VerificationRequestEvent, VerificationRequestEvent,
VerificationRequestEventHandlerMap, VerificationRequestEventHandlerMap,
Verifier, Verifier,
} from "../../../crypto-api/verification"; } from "../../../crypto-api/verification.ts";
// backwards-compatibility exports // backwards-compatibility exports
export { VerificationPhase as Phase, VerificationRequestEvent } from "../../../crypto-api/verification"; export { VerificationPhase as Phase, VerificationRequestEvent } from "../../../crypto-api/verification.ts";
// How long after the event's timestamp that the request times out // How long after the event's timestamp that the request times out
const TIMEOUT_FROM_EVENT_TS = 10 * 60 * 1000; // 10 minutes const TIMEOUT_FROM_EVENT_TS = 10 * 60 * 1000; // 10 minutes

View File

@@ -25,15 +25,15 @@ import {
ISendEventFromWidgetResponseData, ISendEventFromWidgetResponseData,
} from "matrix-widget-api"; } from "matrix-widget-api";
import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event"; import { MatrixEvent, IEvent, IContent, EventStatus } from "./models/event.ts";
import { import {
ISendEventResponse, ISendEventResponse,
SendDelayedEventRequestOpts, SendDelayedEventRequestOpts,
SendDelayedEventResponse, SendDelayedEventResponse,
UpdateDelayedEventAction, UpdateDelayedEventAction,
} from "./@types/requests"; } from "./@types/requests.ts";
import { EventType, StateEvents } from "./@types/event"; import { EventType, StateEvents } from "./@types/event.ts";
import { logger } from "./logger"; import { logger } from "./logger.ts";
import { import {
MatrixClient, MatrixClient,
ClientEvent, ClientEvent,
@@ -42,15 +42,15 @@ import {
SendToDeviceContentMap, SendToDeviceContentMap,
IOpenIDToken, IOpenIDToken,
UNSTABLE_MSC4140_DELAYED_EVENTS, UNSTABLE_MSC4140_DELAYED_EVENTS,
} from "./client"; } from "./client.ts";
import { SyncApi, SyncState } from "./sync"; import { SyncApi, SyncState } from "./sync.ts";
import { SlidingSyncSdk } from "./sliding-sync-sdk"; import { SlidingSyncSdk } from "./sliding-sync-sdk.ts";
import { User } from "./models/user"; import { User } from "./models/user.ts";
import { Room } from "./models/room"; import { Room } from "./models/room.ts";
import { ToDeviceBatch, ToDevicePayload } from "./models/ToDeviceMessage"; import { ToDeviceBatch, ToDevicePayload } from "./models/ToDeviceMessage.ts";
import { DeviceInfo } from "./crypto/deviceinfo"; import { DeviceInfo } from "./crypto/deviceinfo.ts";
import { IOlmDevice } from "./crypto/algorithms/megolm"; import { IOlmDevice } from "./crypto/algorithms/megolm.ts";
import { MapWithDefault, recursiveMapToObject } from "./utils"; import { MapWithDefault, recursiveMapToObject } from "./utils.ts";
interface IStateEventRequest { interface IStateEventRequest {
eventType: string; eventType: string;

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixClient } from "./client"; import { MatrixClient } from "./client.ts";
import { IEvent, MatrixEvent, MatrixEventEvent } from "./models/event"; import { IEvent, MatrixEvent, MatrixEventEvent } from "./models/event.ts";
import { RelationType } from "./@types/event"; import { RelationType } from "./@types/event.ts";
export type EventMapper = (obj: Partial<IEvent>) => MatrixEvent; export type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ExtensibleEventType, IPartialEvent } from "../@types/extensible_events"; import { ExtensibleEventType, IPartialEvent } from "../@types/extensible_events.ts";
/** /**
* Represents an Extensible Event in Matrix. * Represents an Extensible Event in Matrix.

View File

@@ -16,7 +16,7 @@ limitations under the License.
import { Optional } from "matrix-events-sdk"; import { Optional } from "matrix-events-sdk";
import { ExtensibleEvent } from "./ExtensibleEvent"; import { ExtensibleEvent } from "./ExtensibleEvent.ts";
import { import {
ExtensibleEventType, ExtensibleEventType,
IMessageRendering, IMessageRendering,
@@ -26,9 +26,9 @@ import {
M_MESSAGE, M_MESSAGE,
ExtensibleAnyMessageEventContent, ExtensibleAnyMessageEventContent,
M_TEXT, M_TEXT,
} from "../@types/extensible_events"; } from "../@types/extensible_events.ts";
import { isOptionalAString, isProvided } from "./utilities"; import { isOptionalAString, isProvided } from "./utilities.ts";
import { InvalidEventError } from "./InvalidEventError"; import { InvalidEventError } from "./InvalidEventError.ts";
/** /**
* Represents a message event. Message events are the simplest form of event with * Represents a message event. Message events are the simplest form of event with

View File

@@ -20,11 +20,11 @@ import {
isEventTypeSame, isEventTypeSame,
M_TEXT, M_TEXT,
REFERENCE_RELATION, REFERENCE_RELATION,
} from "../@types/extensible_events"; } from "../@types/extensible_events.ts";
import { M_POLL_END, PollEndEventContent } from "../@types/polls"; import { M_POLL_END, PollEndEventContent } from "../@types/polls.ts";
import { ExtensibleEvent } from "./ExtensibleEvent"; import { ExtensibleEvent } from "./ExtensibleEvent.ts";
import { InvalidEventError } from "./InvalidEventError"; import { InvalidEventError } from "./InvalidEventError.ts";
import { MessageEvent } from "./MessageEvent"; import { MessageEvent } from "./MessageEvent.ts";
/** /**
* Represents a poll end/closure event. * Represents a poll end/closure event.

View File

@@ -14,11 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { ExtensibleEvent } from "./ExtensibleEvent"; import { ExtensibleEvent } from "./ExtensibleEvent.ts";
import { M_POLL_RESPONSE, PollResponseEventContent, PollResponseSubtype } from "../@types/polls"; import { M_POLL_RESPONSE, PollResponseEventContent, PollResponseSubtype } from "../@types/polls.ts";
import { ExtensibleEventType, IPartialEvent, isEventTypeSame, REFERENCE_RELATION } from "../@types/extensible_events"; import {
import { InvalidEventError } from "./InvalidEventError"; ExtensibleEventType,
import { PollStartEvent } from "./PollStartEvent"; IPartialEvent,
isEventTypeSame,
REFERENCE_RELATION,
} from "../@types/extensible_events.ts";
import { InvalidEventError } from "./InvalidEventError.ts";
import { PollStartEvent } from "./PollStartEvent.ts";
/** /**
* Represents a poll response event. * Represents a poll response event.

View File

@@ -16,8 +16,8 @@ limitations under the License.
import { NamespacedValue } from "matrix-events-sdk"; import { NamespacedValue } from "matrix-events-sdk";
import { MessageEvent } from "./MessageEvent"; import { MessageEvent } from "./MessageEvent.ts";
import { ExtensibleEventType, IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events"; import { ExtensibleEventType, IPartialEvent, isEventTypeSame, M_TEXT } from "../@types/extensible_events.ts";
import { import {
KnownPollKind, KnownPollKind,
M_POLL_KIND_DISCLOSED, M_POLL_KIND_DISCLOSED,
@@ -26,9 +26,9 @@ import {
PollStartEventContent, PollStartEventContent,
PollStartSubtype, PollStartSubtype,
PollAnswer, PollAnswer,
} from "../@types/polls"; } from "../@types/polls.ts";
import { InvalidEventError } from "./InvalidEventError"; import { InvalidEventError } from "./InvalidEventError.ts";
import { ExtensibleEvent } from "./ExtensibleEvent"; import { ExtensibleEvent } from "./ExtensibleEvent.ts";
/** /**
* Represents a poll answer. Note that this is represented as a subtype and is * Represents a poll answer. Note that this is represented as a subtype and is

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IServerVersions } from "./client"; import { IServerVersions } from "./client.ts";
export enum ServerSupport { export enum ServerSupport {
Stable, Stable,

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { RelationType } from "./@types/event"; import { RelationType } from "./@types/event.ts";
import { MatrixEvent } from "./models/event"; import { MatrixEvent } from "./models/event.ts";
import { FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, THREAD_RELATION_TYPE } from "./models/thread"; import { FILTER_RELATED_BY_REL_TYPES, FILTER_RELATED_BY_SENDERS, THREAD_RELATION_TYPE } from "./models/thread.ts";
/** /**
* Checks if a value matches a given field value, which may be a * terminated * Checks if a value matches a given field value, which may be a * terminated

View File

@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { EventType, RelationType } from "./@types/event"; import { EventType, RelationType } from "./@types/event.ts";
import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync"; import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts";
import { FilterComponent, IFilterComponent } from "./filter-component"; import { FilterComponent, IFilterComponent } from "./filter-component.ts";
import { MatrixEvent } from "./models/event"; import { MatrixEvent } from "./models/event.ts";
/** /**
*/ */

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IUsageLimit } from "../@types/partials"; import { IUsageLimit } from "../@types/partials.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
interface IErrorJson extends Partial<IUsageLimit> { interface IErrorJson extends Partial<IUsageLimit> {
[key: string]: any; // extensible [key: string]: any; // extensible

View File

@@ -18,13 +18,13 @@ limitations under the License.
* This is an internal module. See {@link MatrixHttpApi} for the public class. * This is an internal module. See {@link MatrixHttpApi} for the public class.
*/ */
import { checkObjectHasKeys, encodeParams } from "../utils"; import { checkObjectHasKeys, encodeParams } from "../utils.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { Method } from "./method"; import { Method } from "./method.ts";
import { ConnectionError, MatrixError } from "./errors"; import { ConnectionError, MatrixError } from "./errors.ts";
import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts, Body } from "./interface"; import { HttpApiEvent, HttpApiEventHandlerMap, IHttpOpts, IRequestOpts, Body } from "./interface.ts";
import { anySignal, parseErrorResponse, timeoutSignal } from "./utils"; import { anySignal, parseErrorResponse, timeoutSignal } from "./utils.ts";
import { QueryDict } from "../utils"; import { QueryDict } from "../utils.ts";
interface TypedResponse<T> extends Response { interface TypedResponse<T> extends Response {
json(): Promise<T>; json(): Promise<T>;

View File

@@ -14,20 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { FetchHttpApi } from "./fetch"; import { FetchHttpApi } from "./fetch.ts";
import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface"; import { FileType, IContentUri, IHttpOpts, Upload, UploadOpts, UploadResponse } from "./interface.ts";
import { MediaPrefix } from "./prefix"; import { MediaPrefix } from "./prefix.ts";
import { defer, QueryDict, removeElement } from "../utils"; import { defer, QueryDict, removeElement } from "../utils.ts";
import * as callbacks from "../realtime-callbacks"; import * as callbacks from "../realtime-callbacks.ts";
import { Method } from "./method"; import { Method } from "./method.ts";
import { ConnectionError } from "./errors"; import { ConnectionError } from "./errors.ts";
import { parseErrorResponse } from "./utils"; import { parseErrorResponse } from "./utils.ts";
export * from "./interface"; export * from "./interface.ts";
export * from "./prefix"; export * from "./prefix.ts";
export * from "./errors"; export * from "./errors.ts";
export * from "./method"; export * from "./method.ts";
export * from "./utils"; export * from "./utils.ts";
export class MatrixHttpApi<O extends IHttpOpts> extends FetchHttpApi<O> { export class MatrixHttpApi<O extends IHttpOpts> extends FetchHttpApi<O> {
private uploads: Upload[] = []; private uploads: Upload[] = [];

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixError } from "./errors"; import { MatrixError } from "./errors.ts";
import { Logger } from "../logger"; import { Logger } from "../logger.ts";
export type Body = Record<string, any> | BodyInit; export type Body = Record<string, any> | BodyInit;

View File

@@ -16,9 +16,9 @@ limitations under the License.
import { parse as parseContentType, ParsedMediaType } from "content-type"; import { parse as parseContentType, ParsedMediaType } from "content-type";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { sleep } from "../utils"; import { sleep } from "../utils.ts";
import { ConnectionError, HTTPError, MatrixError } from "./errors"; import { ConnectionError, HTTPError, MatrixError } from "./errors.ts";
// Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout // Ponyfill for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout
export function timeoutSignal(ms: number): AbortSignal { export function timeoutSignal(ms: number): AbortSignal {

View File

@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as matrixcs from "./matrix"; import * as matrixcs from "./matrix.ts";
if (global.__js_sdk_entrypoint) { if (global.__js_sdk_entrypoint) {
throw new Error("Multiple matrix-js-sdk entrypoints detected!"); throw new Error("Multiple matrix-js-sdk entrypoints detected!");
} }
global.__js_sdk_entrypoint = true; global.__js_sdk_entrypoint = true;
export * from "./matrix"; export * from "./matrix.ts";
export default matrixcs; export default matrixcs;

View File

@@ -21,4 +21,4 @@ limitations under the License.
*/ */
/** The {@link IndexedDBStoreWorker} class. */ /** The {@link IndexedDBStoreWorker} class. */
export { IndexedDBStoreWorker } from "./store/indexeddb-store-worker"; export { IndexedDBStoreWorker } from "./store/indexeddb-store-worker.ts";

View File

@@ -16,12 +16,12 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger } from "./logger"; import { logger } from "./logger.ts";
import { MatrixClient } from "./client"; import { MatrixClient } from "./client.ts";
import { defer, IDeferred } from "./utils"; import { defer, IDeferred } from "./utils.ts";
import { MatrixError } from "./http-api"; import { MatrixError } from "./http-api/index.ts";
import { UIAResponse } from "./@types/uia"; import { UIAResponse } from "./@types/uia.ts";
import { UserIdentifier } from "./@types/auth"; import { UserIdentifier } from "./@types/auth.ts";
const EMAIL_STAGE_TYPE = "m.login.email.identity"; const EMAIL_STAGE_TYPE = "m.login.email.identity";
const MSISDN_STAGE_TYPE = "m.login.msisdn"; const MSISDN_STAGE_TYPE = "m.login.msisdn";

View File

@@ -16,74 +16,74 @@ limitations under the License.
import { WidgetApi } from "matrix-widget-api"; import { WidgetApi } from "matrix-widget-api";
import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store"; import { MemoryCryptoStore } from "./crypto/store/memory-crypto-store.ts";
import { MemoryStore } from "./store/memory"; import { MemoryStore } from "./store/memory.ts";
import { MatrixScheduler } from "./scheduler"; import { MatrixScheduler } from "./scheduler.ts";
import { MatrixClient, ICreateClientOpts } from "./client"; import { MatrixClient, ICreateClientOpts } from "./client.ts";
import { RoomWidgetClient, ICapabilities } from "./embedded"; import { RoomWidgetClient, ICapabilities } from "./embedded.ts";
import { CryptoStore } from "./crypto/store/base"; import { CryptoStore } from "./crypto/store/base.ts";
export * from "./client"; export * from "./client.ts";
export * from "./serverCapabilities"; export * from "./serverCapabilities.ts";
export * from "./embedded"; export * from "./embedded.ts";
export * from "./http-api"; export * from "./http-api/index.ts";
export * from "./autodiscovery"; export * from "./autodiscovery.ts";
export * from "./sync-accumulator"; export * from "./sync-accumulator.ts";
export * from "./errors"; export * from "./errors.ts";
export * from "./base64"; export * from "./base64.ts";
export * from "./models/beacon"; export * from "./models/beacon.ts";
export * from "./models/event"; export * from "./models/event.ts";
export * from "./models/room"; export * from "./models/room.ts";
export * from "./models/event-timeline"; export * from "./models/event-timeline.ts";
export * from "./models/event-timeline-set"; export * from "./models/event-timeline-set.ts";
export * from "./models/poll"; export * from "./models/poll.ts";
export * from "./models/room-member"; export * from "./models/room-member.ts";
export * from "./models/room-state"; export * from "./models/room-state.ts";
export * from "./models/thread"; export * from "./models/thread.ts";
export * from "./models/typed-event-emitter"; export * from "./models/typed-event-emitter.ts";
export * from "./models/user"; export * from "./models/user.ts";
export * from "./models/device"; export * from "./models/device.ts";
export * from "./models/search-result"; export * from "./models/search-result.ts";
export * from "./oidc"; export * from "./oidc/index.ts";
export * from "./scheduler"; export * from "./scheduler.ts";
export * from "./filter"; export * from "./filter.ts";
export * from "./timeline-window"; export * from "./timeline-window.ts";
export * from "./interactive-auth"; export * from "./interactive-auth.ts";
export * from "./service-types"; export * from "./service-types.ts";
export * from "./store/memory"; export * from "./store/memory.ts";
export * from "./store/indexeddb"; export * from "./store/indexeddb.ts";
export * from "./crypto/store/memory-crypto-store"; export * from "./crypto/store/memory-crypto-store.ts";
export * from "./crypto/store/localStorage-crypto-store"; export * from "./crypto/store/localStorage-crypto-store.ts";
export * from "./crypto/store/indexeddb-crypto-store"; export * from "./crypto/store/indexeddb-crypto-store.ts";
export type { OutgoingRoomKeyRequest } from "./crypto/store/base"; export type { OutgoingRoomKeyRequest } from "./crypto/store/base.ts";
export * from "./content-repo"; export * from "./content-repo.ts";
export * from "./@types/common"; export * from "./@types/common.ts";
export * from "./@types/uia"; export * from "./@types/uia.ts";
export * from "./@types/event"; export * from "./@types/event.ts";
export * from "./@types/PushRules"; export * from "./@types/PushRules.ts";
export * from "./@types/partials"; export * from "./@types/partials.ts";
export * from "./@types/requests"; export * from "./@types/requests.ts";
export * from "./@types/search"; export * from "./@types/search.ts";
export * from "./@types/beacon"; export * from "./@types/beacon.ts";
export * from "./@types/topic"; export * from "./@types/topic.ts";
export * from "./@types/location"; export * from "./@types/location.ts";
export * from "./@types/threepids"; export * from "./@types/threepids.ts";
export * from "./@types/auth"; export * from "./@types/auth.ts";
export * from "./@types/polls"; export * from "./@types/polls.ts";
export * from "./@types/local_notifications"; export * from "./@types/local_notifications.ts";
export * from "./@types/registration"; export * from "./@types/registration.ts";
export * from "./@types/read_receipts"; export * from "./@types/read_receipts.ts";
export * from "./@types/crypto"; export * from "./@types/crypto.ts";
export * from "./@types/extensible_events"; export * from "./@types/extensible_events.ts";
export * from "./@types/IIdentityServerProvider"; export * from "./@types/IIdentityServerProvider.ts";
export * from "./models/room-summary"; export * from "./models/room-summary.ts";
export * from "./models/event-status"; export * from "./models/event-status.ts";
export type { RoomSummary } from "./client"; export type { RoomSummary } from "./client.ts";
export * as ContentHelpers from "./content-helpers"; export * as ContentHelpers from "./content-helpers.ts";
export * as SecretStorage from "./secret-storage"; export * as SecretStorage from "./secret-storage.ts";
export type { ICryptoCallbacks } from "./crypto"; // used to be located here export type { ICryptoCallbacks } from "./crypto/index.ts"; // used to be located here
export { createNewMatrixCall, CallEvent } from "./webrtc/call"; export { createNewMatrixCall, CallEvent } from "./webrtc/call.ts";
export type { MatrixCall } from "./webrtc/call"; export type { MatrixCall } from "./webrtc/call.ts";
export { export {
GroupCall, GroupCall,
GroupCallEvent, GroupCallEvent,
@@ -91,21 +91,21 @@ export {
GroupCallState, GroupCallState,
GroupCallType, GroupCallType,
GroupCallStatsReportEvent, GroupCallStatsReportEvent,
} from "./webrtc/groupCall"; } from "./webrtc/groupCall.ts";
export { CryptoEvent } from "./crypto"; export { CryptoEvent } from "./crypto/index.ts";
export { SyncState, SetPresence } from "./sync"; export { SyncState, SetPresence } from "./sync.ts";
export type { ISyncStateData as SyncStateData } from "./sync"; export type { ISyncStateData as SyncStateData } from "./sync.ts";
export { SlidingSyncEvent } from "./sliding-sync"; export { SlidingSyncEvent } from "./sliding-sync.ts";
export { MediaHandlerEvent } from "./webrtc/mediaHandler"; export { MediaHandlerEvent } from "./webrtc/mediaHandler.ts";
export { CallFeedEvent } from "./webrtc/callFeed"; export { CallFeedEvent } from "./webrtc/callFeed.ts";
export { StatsReport } from "./webrtc/stats/statsReport"; export { StatsReport } from "./webrtc/stats/statsReport.ts";
export { Relations, RelationsEvent } from "./models/relations"; export { Relations, RelationsEvent } from "./models/relations.ts";
export { TypedEventEmitter } from "./models/typed-event-emitter"; export { TypedEventEmitter } from "./models/typed-event-emitter.ts";
export { LocalStorageErrors } from "./store/local-storage-events-emitter"; export { LocalStorageErrors } from "./store/local-storage-events-emitter.ts";
export { IdentityProviderBrand, SSOAction } from "./@types/auth"; export { IdentityProviderBrand, SSOAction } from "./@types/auth.ts";
export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth"; export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth.ts";
export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces"; export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces.ts";
export { LocationAssetType } from "./@types/location"; export { LocationAssetType } from "./@types/location.ts";
/** /**
* Types supporting cryptography. * Types supporting cryptography.
@@ -113,7 +113,7 @@ export { LocationAssetType } from "./@types/location";
* The most important is {@link Crypto.CryptoApi}, an instance of which can be retrieved via * The most important is {@link Crypto.CryptoApi}, an instance of which can be retrieved via
* {@link MatrixClient.getCrypto}. * {@link MatrixClient.getCrypto}.
*/ */
export * as Crypto from "./crypto-api"; export * as Crypto from "./crypto-api/index.ts";
let cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore(); let cryptoStoreFactory = (): CryptoStore => new MemoryCryptoStore();

View File

@@ -16,10 +16,10 @@ limitations under the License.
import { EitherAnd } from "matrix-events-sdk/lib/types"; import { EitherAnd } from "matrix-events-sdk/lib/types";
import { MatrixEvent } from "../matrix"; import { MatrixEvent } from "../matrix.ts";
import { deepCompare } from "../utils"; import { deepCompare } from "../utils.ts";
import { Focus } from "./focus"; import { Focus } from "./focus.ts";
import { isLivekitFocusActive } from "./LivekitFocus"; import { isLivekitFocusActive } from "./LivekitFocus.ts";
type CallScope = "m.room" | "m.user"; type CallScope = "m.room" | "m.user";
// Represents an entry in the memberships section of an m.call.member event as it is on the wire // Represents an entry in the memberships section of an m.call.member event as it is on the wire

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { Focus } from "./focus"; import { Focus } from "./focus.ts";
export interface LivekitFocusConfig extends Focus { export interface LivekitFocusConfig extends Focus {
type: "livekit"; type: "livekit";

View File

@@ -14,30 +14,30 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger as rootLogger } from "../logger"; import { logger as rootLogger } from "../logger.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { EventTimeline } from "../models/event-timeline"; import { EventTimeline } from "../models/event-timeline.ts";
import { Room } from "../models/room"; import { Room } from "../models/room.ts";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { EventType } from "../@types/event"; import { EventType } from "../@types/event.ts";
import { UpdateDelayedEventAction } from "../@types/requests"; import { UpdateDelayedEventAction } from "../@types/requests.ts";
import { import {
CallMembership, CallMembership,
CallMembershipData, CallMembershipData,
CallMembershipDataLegacy, CallMembershipDataLegacy,
SessionMembershipData, SessionMembershipData,
isLegacyCallMembershipData, isLegacyCallMembershipData,
} from "./CallMembership"; } from "./CallMembership.ts";
import { RoomStateEvent } from "../models/room-state"; import { RoomStateEvent } from "../models/room-state.ts";
import { Focus } from "./focus"; import { Focus } from "./focus.ts";
import { randomString, secureRandomBase64Url } from "../randomstring"; import { randomString, secureRandomBase64Url } from "../randomstring.ts";
import { EncryptionKeysEventContent } from "./types"; import { EncryptionKeysEventContent } from "./types.ts";
import { decodeBase64, encodeUnpaddedBase64 } from "../base64"; import { decodeBase64, encodeUnpaddedBase64 } from "../base64.ts";
import { KnownMembership } from "../@types/membership"; import { KnownMembership } from "../@types/membership.ts";
import { MatrixError } from "../http-api/errors"; import { MatrixError } from "../http-api/errors.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { isLivekitFocusActive } from "./LivekitFocus"; import { isLivekitFocusActive } from "./LivekitFocus.ts";
import { ExperimentalGroupCallRoomMemberState } from "../webrtc/groupCall"; import { ExperimentalGroupCallRoomMemberState } from "../webrtc/groupCall.ts";
const logger = rootLogger.getChild("MatrixRTCSession"); const logger = rootLogger.getChild("MatrixRTCSession");

View File

@@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { logger as rootLogger } from "../logger"; import { logger as rootLogger } from "../logger.ts";
import { MatrixClient, ClientEvent } from "../client"; import { MatrixClient, ClientEvent } from "../client.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter"; import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { Room, RoomEvent } from "../models/room"; import { Room, RoomEvent } from "../models/room.ts";
import { RoomState, RoomStateEvent } from "../models/room-state"; import { RoomState, RoomStateEvent } from "../models/room-state.ts";
import { MatrixEvent } from "../models/event"; import { MatrixEvent } from "../models/event.ts";
import { MatrixRTCSession } from "./MatrixRTCSession"; import { MatrixRTCSession } from "./MatrixRTCSession.ts";
import { EventType } from "../@types/event"; import { EventType } from "../@types/event.ts";
const logger = rootLogger.getChild("MatrixRTCSessionManager"); const logger = rootLogger.getChild("MatrixRTCSessionManager");

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
export * from "./CallMembership"; export * from "./CallMembership.ts";
export * from "./focus"; export * from "./focus.ts";
export * from "./LivekitFocus"; export * from "./LivekitFocus.ts";
export * from "./MatrixRTCSession"; export * from "./MatrixRTCSession.ts";
export * from "./MatrixRTCSessionManager"; export * from "./MatrixRTCSessionManager.ts";
export * from "./types"; export * from "./types.ts";

View File

@@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IMentions } from "../matrix"; import { IMentions } from "../matrix.ts";
export interface EncryptionKeyEntry { export interface EncryptionKeyEntry {
index: number; index: number;
key: string; key: string;

View File

@@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event"; import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event.ts";
import { IContent, MatrixEvent } from "./event"; import { IContent, MatrixEvent } from "./event.ts";
import { MSC3089TreeSpace } from "./MSC3089TreeSpace"; import { MSC3089TreeSpace } from "./MSC3089TreeSpace.ts";
import { EventTimeline } from "./event-timeline"; import { EventTimeline } from "./event-timeline.ts";
import { FileType } from "../http-api"; import { FileType } from "../http-api/index.ts";
import type { ISendEventResponse } from "../@types/requests"; import type { ISendEventResponse } from "../@types/requests.ts";
import { EncryptedFile } from "../@types/media"; import { EncryptedFile } from "../@types/media.ts";
export interface MSC3089EventContent { export interface MSC3089EventContent {
active?: boolean; active?: boolean;

View File

@@ -16,11 +16,11 @@ limitations under the License.
import promiseRetry from "p-retry"; import promiseRetry from "p-retry";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event"; import { EventType, MsgType, UNSTABLE_MSC3089_BRANCH, UNSTABLE_MSC3089_LEAF } from "../@types/event.ts";
import { Room } from "./room"; import { Room } from "./room.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { IContent, MatrixEvent } from "./event"; import { IContent, MatrixEvent } from "./event.ts";
import { import {
averageBetweenStrings, averageBetweenStrings,
DEFAULT_ALPHABET, DEFAULT_ALPHABET,
@@ -28,14 +28,14 @@ import {
nextString, nextString,
prevString, prevString,
simpleRetryOperation, simpleRetryOperation,
} from "../utils"; } from "../utils.ts";
import { MSC3089Branch } from "./MSC3089Branch"; import { MSC3089Branch } from "./MSC3089Branch.ts";
import { isRoomSharedHistory } from "../crypto/algorithms/megolm"; import { isRoomSharedHistory } from "../crypto/algorithms/megolm.ts";
import { ISendEventResponse } from "../@types/requests"; import { ISendEventResponse } from "../@types/requests.ts";
import { FileType } from "../http-api"; import { FileType } from "../http-api/index.ts";
import { KnownMembership } from "../@types/membership"; import { KnownMembership } from "../@types/membership.ts";
import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events"; import { RoomPowerLevelsEventContent, SpaceChildEventContent } from "../@types/state_events.ts";
import type { EncryptedFile, FileContent } from "../@types/media"; import type { EncryptedFile, FileContent } from "../@types/media.ts";
/** /**
* The recommended defaults for a tree space's power levels. Note that this * The recommended defaults for a tree space's power levels. Note that this

View File

@@ -14,11 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MBeaconEventContent } from "../@types/beacon"; import { MBeaconEventContent } from "../@types/beacon.ts";
import { BeaconInfoState, BeaconLocationState, parseBeaconContent, parseBeaconInfoContent } from "../content-helpers"; import {
import { MatrixEvent } from "./event"; BeaconInfoState,
import { sortEventsByLatestContentTimestamp } from "../utils"; BeaconLocationState,
import { TypedEventEmitter } from "./typed-event-emitter"; parseBeaconContent,
parseBeaconInfoContent,
} from "../content-helpers.ts";
import { MatrixEvent } from "./event.ts";
import { sortEventsByLatestContentTimestamp } from "../utils.ts";
import { TypedEventEmitter } from "./typed-event-emitter.ts";
export enum BeaconEvent { export enum BeaconEvent {
New = "Beacon.new", New = "Beacon.new",

View File

@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixEvent } from "./event"; import { MatrixEvent } from "./event.ts";
import { Room } from "./room"; import { Room } from "./room.ts";
import { inMainTimelineForReceipt, threadIdForReceipt } from "../client"; import { inMainTimelineForReceipt, threadIdForReceipt } from "../client.ts";
/** /**
* Determine the order of two events in a room. * Determine the order of two events in a room.

View File

@@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { MatrixEvent } from "./event"; import { MatrixEvent } from "./event.ts";
import { Direction } from "./event-timeline"; import { Direction } from "./event-timeline.ts";
export class EventContext { export class EventContext {
private timeline: MatrixEvent[]; private timeline: MatrixEvent[];

View File

@@ -14,16 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { EventTimeline, IAddEventOptions } from "./event-timeline"; import { EventTimeline, IAddEventOptions } from "./event-timeline.ts";
import { MatrixEvent } from "./event"; import { MatrixEvent } from "./event.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { Room, RoomEvent } from "./room"; import { Room, RoomEvent } from "./room.ts";
import { Filter } from "../filter"; import { Filter } from "../filter.ts";
import { RoomState } from "./room-state"; import { RoomState } from "./room-state.ts";
import { TypedEventEmitter } from "./typed-event-emitter"; import { TypedEventEmitter } from "./typed-event-emitter.ts";
import { RelationsContainer } from "./relations-container"; import { RelationsContainer } from "./relations-container.ts";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { Thread, ThreadFilterType } from "./thread"; import { Thread, ThreadFilterType } from "./thread.ts";
const DEBUG = true; const DEBUG = true;

View File

@@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { IMarkerFoundOptions, RoomState } from "./room-state"; import { IMarkerFoundOptions, RoomState } from "./room-state.ts";
import { EventTimelineSet } from "./event-timeline-set"; import { EventTimelineSet } from "./event-timeline-set.ts";
import { MatrixEvent } from "./event"; import { MatrixEvent } from "./event.ts";
import { Filter } from "../filter"; import { Filter } from "../filter.ts";
import { EventType } from "../@types/event"; import { EventType } from "../@types/event.ts";
export interface IInitialiseStateOptions extends Pick<IMarkerFoundOptions, "timelineWasEmpty"> { export interface IInitialiseStateOptions extends Pick<IMarkerFoundOptions, "timelineWasEmpty"> {
// This is a separate interface without any extra stuff currently added on // This is a separate interface without any extra stuff currently added on

View File

@@ -21,9 +21,9 @@ limitations under the License.
import { ExtensibleEvent, ExtensibleEvents, Optional } from "matrix-events-sdk"; import { ExtensibleEvent, ExtensibleEvents, Optional } from "matrix-events-sdk";
import type { IEventDecryptionResult } from "../@types/crypto"; import type { IEventDecryptionResult } from "../@types/crypto.ts";
import { logger } from "../logger"; import { logger } from "../logger.ts";
import { VerificationRequest } from "../crypto/verification/request/VerificationRequest"; import { VerificationRequest } from "../crypto/verification/request/VerificationRequest.ts";
import { import {
EVENT_VISIBILITY_CHANGE_TYPE, EVENT_VISIBILITY_CHANGE_TYPE,
EventType, EventType,
@@ -32,24 +32,24 @@ import {
ToDeviceMessageId, ToDeviceMessageId,
UNSIGNED_THREAD_ID_FIELD, UNSIGNED_THREAD_ID_FIELD,
UNSIGNED_MEMBERSHIP_FIELD, UNSIGNED_MEMBERSHIP_FIELD,
} from "../@types/event"; } from "../@types/event.ts";
import { Crypto } from "../crypto"; import { Crypto } from "../crypto/index.ts";
import { deepSortedObjectEntries, internaliseString } from "../utils"; import { deepSortedObjectEntries, internaliseString } from "../utils.ts";
import { RoomMember } from "./room-member"; import { RoomMember } from "./room-member.ts";
import { Thread, THREAD_RELATION_TYPE, ThreadEvent, ThreadEventHandlerMap } from "./thread"; import { Thread, THREAD_RELATION_TYPE, ThreadEvent, ThreadEventHandlerMap } from "./thread.ts";
import { IActionsObject } from "../pushprocessor"; import { IActionsObject } from "../pushprocessor.ts";
import { TypedReEmitter } from "../ReEmitter"; import { TypedReEmitter } from "../ReEmitter.ts";
import { MatrixError } from "../http-api"; import { MatrixError } from "../http-api/index.ts";
import { TypedEventEmitter } from "./typed-event-emitter"; import { TypedEventEmitter } from "./typed-event-emitter.ts";
import { EventStatus } from "./event-status"; import { EventStatus } from "./event-status.ts";
import { CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend"; import { CryptoBackend, DecryptionError } from "../common-crypto/CryptoBackend.ts";
import { IAnnotatedPushRule } from "../@types/PushRules"; import { IAnnotatedPushRule } from "../@types/PushRules.ts";
import { Room } from "./room"; import { Room } from "./room.ts";
import { EventTimeline } from "./event-timeline"; import { EventTimeline } from "./event-timeline.ts";
import { Membership } from "../@types/membership"; import { Membership } from "../@types/membership.ts";
import { DecryptionFailureCode } from "../crypto-api"; import { DecryptionFailureCode } from "../crypto-api/index.ts";
export { EventStatus } from "./event-status"; export { EventStatus } from "./event-status.ts";
/* eslint-disable camelcase */ /* eslint-disable camelcase */
export interface IContent { export interface IContent {

View File

@@ -16,13 +16,13 @@ limitations under the License.
import { UnstableValue } from "matrix-events-sdk"; import { UnstableValue } from "matrix-events-sdk";
import { MatrixClient } from "../client"; import { MatrixClient } from "../client.ts";
import { IContent, MatrixEvent } from "./event"; import { IContent, MatrixEvent } from "./event.ts";
import { EventTimeline } from "./event-timeline"; import { EventTimeline } from "./event-timeline.ts";
import { Preset } from "../@types/partials"; import { Preset } from "../@types/partials.ts";
import { globToRegexp } from "../utils"; import { globToRegexp } from "../utils.ts";
import { Room } from "./room"; import { Room } from "./room.ts";
import { EventType, StateEvents } from "../@types/event"; import { EventType, StateEvents } from "../@types/event.ts";
/// The event type storing the user's individual policies. /// The event type storing the user's individual policies.
/// ///

Some files were not shown because too many files have changed in this diff Show More