Compare commits
17 Commits
2.0.7
..
rocket-link
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e9fc402dd | |||
| 4010a3303e | |||
| 955f12033c | |||
| 798405f93a | |||
| 299bb3fa3f | |||
| 6814e7f7aa | |||
| 173ab46b6e | |||
| f2269ef8d1 | |||
| 4d00c74922 | |||
| 1e8fcc8c2c | |||
| 9e1e912788 | |||
| c6838a31f2 | |||
| cdd1b2893a | |||
| 7b9237c39e | |||
| 1b278e59a5 | |||
| 1359edf840 | |||
| 6b32c7ec68 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Locksmith"
|
||||
s.version = "2.0.7"
|
||||
s.version = "2.0.8"
|
||||
s.summary = "Locksmith is a powerful, protocol-oriented library for working with the keychain in Swift."
|
||||
s.description = <<-DESC
|
||||
Locksmith is a powerful, protocol-oriented library for working with the iOS, Mac OS X, watchOS, and tvOS keychain in Swift. It provides extensive support for a lot of different keychain requests, and extensively uses Swift-native concepts.
|
||||
|
||||
@@ -718,6 +718,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -766,6 +767,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
|
||||
@@ -7,6 +7,14 @@ A powerful, protocol-oriented library for working with the keychain in Swift.
|
||||
- [x] ⌚️ watchOS 2
|
||||
- [x] 📺 tvOS
|
||||
|
||||
>
|
||||
>
|
||||
> I make [Rocket](http://matthewpalmer.net/rocket?utm_source=locksmith&utm_medium=readme&utm_campaign=open_source), an app that gives you Slack-style emoji everywhere on your Mac.
|
||||
>
|
||||
>
|
||||
|
||||
## Details
|
||||
|
||||
How is Locksmith different to other keychain wrappers?
|
||||
|
||||
* Locksmith’s API is both super-simple and deeply powerful
|
||||
@@ -32,7 +40,7 @@ Locksmith is available through [CocoaPods](http://cocoapods.org).
|
||||
|
||||
Locksmith is available through [Carthage](https://github.com/Carthage/Carthage).
|
||||
|
||||
github 'matthewpalmer/Locksmith'
|
||||
github "matthewpalmer/Locksmith"
|
||||
|
||||
## Quick start
|
||||
|
||||
|
||||
@@ -517,11 +517,15 @@ extension CreateableSecureStorable {
|
||||
let status = SecItemUpdate(query, attributesToUpdate)
|
||||
|
||||
if let error = LocksmithError(fromStatusCode: Int(status)) {
|
||||
throw error
|
||||
}
|
||||
|
||||
if status != errSecSuccess {
|
||||
throw LocksmithError.Undefined
|
||||
if error == .NotFound || error == .NotAvailable {
|
||||
try self.createInSecureStore()
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
} else {
|
||||
if status != errSecSuccess {
|
||||
throw LocksmithError.Undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,12 @@ class LocksmithTests: XCTestCase {
|
||||
let loaded3 = Locksmith.loadDataForUserAccount(userAccount, inService: service)! as! TestingDictionaryType
|
||||
|
||||
XCTAssertEqual(loaded3, updatedData)
|
||||
|
||||
try! Locksmith.deleteDataForUserAccount(userAccount, inService: service)
|
||||
|
||||
try! Locksmith.updateData(["some update": "data"], forUserAccount: userAccount, inService: service)
|
||||
let updateResult = Locksmith.loadDataForUserAccount(userAccount, inService: service)! as! [String: String]
|
||||
XCTAssertEqual(updateResult, ["some update": "data"])
|
||||
}
|
||||
|
||||
func testStaticMethodsForDefaultService() {
|
||||
@@ -94,6 +100,22 @@ class LocksmithTests: XCTestCase {
|
||||
createGenericPasswordWithData(data)
|
||||
}
|
||||
|
||||
func testUpdateCreatesIfNotExists() {
|
||||
let data = ["some": "data"]
|
||||
|
||||
struct CreateGenericPassword: CreateableSecureStorable, GenericPasswordSecureStorable, ReadableSecureStorable {
|
||||
var data: [String: AnyObject]
|
||||
let account: String
|
||||
let service: String
|
||||
}
|
||||
|
||||
let update = CreateGenericPassword(data: data, account: userAccount, service: service)
|
||||
try! update.updateInSecureStore()
|
||||
|
||||
let read = update.readFromSecureStore()!.data as! [String: String]
|
||||
XCTAssertEqual(read, ["some": "data"])
|
||||
}
|
||||
|
||||
func testUpdateForGenericPassword() {
|
||||
let data = ["some": "data"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user