This repository has been archived by the owner. It is now read-only.
Native SDK for Keelhaul – Serverside receipt validation for iOS/OS X
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CommonCrypto-OSX
CommonCrypto
Demo-iOS.xcodeproj
Keelhaul-OSX
Keelhaul-OSXTests
Keelhaul.xcodeproj
Keelhaul.xcworkspace
Keelhaul
KeelhaulDemo
KeelhaulTests
bin
.gitignore
Header.png
LICENSE
README.md
circle.yml
fake_server.rb

README.md

Keelhaul Logo

Carthage compatible GitHub release Swift 2.1.1 platforms

An iOS/OSX SDK to communicate with Keelhaul—server-side App Store receipt validation API.

Installation

Carthage

Add the following to your Cartfile:

github "thoughtbot/Keelhaul"

Then run carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.

How It Works

The Keelhaul SDK communicates via HTTPS with the server, which in turn sends receipt validation requests to Apple and caches the response for future SDK requests. It also keeps track of which device was used to validate the receipt and makes sure that any receipt is used on exactly one device– a feature that Apple's validation server does not provide.

Quick Start

import Keelhaul

let keelhaul = Keelhaul.init(token: "YOUR_API_TOKEN")

keelhaul.validateReceipt { receipt, validationError in
  if let error = validationError {
    // Handle invalid receipt with error...
    return
  }

  if let receipt = receipt {
    // Handle valid receipt...
  }
}

There are several reasons the validation would fail, so handle each accordingly:

public enum KeelhaulError: Int {
  case MalformedRequestJSON
  case MalformedReceiptData
  case UnauthenticSignature
  case WrongSubscriptionPassword
  case AppleServerUnavailable
  case ExpiredSubscription
  case SanboxReceiptEnvMismatch
  case ProductionReceiptEnvMismatch
  case MalformedResponseJSON
  case InsufficientResponseJSON
  case MissingReceipt
  case MissingDeviceHash
  case InvalidHTTPResponse
  case MissingResponseData
  case InvalidResponse
  case InvalidDeveloperAPIKey
  case DeviceMismatch
  case UnknownSDKError
}

License

Keelhaul is Copyright (c) 2016 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

thoughtbot

Keelhaul is maintained and funded by thoughtbot, inc.

The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or look at our product case studies and hire us to help build your iOS app.