Latest 1.0.0
Homepage https://github.com/bilby91/HMACSigner
License MIT
Platforms ios 7.0, requires ARC
Authors

[CI Status](https://travis-ci.org/Martin Fernandez/HMACSigner)
Version
License
Platform

Usage

HMACSigner signs your requests using HMAC + SHA1. It was designed to work with ApiAuth gem.

To sign a request, the following steps are taken:

  1. Calculates a canonical string like this ‘HTTPMethod,Content-Type,MD5(Body),URI,HTTPDate’
  2. Hashes the canonical string using the secret
  3. Adds the ‘Authorization’ header with "APIAuth identifier:hashedString"

To use it:

Objective-C

  NSURL *url = [NSURL URLWithString:@"https://api.domain.com/users/me"];
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
  request.HTTPMethod = @"POST";
  request.HTTPBody = [@"Message" dataUsingEncoding:NSUTF8StringEncoding];
  [request setValue:@"application/text" forHTTPHeaderField:@"Content-Type"]; 

  [request signWithAccessIdentifier:@"userId" andSecret:@"secret"];

Swift

let request = NSMutableURLRequest( url: URL(string: "https://api.domain.com/users/me"))
request.httpMethod = "POST"
request.httpBody = "Message".data(using: .utf8)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

request.sign(withAccessIdentifier: "userId", andSecret: "secret")

Requirements

Installation

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

pod "HMACSigner"

Author

Martin Fernandez [email protected]

License

HMACSigner is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HMACSigner",
    "version": "1.0.0",
    "summary": "HMACSigner signs your requests using HMAC + SHA1. It was a designed to work with ApiAuth.",
    "homepage": "https://github.com/bilby91/HMACSigner",
    "license": "MIT",
    "authors": {
        "Martin Fernandez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bilby91/HMACSigner.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/bilby91",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "public_header_files": "Pod/Classes/**/*.h"
}

Pin It on Pinterest

Share This