PPOTSimpleKeychain.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // adapted from https://raw.github.com/rackspace/rackspace-ios/master/Classes/Keychain.h
  2. //
  3. // PPOTSimpleKeychain.h
  4. // OpenStack
  5. //
  6. // Based on CardIOKeychain
  7. // Based on KeychainWrapper in BadassVNC by Dylan Barrie
  8. //
  9. // Created by Mike Mayo on 10/1/10.
  10. // The OpenStack project is provided under the Apache 2.0 license.
  11. //
  12. #import <Foundation/Foundation.h>
  13. /**
  14. Wrapper to help deal with Keychain-related things such as storing API keys and passwords.
  15. The key used in the methods may not be the actual key used in the keychain
  16. */
  17. @interface PPOTSimpleKeychain : NSObject
  18. /**
  19. Sets the given data for the given key
  20. @param data the data to set, null if any data associated with the key should be deleted
  21. @param key the key to use
  22. @return YES if successful, NO if not
  23. */
  24. + (BOOL)setData:(nullable NSData *)data forKey:(nonnull NSString *)key;
  25. /**
  26. Retrieves the data associated with the given key
  27. @param key the key to use
  28. @return any data associated with the key
  29. */
  30. + (nullable NSData *)dataForKey:(nonnull NSString *)key;
  31. /**
  32. Retrieves the unarchived object with the given key
  33. @param key the key to use
  34. @return the unarchived object associated with the given key
  35. */
  36. + (nullable id)unarchiveObjectWithDataForKey:(nonnull NSString *)key;
  37. @end