Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "feature",
"description": "Update supported httpChecksum algorithms",
"pull_requests": [
"[#2943](https://github.com/smithy-lang/smithy/pull/2943)"
]
}
43 changes: 35 additions & 8 deletions docs/source-2.0/aws/aws-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,17 @@ The ``httpChecksum`` trait is a structure that contains the following members:
request checksum behavior. The input member MUST target an :ref:`enum`
shape. Each value in the enum represents a supported checksum
algorithm. Algorithms MUST be one of the following supported values:
"CRC64NVME", "CRC32C", "CRC32", "SHA1", or "SHA256".

- "CRC32"
- "CRC32C"
- "CRC64NVME"
- "MD5"
- "SHA1"
- "SHA256"
- "SHA512"
- "XXHASH64"
- "XXHASH3"
- "XXHASH128"
* - requestChecksumRequired
- ``boolean``
- Indicates an operation requires a checksum in its HTTP request. If the
Expand All @@ -981,8 +991,18 @@ The ``httpChecksum`` trait is a structure that contains the following members:
- ``set<string>``
- Defines the checksum algorithms clients SHOULD look for when validating
checksums returned in the HTTP response. Each algorithm must be one of
the following supported values: "CRC64NVME", "CRC32C", "CRC32", "SHA1",
or "SHA256".
the following supported values:

- "CRC32"
- "CRC32C"
- "CRC64NVME"
- "MD5"
- "SHA1"
- "SHA256"
- "SHA512"
- "XXHASH64"
- "XXHASH3"
- "XXHASH128"

The ``httpChecksum`` trait MUST define at least one of the request checksumming
behavior, by setting the ``requestAlgorithmMember`` or
Expand Down Expand Up @@ -1058,13 +1078,20 @@ Client behavior
Supported checksum algorithms
-----------------------------
The following checksum algorithms MUST be supported by clients.
* CRC32
* SHA1
* SHA256

- CRC32
- SHA1
- SHA256

Additionally, the following checksum algorithms SHOULD be supported by clients.
* CRC64NVME
* CRC32C

- CRC32C
- CRC64NVME
- MD5
- SHA512
- XXHASH64
- XXHASH3
- XXHASH128

HTTP request checksums
----------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ public final class HttpChecksumTrait extends AbstractTrait implements ToSmithyBu
public static final ShapeId ID = ShapeId.from("aws.protocols#httpChecksum");
public static final String CHECKSUM_PREFIX = "x-amz-checksum-";
// This list should be in sync with the trait definition in `aws.protocols.smithy`.
public static final List<String> CHECKSUM_ALGORITHMS = ListUtils.of("CRC64NVME",
"CRC32C",
public static final List<String> CHECKSUM_ALGORITHMS = ListUtils.of(
"CRC32",
"CRC32C",
"CRC64NVME",
"MD5",
"SHA1",
"SHA256");
"SHA256",
"SHA512",
"XXHASH64",
"XXHASH3",
"XXHASH128");
public static final List<String> VALIDATION_MODES = ListUtils.of("ENABLED");

public static final String REQUEST_CHECKSUM_REQUIRED = "requestChecksumRequired";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,33 @@ list ChecksumAlgorithmSet {
// This enum should be in sync with the `HttpChecksumTrait` list.
@private
enum ChecksumAlgorithm {
/// CRC64NVME
CRC64NVME
/// CRC32
CRC32

/// CRC32C
CRC32C

/// CRC32
CRC32
/// CRC64NVME
CRC64NVME

/// MD5
MD5

/// SHA1
SHA1

/// SHA256
SHA256

/// SHA512
SHA512

/// XXHASH64
XXHASH64

/// XXHASH3
XXHASH3

/// XXHASH128
XXHASH128
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.junit.jupiter.api.Test;
Expand All @@ -30,9 +29,8 @@ public class HttpChecksumTraitTest {
public void loadsTrait() {
TraitFactory provider = TraitFactory.createServiceFactory();

List<String> algorithms = new ArrayList<>(Arrays.asList("CRC64NVME", "CRC32C", "CRC32", "SHA1", "SHA256"));
List<Node> responseAlgorithmNodes = new ArrayList<>();
for (String algorithm : algorithms) {
for (String algorithm : HttpChecksumTrait.CHECKSUM_ALGORITHMS) {
responseAlgorithmNodes.add(Node.from(algorithm));
}

Expand All @@ -54,11 +52,17 @@ public void loadsTrait() {
assertThat(checksumTrait.getRequestAlgorithmMember().get(), equalTo("ChecksumAlgorithm"));
assertThat(checksumTrait.getRequestValidationModeMember().get(), equalTo("ChecksumMode"));
assertThat(checksumTrait.getResponseAlgorithms(),
containsInRelativeOrder("CRC64NVME",
"CRC32C",
containsInRelativeOrder(
"CRC32",
"CRC32C",
"CRC64NVME",
"MD5",
"SHA1",
"SHA256"));
"SHA256",
"SHA512",
"XXHASH64",
"XXHASH3",
"XXHASH128"));

assertThat(node.expectBooleanMember("requestChecksumRequired"), equalTo(BooleanNode.from(true)));
assertThat(node.expectStringMember("requestAlgorithmMember"), equalTo(Node.from("ChecksumAlgorithm")));
Expand Down
Loading