KeyClip alternatives and similar libraries
Based on the "Keychain" category.
Alternatively, view KeyClip alternatives based on common mentions on social networks and blogs.
-
KeychainAccess
Simple Swift wrapper for Keychain that works on iOS and OS X. -
Valet
Valet lets you securely store data in the iOS or OS X Keychain without knowing a thing about how the Keychain works. It’s easy. We promise. -
Locksmith
A powerful, protocol-oriented library for working with the iOS Keychain in Swift. -
keychain-swift
Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS. -
SwiftKeychainWrapper
a simple static wrapper for the iOS Keychain to allow you to use it in a similar fashion to user defaults. -
SAMKeychain
Simple Objective-C wrapper for the keychain that works on Mac and iOS
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of KeyClip or a related project?
README
KeyClip
KeyClip is yet another Keychain library written in Swift.
Features
- [x] Multi Types ( String / NSDictionary / NSData )
- [x] Error Handling
- [x] Settings ( kSecAttrAccessGroup / kSecAttrService / kSecAttrAccessible )
- [x] Works fine with release ( Fastest [-O] ) build.
Usage
String
KeyClip.save("access_token", string: "********") // -> Bool
let token = KeyClip.load("access_token") as String?
KeyClip.delete("access_token") // Remove the data
KeyClip.clear() // Remove all the data
KeyClip.exists("access_token") // -> Bool
NSDictionary
Must be compatible to NSJSONSerialization.
Valid JSON elements are Dictionary, Array, String, Number, Boolean and null.
KeyClip.save("account", dictionary: ["name": "aska", "token": "******"]) // -> Bool
let dictionary = KeyClip.load("account") as NSDictionary?
NSData
KeyClip.save("data", data: NSData()) // -> Bool
let data = KeyClip.load("data") as NSData?
Your Class
KeyClip.save("account", dictionary: account.dictionaryValue)
let account = KeyClip.load("account") { (dictionary) -> Account in
return Account(dictionary)
}
class Account {
let name: String
let password: String
init(_ dictionary: NSDictionary) {
self.name = dictionary["name"] as String
self.password = dictionary["password"] as String
}
var dictionaryValue: [String: String] {
return ["name": name, "password": password]
}
}
Error Handling
Return value
let success = KeyClip.save("password", string: "********")
if !success {
// Show Alert "Saving password to keychain failed"
}
Clojure
KeyClip.save("password", string: "********") { error in
let status = error.code // OSStatus
// Show Alert "Saving failed \(error.localizedDescription)(\(error.code))"
}
Debug print
KeyClip.printError(true)
Settings
let clip = KeyClip.Builder()
// kSecAttrService
.service(NSBundle.mainBundle().bundleIdentifier) // default
// kSecAttrAccessible
.accessible(kSecAttrAccessibleAfterFirstUnlock) // default
// kSecAttrAccessGroup
.accessGroup("XXXX23F3DC53.com.example.share") // default is nil
.build()
Note to accessGroup
:warning: iOS Simulator's keychain implementation does not support kSecAttrAccessGroup. (always "test")
:warning: kSecAttrAccessGroup must match the App Identifier prefix. https://developer.apple.com/library/mac/documentation/Security/Reference/keychainservices/index.html
How to check the App Identifier
Entitlement.plist's keychain-access-groups or App Identifier.
KeyClip.defaultAccessGroup() // -> String (eg. XXXX23F3DC53.*)
Requirements
- iOS 8.0+ / Mac OS X 10.10+
- Xcode 8
Installation
Carthage
Add the following line to your Cartfile
github "s-aska/KeyClip"
CocoaPods
Add the following line to your Podfile
use_frameworks!
pod 'KeyClip'
License
KeyClip is released under the MIT license. See LICENSE for details.
*Note that all licence references and agreements mentioned in the KeyClip README section above
are relevant to that project's source code only.