Latest0.1
Homepagehttps://github.com/rheinfabrik/RFKeychain
LicenseMIT
Platformsios 6.0, osx 10.8, requires ARC
FrameworksSecurity
Authors

RFKeychain is an Objective-C keychain wrapper for iOS and Mac OS X. It is only tested on iOS 6 and Mac OS X 10.8.

Why another xxKeychain?

Other libraries I found seemed unnecessarily complex and I wanted to get a better understanding of the keychain. By building it completely test-driven, there should be nothing in the code that is not necessary to pass the tests which keeps the code short and clean. Tests are written in BDD-style syntax for Kiwi. Therefore, it should be stable and a good example for people getting started with unit testing on iOS.

Installation

CocoaPods

pod 'RFKeychain', '~> 0.3'

Manual

  • Copy RFKeychain.[h|m] into your project
  • Add Security.framework to your target

Usage

The following methods are currently implemented

+ (BOOL)setPassword:(NSString *)password
            account:(NSString *)account
            service:(NSString *)service;
+ (NSString *)passwordForAccount:(NSString *)account
                         service:(NSString *)service;
+ (BOOL)deletePasswordForAccount:(NSString *)account
                         service:(NSString *)service;

There are also methods to use iOS 7 keychain sharing which expect an additional accessGroup that you have specified in your app’s entitlements

+ (BOOL)setPassword:(NSString *)password
            account:(NSString *)account
            service:(NSString *)service
        accessGroup:(NSString *)accessGroup;
+ (NSString *)passwordForAccount:(NSString *)account
                         service:(NSString *)service
                     accessGroup:(NSString *)accessGroup;
+ (BOOL)deletePasswordForAccount:(NSString *)account
                         service:(NSString *)service
                     accessGroup:(NSString *)accessGroup;

If you want to know more about the methods, you can find their behaviour in the RFKeychainSpec.

Tests

To run the tests, you first need to install Kiwi by running pod install (assuming you have CocoaPods installed, otherwise you need to do that first, obviously). The included project is configured to run on Mac OS X. However, you could easily create an iOS project that runs the tests.

Status

RFKeychain is pretty trivial right now, I’ll add features and better error handling as I need them myself. Feel free to help out but please always add tests.

Latest podspec

{
    "name": "RFKeychain",
    "version": "0.1",
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "license": "MIT",
    "summary": "Keychain wrapper for iOS and Mac OS X.",
    "homepage": "https://github.com/rheinfabrik/RFKeychain",
    "authors": {
        "Tim Bru00fcckmann": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rheinfabrik/RFKeychain.git",
        "tag": "0.1"
    },
    "source_files": "RFKeychain.{h,m}",
    "requires_arc": true,
    "frameworks": "Security"
}

Pin It on Pinterest

Share This