@wireapp/core 20.1.3 → 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,17 @@
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
+
6
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)
7
18
 
8
19
  **Note:** Version bump only for package @wireapp/core
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": "20.1.3",
73
- "gitHead": "6470b37490179eadfe0ae855726c7945931fa54f"
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.apiClient.asset.api.postAsset(new Uint8Array(cipherText), options, progressCallback);
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 {