Latest 0.0.4
License MIT
Platforms ios 8.0


Based on the original implementation of Hawk:


SwiftyHawk is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'SwiftyHawk'


Usage is easy and straight forward, here is the basic usage:

let creds = HawkCredentials(id: "123456", key: "2983d45yun89q", algorithm: .SHA1)
let client = try! HawkClient(creds: creds)
let options = HawkOptions(url: URL(string: ""), method: .post)
let header = try! client.generateAuthorizationHeader(usingOptions: options) // example output: Hawk id="123456", ts="1353809207", nonce="Ygvqdz", ext="Bazinga!", mac="qbf1ZPG/r/e06F4ht+T77LXi5vw="
Based on the server implementation and your own requirements, you can change the following properties in the options class:
/// Extra information to pass to the server
public var ext: String?

/// A pre-calcualated hash of the payload, if the payload validation is required.
public var payloadHash: String?

/// If the payload validation is required, and the hash not calcualted.
public var payload: String?

/// Payload ContentType, If the payload validation is required, and the hash not calcualted.
public var contentType: String?

/// Optional Timestamp, if not provided HawkClient will get the current TimeStamp
public var ts: Int?

/// Optional Nonce, if not provided HawkClient will generate a random nonce.
public var nonce: String?

/// Oz Application Id
public var app: String?

/// Oz delegator
public var dlg: String?


Few client tests are included in the project to test the output of the generateAuthorizationHeader method for now, PRs are welcome to have a more structured, inclusive tests!

What’s Next?

Only generateAuthorizationHeader is implemented for now, so there’s a lot of work to be done..

How to contribute?

There’re open issues for the missing parts of Hawk, you can start with that.. PRs are welcome!

As a reference, clone for specs (or you can read it from github directly)..

Latest podspec

    "name": "SwiftyHawk",
    "version": "0.0.4",
    "summary": "Hawk Authentication Implementation for Swift",
    "swift_version": "4.2",
    "description": "Hawk Authentication Implementation for Swift based on the original implementation",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Muhamed ALGHZAWI": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.0.4"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source_files": "SwiftyHawk/Classes/**/*"

Pin It on Pinterest

Share This