Latest 0.0.1
Homepage https://github.com/hons82/THLicense
License MIT
Platforms ios 8.0, requires ARC
Authors

Pod Version
Pod Platform
Pod License

These classes are supposed to be used inside your frameworks when you want to provide certain pro-features to customers that pay a license fee or limit the whole use od the framework to the simulator.

Installation

CocoaPods

Install with CocoaPods by adding the following to your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

use_frameworks!

pod 'THLicense', '~> 0.1.0'

Note: We follow http://semver.org for versioning the public API.

Manually

That’s a bit complex, as CommonCrypto is not (yet) available directly to swift. So what you need to do is

  • copy the Files under ./THLicense/
  • Create a CommonCrypto directory inside the project directory.
  • create a module.map file to allow us to use the CommonCrypto library as a module within Swift.
module CommonCrypto [system] {
    header "/usr/include/CommonCrypto/CommonCrypto.h"
    export *
}
  • Add CommonCryptoto the "Build Settings –> SwiftCompiler – Search Paths –> Import Paths"

    Usage

// Set a License key (That will be provided by your customer)
THLicense.sharedLicense.setLicenseKey("db693f13bf2267c510a2e202afcca4067a16d8ed")
// Set a constant Salt
THLicense.sharedLicense.setSalt("123456")
// Only during development
//THLicense.sharedLicense.debugMode = true

// Check if the License is valid
if (THLicense.sharedLicense.isLicenseValid()) {
    // continue with your framework execution
}

If you put it in debug mode it will show you in the log the possible valid license keys. Currently it uses the bundleId and the salt to create the keys and checks are performed in the following order

  • org.company.Appname + Salt
  • org.company + Salt

In that way you can sell licenses to all APPs in a company or just for a single App

Contributions

…are really welcome. Maybe there is a better way of doing this checks, or it needs additional settings, so I’d like to improve it with your help.

License

Source code of this project is available under the standard MIT license. Please see the license file.

Latest podspec

{
    "name": "THLicense",
    "version": "0.0.1",
    "summary": "Validate licenses inside a framework",
    "description": "These classes are supposed to be used inside your frameworks when you want to provide certain pro-features to customers that pay a license fee or limit the whole use od the framework to the simulator.n",
    "homepage": "https://github.com/hons82/THLicense",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Hannes Tribus": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hons82/THLicense.git",
        "tag": "v0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "default_subspecs": "Core",
    "header_mappings_dir": "THLicense",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "THLicense/*.{h,swift}",
            "dependencies": {
                "THLicense/Hashing": []
            }
        },
        {
            "name": "Hashing",
            "source_files": "THLicense/Hashing/*.swift",
            "resources": [
                "CommonCrypto/*.map"
            ],
            "xcconfig": {
                "SWIFT_INCLUDE_PATHS": "${PODS_ROOT}/THLicense/CommonCrypto"
            }
        }
    ]
}

Pin It on Pinterest

Share This