@aws-sdk/sha256-tree-hash 3.224.0 → 3.254.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/dist-cjs/index.js CHANGED
@@ -73,5 +73,9 @@ class TreeHash {
73
73
  }
74
74
  return new Uint8Array(data);
75
75
  }
76
+ reset() {
77
+ this.buffer = undefined;
78
+ this.collectedHashDigests = [];
79
+ }
76
80
  }
77
81
  exports.TreeHash = TreeHash;
package/dist-es/index.js CHANGED
@@ -70,4 +70,8 @@ export class TreeHash {
70
70
  }
71
71
  return new Uint8Array(data);
72
72
  }
73
+ reset() {
74
+ this.buffer = undefined;
75
+ this.collectedHashDigests = [];
76
+ }
73
77
  }
@@ -1,8 +1,8 @@
1
- import { Decoder, Hash, HashConstructor, SourceData } from "@aws-sdk/types";
1
+ import { Checksum, ChecksumConstructor, Decoder, HashConstructor, SourceData } from "@aws-sdk/types";
2
2
  /**
3
3
  * A Hash that will calculate a Sha256 tree hash.
4
4
  */
5
- export declare class TreeHash implements Hash {
5
+ export declare class TreeHash implements Checksum {
6
6
  private readonly Sha256;
7
7
  private readonly fromUtf8;
8
8
  private buffer?;
@@ -11,7 +11,7 @@ export declare class TreeHash implements Hash {
11
11
  * Initializes a TreeHash.
12
12
  * @param Sha256 A Sha256 hash constructor.
13
13
  */
14
- constructor(Sha256: HashConstructor, fromUtf8: Decoder);
14
+ constructor(Sha256: ChecksumConstructor | HashConstructor, fromUtf8: Decoder);
15
15
  /**
16
16
  * Generates Sha256 hashes from 1 MiB chunks of the
17
17
  * internal buffer.
@@ -21,7 +21,7 @@ export declare class TreeHash implements Hash {
21
21
  private hashBuffer;
22
22
  /**
23
23
  * Updates the tree hash with byte data.
24
- * @param chunk Byte data to apply to the tree hash.
24
+ * @param data Byte data to apply to the tree hash.
25
25
  */
26
26
  update(data: SourceData): void;
27
27
  /**
@@ -33,4 +33,5 @@ export declare class TreeHash implements Hash {
33
33
  * @param data Data to convert to a Uint8Array.
34
34
  */
35
35
  private convertToBuffer;
36
+ reset(): void;
36
37
  }
@@ -1,12 +1,19 @@
1
- import { Decoder, Hash, HashConstructor, SourceData } from "@aws-sdk/types";
2
- export declare class TreeHash implements Hash {
1
+ import {
2
+ Checksum,
3
+ ChecksumConstructor,
4
+ Decoder,
5
+ HashConstructor,
6
+ SourceData,
7
+ } from "@aws-sdk/types";
8
+ export declare class TreeHash implements Checksum {
3
9
  private readonly Sha256;
4
10
  private readonly fromUtf8;
5
11
  private buffer?;
6
12
  private collectedHashDigests;
7
- constructor(Sha256: HashConstructor, fromUtf8: Decoder);
13
+ constructor(Sha256: ChecksumConstructor | HashConstructor, fromUtf8: Decoder);
8
14
  private hashBuffer;
9
15
  update(data: SourceData): void;
10
16
  digest(): Promise<Uint8Array>;
11
17
  private convertToBuffer;
18
+ reset(): void;
12
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/sha256-tree-hash",
3
- "version": "3.224.0",
3
+ "version": "3.254.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,11 +20,11 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.224.0",
23
+ "@aws-sdk/types": "3.254.0",
24
24
  "tslib": "^2.3.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@aws-crypto/sha256-js": "2.0.0",
27
+ "@aws-crypto/sha256-js": "3.0.0",
28
28
  "@aws-sdk/util-hex-encoding": "3.201.0",
29
29
  "@aws-sdk/util-utf8-node": "3.208.0",
30
30
  "@tsconfig/recommended": "1.0.1",