Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy crypto support in sync api #4622

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,6 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*/
protected buildSyncApiOptions(): SyncApiOptions {
return {
crypto: this.crypto,
cryptoCallbacks: this.cryptoBackend,
canResetEntireTimeline: (roomId: string): boolean => {
if (!this.canResetTimelineCallback) {
Expand Down
26 changes: 0 additions & 26 deletions src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { BeaconEvent } from "./models/beacon.ts";
import { IEventsResponse } from "./@types/requests.ts";
import { UNREAD_THREAD_NOTIFICATIONS } from "./@types/sync.ts";
import { Feature, ServerSupport } from "./feature.ts";
import { Crypto } from "./crypto/index.ts";
import { KnownMembership } from "./@types/membership.ts";

const DEBUG = true;
Expand Down Expand Up @@ -116,13 +115,6 @@ function debuglog(...params: any[]): void {
* Options passed into the constructor of SyncApi by MatrixClient
*/
export interface SyncApiOptions {
/**
* Crypto manager
*
* @deprecated in favour of cryptoCallbacks
*/
crypto?: Crypto;

/**
* If crypto is enabled on our client, callbacks into the crypto module
*/
Expand Down Expand Up @@ -642,9 +634,6 @@ export class SyncApi {
}
this.opts.filter.setLazyLoadMembers(true);
}
if (this.opts.lazyLoadMembers) {
this.syncOpts.crypto?.enableLazyLoading();
}
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
};

private storeClientOptions = async (): Promise<void> => {
Expand Down Expand Up @@ -880,12 +869,6 @@ export class SyncApi {
catchingUp: this.catchingUp,
};

if (this.syncOpts.crypto) {
// tell the crypto module we're about to process a sync
// response
await this.syncOpts.crypto.onSyncWillProcess(syncEventData);
}

try {
await this.processSyncResponse(syncEventData, data);
} catch (e) {
Expand Down Expand Up @@ -920,15 +903,6 @@ export class SyncApi {
this.updateSyncState(SyncState.Syncing, syncEventData);

if (this.client.store.wantsSave()) {
// We always save the device list (if it's dirty) before saving the sync data:
// this means we know the saved device list data is at least as fresh as the
// stored sync data which means we don't have to worry that we may have missed
// device changes. We can also skip the delay since we're not calling this very
// frequently (and we don't really want to delay the sync for it).
if (this.syncOpts.crypto) {
await this.syncOpts.crypto.saveDeviceList(0);
}
t3chguy marked this conversation as resolved.
Show resolved Hide resolved

// tell databases that everything is now in a consistent state and can be saved.
await this.client.store.save();
}
Expand Down
Loading