Skip to content

Commit

Permalink
feat: remove getDeviceList
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-tanker authored and JMounier committed Sep 2, 2022
1 parent e4e0ff0 commit 072773b
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 84 deletions.
7 changes: 0 additions & 7 deletions packages/core/src/LocalUser/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import type { UserData, DelegationToken } from './UserData';
import type { Client, PullOptions } from '../Network/Client';
import { OidcNonceManager } from '../OidcNonce/Manager';
import { Status } from '../Session/status';
import type { Device } from '../Users/types';
import { makeSessionCertificate } from './SessionCertificate';

export type PrivateProvisionalKeys = {
Expand Down Expand Up @@ -279,12 +278,6 @@ export class LocalUserManager extends EventEmitter {
}
};

listDevices = async (): Promise<Array<Device>> => {
await this.updateLocalUser({ isLight: false });
const devices = this._localUser.devices;
return devices.filter(d => !d.isGhostDevice);
};

getSessionToken = async (verification: VerificationWithToken): Promise<string> => {
await this.updateLocalUser({ isLight: true });

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/Session/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export class Session extends EventEmitter {
createNewDevice = this._promiseChain(this._forward(this._getLocalUserManager, 'createNewDevice'), this._setReady, this._stopIfNotRetryable);

getVerificationKey = this._forward(this._getLocalUserManager, 'getVerificationKey');
listDevices = this._forward(this._getLocalUserManager, 'listDevices');
deviceId = () => this._localUserManager.localUser.deviceId;

setVerificationMethod = this._forward(this._getLocalUserManager, 'setVerificationMethod');
Expand Down
12 changes: 0 additions & 12 deletions packages/core/src/Tanker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export type TankerCoreOptions = {

export type TankerOptions = Partial<Omit<TankerCoreOptions, 'dataStore'> & { dataStore: Partial<DataStoreOptions>; }>;

export type Device = { id: string; };
export type ProvisionalVerification = EmailVerification | PhoneNumberVerification;

export function optionsWithDefaults(options: TankerOptions, defaults: TankerCoreOptions): TankerCoreOptions {
Expand Down Expand Up @@ -439,17 +438,6 @@ export class Tanker extends EventEmitter {
}
}

async getDeviceList(): Promise<Array<Device>> {
console.warn('The "getDeviceList" method is deprecated, it will be removed in the future');

assertStatus(this.status, statuses.READY, 'get the device list');

const devices = await this.session.listDevices();
return devices.map(d => ({
id: utils.toBase64(d.deviceId),
}));
}

async share(resourceIds: Array<b64string>, options: SharingOptions): Promise<void> {
assertStatus(this.status, statuses.READY, 'share');

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type {
LegacyEmailVerificationMethod,
} from './LocalUser/types';
export type { AttachResult } from './ProvisionalIdentity/types';
export type { TankerOptions, Device, ProvisionalVerification } from './Tanker';
export type { TankerOptions, ProvisionalVerification } from './Tanker';
export type { EncryptionSession } from './DataProtection/EncryptionSession';
export type { UploadStream } from './CloudStorage/UploadStream';
export type { DownloadStream } from './CloudStorage/DownloadStream';
Expand Down
51 changes: 0 additions & 51 deletions packages/functional-tests/src/getDeviceList.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/functional-tests/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { generateEncryptionTests } from './encryption';
import { generateEnrollTests } from './enroll';
import { generateFakeAuthenticationTests } from './fake-authentication';
import { generateNetworkTests } from './network';
import { generateGetDeviceListTests } from './getDeviceList';
import { generateGroupsTests } from './groups';
import { generateSessionTests } from './session';
import { generateUploadTests } from './upload';
Expand Down Expand Up @@ -64,7 +63,6 @@ export function generateFunctionalTests(
});

generateSessionTests(args);
generateGetDeviceListTests(args);
generateVerificationTests(args);
generateEncryptionTests(args);
generateEncryptionSessionTests(args);
Expand Down
10 changes: 0 additions & 10 deletions packages/functional-tests/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ export const generateSessionTests = (args: TestArgs) => {
await expect(bobLaptop.status).to.equal(IDENTITY_VERIFICATION_NEEDED);

await bobLaptop.verifyIdentity({ passphrase: 'passphrase' });

// Check two devices have been created
const devices = await bobLaptop.getDeviceList();
expect(devices).to.have.lengthOf(2);
expect(devices).to.deep.include.members([{ id: bobLaptop.deviceId }]);
});
});

Expand Down Expand Up @@ -215,11 +210,6 @@ export const generateSessionTests = (args: TestArgs) => {
await expect(bobLaptop.status).to.equal(IDENTITY_VERIFICATION_NEEDED);

await bobLaptop.verifyIdentity({ passphrase: 'passphrase' });

// Check two devices have been created
const devices = await bobLaptop.getDeviceList();
expect(devices).to.have.lengthOf(3);
expect(devices).to.deep.include.members([{ id: bobLaptop.deviceId }]);
});
});
});
Expand Down

0 comments on commit 072773b

Please sign in to comment.