@wireapp/core 25.3.0 → 25.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [25.3.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.3.0...@wireapp/core@25.3.1) (2022-05-16)
7
+
8
+ **Note:** Version bump only for package @wireapp/core
9
+
10
+
11
+
12
+
13
+
6
14
  # [25.3.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.2.1...@wireapp/core@25.3.0) (2022-05-16)
7
15
 
8
16
 
package/package.json CHANGED
@@ -69,6 +69,6 @@
69
69
  "test:project": "yarn dist && yarn test",
70
70
  "test:node": "nyc jasmine --config=jasmine.json"
71
71
  },
72
- "version": "25.3.0",
73
- "gitHead": "a8bf270b2a73f44d611bcb9bb2965dc24e6918a1"
72
+ "version": "25.3.1",
73
+ "gitHead": "53e7ce7b1e5d68e425b128555e19e3203a5292c9"
74
74
  }
@@ -6,6 +6,6 @@ export declare class ClientBackendRepository {
6
6
  getClients(): Promise<RegisteredClient[]>;
7
7
  postClient(client: CreateClientPayload): Promise<RegisteredClient>;
8
8
  putClient(clientId: string, updates: UpdateClientPayload): Promise<void>;
9
- deleteClient(clientId: string, password: string): Promise<void>;
9
+ deleteClient(clientId: string, password?: string): Promise<void>;
10
10
  uploadMLSKeyPackages(clientId: string, keyPackages: string[]): Promise<void>;
11
11
  }
@@ -35,7 +35,7 @@ class ClientDatabaseRepository {
35
35
  return this.storeEngine.read(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
36
36
  }
37
37
  deleteLocalClient() {
38
- return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
38
+ return this.deleteClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
39
39
  }
40
40
  deleteClient(sessionId) {
41
41
  return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
@@ -18,16 +18,21 @@ export declare class ClientService {
18
18
  private readonly database;
19
19
  private readonly backend;
20
20
  constructor(apiClient: APIClient, storeEngine: CRUDEngine, cryptographyService: CryptographyService);
21
- deleteLocalClient(): Promise<string>;
22
21
  getClients(): Promise<RegisteredClient[]>;
23
22
  /**
24
23
  * Will delete the given client from backend and will also delete it from the local database
24
+ *
25
+ * note: use deleteLocalClient if you wish to delete the client currently used by the user
26
+ *
25
27
  * @param clientId The id of the client to delete
26
- * @param password Password of the owning user
27
- * @param isLocalClient Is the client also the client currently used by the app (as opposed to a client the user owns but not currenly in use)
28
- * @returns Promise
28
+ * @param password? Password of the owning user. Can be omitted for temporary devices
29
29
  */
30
- deleteClient(clientId: string, password: string, isLocalClient?: boolean): Promise<unknown>;
30
+ deleteClient(clientId: string, password?: string): Promise<unknown>;
31
+ /**
32
+ * Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
33
+ * @param password? Password of the owning user. Can be omitted for temporary devices
34
+ */
35
+ deleteLocalClient(password?: string): Promise<string>;
31
36
  getLocalClient(): Promise<MetaClient>;
32
37
  createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
33
38
  synchronizeClients(): Promise<MetaClient[]>;
@@ -29,25 +29,34 @@ class ClientService {
29
29
  this.database = new _1.ClientDatabaseRepository(this.storeEngine, this.cryptographyService);
30
30
  this.backend = new _1.ClientBackendRepository(this.apiClient);
31
31
  }
32
- deleteLocalClient() {
33
- return this.database.deleteLocalClient();
34
- }
35
32
  getClients() {
36
33
  return this.backend.getClients();
37
34
  }
38
35
  /**
39
36
  * Will delete the given client from backend and will also delete it from the local database
37
+ *
38
+ * note: use deleteLocalClient if you wish to delete the client currently used by the user
39
+ *
40
40
  * @param clientId The id of the client to delete
41
- * @param password Password of the owning user
42
- * @param isLocalClient Is the client also the client currently used by the app (as opposed to a client the user owns but not currenly in use)
43
- * @returns Promise
41
+ * @param password? Password of the owning user. Can be omitted for temporary devices
44
42
  */
45
- async deleteClient(clientId, password, isLocalClient = false) {
43
+ async deleteClient(clientId, password) {
46
44
  const userId = { id: this.apiClient.userId, domain: this.apiClient.domain || '' };
47
45
  await this.backend.deleteClient(clientId, password);
48
- return isLocalClient
49
- ? this.database.deleteLocalClient()
50
- : this.database.deleteClient(this.cryptographyService.constructSessionId(userId, clientId));
46
+ return this.database.deleteClient(this.cryptographyService.constructSessionId(userId, clientId));
47
+ }
48
+ /**
49
+ * Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
50
+ * @param password? Password of the owning user. Can be omitted for temporary devices
51
+ */
52
+ async deleteLocalClient(password) {
53
+ var _a;
54
+ const localClientId = (_a = this.apiClient.context) === null || _a === void 0 ? void 0 : _a.clientId;
55
+ if (!localClientId) {
56
+ throw new Error('Trying to delete local client, but local client has not been set');
57
+ }
58
+ await this.backend.deleteClient(localClientId, password);
59
+ return this.database.deleteLocalClient();
51
60
  }
52
61
  getLocalClient() {
53
62
  return this.database.getLocalClient();