{"id":13489594,"url":"https://github.com/s-aska/KeyClip","last_synced_at":"2025-03-28T05:31:02.951Z","repository":{"id":23914438,"uuid":"27294734","full_name":"s-aska/KeyClip","owner":"s-aska","description":"KeyClip is yet another Keychain library written in Swift.","archived":true,"fork":false,"pushed_at":"2019-05-06T21:06:51.000Z","size":111,"stargazers_count":41,"open_issues_count":6,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-29T08:34:36.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s-aska.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-29T07:23:46.000Z","updated_at":"2024-01-26T08:25:25.000Z","dependencies_parsed_at":"2022-08-21T03:50:55.308Z","dependency_job_id":null,"html_url":"https://github.com/s-aska/KeyClip","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-aska%2FKeyClip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-aska%2FKeyClip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-aska%2FKeyClip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s-aska%2FKeyClip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s-aska","download_url":"https://codeload.github.com/s-aska/KeyClip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978200,"owners_count":20703675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:00:31.541Z","updated_at":"2025-03-28T05:31:02.561Z","avatar_url":"https://github.com/s-aska.png","language":"Swift","funding_links":[],"categories":["Libs"],"sub_categories":["Security"],"readme":"# KeyClip\n\n[![Build Status](https://www.bitrise.io/app/8ab98cb35d63d2a8.svg?token=bPKUkQrsCZT8SlQaflgdOA\u0026branch=master)](https://www.bitrise.io/app/8ab98cb35d63d2a8)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![](https://img.shields.io/badge/Xcode-8%2B-brightgreen.svg?style=flat)]()\n[![](https://img.shields.io/badge/iOS-8.0%2B-brightgreen.svg?style=flat)]()\n[![](https://img.shields.io/badge/OS%20X-10.10%2B-brightgreen.svg?style=flat)]()\n\nKeyClip is yet another Keychain library written in Swift.\n\n## Features\n\n- [x] Multi Types ( String / NSDictionary / NSData )\n- [x] Error Handling\n- [x] Settings ( kSecAttrAccessGroup / kSecAttrService / kSecAttrAccessible )\n- [x] [Works fine with release ( Fastest \\[-O\\] ) build.](http://stackoverflow.com/questions/24145838/querying-ios-keychain-using-swift/27721328?stw=2#27721328)\n\n\n## Usage\n\n### String\n\n```swift\nKeyClip.save(\"access_token\", string: \"********\") // -\u003e Bool\n\nlet token = KeyClip.load(\"access_token\") as String?\n\nKeyClip.delete(\"access_token\") // Remove the data\n\nKeyClip.clear() // Remove all the data\n\nKeyClip.exists(\"access_token\") // -\u003e Bool\n```\n\n### NSDictionary\n\nMust be compatible to NSJSONSerialization.\n\nValid JSON elements are Dictionary, Array, String, Number, Boolean and null.\n\n```swift\nKeyClip.save(\"account\", dictionary: [\"name\": \"aska\", \"token\": \"******\"]) // -\u003e Bool\n\nlet dictionary = KeyClip.load(\"account\") as NSDictionary?\n```\n\n### NSData\n\n```swift\nKeyClip.save(\"data\", data: NSData()) // -\u003e Bool\n\nlet data = KeyClip.load(\"data\") as NSData?\n```\n\n### Your Class\n\n```swift\nKeyClip.save(\"account\", dictionary: account.dictionaryValue)\n\nlet account = KeyClip.load(\"account\") { (dictionary) -\u003e Account in\n    return Account(dictionary)\n}\n\nclass Account {\n    let name: String\n    let password: String\n\n    init(_ dictionary: NSDictionary) {\n        self.name = dictionary[\"name\"] as String\n        self.password = dictionary[\"password\"] as String\n    }\n\n    var dictionaryValue: [String: String] {\n        return [\"name\": name, \"password\": password]\n    }\n}\n```\n\n## Error Handling\n\n### Return value\n\n```swift\nlet success = KeyClip.save(\"password\", string: \"********\")\nif !success {\n    // Show Alert \"Saving password to keychain failed\"\n}\n```\n\n### Clojure\n\n```swift\nKeyClip.save(\"password\", string: \"********\") { error in\n    let status = error.code // OSStatus\n    // Show Alert \"Saving failed \\(error.localizedDescription)(\\(error.code))\"\n}\n```\n\n### Debug print\n\n```swift\nKeyClip.printError(true)\n```\n\n\n## Settings\n\n```swift\nlet clip = KeyClip.Builder()\n\n    // kSecAttrService\n    .service(NSBundle.mainBundle().bundleIdentifier) // default\n\n    // kSecAttrAccessible\n    .accessible(kSecAttrAccessibleAfterFirstUnlock) // default\n\n    // kSecAttrAccessGroup\n    .accessGroup(\"XXXX23F3DC53.com.example.share\") // default is nil\n\n    .build()\n```\n\n### Note to accessGroup\n\n:warning: iOS Simulator's keychain implementation does not support kSecAttrAccessGroup. (always \"test\")\n\n:warning: kSecAttrAccessGroup must match the App Identifier prefix. https://developer.apple.com/library/mac/documentation/Security/Reference/keychainservices/index.html\n\n#### How to check the App Identifier\n\nEntitlement.plist's keychain-access-groups or App Identifier.\n\n```swift\nKeyClip.defaultAccessGroup() // -\u003e String (eg. XXXX23F3DC53.*)\n```\n\n\n## Requirements\n\n- iOS 8.0+ / Mac OS X 10.10+\n- Xcode 8\n\n\n## Installation\n\n#### Carthage\n\nAdd the following line to your [Cartfile](https://github.com/carthage/carthage)\n\n```\ngithub \"s-aska/KeyClip\"\n```\n\n#### CocoaPods\n\nAdd the following line to your [Podfile](https://guides.cocoapods.org/)\n\n```\nuse_frameworks!\npod 'KeyClip'\n```\n\n\n## License\n\nKeyClip is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-aska%2FKeyClip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs-aska%2FKeyClip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs-aska%2FKeyClip/lists"}