@wireapp/core 20.1.0 → 20.2.0
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,47 @@
|
|
|
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
|
+
# [20.2.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@20.1.3...@wireapp/core@20.2.0) (2021-12-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **core:** Add a method to upload an unencrypted asset ([#4203](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4203)) ([7bbef28](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/7bbef28b49b877312512dc59c31d2249f876fa67))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [20.1.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@20.1.2...@wireapp/core@20.1.3) (2021-12-16)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @wireapp/core
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [20.1.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@20.1.1...@wireapp/core@20.1.2) (2021-12-15)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **core:** Await for mismatch handling before considering a message sent ([925ecbb](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/925ecbb9f9a8e5f0f123d29615a794d7c58f2f10))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## [20.1.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@20.1.0...@wireapp/core@20.1.1) (2021-12-14)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **core:** Call message send success callback after mismatch handling ([ada3fd1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/ada3fd1378a7c5fecddd03db9547a89f90a7a174))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
6
47
|
# [20.1.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@20.0.2...@wireapp/core@20.1.0) (2021-12-14)
|
|
7
48
|
|
|
8
49
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@types/long": "4.0.1",
|
|
7
7
|
"@types/node": "~14",
|
|
8
|
-
"@wireapp/api-client": "16.
|
|
8
|
+
"@wireapp/api-client": "16.2.0",
|
|
9
9
|
"@wireapp/cryptobox": "12.7.1",
|
|
10
10
|
"bazinga64": "5.10.0",
|
|
11
11
|
"hash.js": "1.1.7",
|
|
@@ -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": "20.
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"version": "20.2.0",
|
|
73
|
+
"gitHead": "5ff57f8efd8713ae9767f12c103ea918acbbaa3b"
|
|
74
74
|
}
|
|
@@ -6,5 +6,22 @@ import type { EncryptedAssetUploaded } from '../cryptography/';
|
|
|
6
6
|
export declare class AssetService {
|
|
7
7
|
private readonly apiClient;
|
|
8
8
|
constructor(apiClient: APIClient);
|
|
9
|
+
/**
|
|
10
|
+
* Uploads a raw asset to the backend without encrypting it
|
|
11
|
+
*
|
|
12
|
+
* @param plainText The raw content of the asset to upload
|
|
13
|
+
* @param options?
|
|
14
|
+
* @param progressCallback?
|
|
15
|
+
* @return cancellable request that resolves with the uploaded image
|
|
16
|
+
*/
|
|
17
|
+
uploadRawAsset(asset: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<import("@wireapp/api-client/src/asset").AssetUploadData>;
|
|
18
|
+
/**
|
|
19
|
+
* Will encrypt and upload an asset to the backend
|
|
20
|
+
*
|
|
21
|
+
* @param plainText The raw content of the asset to upload
|
|
22
|
+
* @param options?
|
|
23
|
+
* @param progressCallback?
|
|
24
|
+
* @return cancellable request that resolves with the uploaded image and decryption keys
|
|
25
|
+
*/
|
|
9
26
|
uploadAsset(plainText: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): Promise<RequestCancelable<EncryptedAssetUploaded>>;
|
|
10
27
|
}
|
|
@@ -24,13 +24,32 @@ class AssetService {
|
|
|
24
24
|
constructor(apiClient) {
|
|
25
25
|
this.apiClient = apiClient;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Uploads a raw asset to the backend without encrypting it
|
|
29
|
+
*
|
|
30
|
+
* @param plainText The raw content of the asset to upload
|
|
31
|
+
* @param options?
|
|
32
|
+
* @param progressCallback?
|
|
33
|
+
* @return cancellable request that resolves with the uploaded image
|
|
34
|
+
*/
|
|
35
|
+
uploadRawAsset(asset, options, progressCallback) {
|
|
36
|
+
return this.apiClient.asset.api.postAsset(new Uint8Array(asset), options, progressCallback);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Will encrypt and upload an asset to the backend
|
|
40
|
+
*
|
|
41
|
+
* @param plainText The raw content of the asset to upload
|
|
42
|
+
* @param options?
|
|
43
|
+
* @param progressCallback?
|
|
44
|
+
* @return cancellable request that resolves with the uploaded image and decryption keys
|
|
45
|
+
*/
|
|
27
46
|
async uploadAsset(plainText, options, progressCallback) {
|
|
28
47
|
const { cipherText, keyBytes, sha256 } = await (0, AssetCryptography_1.encryptAsset)({
|
|
29
48
|
plainText,
|
|
30
49
|
algorithm: options === null || options === void 0 ? void 0 : options.algorithm,
|
|
31
50
|
hash: options === null || options === void 0 ? void 0 : options.hash,
|
|
32
51
|
});
|
|
33
|
-
const request = this.
|
|
52
|
+
const request = this.uploadRawAsset(cipherText, options, progressCallback);
|
|
34
53
|
return Object.assign(Object.assign({}, request), { response: request.response.then(response => {
|
|
35
54
|
const { key, token } = response;
|
|
36
55
|
return {
|
|
@@ -686,11 +686,11 @@ class ConversationService {
|
|
|
686
686
|
onClientMismatch: callbacks === null || callbacks === void 0 ? void 0 : callbacks.onClientMismatch,
|
|
687
687
|
});
|
|
688
688
|
if (!response.errored) {
|
|
689
|
-
(_b = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onSuccess) === null || _b === void 0 ? void 0 : _b.call(callbacks, genericMessage, response.time);
|
|
690
689
|
if (!this.isClearFromMismatch(response)) {
|
|
691
690
|
// We warn the consumer that there is a mismatch that did not prevent message sending
|
|
692
|
-
(
|
|
691
|
+
await ((_b = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onClientMismatch) === null || _b === void 0 ? void 0 : _b.call(callbacks, response, true));
|
|
693
692
|
}
|
|
693
|
+
(_c = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onSuccess) === null || _c === void 0 ? void 0 : _c.call(callbacks, genericMessage, response.time);
|
|
694
694
|
}
|
|
695
695
|
return Object.assign(Object.assign({}, payloadBundle), { content: processedContent || payloadBundle.content, messageTimer: ((_d = genericMessage.ephemeral) === null || _d === void 0 ? void 0 : _d.expireAfterMillis) || 0, state: response.errored ? conversation_2.PayloadBundleState.CANCELLED : conversation_2.PayloadBundleState.OUTGOING_SENT });
|
|
696
696
|
}
|