@aws-sdk/checksums 3.1000.9 → 3.1000.11
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/crc.d.ts +5 -0
- package/crc.js +5 -0
- package/dist-cjs/index.js +5 -551
- 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 -8
- 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/{crc64-nvme/Crc64Nvme.js → submodules/crc/crc64-nvme/Crc64NvmeJs.js} +2 -2
- 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/index.js +6 -0
- package/dist-es/{flexible-checksums → submodules/flexible-checksums}/selectChecksumAlgorithmFunction.js +4 -10
- 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 -11
- 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/{crc64-nvme → submodules/crc/crc64-nvme}/Crc64Nvme.d.ts +3 -6
- package/dist-types/submodules/crc/crc64-nvme/Crc64NvmeJs.d.ts +14 -0
- package/dist-types/{crc64-nvme → submodules/crc/crc64-nvme}/crc64-nvme-crt-container.d.ts +1 -3
- 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/index.d.ts +9 -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 +11 -14
- 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/{crc64-nvme → submodules/crc/crc64-nvme}/Crc64Nvme.d.ts +1 -2
- package/dist-types/ts3.4/submodules/crc/crc64-nvme/Crc64NvmeJs.d.ts +9 -0
- package/dist-types/ts3.4/submodules/crc/index.browser.d.ts +8 -0
- package/dist-types/ts3.4/submodules/crc/index.d.ts +6 -0
- package/dist-types/ts3.4/submodules/flexible-checksums/index.d.ts +31 -0
- package/dist-types/ts3.4/submodules/md5/index.d.ts +1 -0
- package/dist-types/ts3.4/submodules/sha/index.browser.d.ts +8 -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 +67 -10
- package/sha.d.ts +5 -0
- package/sha.js +5 -0
- package/dist-es/flexible-checksums/getCrc32ChecksumAlgorithmFunction.browser.js +0 -2
- package/dist-es/flexible-checksums/getCrc32ChecksumAlgorithmFunction.js +0 -21
- package/dist-types/flexible-checksums/getCrc32ChecksumAlgorithmFunction.browser.d.ts +0 -2
- package/dist-types/flexible-checksums/getCrc32ChecksumAlgorithmFunction.d.ts +0 -10
- package/dist-types/ts3.4/flexible-checksums/getCrc32ChecksumAlgorithmFunction.browser.d.ts +0 -2
- package/dist-types/ts3.4/flexible-checksums/getCrc32ChecksumAlgorithmFunction.d.ts +0 -12
- /package/dist-es/{crc64-nvme → submodules/crc/crc64-nvme}/crc64-nvme-crt-container.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/configuration.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/constants.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsInputMiddleware.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsMiddleware.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsResponseMiddleware.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/getChecksum.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmForRequest.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmListForResponse.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/getChecksumLocationName.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/getFlexibleChecksumsPlugin.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/hasHeader.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/hasHeaderWithPrefix.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/isChecksumWithPartNumber.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/isStreaming.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/resolveFlexibleChecksumsConfig.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/stringHasher.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/stringUnionSelector.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/types.js +0 -0
- /package/dist-es/{flexible-checksums → submodules/flexible-checksums}/validateChecksumFromResponse.js +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/configuration.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/constants.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsInputMiddleware.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsMiddleware.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsResponseMiddleware.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/getChecksum.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmForRequest.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmListForResponse.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/getChecksumLocationName.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/getFlexibleChecksumsPlugin.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/hasHeader.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/hasHeaderWithPrefix.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/isChecksumWithPartNumber.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/isStreaming.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/resolveFlexibleChecksumsConfig.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/selectChecksumAlgorithmFunction.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/stringHasher.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/stringUnionSelector.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/types.d.ts +0 -0
- /package/dist-types/{flexible-checksums → submodules/flexible-checksums}/validateChecksumFromResponse.d.ts +0 -0
- /package/dist-types/ts3.4/{crc64-nvme → submodules/crc/crc64-nvme}/crc64-nvme-crt-container.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/configuration.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/constants.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsInputMiddleware.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsMiddleware.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/flexibleChecksumsResponseMiddleware.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/getChecksum.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmForRequest.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/getChecksumAlgorithmListForResponse.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/getChecksumLocationName.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/getFlexibleChecksumsPlugin.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/hasHeader.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/hasHeaderWithPrefix.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/isChecksumWithPartNumber.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/isStreaming.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/resolveFlexibleChecksumsConfig.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/selectChecksumAlgorithmFunction.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/stringHasher.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/stringUnionSelector.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/types.d.ts +0 -0
- /package/dist-types/ts3.4/{flexible-checksums → submodules/flexible-checksums}/validateChecksumFromResponse.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createHash, createHmac } from "node:crypto";
|
|
2
|
+
import { Sha1Js } from "./Sha1Js";
|
|
3
|
+
const hasNativeCrypto = (() => {
|
|
4
|
+
try {
|
|
5
|
+
createHash("sha1");
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
})();
|
|
12
|
+
export const Sha1Node = hasNativeCrypto ? buildNativeClass() : Sha1Js;
|
|
13
|
+
function buildNativeClass() {
|
|
14
|
+
return class Sha1Node {
|
|
15
|
+
digestLength = 20;
|
|
16
|
+
secret;
|
|
17
|
+
hash;
|
|
18
|
+
isHmac;
|
|
19
|
+
finished = false;
|
|
20
|
+
constructor(secret) {
|
|
21
|
+
this.secret = secret;
|
|
22
|
+
this.isHmac = !!secret;
|
|
23
|
+
this.hash = this.createHash();
|
|
24
|
+
}
|
|
25
|
+
update(data) {
|
|
26
|
+
if (this.finished) {
|
|
27
|
+
throw new Error("Attempted to update an already finished hash.");
|
|
28
|
+
}
|
|
29
|
+
this.hash.update(data);
|
|
30
|
+
}
|
|
31
|
+
async digest() {
|
|
32
|
+
let buf;
|
|
33
|
+
if (this.isHmac) {
|
|
34
|
+
this.finished = true;
|
|
35
|
+
buf = this.hash.digest();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
buf = this.hash.copy().digest();
|
|
39
|
+
}
|
|
40
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
41
|
+
}
|
|
42
|
+
reset() {
|
|
43
|
+
this.hash = this.createHash();
|
|
44
|
+
this.finished = false;
|
|
45
|
+
}
|
|
46
|
+
createHash() {
|
|
47
|
+
return this.secret ? createHmac("sha1", toBuffer(this.secret)) : createHash("sha1");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function toBuffer(data) {
|
|
52
|
+
if (typeof data === "string") {
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
if (ArrayBuffer.isView(data)) {
|
|
56
|
+
return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
57
|
+
}
|
|
58
|
+
return Buffer.from(data);
|
|
59
|
+
}
|
|
@@ -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
|
+
}
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export { Crc64Nvme } from "
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { ENV_RESPONSE_CHECKSUM_VALIDATION, CONFIG_RESPONSE_CHECKSUM_VALIDATION, NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, } from "./flexible-checksums/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
|
|
5
|
-
export { RequestChecksumCalculation, DEFAULT_REQUEST_CHECKSUM_CALCULATION, ResponseChecksumValidation, DEFAULT_RESPONSE_CHECKSUM_VALIDATION, ChecksumAlgorithm, ChecksumLocation, DEFAULT_CHECKSUM_ALGORITHM, } from "./flexible-checksums/constants";
|
|
6
|
-
export type { FlexibleChecksumsRequestMiddlewareConfig } from "./flexible-checksums/flexibleChecksumsMiddleware";
|
|
7
|
-
export { flexibleChecksumsMiddlewareOptions, flexibleChecksumsMiddleware, } from "./flexible-checksums/flexibleChecksumsMiddleware";
|
|
8
|
-
export type { FlexibleChecksumsMiddlewareConfig } from "./flexible-checksums/getFlexibleChecksumsPlugin";
|
|
9
|
-
export { getFlexibleChecksumsPlugin } from "./flexible-checksums/getFlexibleChecksumsPlugin";
|
|
10
|
-
export type { FlexibleChecksumsInputConfig, FlexibleChecksumsResolvedConfig, } from "./flexible-checksums/resolveFlexibleChecksumsConfig";
|
|
11
|
-
export { resolveFlexibleChecksumsConfig } from "./flexible-checksums/resolveFlexibleChecksumsConfig";
|
|
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;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Checksum } from "@smithy/types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* This class provides CRC-64 checksum calculation using the NVMe polynomial (0x9a6c9329ac4bc9b5).
|
|
6
|
-
* It uses an 8-slice lookup table for efficient computation.
|
|
3
|
+
* CRC-64/NVME checksum. Uses the CRT native implementation if loaded,
|
|
4
|
+
* otherwise falls back to the pure JS implementation.
|
|
7
5
|
*
|
|
8
6
|
* @example
|
|
9
7
|
* ```typescript
|
|
@@ -15,8 +13,7 @@ import type { Checksum } from "@smithy/types";
|
|
|
15
13
|
* @public
|
|
16
14
|
*/
|
|
17
15
|
export declare class Crc64Nvme implements Checksum {
|
|
18
|
-
private
|
|
19
|
-
private c2;
|
|
16
|
+
private impl;
|
|
20
17
|
constructor();
|
|
21
18
|
update(data: Uint8Array): void;
|
|
22
19
|
digest(): Promise<Uint8Array>;
|
|
@@ -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
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { ChecksumConstructor } from "@smithy/types";
|
|
2
2
|
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*
|
|
5
3
|
* \@aws-sdk/crc64-nvme-crt will install the constructor in this
|
|
6
4
|
* container if it is installed.
|
|
7
5
|
*
|
|
8
6
|
* This avoids a runtime-require being interpreted statically by bundlers.
|
|
9
|
-
*
|
|
7
|
+
* @internal
|
|
10
8
|
*/
|
|
11
9
|
export declare const crc64NvmeCrtContainer: {
|
|
12
10
|
CrtCrc64Nvme: null | ChecksumConstructor;
|
|
@@ -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,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 { Md5, Md5Js, Md5Node } from "@smithy/core/checksum";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Checksum, SourceData } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* Pure JS SHA-1 implementation with HMAC support.
|
|
4
|
+
* Non-destructive digest for plain hash — safe to call digest() multiple times.
|
|
5
|
+
* @see https://csrc.nist.gov/pubs/fips/180-4/upd1/final
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class Sha1Js implements Checksum {
|
|
9
|
+
readonly digestLength = 20;
|
|
10
|
+
private state;
|
|
11
|
+
private w?;
|
|
12
|
+
private buffer;
|
|
13
|
+
private bufferLength;
|
|
14
|
+
private bytesHashed;
|
|
15
|
+
private finished;
|
|
16
|
+
private readonly inner?;
|
|
17
|
+
private readonly outer?;
|
|
18
|
+
constructor(secret?: SourceData);
|
|
19
|
+
update(data: Uint8Array): void;
|
|
20
|
+
digest(): Promise<Uint8Array>;
|
|
21
|
+
reset(): void;
|
|
22
|
+
private digestSync;
|
|
23
|
+
private static normalizeKey;
|
|
24
|
+
private hashBuffer;
|
|
25
|
+
private hashBufferWith;
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Checksum, SourceData } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* SHA-1 using Node.js crypto native implementation when available,
|
|
4
|
+
* falling back to the pure JS implementation.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface Sha1Node extends Checksum {
|
|
8
|
+
readonly digestLength: 20;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const Sha1Node: new (secret?: SourceData) => Sha1Node;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Checksum, SourceData } from "@smithy/types";
|
|
2
|
+
/**
|
|
3
|
+
* SHA-1 using the Web Crypto API (crypto.subtle) when available,
|
|
4
|
+
* falling back to the pure JS implementation.
|
|
5
|
+
*
|
|
6
|
+
* Caution: buffers data entirely in memory since WebCrypto requires
|
|
7
|
+
* all data at once for digest().
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class Sha1WebCrypto implements Checksum {
|
|
11
|
+
readonly digestLength: 20;
|
|
12
|
+
private readonly secret?;
|
|
13
|
+
private pending;
|
|
14
|
+
private pendingBytes;
|
|
15
|
+
private fallback?;
|
|
16
|
+
private finished;
|
|
17
|
+
constructor(secret?: SourceData);
|
|
18
|
+
update(data: Uint8Array): void;
|
|
19
|
+
digest(): Promise<Uint8Array>;
|
|
20
|
+
reset(): void;
|
|
21
|
+
private switchToFallback;
|
|
22
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export {
|
|
2
|
+
Crc64Nvme,
|
|
3
|
+
Crc64NvmeJs,
|
|
4
|
+
crc64NvmeCrtContainer,
|
|
5
|
+
} from "@aws-sdk/checksums/crc";
|
|
3
6
|
export {
|
|
4
7
|
ENV_REQUEST_CHECKSUM_CALCULATION,
|
|
5
8
|
CONFIG_REQUEST_CHECKSUM_CALCULATION,
|
|
6
9
|
NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS,
|
|
7
|
-
} from "./flexible-checksums/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
|
|
8
|
-
export {
|
|
9
10
|
ENV_RESPONSE_CHECKSUM_VALIDATION,
|
|
10
11
|
CONFIG_RESPONSE_CHECKSUM_VALIDATION,
|
|
11
12
|
NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS,
|
|
12
|
-
} from "./flexible-checksums/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
|
|
13
|
-
export {
|
|
14
13
|
RequestChecksumCalculation,
|
|
15
14
|
DEFAULT_REQUEST_CHECKSUM_CALCULATION,
|
|
16
15
|
ResponseChecksumValidation,
|
|
@@ -18,16 +17,14 @@ export {
|
|
|
18
17
|
ChecksumAlgorithm,
|
|
19
18
|
ChecksumLocation,
|
|
20
19
|
DEFAULT_CHECKSUM_ALGORITHM,
|
|
21
|
-
} from "./flexible-checksums/constants";
|
|
22
|
-
export { FlexibleChecksumsRequestMiddlewareConfig } from "./flexible-checksums/flexibleChecksumsMiddleware";
|
|
23
|
-
export {
|
|
24
20
|
flexibleChecksumsMiddlewareOptions,
|
|
25
21
|
flexibleChecksumsMiddleware,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
getFlexibleChecksumsPlugin,
|
|
23
|
+
resolveFlexibleChecksumsConfig,
|
|
24
|
+
} from "@aws-sdk/checksums/flexible-checksums";
|
|
29
25
|
export {
|
|
26
|
+
FlexibleChecksumsRequestMiddlewareConfig,
|
|
27
|
+
FlexibleChecksumsMiddlewareConfig,
|
|
30
28
|
FlexibleChecksumsInputConfig,
|
|
31
29
|
FlexibleChecksumsResolvedConfig,
|
|
32
|
-
} from "
|
|
33
|
-
export { resolveFlexibleChecksumsConfig } from "./flexible-checksums/resolveFlexibleChecksumsConfig";
|
|
30
|
+
} from "@aws-sdk/checksums/flexible-checksums";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Crc32cJs, Crc32cJs as Crc32c } from "./crc32c/Crc32cJs";
|
|
2
|
+
export declare const Crc32cNode: symbol;
|
|
3
|
+
export {
|
|
4
|
+
Crc64NvmeJs,
|
|
5
|
+
Crc64NvmeJs as Crc64Nvme,
|
|
6
|
+
} from "./crc64-nvme/Crc64NvmeJs";
|
|
7
|
+
export { crc64NvmeCrtContainer } from "./crc64-nvme/crc64-nvme-crt-container";
|
|
8
|
+
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,31 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ENV_REQUEST_CHECKSUM_CALCULATION,
|
|
3
|
+
CONFIG_REQUEST_CHECKSUM_CALCULATION,
|
|
4
|
+
NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS,
|
|
5
|
+
} from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
|
|
6
|
+
export {
|
|
7
|
+
ENV_RESPONSE_CHECKSUM_VALIDATION,
|
|
8
|
+
CONFIG_RESPONSE_CHECKSUM_VALIDATION,
|
|
9
|
+
NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS,
|
|
10
|
+
} from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
|
|
11
|
+
export {
|
|
12
|
+
RequestChecksumCalculation,
|
|
13
|
+
DEFAULT_REQUEST_CHECKSUM_CALCULATION,
|
|
14
|
+
ResponseChecksumValidation,
|
|
15
|
+
DEFAULT_RESPONSE_CHECKSUM_VALIDATION,
|
|
16
|
+
ChecksumAlgorithm,
|
|
17
|
+
ChecksumLocation,
|
|
18
|
+
DEFAULT_CHECKSUM_ALGORITHM,
|
|
19
|
+
} from "./constants";
|
|
20
|
+
export { FlexibleChecksumsRequestMiddlewareConfig } from "./flexibleChecksumsMiddleware";
|
|
21
|
+
export {
|
|
22
|
+
flexibleChecksumsMiddlewareOptions,
|
|
23
|
+
flexibleChecksumsMiddleware,
|
|
24
|
+
} from "./flexibleChecksumsMiddleware";
|
|
25
|
+
export { FlexibleChecksumsMiddlewareConfig } from "./getFlexibleChecksumsPlugin";
|
|
26
|
+
export { getFlexibleChecksumsPlugin } from "./getFlexibleChecksumsPlugin";
|
|
27
|
+
export {
|
|
28
|
+
FlexibleChecksumsInputConfig,
|
|
29
|
+
FlexibleChecksumsResolvedConfig,
|
|
30
|
+
} from "./resolveFlexibleChecksumsConfig";
|
|
31
|
+
export { resolveFlexibleChecksumsConfig } from "./resolveFlexibleChecksumsConfig";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Md5, Md5Js, Md5Node } from "@smithy/core/checksum";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Checksum, SourceData } from "@smithy/types";
|
|
2
|
+
export declare class Sha1Js implements Checksum {
|
|
3
|
+
readonly digestLength = 20;
|
|
4
|
+
private state;
|
|
5
|
+
private w?;
|
|
6
|
+
private buffer;
|
|
7
|
+
private bufferLength;
|
|
8
|
+
private bytesHashed;
|
|
9
|
+
private finished;
|
|
10
|
+
private readonly inner?;
|
|
11
|
+
private readonly outer?;
|
|
12
|
+
constructor(secret?: SourceData);
|
|
13
|
+
update(data: Uint8Array): void;
|
|
14
|
+
digest(): Promise<Uint8Array>;
|
|
15
|
+
reset(): void;
|
|
16
|
+
private digestSync;
|
|
17
|
+
private static normalizeKey;
|
|
18
|
+
private hashBuffer;
|
|
19
|
+
private hashBufferWith;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Checksum, SourceData } from "@smithy/types";
|
|
2
|
+
export declare class Sha1WebCrypto implements Checksum {
|
|
3
|
+
readonly digestLength: 20;
|
|
4
|
+
private readonly secret?;
|
|
5
|
+
private pending;
|
|
6
|
+
private pendingBytes;
|
|
7
|
+
private fallback?;
|
|
8
|
+
private finished;
|
|
9
|
+
constructor(secret?: SourceData);
|
|
10
|
+
update(data: Uint8Array): void;
|
|
11
|
+
digest(): Promise<Uint8Array>;
|
|
12
|
+
reset(): void;
|
|
13
|
+
private switchToFallback;
|
|
14
|
+
}
|
package/md5.d.ts
ADDED