Skip to content

Commit

Permalink
feat(legacy crypto!): remove ICreateClientOpts.deviceToImport.
Browse files Browse the repository at this point in the history
`ICreateClientOpts.deviceToImport` was used in the legacy cryto. The rust crypto doesn't support to import devices in this way.
  • Loading branch information
florianduros committed Jan 28, 2025
1 parent 89ac700 commit 8fc29ae
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@ export const UNSTABLE_MSC3852_LAST_SEEN_UA = new UnstableValue(
"org.matrix.msc3852.last_seen_user_agent",
);

interface IExportedDevice {
userId: string;
deviceId: string;
}

export interface IKeysUploadResponse {
one_time_key_counts: {
// eslint-disable-line camelcase
Expand Down Expand Up @@ -335,15 +330,6 @@ export interface ICreateClientOpts {
*/
queryParams?: Record<string, string>;

/**
* Device data exported with
* "exportDevice" method that must be imported to recreate this device.
* Should only be useful for devices with end-to-end crypto enabled.
* If provided, deviceId and userId should **NOT** be provided at the top
* level (they are present in the exported data).
*/
deviceToImport?: IExportedDevice;

/**
* Encryption key used for encrypting sensitive data (such as e2ee keys) in {@link ICreateClientOpts#cryptoStore}.
*
Expand Down Expand Up @@ -1288,24 +1274,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
logger: this.logger,
});

if (opts.deviceToImport) {
if (this.deviceId) {
this.logger.warn(
"not importing device because device ID is provided to " +
"constructor independently of exported data",
);
} else if (this.credentials.userId) {
this.logger.warn(
"not importing device because user ID is provided to " +
"constructor independently of exported data",
);
} else if (!opts.deviceToImport.deviceId) {
this.logger.warn("not importing device because no device ID in exported data");
} else {
this.deviceId = opts.deviceToImport.deviceId;
this.credentials.userId = opts.deviceToImport.userId;
}
} else if (opts.pickleKey) {
if (opts.pickleKey) {
this.legacyPickleKey = opts.pickleKey;
}

Expand Down

0 comments on commit 8fc29ae

Please sign in to comment.