diff --git a/Source/AwsCommonRuntimeKit/auth/credentials/CredentialsProvider.swift b/Source/AwsCommonRuntimeKit/auth/credentials/CredentialsProvider.swift index 0d85f371b..34cea7c65 100644 --- a/Source/AwsCommonRuntimeKit/auth/credentials/CredentialsProvider.swift +++ b/Source/AwsCommonRuntimeKit/auth/credentials/CredentialsProvider.swift @@ -6,7 +6,7 @@ import AwsCIo import AwsCHttp import Foundation -public protocol CredentialsProviding: AnyObject { +public protocol CredentialsProviding { func getCredentials() async throws -> Credentials } diff --git a/Source/AwsCommonRuntimeKit/crt/ByteBuffer.swift b/Source/AwsCommonRuntimeKit/crt/ByteBuffer.swift index fda12b827..3aee4f332 100644 --- a/Source/AwsCommonRuntimeKit/crt/ByteBuffer.swift +++ b/Source/AwsCommonRuntimeKit/crt/ByteBuffer.swift @@ -70,9 +70,3 @@ extension ByteBuffer: IStreamable { return dataSlice.count } } - -extension ByteBuffer { - func encodeToHexString() -> String { - data.map { String(format: "%02x", $0) }.joined() - } -} diff --git a/Source/AwsCommonRuntimeKit/crt/Utilities.swift b/Source/AwsCommonRuntimeKit/crt/Utilities.swift index 7ca980162..22a4ed110 100644 --- a/Source/AwsCommonRuntimeKit/crt/Utilities.swift +++ b/Source/AwsCommonRuntimeKit/crt/Utilities.swift @@ -41,7 +41,7 @@ extension String { extension Data { /// Computes the sha256 hash over data. - func sha256(truncate: Int = 0, allocator: Allocator = defaultAllocator) throws -> Data { + public func sha256(truncate: Int = 0, allocator: Allocator = defaultAllocator) throws -> Data { try self.withUnsafeBytes { bufferPointer in var byteCursor = aws_byte_cursor_from_array(bufferPointer.baseAddress, count) let bufferSize = Int(AWS_SHA256_LEN) @@ -55,6 +55,10 @@ extension Data { return bufferData } } + + public func encodeToHexString() -> String { + map { String(format: "%02x", $0) }.joined() + } } extension aws_date_time {