Comments (7)
you need to add these 2 methods to do so.
class func removeAllData() {
deleteKeychainSecClass(kSecClassGenericPassword)
deleteKeychainSecClass(kSecClassInternetPassword)
deleteKeychainSecClass(kSecClassCertificate)
deleteKeychainSecClass(kSecClassKey)
deleteKeychainSecClass(kSecClassIdentity)
}
private class func deleteKeychainSecClass(secClass: AnyObject) -> Bool {
let query = [ kSecClass as String : secClass ]
let status: OSStatus = SecItemDelete(query as CFDictionaryRef)
if status == errSecSuccess {
return true
} else {
return false
}
}
from swiftkeychainwrapper.
Hey,
Thanks for the post. I was actually considering returning a bool for the deleteMethod as well, however in my case I am only using this method for internal testing so I didnt bother. However there might be situations where you need this method in a regular app so it probably a good idea to return a bool.
Hopefully the author puts this in his awesome helper.
Thanks again.
from swiftkeychainwrapper.
Hey guys, I know you've been asking for this. I'm trying to find some time to work on the library, I've got a handful of changes I'd like to put into an update.
from swiftkeychainwrapper.
Awesome, looking forward to it. Hope you keep it as simple and great as it is right now. The one thing I would also love to see is an option to directly save Bool and/or Int values, like you can in NSUserDefaults. (boolForKey(...), intForKey(...) )
Thank you for your great helper.
from swiftkeychainwrapper.
I pulled the suggested delete operation into a new branch on the repo and started testing. I have mixed feelings about a "delete all" function that has the potential to wipe more than you expected. While I agree its useful, it can also be dangerous if you don't understand what you're doing, so at the very least I want to make sure its well documented before I release it. I've also added a delete that only deletes keys that match your current wrapper settings (service name and access group).
I'm going to be continuing on with several changes for what I'm considering a "v2" of the library, and pull the delete stuff into that. As part of these changes, I will also look at adding convenience functions such as boolForKey, intForKey, etc. I always wanted this to be simple to use, like NSUserDefaults, for someone that has no understanding of keychain. Hence, why it does things like only allow access when the device is unlocked.
At the same time, I also see the potential for users to want more control. So my approach for v2 will more closely follow the pattern established by NSUserDefaults. There will be a "StandardKeychainAccess" or something along those lines, a singleton that gives you quick and easy access with fixed settings. And then the option to create your own keychain wrapper instance with more custom settings such as ServiceName, access group and access level. For backwards compatibility, I'll leave the existing class methods on the wrapper, they will just default to using the standard instance instead of some static state.
I've started this work in a branch called "unstable" as I tend to commit often things that I am working on but also change them often as I think of different or better ways to do something. So you're welcome to track along, but don't get too attached to anything specific :)
from swiftkeychainwrapper.
Awesome, thank you very much, looking forward to it.
from swiftkeychainwrapper.
This is now part of the 2.0 release I'm working on in the develop branch. Hoping to do a bit more testing and get it pulled through to master soon.
from swiftkeychainwrapper.
Related Issues (20)
- Module compiled with Swift 5.1.3 cannot be imported by the Swift 5.2 compiler HOT 1
- Error trying to install application
- Clear Data HOT 1
- Deprecation warnings for iOS12 HOT 4
- Accessibility is not working HOT 2
- Problem with set(...) in template
- Access Groups clarification HOT 4
- Support for multi platform framework target(tvOS, iOS, macOS) HOT 1
- Can this pod work with Mac Project Catalyst
- SecItemCopyMatching Crash HOT 1
- iOS15 beta clearing keychain HOT 1
- 'NSKeyedUnarchiveFromData' should not be used
- Callback on keychain value change for given key
- I've noticed, that if i store something and immediately retrieve from other function, it not manage to return appropriate value.
- KeyChain access between app and share extension HOT 1
- XCTestCase: set NewValue return False HOT 2
- Incrementing and saving do not work properly HOT 1
- Apple SignIn email is not retrieving
- removeAllKeys does not delete any items that were saved with synchronizable as true
- Receiving "warning: linking against a dylib which is not safe for use in application extensions"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftkeychainwrapper.