Swiftpack.co - benspratling4/SwiftAWSSignatureV4 as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by benspratling4.
benspratling4/SwiftAWSSignatureV4 3.0.1
AWS's signature version 4 in cross-platform Swift
⭐️ 5
🕓 2 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/benspratling4/SwiftAWSSignatureV4.git", from: "3.0.1")


AWS's signature version 4 in cross-platform Swift

Given a (mutable) URLRequest, sign with AWS Signature v4 using an instance of an AWSAccount, which would include your IAM credentials.

var request:URLRequest = ...
let account:AWSAccount = ...

With a simple Data as the .httpBody of the request, no chunking is used.

Appropriate date headers are added for you as part of the signing process. You should add all other headers which are part of the service, but not speciic to signing before signing, because the signing process signs the headers.

To use chunking, provide an InputStream as the .httpBodyStream of the request, and / or provide a value for the chunk size (in bytes):

request.sign(for:account, chunkSize:32568)

Chunking alters the .httpBodyStream, so do not alter the .httpBodyStream after signing.

Testing/ Platform Status

Signing without chunking has been tested on both macOS and Linux. Chunking has only been tested on macOS. Chunking is primarily useful for streams, which send data before reading the entire body in RAM. Stream support may be altered or improve on Linux in the near future.

Depends on IBM's BlueCryptor for platform-independent hashing.


Stars: 5
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.


Release Notes

Correct issues with dates & queries
3 years ago

Also updates tool versions, dependencies & sets minimum mac os version

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics