Skip to content

Commit

Permalink
fix: Various fixes to help aws-swift-sdk update to 0.5.0+ (#130)
Browse files Browse the repository at this point in the history
* Removes `AnyObject` constraint from `CredentialsProviding`

* Makes sha156 public and exposes encodeToHexString

* Removes encodeToHexString function from ByteBuffer
  • Loading branch information
epau committed Dec 21, 2022
1 parent 27830c1 commit 02161b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AwsCIo
import AwsCHttp
import Foundation

public protocol CredentialsProviding: AnyObject {
public protocol CredentialsProviding {
func getCredentials() async throws -> Credentials
}

Expand Down
6 changes: 0 additions & 6 deletions Source/AwsCommonRuntimeKit/crt/ByteBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,3 @@ extension ByteBuffer: IStreamable {
return dataSlice.count
}
}

extension ByteBuffer {
func encodeToHexString() -> String {
data.map { String(format: "%02x", $0) }.joined()
}
}
6 changes: 5 additions & 1 deletion Source/AwsCommonRuntimeKit/crt/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -55,6 +55,10 @@ extension Data {
return bufferData
}
}

public func encodeToHexString() -> String {
map { String(format: "%02x", $0) }.joined()
}
}

extension aws_date_time {
Expand Down

0 comments on commit 02161b8

Please sign in to comment.