@depup/aws-sdk__checksums 3.1000.18-depup.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/LICENSE +201 -0
- package/README.md +32 -0
- package/changes.json +14 -0
- package/crc.d.ts +5 -0
- package/crc.js +5 -0
- package/dist-cjs/index.js +22 -0
- package/dist-cjs/submodules/crc/index.js +159 -0
- package/dist-cjs/submodules/flexible-checksums/index.js +444 -0
- package/dist-cjs/submodules/md5/index.js +4 -0
- package/dist-cjs/submodules/sha/index.js +312 -0
- package/dist-es/index.js +2 -0
- package/dist-es/submodules/crc/crc32c/Crc32cJs.js +31 -0
- package/dist-es/submodules/crc/crc32c/Crc32cNode.js +2 -0
- package/dist-es/submodules/crc/crc64-nvme/Crc64Nvme.js +18 -0
- package/dist-es/submodules/crc/crc64-nvme/Crc64NvmeJs.js +92 -0
- package/dist-es/submodules/crc/crc64-nvme/crc64-nvme-crt-container.js +3 -0
- package/dist-es/submodules/crc/index.browser.js +6 -0
- package/dist-es/submodules/crc/index.js +6 -0
- package/dist-es/submodules/flexible-checksums/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.js +9 -0
- package/dist-es/submodules/flexible-checksums/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.js +9 -0
- package/dist-es/submodules/flexible-checksums/configuration.js +1 -0
- package/dist-es/submodules/flexible-checksums/constants.js +25 -0
- package/dist-es/submodules/flexible-checksums/flexibleChecksumsInputMiddleware.js +37 -0
- package/dist-es/submodules/flexible-checksums/flexibleChecksumsMiddleware.js +123 -0
- package/dist-es/submodules/flexible-checksums/flexibleChecksumsResponseMiddleware.js +48 -0
- package/dist-es/submodules/flexible-checksums/getChecksum.js +2 -0
- package/dist-es/submodules/flexible-checksums/getChecksumAlgorithmForRequest.js +13 -0
- package/dist-es/submodules/flexible-checksums/getChecksumAlgorithmListForResponse.js +15 -0
- package/dist-es/submodules/flexible-checksums/getChecksumLocationName.js +2 -0
- package/dist-es/submodules/flexible-checksums/getFlexibleChecksumsPlugin.js +10 -0
- package/dist-es/submodules/flexible-checksums/hasHeader.js +9 -0
- package/dist-es/submodules/flexible-checksums/hasHeaderWithPrefix.js +9 -0
- package/dist-es/submodules/flexible-checksums/index.js +6 -0
- package/dist-es/submodules/flexible-checksums/isChecksumWithPartNumber.js +13 -0
- package/dist-es/submodules/flexible-checksums/isStreaming.js +2 -0
- package/dist-es/submodules/flexible-checksums/resolveFlexibleChecksumsConfig.js +11 -0
- package/dist-es/submodules/flexible-checksums/selectChecksumAlgorithmFunction.js +27 -0
- package/dist-es/submodules/flexible-checksums/stringHasher.js +6 -0
- package/dist-es/submodules/flexible-checksums/stringUnionSelector.js +14 -0
- package/dist-es/submodules/flexible-checksums/types.js +15 -0
- package/dist-es/submodules/flexible-checksums/validateChecksumFromResponse.js +45 -0
- package/dist-es/submodules/md5/index.js +1 -0
- package/dist-es/submodules/sha/index.browser.js +4 -0
- package/dist-es/submodules/sha/index.js +4 -0
- package/dist-es/submodules/sha/sha1/Sha1Js.js +173 -0
- package/dist-es/submodules/sha/sha1/Sha1Node.js +59 -0
- package/dist-es/submodules/sha/sha1/Sha1WebCrypto.js +71 -0
- package/dist-types/index.d.ts +3 -0
- package/dist-types/submodules/crc/crc32c/Crc32cJs.d.ts +13 -0
- package/dist-types/submodules/crc/crc32c/Crc32cNode.d.ts +13 -0
- package/dist-types/submodules/crc/crc64-nvme/Crc64Nvme.d.ts +21 -0
- package/dist-types/submodules/crc/crc64-nvme/Crc64NvmeJs.d.ts +14 -0
- package/dist-types/submodules/crc/crc64-nvme/crc64-nvme-crt-container.d.ts +11 -0
- package/dist-types/submodules/crc/index.browser.d.ts +5 -0
- package/dist-types/submodules/crc/index.d.ts +6 -0
- package/dist-types/submodules/flexible-checksums/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +14 -0
- package/dist-types/submodules/flexible-checksums/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +14 -0
- package/dist-types/submodules/flexible-checksums/configuration.d.ts +58 -0
- package/dist-types/submodules/flexible-checksums/constants.d.ts +83 -0
- package/dist-types/submodules/flexible-checksums/flexibleChecksumsInputMiddleware.d.ts +22 -0
- package/dist-types/submodules/flexible-checksums/flexibleChecksumsMiddleware.d.ts +33 -0
- package/dist-types/submodules/flexible-checksums/flexibleChecksumsResponseMiddleware.d.ts +27 -0
- package/dist-types/submodules/flexible-checksums/getChecksum.d.ts +6 -0
- package/dist-types/submodules/flexible-checksums/getChecksumAlgorithmForRequest.d.ts +22 -0
- package/dist-types/submodules/flexible-checksums/getChecksumAlgorithmListForResponse.d.ts +6 -0
- package/dist-types/submodules/flexible-checksums/getChecksumLocationName.d.ts +5 -0
- package/dist-types/submodules/flexible-checksums/getFlexibleChecksumsPlugin.d.ts +14 -0
- package/dist-types/submodules/flexible-checksums/hasHeader.d.ts +6 -0
- package/dist-types/submodules/flexible-checksums/hasHeaderWithPrefix.d.ts +6 -0
- package/dist-types/submodules/flexible-checksums/index.d.ts +9 -0
- package/dist-types/submodules/flexible-checksums/isChecksumWithPartNumber.d.ts +1 -0
- package/dist-types/submodules/flexible-checksums/isStreaming.d.ts +4 -0
- package/dist-types/submodules/flexible-checksums/resolveFlexibleChecksumsConfig.d.ts +57 -0
- package/dist-types/submodules/flexible-checksums/selectChecksumAlgorithmFunction.d.ts +7 -0
- package/dist-types/submodules/flexible-checksums/stringHasher.d.ts +5 -0
- package/dist-types/submodules/flexible-checksums/stringUnionSelector.d.ts +12 -0
- package/dist-types/submodules/flexible-checksums/types.d.ts +9 -0
- package/dist-types/submodules/flexible-checksums/validateChecksumFromResponse.d.ts +13 -0
- package/dist-types/submodules/md5/index.d.ts +1 -0
- package/dist-types/submodules/sha/index.browser.d.ts +3 -0
- package/dist-types/submodules/sha/index.d.ts +4 -0
- package/dist-types/submodules/sha/sha1/Sha1Js.d.ts +26 -0
- package/dist-types/submodules/sha/sha1/Sha1Node.d.ts +13 -0
- package/dist-types/submodules/sha/sha1/Sha1WebCrypto.d.ts +22 -0
- package/dist-types/ts3.4/index.d.ts +26 -0
- package/dist-types/ts3.4/submodules/crc/crc32c/Crc32cJs.d.ts +8 -0
- package/dist-types/ts3.4/submodules/crc/crc32c/Crc32cNode.d.ts +5 -0
- package/dist-types/ts3.4/submodules/crc/crc64-nvme/Crc64Nvme.d.ts +8 -0
- package/dist-types/ts3.4/submodules/crc/crc64-nvme/Crc64NvmeJs.d.ts +9 -0
- package/dist-types/ts3.4/submodules/crc/crc64-nvme/crc64-nvme-crt-container.d.ts +4 -0
- package/dist-types/ts3.4/submodules/crc/index.browser.d.ts +5 -0
- package/dist-types/ts3.4/submodules/crc/index.d.ts +6 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +5 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +5 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/configuration.d.ts +26 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/constants.d.ts +27 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/flexibleChecksumsInputMiddleware.d.ts +10 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/flexibleChecksumsMiddleware.d.ts +14 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/flexibleChecksumsResponseMiddleware.d.ts +11 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/getChecksum.d.ts +9 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/getChecksumAlgorithmForRequest.d.ts +15 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/getChecksumAlgorithmListForResponse.d.ts +4 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/getChecksumLocationName.d.ts +2 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/getFlexibleChecksumsPlugin.d.ts +14 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/hasHeader.d.ts +2 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/hasHeaderWithPrefix.d.ts +2 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/index.d.ts +31 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/isChecksumWithPartNumber.d.ts +1 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/isStreaming.d.ts +1 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/resolveFlexibleChecksumsConfig.d.ts +25 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/selectChecksumAlgorithmFunction.d.ts +7 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/stringHasher.d.ts +5 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/stringUnionSelector.d.ts +10 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/types.d.ts +3 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/validateChecksumFromResponse.d.ts +12 -0
- package/dist-types/ts3.4/submodules/md5/index.d.ts +1 -0
- package/dist-types/ts3.4/submodules/sha/index.browser.d.ts +3 -0
- package/dist-types/ts3.4/submodules/sha/index.d.ts +4 -0
- package/dist-types/ts3.4/submodules/sha/sha1/Sha1Js.d.ts +20 -0
- package/dist-types/ts3.4/submodules/sha/sha1/Sha1Node.d.ts +5 -0
- package/dist-types/ts3.4/submodules/sha/sha1/Sha1WebCrypto.d.ts +14 -0
- package/flexible-checksums.d.ts +5 -0
- package/flexible-checksums.js +5 -0
- package/md5.d.ts +5 -0
- package/md5.js +5 -0
- package/package.json +159 -0
- package/sha.d.ts +5 -0
- package/sha.js +5 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { concatBytes, toUint8Array } from "@smithy/core/serde";
|
|
2
|
+
import { Sha1Js } from "./Sha1Js";
|
|
3
|
+
const { digest, sign, importKey } = globalThis?.crypto?.subtle ?? {};
|
|
4
|
+
const subtle = typeof digest === "function" && typeof sign === "function" && typeof importKey === "function"
|
|
5
|
+
? globalThis.crypto.subtle
|
|
6
|
+
: undefined;
|
|
7
|
+
const MAX_PENDING_BYTES = 8 * 1024 * 1024;
|
|
8
|
+
export class Sha1WebCrypto {
|
|
9
|
+
digestLength = 20;
|
|
10
|
+
secret;
|
|
11
|
+
pending = [];
|
|
12
|
+
pendingBytes = 0;
|
|
13
|
+
fallback;
|
|
14
|
+
finished = false;
|
|
15
|
+
constructor(secret) {
|
|
16
|
+
if (secret) {
|
|
17
|
+
this.secret = toUint8Array(secret);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
update(data) {
|
|
21
|
+
if (this.finished) {
|
|
22
|
+
throw new Error("Attempted to update an already finished HMAC.");
|
|
23
|
+
}
|
|
24
|
+
if (this.fallback) {
|
|
25
|
+
this.fallback.update(data);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.pending.push(data.slice());
|
|
29
|
+
this.pendingBytes += data.byteLength;
|
|
30
|
+
if (this.pendingBytes >= MAX_PENDING_BYTES) {
|
|
31
|
+
this.switchToFallback();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async digest() {
|
|
35
|
+
if (this.fallback) {
|
|
36
|
+
return this.fallback.digest();
|
|
37
|
+
}
|
|
38
|
+
if (this.secret && this.finished) {
|
|
39
|
+
throw new Error("Attempted to digest an already finished HMAC.");
|
|
40
|
+
}
|
|
41
|
+
const data = concatBytes(this.pending);
|
|
42
|
+
if (subtle) {
|
|
43
|
+
if (this.secret) {
|
|
44
|
+
this.finished = true;
|
|
45
|
+
const key = await subtle.importKey("raw", this.secret, { name: "HMAC", hash: "SHA-1" }, false, ["sign"]);
|
|
46
|
+
const sig = await subtle.sign("HMAC", key, data);
|
|
47
|
+
return new Uint8Array(sig);
|
|
48
|
+
}
|
|
49
|
+
const hash = await subtle.digest("SHA-1", data);
|
|
50
|
+
return new Uint8Array(hash);
|
|
51
|
+
}
|
|
52
|
+
const sha1 = new Sha1Js(this.secret);
|
|
53
|
+
sha1.update(data);
|
|
54
|
+
return sha1.digest();
|
|
55
|
+
}
|
|
56
|
+
reset() {
|
|
57
|
+
this.pending = [];
|
|
58
|
+
this.pendingBytes = 0;
|
|
59
|
+
this.fallback = undefined;
|
|
60
|
+
this.finished = false;
|
|
61
|
+
}
|
|
62
|
+
switchToFallback() {
|
|
63
|
+
const sha1Js = new Sha1Js(this.secret);
|
|
64
|
+
for (const chunk of this.pending) {
|
|
65
|
+
sha1Js.update(chunk);
|
|
66
|
+
}
|
|
67
|
+
this.fallback = sha1Js;
|
|
68
|
+
this.pending = [];
|
|
69
|
+
this.pendingBytes = 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Crc64Nvme, Crc64NvmeJs, crc64NvmeCrtContainer } from "@aws-sdk/checksums/crc";
|
|
2
|
+
export { ENV_REQUEST_CHECKSUM_CALCULATION, CONFIG_REQUEST_CHECKSUM_CALCULATION, NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, ENV_RESPONSE_CHECKSUM_VALIDATION, CONFIG_RESPONSE_CHECKSUM_VALIDATION, NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, RequestChecksumCalculation, DEFAULT_REQUEST_CHECKSUM_CALCULATION, ResponseChecksumValidation, DEFAULT_RESPONSE_CHECKSUM_VALIDATION, ChecksumAlgorithm, ChecksumLocation, DEFAULT_CHECKSUM_ALGORITHM, flexibleChecksumsMiddlewareOptions, flexibleChecksumsMiddleware, getFlexibleChecksumsPlugin, resolveFlexibleChecksumsConfig, } from "@aws-sdk/checksums/flexible-checksums";
|
|
3
|
+
export type { FlexibleChecksumsRequestMiddlewareConfig, FlexibleChecksumsMiddlewareConfig, FlexibleChecksumsInputConfig, FlexibleChecksumsResolvedConfig, } from "@aws-sdk/checksums/flexible-checksums";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Checksum } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* Pure JS CRC-32C using the Castagnoli polynomial.
|
|
4
|
+
* Non-destructive digest — safe to call digest() multiple times.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class Crc32cJs implements Checksum {
|
|
8
|
+
readonly digestLength = 4;
|
|
9
|
+
private crc;
|
|
10
|
+
update(data: Uint8Array): void;
|
|
11
|
+
digest(): Promise<Uint8Array>;
|
|
12
|
+
reset(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Checksum } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* CRC-32C (Castagnoli). No native Node.js implementation exists,
|
|
4
|
+
* so this is equivalent to the pure JS version.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface Crc32cNode extends Checksum {
|
|
8
|
+
readonly digestLength: 4;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const Crc32cNode: new () => Crc32cNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Checksum } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* CRC-64/NVME checksum. Uses the CRT native implementation if loaded,
|
|
4
|
+
* otherwise falls back to the pure JS implementation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const checksum = new Crc64Nvme();
|
|
9
|
+
* checksum.update(new Uint8Array([1, 2, 3]));
|
|
10
|
+
* const result = await checksum.digest();
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare class Crc64Nvme implements Checksum {
|
|
16
|
+
private impl;
|
|
17
|
+
constructor();
|
|
18
|
+
update(data: Uint8Array): void;
|
|
19
|
+
digest(): Promise<Uint8Array>;
|
|
20
|
+
reset(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Checksum } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* Pure JS CRC-64/NVME implementation using the NVMe polynomial (0x9a6c9329ac4bc9b5).
|
|
4
|
+
* Uses an 8-slice lookup table for efficient computation.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class Crc64NvmeJs implements Checksum {
|
|
8
|
+
private c1;
|
|
9
|
+
private c2;
|
|
10
|
+
constructor();
|
|
11
|
+
update(data: Uint8Array): void;
|
|
12
|
+
digest(): Promise<Uint8Array>;
|
|
13
|
+
reset(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChecksumConstructor } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* \@aws-sdk/crc64-nvme-crt will install the constructor in this
|
|
4
|
+
* container if it is installed.
|
|
5
|
+
*
|
|
6
|
+
* This avoids a runtime-require being interpreted statically by bundlers.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const crc64NvmeCrtContainer: {
|
|
10
|
+
CrtCrc64Nvme: null | ChecksumConstructor;
|
|
11
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Crc32cJs, Crc32cJs as Crc32c } from "./crc32c/Crc32cJs";
|
|
2
|
+
export declare const Crc32cNode: symbol;
|
|
3
|
+
export { Crc64NvmeJs, Crc64NvmeJs as Crc64Nvme } from "./crc64-nvme/Crc64NvmeJs";
|
|
4
|
+
export { crc64NvmeCrtContainer } from "./crc64-nvme/crc64-nvme-crt-container";
|
|
5
|
+
export { Crc32, Crc32Js, Crc32Node } from "@smithy/core/checksum";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Crc32cJs } from "./crc32c/Crc32cJs";
|
|
2
|
+
export { Crc32cNode, Crc32cNode as Crc32c } from "./crc32c/Crc32cNode";
|
|
3
|
+
export { Crc64Nvme } from "./crc64-nvme/Crc64Nvme";
|
|
4
|
+
export { Crc64NvmeJs } from "./crc64-nvme/Crc64NvmeJs";
|
|
5
|
+
export { crc64NvmeCrtContainer } from "./crc64-nvme/crc64-nvme-crt-container";
|
|
6
|
+
export { Crc32, Crc32Js, Crc32Node } from "@smithy/core/checksum";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
|
+
import { RequestChecksumCalculation } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const ENV_REQUEST_CHECKSUM_CALCULATION = "AWS_REQUEST_CHECKSUM_CALCULATION";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const CONFIG_REQUEST_CHECKSUM_CALCULATION = "request_checksum_calculation";
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS: LoadedConfigSelectors<RequestChecksumCalculation>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
|
+
import { ResponseChecksumValidation } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare const ENV_RESPONSE_CHECKSUM_VALIDATION = "AWS_RESPONSE_CHECKSUM_VALIDATION";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const CONFIG_RESPONSE_CHECKSUM_VALIDATION = "response_checksum_validation";
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS: LoadedConfigSelectors<ResponseChecksumValidation>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BodyLengthCalculator, ChecksumConstructor, Encoder, GetAwsChunkedEncodingStream, HashConstructor, Provider, StreamCollector, StreamHasher } from "@smithy/types";
|
|
2
|
+
import type { RequestChecksumCalculation, ResponseChecksumValidation } from "./constants";
|
|
3
|
+
import type { FlexibleChecksumsInputConfig } from "./resolveFlexibleChecksumsConfig";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface PreviouslyResolved {
|
|
8
|
+
/**
|
|
9
|
+
* The function that will be used to convert binary data to a base64-encoded string.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
base64Encoder: Encoder;
|
|
13
|
+
/**
|
|
14
|
+
* A function that can calculate the length of a body.
|
|
15
|
+
*/
|
|
16
|
+
bodyLengthChecker: BodyLengthCalculator;
|
|
17
|
+
/**
|
|
18
|
+
* A function that returns Readable Stream which follows aws-chunked encoding stream.
|
|
19
|
+
*/
|
|
20
|
+
getAwsChunkedEncodingStream: GetAwsChunkedEncodingStream;
|
|
21
|
+
/**
|
|
22
|
+
* A constructor for a class implementing the {@link Hash} interface that computes MD5 hashes.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
md5: ChecksumConstructor | HashConstructor;
|
|
26
|
+
/**
|
|
27
|
+
* Determines when a checksum will be calculated for request payloads
|
|
28
|
+
*/
|
|
29
|
+
requestChecksumCalculation: Provider<RequestChecksumCalculation>;
|
|
30
|
+
/**
|
|
31
|
+
* Determines when a checksum will be calculated for response payloads
|
|
32
|
+
*/
|
|
33
|
+
responseChecksumValidation: Provider<ResponseChecksumValidation>;
|
|
34
|
+
/**
|
|
35
|
+
* A constructor for a class implementing the {@link Hash} interface that computes SHA1 hashes.
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
sha1: ChecksumConstructor | HashConstructor;
|
|
39
|
+
/**
|
|
40
|
+
* A constructor for a class implementing the {@link Hash} interface that computes SHA256 hashes.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
sha256: ChecksumConstructor | HashConstructor;
|
|
44
|
+
/**
|
|
45
|
+
* A function that, given a hash constructor and a stream, calculates the hash of the streamed value.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
streamHasher: StreamHasher<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Collects streams into buffers.
|
|
51
|
+
*/
|
|
52
|
+
streamCollector: StreamCollector;
|
|
53
|
+
/**
|
|
54
|
+
* Minimum bytes from a stream to buffer into a chunk before passing to chunked encoding.
|
|
55
|
+
*/
|
|
56
|
+
requestStreamBufferSize: number;
|
|
57
|
+
checksumAlgorithms?: FlexibleChecksumsInputConfig["checksumAlgorithms"];
|
|
58
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines when a checksum will be calculated for request payloads.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare const RequestChecksumCalculation: {
|
|
6
|
+
/**
|
|
7
|
+
* When set, a checksum will be calculated for all request payloads of operations
|
|
8
|
+
* modeled with the {@link httpChecksum} trait where `requestChecksumRequired` is `true`
|
|
9
|
+
* AND/OR a `requestAlgorithmMember` is modeled.
|
|
10
|
+
* {@link https://smithy.io/2.0/aws/aws-core.html#aws-protocols-httpchecksum-trait httpChecksum}
|
|
11
|
+
*/
|
|
12
|
+
readonly WHEN_SUPPORTED: "WHEN_SUPPORTED";
|
|
13
|
+
/**
|
|
14
|
+
* When set, a checksum will only be calculated for request payloads of operations
|
|
15
|
+
* modeled with the {@link httpChecksum} trait where `requestChecksumRequired` is `true`
|
|
16
|
+
* OR where a `requestAlgorithmMember` is modeled and the user sets it.
|
|
17
|
+
* {@link https://smithy.io/2.0/aws/aws-core.html#aws-protocols-httpchecksum-trait httpChecksum}
|
|
18
|
+
*/
|
|
19
|
+
readonly WHEN_REQUIRED: "WHEN_REQUIRED";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export type RequestChecksumCalculation = (typeof RequestChecksumCalculation)[keyof typeof RequestChecksumCalculation];
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_REQUEST_CHECKSUM_CALCULATION: "WHEN_SUPPORTED";
|
|
29
|
+
/**
|
|
30
|
+
* Determines when checksum validation will be performed on response payloads.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare const ResponseChecksumValidation: {
|
|
34
|
+
/**
|
|
35
|
+
* When set, checksum validation MUST be performed on all response payloads of operations
|
|
36
|
+
* modeled with the {@link httpChecksum} trait where `responseAlgorithms` is modeled,
|
|
37
|
+
* except when no modeled checksum algorithms are supported by an SDK.
|
|
38
|
+
* {@link https://smithy.io/2.0/aws/aws-core.html#aws-protocols-httpchecksum-trait httpChecksum}
|
|
39
|
+
*/
|
|
40
|
+
readonly WHEN_SUPPORTED: "WHEN_SUPPORTED";
|
|
41
|
+
/**
|
|
42
|
+
* When set, checksum validation MUST NOT be performed on response payloads of operations UNLESS
|
|
43
|
+
* the SDK supports the modeled checksum algorithms AND the user has set the `requestValidationModeMember` to `ENABLED`.
|
|
44
|
+
* It is currently impossible to model an operation as requiring a response checksum,
|
|
45
|
+
* but this setting leaves the door open for future updates.
|
|
46
|
+
*/
|
|
47
|
+
readonly WHEN_REQUIRED: "WHEN_REQUIRED";
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export type ResponseChecksumValidation = (typeof ResponseChecksumValidation)[keyof typeof ResponseChecksumValidation];
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare const DEFAULT_RESPONSE_CHECKSUM_VALIDATION: "WHEN_SUPPORTED";
|
|
57
|
+
/**
|
|
58
|
+
* Checksum Algorithms supported by the SDK.
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export declare enum ChecksumAlgorithm {
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use {@link ChecksumAlgorithm.CRC32} instead.
|
|
64
|
+
*/
|
|
65
|
+
MD5 = "MD5",
|
|
66
|
+
CRC32 = "CRC32",
|
|
67
|
+
CRC32C = "CRC32C",
|
|
68
|
+
CRC64NVME = "CRC64NVME",
|
|
69
|
+
SHA1 = "SHA1",
|
|
70
|
+
SHA256 = "SHA256"
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Location when the checksum is stored in the request body.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export declare enum ChecksumLocation {
|
|
77
|
+
HEADER = "header",
|
|
78
|
+
TRAILER = "trailer"
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export declare const DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.CRC32;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RelativeMiddlewareOptions, SerializeMiddleware } from "@smithy/types";
|
|
2
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface FlexibleChecksumsInputMiddlewareConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Defines a top-level operation input member used to opt-in to best-effort validation
|
|
9
|
+
* of a checksum returned in the HTTP response of the operation.
|
|
10
|
+
*/
|
|
11
|
+
requestValidationModeMember?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const flexibleChecksumsInputMiddlewareOptions: RelativeMiddlewareOptions;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
20
|
+
* The input counterpart to the flexibleChecksumsMiddleware.
|
|
21
|
+
*/
|
|
22
|
+
export declare const flexibleChecksumsInputMiddleware: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsInputMiddlewareConfig) => SerializeMiddleware<any, any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BuildHandlerOptions, BuildMiddleware } from "@smithy/types";
|
|
2
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface FlexibleChecksumsRequestMiddlewareConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Indicates an operation requires a checksum in its HTTP request.
|
|
9
|
+
*/
|
|
10
|
+
requestChecksumRequired: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Member that is used to configure request checksum behavior.
|
|
13
|
+
*/
|
|
14
|
+
requestAlgorithmMember?: {
|
|
15
|
+
/**
|
|
16
|
+
* Defines a top-level operation input member that is used to configure request checksum behavior.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* The {@link httpHeader} value, if present.
|
|
21
|
+
* {@link https://smithy.io/2.0/spec/http-bindings.html#httpheader-trait httpHeader}
|
|
22
|
+
*/
|
|
23
|
+
httpHeader?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const flexibleChecksumsMiddlewareOptions: BuildHandlerOptions;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const flexibleChecksumsMiddleware: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsRequestMiddlewareConfig) => BuildMiddleware<any, any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DeserializeMiddleware, RelativeMiddlewareOptions } from "@smithy/types";
|
|
2
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface FlexibleChecksumsResponseMiddlewareConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Defines a top-level operation input member used to opt-in to best-effort validation
|
|
9
|
+
* of a checksum returned in the HTTP response of the operation.
|
|
10
|
+
*/
|
|
11
|
+
requestValidationModeMember?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Defines the checksum algorithms clients SHOULD look for when validating checksums
|
|
14
|
+
* returned in the HTTP response.
|
|
15
|
+
*/
|
|
16
|
+
responseAlgorithms?: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const flexibleChecksumsResponseMiddlewareOptions: RelativeMiddlewareOptions;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*
|
|
25
|
+
* The validation counterpart to the flexibleChecksumsMiddleware.
|
|
26
|
+
*/
|
|
27
|
+
export declare const flexibleChecksumsResponseMiddleware: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsResponseMiddlewareConfig) => DeserializeMiddleware<any, any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ChecksumConstructor, Encoder, HashConstructor } from "@smithy/types";
|
|
2
|
+
export interface GetChecksumDigestOptions {
|
|
3
|
+
checksumAlgorithmFn: ChecksumConstructor | HashConstructor;
|
|
4
|
+
base64Encoder: Encoder;
|
|
5
|
+
}
|
|
6
|
+
export declare const getChecksum: (body: unknown, { checksumAlgorithmFn, base64Encoder }: GetChecksumDigestOptions) => Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
import { RequestChecksumCalculation } from "./constants";
|
|
3
|
+
export interface GetChecksumAlgorithmForRequestOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Indicates an operation requires a checksum in its HTTP request.
|
|
6
|
+
*/
|
|
7
|
+
requestChecksumRequired: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Defines a top-level operation input member that is used to configure request checksum behavior.
|
|
10
|
+
*/
|
|
11
|
+
requestAlgorithmMember?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Determines when a checksum will be calculated for request payloads
|
|
14
|
+
*/
|
|
15
|
+
requestChecksumCalculation: RequestChecksumCalculation;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns the checksum algorithm to use for the request, along with
|
|
19
|
+
* the priority array of location to use to populate checksum and names
|
|
20
|
+
* to be used as a key at the location.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getChecksumAlgorithmForRequest: (input: any, { requestChecksumRequired, requestAlgorithmMember, requestChecksumCalculation }: GetChecksumAlgorithmForRequestOptions) => ChecksumAlgorithm | string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the priority array of algorithm to use to verify checksum and names
|
|
4
|
+
* to be used as a key in the response header.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getChecksumAlgorithmListForResponse: (responseAlgorithms?: string[]) => ChecksumAlgorithm[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Pluggable } from "@smithy/types";
|
|
2
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import type { FlexibleChecksumsInputMiddlewareConfig } from "./flexibleChecksumsInputMiddleware";
|
|
4
|
+
import type { FlexibleChecksumsRequestMiddlewareConfig } from "./flexibleChecksumsMiddleware";
|
|
5
|
+
import type { FlexibleChecksumsResponseMiddlewareConfig } from "./flexibleChecksumsResponseMiddleware";
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface FlexibleChecksumsMiddlewareConfig extends FlexibleChecksumsRequestMiddlewareConfig, FlexibleChecksumsInputMiddlewareConfig, FlexibleChecksumsResponseMiddlewareConfig {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const getFlexibleChecksumsPlugin: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsMiddlewareConfig) => Pluggable<any, any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ENV_REQUEST_CHECKSUM_CALCULATION, CONFIG_REQUEST_CHECKSUM_CALCULATION, NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, } from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
|
|
2
|
+
export { ENV_RESPONSE_CHECKSUM_VALIDATION, CONFIG_RESPONSE_CHECKSUM_VALIDATION, NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, } from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
|
|
3
|
+
export { RequestChecksumCalculation, DEFAULT_REQUEST_CHECKSUM_CALCULATION, ResponseChecksumValidation, DEFAULT_RESPONSE_CHECKSUM_VALIDATION, ChecksumAlgorithm, ChecksumLocation, DEFAULT_CHECKSUM_ALGORITHM, } from "./constants";
|
|
4
|
+
export type { FlexibleChecksumsRequestMiddlewareConfig } from "./flexibleChecksumsMiddleware";
|
|
5
|
+
export { flexibleChecksumsMiddlewareOptions, flexibleChecksumsMiddleware } from "./flexibleChecksumsMiddleware";
|
|
6
|
+
export type { FlexibleChecksumsMiddlewareConfig } from "./getFlexibleChecksumsPlugin";
|
|
7
|
+
export { getFlexibleChecksumsPlugin } from "./getFlexibleChecksumsPlugin";
|
|
8
|
+
export type { FlexibleChecksumsInputConfig, FlexibleChecksumsResolvedConfig } from "./resolveFlexibleChecksumsConfig";
|
|
9
|
+
export { resolveFlexibleChecksumsConfig } from "./resolveFlexibleChecksumsConfig";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isChecksumWithPartNumber: (checksum: string) => boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ChecksumConstructor, Provider } from "@smithy/types";
|
|
2
|
+
import type { RequestChecksumCalculation, ResponseChecksumValidation } from "./constants";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface FlexibleChecksumsInputConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Determines when a checksum will be calculated for request payloads.
|
|
9
|
+
*/
|
|
10
|
+
requestChecksumCalculation?: RequestChecksumCalculation | Provider<RequestChecksumCalculation>;
|
|
11
|
+
/**
|
|
12
|
+
* Determines when checksum validation will be performed on response payloads.
|
|
13
|
+
*/
|
|
14
|
+
responseChecksumValidation?: ResponseChecksumValidation | Provider<ResponseChecksumValidation>;
|
|
15
|
+
/**
|
|
16
|
+
* Default 0 (off).
|
|
17
|
+
*
|
|
18
|
+
* When set to a value greater than or equal to 8192, sets the minimum number
|
|
19
|
+
* of bytes to buffer into a chunk when processing input streams
|
|
20
|
+
* with chunked encoding (that is, when request checksums are enabled).
|
|
21
|
+
* A minimum of 8kb = 8 * 1024 is required, and 64kb or higher is recommended.
|
|
22
|
+
*
|
|
23
|
+
* See https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html.
|
|
24
|
+
*
|
|
25
|
+
* This has a slight performance penalty because it must wrap and buffer
|
|
26
|
+
* your input stream.
|
|
27
|
+
* You do not need to set this value if your stream already flows chunks
|
|
28
|
+
* of 8kb or greater.
|
|
29
|
+
*/
|
|
30
|
+
requestStreamBufferSize?: number | false;
|
|
31
|
+
/**
|
|
32
|
+
* Optional implementations of checksum algorithms adhering to the
|
|
33
|
+
* Checksum interface.
|
|
34
|
+
*/
|
|
35
|
+
checksumAlgorithms?: {
|
|
36
|
+
CRC32?: ChecksumConstructor;
|
|
37
|
+
CRC32C?: ChecksumConstructor;
|
|
38
|
+
CRC64NVME?: ChecksumConstructor;
|
|
39
|
+
SHA1?: ChecksumConstructor;
|
|
40
|
+
SHA256?: ChecksumConstructor;
|
|
41
|
+
} & {
|
|
42
|
+
[algorithmId: string]: ChecksumConstructor;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export interface FlexibleChecksumsResolvedConfig {
|
|
49
|
+
requestChecksumCalculation: Provider<RequestChecksumCalculation>;
|
|
50
|
+
responseChecksumValidation: Provider<ResponseChecksumValidation>;
|
|
51
|
+
requestStreamBufferSize: number;
|
|
52
|
+
checksumAlgorithms?: FlexibleChecksumsInputConfig["checksumAlgorithms"];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export declare const resolveFlexibleChecksumsConfig: <T>(input: T & FlexibleChecksumsInputConfig) => T & FlexibleChecksumsResolvedConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChecksumConstructor, HashConstructor } from "@smithy/types";
|
|
2
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the function that will compute the checksum for the given {@link ChecksumAlgorithm}.
|
|
6
|
+
*/
|
|
7
|
+
export declare const selectChecksumAlgorithmFunction: (checksumAlgorithm: ChecksumAlgorithm | string, config: PreviouslyResolved) => ChecksumConstructor | HashConstructor;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChecksumConstructor, HashConstructor } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* A function that, given a hash constructor and a string, calculates the hash of the string.
|
|
4
|
+
*/
|
|
5
|
+
export declare const stringHasher: (checksumAlgorithmFn: ChecksumConstructor | HashConstructor, body: any) => Promise<Uint8Array>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum SelectorType {
|
|
2
|
+
ENV = "env",
|
|
3
|
+
CONFIG = "shared config entry"
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Returns undefined, if obj[key] is not defined.
|
|
7
|
+
* Returns string value, if the string is defined in obj[key] and it's uppercase matches union value.
|
|
8
|
+
* Throws error for all other cases.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const stringUnionSelector: <U extends object, K extends keyof U>(obj: Record<string, string | undefined>, key: string, union: U, type: SelectorType) => U[K] | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* List of algorithms supported by client.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLIENT_SUPPORTED_ALGORITHMS: ChecksumAlgorithm[];
|
|
6
|
+
/**
|
|
7
|
+
* Priority order for validating checksum algorithm. A faster algorithm has higher priority.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PRIORITY_ORDER_ALGORITHMS: ChecksumAlgorithm[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HttpResponse } from "@smithy/core/protocols";
|
|
2
|
+
import type { Logger } from "@smithy/types";
|
|
3
|
+
import type { PreviouslyResolved } from "./configuration";
|
|
4
|
+
export interface ValidateChecksumFromResponseOptions {
|
|
5
|
+
config: PreviouslyResolved;
|
|
6
|
+
/**
|
|
7
|
+
* Defines the checksum algorithms clients SHOULD look for when validating checksums
|
|
8
|
+
* returned in the HTTP response.
|
|
9
|
+
*/
|
|
10
|
+
responseAlgorithms?: string[];
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
}
|
|
13
|
+
export declare const validateChecksumFromResponse: (response: HttpResponse, { config, responseAlgorithms, logger }: ValidateChecksumFromResponseOptions) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Md5, Md5Js, Md5Node } from "@smithy/core/checksum";
|