GithubHelp home page GithubHelp logo

Comments (7)

crashoverride777 avatar crashoverride777 commented on July 30, 2024

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.

crashoverride777 avatar crashoverride777 commented on July 30, 2024

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.

jrendel avatar jrendel commented on July 30, 2024

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.

crashoverride777 avatar crashoverride777 commented on July 30, 2024

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.

jrendel avatar jrendel commented on July 30, 2024

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.

crashoverride777 avatar crashoverride777 commented on July 30, 2024

Awesome, thank you very much, looking forward to it.

from swiftkeychainwrapper.

jrendel avatar jrendel commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.