├── LxKeychainDemo
├── LxKeychainDemo.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
└── LxKeychainDemo
│ ├── AppDelegate.swift
│ ├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── Main.storyboard
│ └── LaunchScreen.xib
│ ├── Info.plist
│ └── ViewController.swift
├── .gitignore
├── README.md
├── LxKeychain.swift
└── LICENSE
/LxKeychainDemo/LxKeychainDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // LxKeychainDemo
4 | //
5 |
6 | import UIKit
7 |
8 | @UIApplicationMain
9 | class AppDelegate: UIResponder, UIApplicationDelegate {
10 |
11 | var window: UIWindow?
12 |
13 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
14 |
15 | return true
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | # Pods/
27 |
28 | # Carthage
29 | #
30 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
31 | # Carthage/Checkouts
32 |
33 | Carthage/Build
34 |
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | etiantian.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // LxKeychainDemo
4 | //
5 |
6 | import UIKit
7 |
8 | class ViewController: UIViewController {
9 |
10 | override func viewDidLoad() {
11 | super.viewDidLoad()
12 |
13 | println("savedUsernameArray = \(LxKeychain.savedUsernameArray())")
14 |
15 | LxKeychain.insertOrUpdatePairsOfUsername("username1", password: "password1")
16 | LxKeychain.insertOrUpdatePairsOfUsername("username2", password: "password2")
17 | LxKeychain.insertOrUpdatePairsOfUsername("username3", password: "password3")
18 | LxKeychain.insertOrUpdatePairsOfUsername("username1", password: "password4")
19 | LxKeychain.cleanPasswordForUsername("username2")
20 | LxKeychain.deletePairsByUsername("username3")
21 |
22 | println("savedUsernameArray = \(LxKeychain.savedUsernameArray())")
23 |
24 | let username1 = "username1"
25 | println("username1 password: \(LxKeychain.passwordForUsername(username1))")
26 |
27 | let password1 = "password1"
28 | var judgement = LxKeychain.password(password1, isCorrectToUsername: username1) ? "is" : "is not"
29 | println("username1's password \(judgement) password1")
30 | let password4 = "password4"
31 | judgement = LxKeychain.password(password4, isCorrectToUsername: username1) ? "is" : "is not"
32 | println("username1's password \(judgement) password4")
33 |
34 | println("lastestUpdatedUsername = \(LxKeychain.lastestUpdatedUsername())")
35 |
36 | let YourSaveKey = "YourSaveKey"
37 | println("Your saved string: \(LxKeychain.fetchDataOfService(YourSaveKey))")
38 | LxKeychain.saveData("Here is What you want to save forever!", forService: YourSaveKey)
39 |
40 | println("Your LxKeychain device unique identifer is \(LxKeychain.deviceUniqueIdentifer())")
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LxKeychain-swift
2 | Manage your username and password for iOS and OS X platform. Highly encryption and won't be lose even you uninstall your app.
3 | Installation
4 | ------------
5 | You only need drag LxKeychain.swift to your project.
6 | Support
7 | ------------
8 | Minimum support iOS version: iOS 6.0
9 | Usage
10 | --------------
11 |
12 | println("savedUsernameArray = \(LxKeychain.savedUsernameArray())")
13 |
14 | LxKeychain.insertOrUpdatePairsOfUsername("username1", password: "password1")
15 | LxKeychain.insertOrUpdatePairsOfUsername("username2", password: "password2")
16 | LxKeychain.insertOrUpdatePairsOfUsername("username3", password: "password3")
17 | LxKeychain.insertOrUpdatePairsOfUsername("username1", password: "password4")
18 | LxKeychain.cleanPasswordForUsername("username2")
19 | LxKeychain.deletePairsByUsername("username3")
20 |
21 | println("savedUsernameArray = \(LxKeychain.savedUsernameArray())")
22 |
23 | let username1 = "username1"
24 | println("username1 password: \(LxKeychain.passwordForUsername(username1))")
25 |
26 | let password1 = "password1"
27 | var judgement = LxKeychain.password(password1, isCorrectToUsername: username1) ? "is" : "is not"
28 | println("username1's password \(judgement) password1")
29 | let password4 = "password4"
30 | judgement = LxKeychain.password(password4, isCorrectToUsername: username1) ? "is" : "is not"
31 | println("username1's password \(judgement) password4")
32 |
33 | println("lastestUpdatedUsername = \(LxKeychain.lastestUpdatedUsername())")
34 |
35 | let YourSaveKey = "YourSaveKey"
36 | println("Your saved string: \(LxKeychain.fetchDataOfService(YourSaveKey))")
37 | LxKeychain.saveData("Here is What you want to save forever!", forService: YourSaveKey)
38 |
39 | println("Your LxKeychain device unique identifer is \(LxKeychain.deviceUniqueIdentifer())")
40 | License
41 | -----------
42 | LxKeychain is available under the Apache License 2.0. See the LICENSE file for more info.
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/LxKeychain.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LxKeychain.swift
3 | // LxKeychainDemo
4 | //
5 |
6 | import UIKit
7 |
8 | let LxKeychainEncryptionBlock = {(string: String) -> String in
9 |
10 | // You can custom here
11 |
12 | return string
13 | }
14 |
15 | let LX_USERNAME_ARRAY_SERVICE = "LX_USERNAME_ARRAY_SERVICE";
16 | let LX_USERNAME_KEY = "LX_USERNAME_KEY";
17 | let LX_PASSWORD_KEY = "LX_PASSWORD_KEY";
18 | let LX_DEVICE_UNIQUE_IDENTIFIER = "LX_DEVICE_UNIQUE_IDENTIFIER";
19 |
20 | class LxKeychain {
21 |
22 | private class func generateServiceByUsername(username: String) -> String {
23 | return LxKeychainEncryptionBlock(username)
24 | }
25 |
26 | class func insertOrUpdatePairsOfUsername(username: String, password: String) -> OSStatus {
27 |
28 | let service = generateServiceByUsername(username)
29 | var status = noErr
30 | status = deleteService(service)
31 | status = saveData(password, forService: service)
32 |
33 | let usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE)
34 |
35 | var usernameArray = savedUsernameArray()
36 |
37 | if contains(usernameArray, username) {
38 | let index = find(usernameArray, username)
39 | usernameArray.removeAtIndex(index!)
40 | }
41 |
42 | usernameArray.append(username)
43 | status = deleteService(usernameArrayService)
44 | status = saveData(usernameArray, forService: usernameArrayService)
45 |
46 | return status
47 | }
48 |
49 | class func cleanPasswordForUsername(username: String) -> OSStatus {
50 |
51 | let service = generateServiceByUsername(username)
52 | var status = noErr
53 | status = deleteService(service)
54 | status = saveData(nil, forService: service)
55 | return status
56 | }
57 |
58 | class func deletePairsByUsername(username: String) -> OSStatus {
59 |
60 | let service = generateServiceByUsername(username)
61 | var status = noErr
62 | status = deleteService(service)
63 |
64 | let usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE)
65 | var usernameArray = savedUsernameArray()
66 | if contains(usernameArray, username) {
67 | let index = find(usernameArray, username)
68 | usernameArray.removeAtIndex(index!)
69 | }
70 |
71 | status = deleteService(usernameArrayService)
72 | status = saveData(usernameArray, forService: usernameArrayService)
73 |
74 | return status
75 | }
76 |
77 | class func passwordForUsername(username: String) -> String? {
78 |
79 | let service = generateServiceByUsername(username)
80 | return fetchDataOfService(service) as? String
81 | }
82 |
83 | class func password(password: String, isCorrectToUsername username: String) -> Bool {
84 |
85 | return password == passwordForUsername(username)
86 | }
87 |
88 | class func savedUsernameArray() -> [String] {
89 |
90 | let usernameArrayService = LxKeychainEncryptionBlock(LX_USERNAME_ARRAY_SERVICE)
91 | var usernameArray = fetchDataOfService(usernameArrayService) as? [String]
92 | if usernameArray == nil {
93 |
94 | usernameArray = [String]()
95 | }
96 | return usernameArray!
97 | }
98 |
99 | class func lastestUpdatedUsername() -> String? {
100 |
101 | return savedUsernameArray().last
102 | }
103 |
104 | // MARK:- fundation
105 | class func generateQueryMutableDictionaryOfService(service: String) -> NSMutableDictionary {
106 |
107 | let queryDictionary = NSMutableDictionary()
108 | queryDictionary.setValue(kSecClassGenericPassword as String, forKey: kSecClass as String)
109 | queryDictionary.setValue(kSecAttrAccessibleAfterFirstUnlock as String, forKey: kSecAttrAccessible as String)
110 | queryDictionary.setValue(service, forKey: kSecAttrService as String)
111 | queryDictionary.setValue(service, forKey: kSecAttrAccount as String)
112 |
113 | return queryDictionary
114 | }
115 |
116 | class func saveData(data: NSCoding?, forService service: String) -> OSStatus {
117 |
118 | var keychainQuery = generateQueryMutableDictionaryOfService(service)
119 |
120 | var status = noErr
121 | status = SecItemDelete(keychainQuery)
122 |
123 | if let d = data {
124 |
125 | keychainQuery[kSecValueData as String] = NSKeyedArchiver.archivedDataWithRootObject(d)
126 | }
127 | else {
128 | keychainQuery[kSecValueData as String] = NSKeyedArchiver.archivedDataWithRootObject(NSData())
129 | }
130 |
131 | var result: Unmanaged? = nil
132 | status = SecItemAdd(keychainQuery, &result)
133 |
134 | return status
135 | }
136 |
137 | class func fetchDataOfService(service: String) -> NSCoding? {
138 |
139 | var keychainQuery = generateQueryMutableDictionaryOfService(service)
140 | keychainQuery[kSecReturnData as String] = kCFBooleanTrue
141 | keychainQuery[kSecMatchLimit as String] = kSecMatchLimitOne
142 |
143 | var status = noErr
144 |
145 | var matchResult: Unmanaged?
146 | status = SecItemCopyMatching(keychainQuery, &matchResult)
147 |
148 | if status == noErr {
149 |
150 | let opaque = matchResult?.toOpaque()
151 | var archivedData = Unmanaged.fromOpaque(opaque!).takeUnretainedValue()
152 |
153 | let data: AnyObject? = NSKeyedUnarchiver.unarchiveObjectWithData(archivedData)
154 | return data as? NSCoding
155 | }
156 | return nil
157 | }
158 |
159 | class func deleteService(service: String) -> OSStatus {
160 |
161 | var keychainQuery = generateQueryMutableDictionaryOfService(service)
162 | return SecItemDelete(keychainQuery)
163 | }
164 |
165 | class func deviceUniqueIdentifer() -> String {
166 |
167 | var deviceUniqueIdentifer = fetchDataOfService(LX_DEVICE_UNIQUE_IDENTIFIER) as? String
168 |
169 | if let d = deviceUniqueIdentifer {
170 |
171 | deviceUniqueIdentifer = UIDevice.currentDevice().identifierForVendor.UUIDString
172 | saveData(deviceUniqueIdentifer, forService: LX_DEVICE_UNIQUE_IDENTIFIER)
173 | }
174 |
175 | return deviceUniqueIdentifer!
176 | }
177 | }
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/LxKeychainDemo/LxKeychainDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | B614858B1B3E90E000456867 /* LxKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B614858A1B3E90E000456867 /* LxKeychain.swift */; };
11 | B6F66A431B3AB3BD001A365A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F66A421B3AB3BD001A365A /* AppDelegate.swift */; };
12 | B6F66A451B3AB3BD001A365A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6F66A441B3AB3BD001A365A /* ViewController.swift */; };
13 | B6F66A481B3AB3BD001A365A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B6F66A461B3AB3BD001A365A /* Main.storyboard */; };
14 | B6F66A4A1B3AB3BD001A365A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B6F66A491B3AB3BD001A365A /* Images.xcassets */; };
15 | B6F66A4D1B3AB3BD001A365A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = B6F66A4B1B3AB3BD001A365A /* LaunchScreen.xib */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXFileReference section */
19 | B614858A1B3E90E000456867 /* LxKeychain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LxKeychain.swift; path = ../../LxKeychain.swift; sourceTree = ""; };
20 | B6F66A3D1B3AB3BD001A365A /* LxKeychainDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LxKeychainDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
21 | B6F66A411B3AB3BD001A365A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
22 | B6F66A421B3AB3BD001A365A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
23 | B6F66A441B3AB3BD001A365A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
24 | B6F66A471B3AB3BD001A365A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
25 | B6F66A491B3AB3BD001A365A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
26 | B6F66A4C1B3AB3BD001A365A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
27 | /* End PBXFileReference section */
28 |
29 | /* Begin PBXFrameworksBuildPhase section */
30 | B6F66A3A1B3AB3BD001A365A /* Frameworks */ = {
31 | isa = PBXFrameworksBuildPhase;
32 | buildActionMask = 2147483647;
33 | files = (
34 | );
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXFrameworksBuildPhase section */
38 |
39 | /* Begin PBXGroup section */
40 | B6F66A341B3AB3BD001A365A = {
41 | isa = PBXGroup;
42 | children = (
43 | B6F66A3F1B3AB3BD001A365A /* LxKeychainDemo */,
44 | B6F66A3E1B3AB3BD001A365A /* Products */,
45 | );
46 | sourceTree = "";
47 | };
48 | B6F66A3E1B3AB3BD001A365A /* Products */ = {
49 | isa = PBXGroup;
50 | children = (
51 | B6F66A3D1B3AB3BD001A365A /* LxKeychainDemo.app */,
52 | );
53 | name = Products;
54 | sourceTree = "";
55 | };
56 | B6F66A3F1B3AB3BD001A365A /* LxKeychainDemo */ = {
57 | isa = PBXGroup;
58 | children = (
59 | B614858A1B3E90E000456867 /* LxKeychain.swift */,
60 | B6F66A421B3AB3BD001A365A /* AppDelegate.swift */,
61 | B6F66A441B3AB3BD001A365A /* ViewController.swift */,
62 | B6F66A401B3AB3BD001A365A /* Supporting Files */,
63 | );
64 | path = LxKeychainDemo;
65 | sourceTree = "";
66 | };
67 | B6F66A401B3AB3BD001A365A /* Supporting Files */ = {
68 | isa = PBXGroup;
69 | children = (
70 | B6F66A4B1B3AB3BD001A365A /* LaunchScreen.xib */,
71 | B6F66A461B3AB3BD001A365A /* Main.storyboard */,
72 | B6F66A491B3AB3BD001A365A /* Images.xcassets */,
73 | B6F66A411B3AB3BD001A365A /* Info.plist */,
74 | );
75 | name = "Supporting Files";
76 | sourceTree = "";
77 | };
78 | /* End PBXGroup section */
79 |
80 | /* Begin PBXNativeTarget section */
81 | B6F66A3C1B3AB3BD001A365A /* LxKeychainDemo */ = {
82 | isa = PBXNativeTarget;
83 | buildConfigurationList = B6F66A5C1B3AB3BD001A365A /* Build configuration list for PBXNativeTarget "LxKeychainDemo" */;
84 | buildPhases = (
85 | B6F66A391B3AB3BD001A365A /* Sources */,
86 | B6F66A3A1B3AB3BD001A365A /* Frameworks */,
87 | B6F66A3B1B3AB3BD001A365A /* Resources */,
88 | );
89 | buildRules = (
90 | );
91 | dependencies = (
92 | );
93 | name = LxKeychainDemo;
94 | productName = LxKeychainDemo;
95 | productReference = B6F66A3D1B3AB3BD001A365A /* LxKeychainDemo.app */;
96 | productType = "com.apple.product-type.application";
97 | };
98 | /* End PBXNativeTarget section */
99 |
100 | /* Begin PBXProject section */
101 | B6F66A351B3AB3BD001A365A /* Project object */ = {
102 | isa = PBXProject;
103 | attributes = {
104 | LastUpgradeCheck = 0630;
105 | ORGANIZATIONNAME = DeveloperLx;
106 | TargetAttributes = {
107 | B6F66A3C1B3AB3BD001A365A = {
108 | CreatedOnToolsVersion = 6.3;
109 | };
110 | };
111 | };
112 | buildConfigurationList = B6F66A381B3AB3BD001A365A /* Build configuration list for PBXProject "LxKeychainDemo" */;
113 | compatibilityVersion = "Xcode 3.2";
114 | developmentRegion = English;
115 | hasScannedForEncodings = 0;
116 | knownRegions = (
117 | en,
118 | Base,
119 | );
120 | mainGroup = B6F66A341B3AB3BD001A365A;
121 | productRefGroup = B6F66A3E1B3AB3BD001A365A /* Products */;
122 | projectDirPath = "";
123 | projectRoot = "";
124 | targets = (
125 | B6F66A3C1B3AB3BD001A365A /* LxKeychainDemo */,
126 | );
127 | };
128 | /* End PBXProject section */
129 |
130 | /* Begin PBXResourcesBuildPhase section */
131 | B6F66A3B1B3AB3BD001A365A /* Resources */ = {
132 | isa = PBXResourcesBuildPhase;
133 | buildActionMask = 2147483647;
134 | files = (
135 | B6F66A481B3AB3BD001A365A /* Main.storyboard in Resources */,
136 | B6F66A4D1B3AB3BD001A365A /* LaunchScreen.xib in Resources */,
137 | B6F66A4A1B3AB3BD001A365A /* Images.xcassets in Resources */,
138 | );
139 | runOnlyForDeploymentPostprocessing = 0;
140 | };
141 | /* End PBXResourcesBuildPhase section */
142 |
143 | /* Begin PBXSourcesBuildPhase section */
144 | B6F66A391B3AB3BD001A365A /* Sources */ = {
145 | isa = PBXSourcesBuildPhase;
146 | buildActionMask = 2147483647;
147 | files = (
148 | B6F66A451B3AB3BD001A365A /* ViewController.swift in Sources */,
149 | B614858B1B3E90E000456867 /* LxKeychain.swift in Sources */,
150 | B6F66A431B3AB3BD001A365A /* AppDelegate.swift in Sources */,
151 | );
152 | runOnlyForDeploymentPostprocessing = 0;
153 | };
154 | /* End PBXSourcesBuildPhase section */
155 |
156 | /* Begin PBXVariantGroup section */
157 | B6F66A461B3AB3BD001A365A /* Main.storyboard */ = {
158 | isa = PBXVariantGroup;
159 | children = (
160 | B6F66A471B3AB3BD001A365A /* Base */,
161 | );
162 | name = Main.storyboard;
163 | sourceTree = "";
164 | };
165 | B6F66A4B1B3AB3BD001A365A /* LaunchScreen.xib */ = {
166 | isa = PBXVariantGroup;
167 | children = (
168 | B6F66A4C1B3AB3BD001A365A /* Base */,
169 | );
170 | name = LaunchScreen.xib;
171 | sourceTree = "";
172 | };
173 | /* End PBXVariantGroup section */
174 |
175 | /* Begin XCBuildConfiguration section */
176 | B6F66A5A1B3AB3BD001A365A /* Debug */ = {
177 | isa = XCBuildConfiguration;
178 | buildSettings = {
179 | ALWAYS_SEARCH_USER_PATHS = NO;
180 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
181 | CLANG_CXX_LIBRARY = "libc++";
182 | CLANG_ENABLE_MODULES = YES;
183 | CLANG_ENABLE_OBJC_ARC = YES;
184 | CLANG_WARN_BOOL_CONVERSION = YES;
185 | CLANG_WARN_CONSTANT_CONVERSION = YES;
186 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
187 | CLANG_WARN_EMPTY_BODY = YES;
188 | CLANG_WARN_ENUM_CONVERSION = YES;
189 | CLANG_WARN_INT_CONVERSION = YES;
190 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
191 | CLANG_WARN_UNREACHABLE_CODE = YES;
192 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
193 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
194 | COPY_PHASE_STRIP = NO;
195 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
196 | ENABLE_STRICT_OBJC_MSGSEND = YES;
197 | GCC_C_LANGUAGE_STANDARD = gnu99;
198 | GCC_DYNAMIC_NO_PIC = NO;
199 | GCC_NO_COMMON_BLOCKS = YES;
200 | GCC_OPTIMIZATION_LEVEL = 0;
201 | GCC_PREPROCESSOR_DEFINITIONS = (
202 | "DEBUG=1",
203 | "$(inherited)",
204 | );
205 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
208 | GCC_WARN_UNDECLARED_SELECTOR = YES;
209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
210 | GCC_WARN_UNUSED_FUNCTION = YES;
211 | GCC_WARN_UNUSED_VARIABLE = YES;
212 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
213 | MTL_ENABLE_DEBUG_INFO = YES;
214 | ONLY_ACTIVE_ARCH = YES;
215 | SDKROOT = iphoneos;
216 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
217 | TARGETED_DEVICE_FAMILY = "1,2";
218 | };
219 | name = Debug;
220 | };
221 | B6F66A5B1B3AB3BD001A365A /* Release */ = {
222 | isa = XCBuildConfiguration;
223 | buildSettings = {
224 | ALWAYS_SEARCH_USER_PATHS = NO;
225 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
226 | CLANG_CXX_LIBRARY = "libc++";
227 | CLANG_ENABLE_MODULES = YES;
228 | CLANG_ENABLE_OBJC_ARC = YES;
229 | CLANG_WARN_BOOL_CONVERSION = YES;
230 | CLANG_WARN_CONSTANT_CONVERSION = YES;
231 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
232 | CLANG_WARN_EMPTY_BODY = YES;
233 | CLANG_WARN_ENUM_CONVERSION = YES;
234 | CLANG_WARN_INT_CONVERSION = YES;
235 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
236 | CLANG_WARN_UNREACHABLE_CODE = YES;
237 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
238 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
239 | COPY_PHASE_STRIP = NO;
240 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
241 | ENABLE_NS_ASSERTIONS = NO;
242 | ENABLE_STRICT_OBJC_MSGSEND = YES;
243 | GCC_C_LANGUAGE_STANDARD = gnu99;
244 | GCC_NO_COMMON_BLOCKS = YES;
245 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
246 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
247 | GCC_WARN_UNDECLARED_SELECTOR = YES;
248 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
249 | GCC_WARN_UNUSED_FUNCTION = YES;
250 | GCC_WARN_UNUSED_VARIABLE = YES;
251 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
252 | MTL_ENABLE_DEBUG_INFO = NO;
253 | SDKROOT = iphoneos;
254 | TARGETED_DEVICE_FAMILY = "1,2";
255 | VALIDATE_PRODUCT = YES;
256 | };
257 | name = Release;
258 | };
259 | B6F66A5D1B3AB3BD001A365A /* Debug */ = {
260 | isa = XCBuildConfiguration;
261 | buildSettings = {
262 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
263 | CLANG_ENABLE_MODULES = YES;
264 | INFOPLIST_FILE = LxKeychainDemo/Info.plist;
265 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
266 | PRODUCT_NAME = "$(TARGET_NAME)";
267 | SWIFT_OBJC_BRIDGING_HEADER = "";
268 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
269 | };
270 | name = Debug;
271 | };
272 | B6F66A5E1B3AB3BD001A365A /* Release */ = {
273 | isa = XCBuildConfiguration;
274 | buildSettings = {
275 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
276 | CLANG_ENABLE_MODULES = YES;
277 | INFOPLIST_FILE = LxKeychainDemo/Info.plist;
278 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
279 | PRODUCT_NAME = "$(TARGET_NAME)";
280 | SWIFT_OBJC_BRIDGING_HEADER = "";
281 | };
282 | name = Release;
283 | };
284 | /* End XCBuildConfiguration section */
285 |
286 | /* Begin XCConfigurationList section */
287 | B6F66A381B3AB3BD001A365A /* Build configuration list for PBXProject "LxKeychainDemo" */ = {
288 | isa = XCConfigurationList;
289 | buildConfigurations = (
290 | B6F66A5A1B3AB3BD001A365A /* Debug */,
291 | B6F66A5B1B3AB3BD001A365A /* Release */,
292 | );
293 | defaultConfigurationIsVisible = 0;
294 | defaultConfigurationName = Release;
295 | };
296 | B6F66A5C1B3AB3BD001A365A /* Build configuration list for PBXNativeTarget "LxKeychainDemo" */ = {
297 | isa = XCConfigurationList;
298 | buildConfigurations = (
299 | B6F66A5D1B3AB3BD001A365A /* Debug */,
300 | B6F66A5E1B3AB3BD001A365A /* Release */,
301 | );
302 | defaultConfigurationIsVisible = 0;
303 | defaultConfigurationName = Release;
304 | };
305 | /* End XCConfigurationList section */
306 | };
307 | rootObject = B6F66A351B3AB3BD001A365A /* Project object */;
308 | }
309 |
--------------------------------------------------------------------------------