Skip to content

Commit c40eaac

Browse files
authored
feat: switch default signer implementation to standard (from CRT) (#616)
1 parent 3241061 commit c40eaac

File tree

11 files changed

+25
-23
lines changed

11 files changed

+25
-23
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "2ca8d856-ee23-4d3f-94d4-633e7dbf9293",
3+
"type": "feature",
4+
"description": "Add a new non-CRT SigV4 signer and use it as the default. This removes the CRT as a hard dependency for using the SDK (although the CRT signer can still be used via explicit configuration on client creation).",
5+
"issues": [
6+
"awslabs/smithy-kotlin#617"
7+
]
8+
}

aws-runtime/aws-config/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ kotlin {
3838
implementation(project(":aws-runtime:protocols:aws-xml-protocols"))
3939
implementation(project(":aws-runtime:aws-endpoint"))
4040
implementation("aws.smithy.kotlin:aws-signing-common:$smithyKotlinVersion")
41-
42-
// TODO -- replace this once CRT is no longer the default signer
43-
implementation("aws.smithy.kotlin:aws-signing-crt:$smithyKotlinVersion")
41+
implementation("aws.smithy.kotlin:aws-signing-default:$smithyKotlinVersion")
4442

4543
// additional dependencies required by generated sso provider
4644
implementation(project(":aws-runtime:protocols:aws-json-protocols"))

aws-runtime/protocols/aws-event-stream/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ kotlin {
2929
dependencies {
3030
implementation(project(":aws-runtime:testing"))
3131
api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
32-
33-
// TODO -- replace this once CRT is no longer the default signer
34-
api("aws.smithy.kotlin:aws-signing-crt:$smithyKotlinVersion")
32+
implementation("aws.smithy.kotlin:aws-signing-default:$smithyKotlinVersion")
3533
}
3634
}
3735

aws-runtime/protocols/aws-event-stream/common/test/aws/sdk/kotlin/runtime/protocol/eventstream/EventStreamSigningTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials
99
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
1010
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSignatureType
1111
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningConfig
12-
import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
12+
import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner
1313
import aws.smithy.kotlin.runtime.hashing.sha256
1414
import aws.smithy.kotlin.runtime.io.SdkByteBuffer
1515
import aws.smithy.kotlin.runtime.io.bytes
@@ -50,7 +50,7 @@ class EventStreamSigningTest {
5050
val buffer = SdkByteBuffer(0U)
5151
messageToSign.encode(buffer)
5252
val messagePayload = buffer.bytes()
53-
val result = CrtAwsSigner.signPayload(signingConfig, prevSignature, messagePayload, testClock)
53+
val result = DefaultAwsSigner.signPayload(signingConfig, prevSignature, messagePayload, testClock)
5454
assertEquals(":date", result.output.headers[0].name)
5555

5656
val dateHeader = result.output.headers[0].value.expectTimestamp()

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/PresignerGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ class PresignerGenerator : KotlinIntegration {
357357
name = "signer"
358358
documentation = "The implementation of AWS signer to use for signing requests"
359359
baseClass = RuntimeTypes.Auth.Signing.AwsSigningCommon.ServicePresignConfig
360-
propertyType = ClientConfigPropertyType.RequiredWithDefault("CrtAwsSigner")
360+
propertyType = ClientConfigPropertyType.RequiredWithDefault("DefaultAwsSigner")
361361
additionalImports = listOf(
362-
RuntimeTypes.Auth.Signing.AwsSigningCrt.CrtAwsSigner,
362+
RuntimeTypes.Auth.Signing.AwsSigningStandard.DefaultAwsSigner,
363363
)
364364
},
365365
ClientConfigProperty {

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/eventstream/EventStreamSerializerGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class EventStreamSerializerGenerator(
6565
writer.write("val signingConfig = context.#T()", AwsRuntimeTypes.AwsEventStream.newEventStreamSigningConfig)
6666
// FIXME - needs to be set on the operation for initial request
6767
// context[AwsSigningAttributes.SignedBodyHeader] = AwsSignedBodyHeader.X_AMZ_CONTENT_SHA256.name
68-
// context[AwsSigningAttributes.BodyHash] = BodyHash.StreamingAws4HmacSha256Events
68+
// context[AwsSigningAttributes.HashSpecification] = HashSpecification.StreamingAws4HmacSha256Events
6969

7070
val encodeFn = encodeEventStreamMessage(ctx, op, streamShape)
7171
writer.withBlock("val messages = stream", "") {

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ class PresignerGeneratorTest {
9191
import aws.sdk.kotlin.runtime.endpoint.asSigningEndpointProvider
9292
import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider
9393
import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigner
94+
import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner
9495
import aws.smithy.kotlin.runtime.auth.awssigning.PresignedRequestConfig
9596
import aws.smithy.kotlin.runtime.auth.awssigning.PresigningLocation
9697
import aws.smithy.kotlin.runtime.auth.awssigning.ServicePresignConfig
9798
import aws.smithy.kotlin.runtime.auth.awssigning.SigningEndpointProvider
9899
import aws.smithy.kotlin.runtime.auth.awssigning.createPresignedRequest
99-
import aws.smithy.kotlin.runtime.auth.awssigning.crt.CrtAwsSigner
100100
import aws.smithy.kotlin.runtime.client.ExecutionContext
101101
import aws.smithy.kotlin.runtime.http.QueryParameters
102102
import aws.smithy.kotlin.runtime.http.request.HttpRequest
@@ -238,7 +238,7 @@ class PresignerGeneratorTest {
238238
override val normalizeUriPath: Boolean = true
239239
override val region: String = requireNotNull(builder.region) { "region is a required configuration property" }
240240
override val serviceId: String = "example"
241-
override val signer: AwsSigner = builder.signer ?: CrtAwsSigner
241+
override val signer: AwsSigner = builder.signer ?: DefaultAwsSigner
242242
override val signingName: String = "example-signing-name"
243243
override val useDoubleUriEncode: Boolean = true
244244
companion object {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sdkVersion=0.16.1-SNAPSHOT
1212
smithyVersion=1.17.0
1313
smithyGradleVersion=0.5.3
1414
# smithy-kotlin codegen and runtime are versioned together
15-
smithyKotlinVersion=0.10.0
15+
smithyKotlinVersion=0.10.1-SNAPSHOT
1616

1717
# kotlin
1818
kotlinVersion=1.6.21
@@ -42,4 +42,4 @@ slf4jVersion=1.7.36
4242

4343
# dokka config (values specified at build-time as needed)
4444
smithyKotlinPackageListUrl=
45-
smithyKotlinDocBaseUrl=https://docs.aws.amazon.com/sdk-for-kotlin/latest/reference/smithy-kotlin
45+
smithyKotlinDocBaseUrl=https://docs.aws.amazon.com/sdk-for-kotlin/latest/reference/smithy-kotlin

services/glacier/common/test/aws/sdk/kotlin/services/glacier/internal/TreeHasherTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class RollingSumHashFunction(private val chunkSize: Int) : HashFunction {
8383

8484
override fun digest(): ByteArray = rollingHash
8585
override fun reset() = fail("reset should not have been called")
86-
override fun update(input: ByteArray) {
86+
override fun update(input: ByteArray, offset: Int, length: Int) {
8787
assertEquals(chunkSize, input.size, "Chunk size must be exactly $chunkSize")
8888
for (i in input.indices) {
8989
rollingHash[i] = (rollingHash[i] + input[i] + 1).toByte()

tests/codegen/event-stream/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ dependencies {
136136
testImplementation(kotlin("test-junit5"))
137137
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
138138
testImplementation("aws.smithy.kotlin:smithy-test:$smithyKotlinVersion")
139-
140-
// TODO -- replace this once CRT is no longer the default signer
141-
testImplementation("aws.smithy.kotlin:aws-signing-crt:$smithyKotlinVersion")
139+
testImplementation("aws.smithy.kotlin:aws-signing-default:$smithyKotlinVersion")
142140

143141
// have to manually add all the dependencies of the generated client(s)
144142
// doing it this way (as opposed to doing what we do for protocol-tests) allows

0 commit comments

Comments
 (0)