VALValet_Protected.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // VALValet_Protected.h
  3. // Valet
  4. //
  5. // Created by Dan Federman on 3/16/15.
  6. // Copyright 2015 Square, Inc.
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License");
  9. // you may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at
  11. //
  12. //    http://www.apache.org/licenses/LICENSE-2.0
  13. //
  14. // Unless required by applicable law or agreed to in writing, software
  15. // distributed under the License is distributed on an "AS IS" BASIS,
  16. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. // See the License for the specific language governing permissions and
  18. // limitations under the License.
  19. //
  20. #import <Valet/VALValet.h>
  21. extern NSString * __nonnull VALStringForAccessibility(VALAccessibility accessibility);
  22. extern void VALAtomicSecItemLock(__nonnull dispatch_block_t block);
  23. @interface VALValet ()
  24. /// Ensures the atomicity for set and remove operations by limiting ourselves to one instance per configuration.
  25. /// @return An existing valet object with the same configuration as the valet provided if one exists, or the passed in valet.
  26. + (nonnull id)sharedValetForValet:(nonnull VALValet *)valet;
  27. /// Creates a base query given the injected properties. Do not override.
  28. + (nullable NSMutableDictionary *)mutableBaseQueryWithIdentifier:(nonnull NSString *)identifier accessibility:(VALAccessibility)accessibility initializer:(nonnull SEL)initializer;
  29. /// Creates a base query for shared access group Valets given the injected properties. Do not override.
  30. + (nullable NSMutableDictionary *)mutableBaseQueryWithSharedAccessGroupIdentifier:(nonnull NSString *)sharedAccessGroupIdentifier accessibility:(VALAccessibility)accessibility initializer:(nonnull SEL)initializer;
  31. /// Stores the root query to be used in all SecItem queries.
  32. @property (nonnull, copy, readonly) NSDictionary *baseQuery;
  33. - (BOOL)setObject:(nonnull NSData *)value forKey:(nonnull NSString *)key options:(nullable NSDictionary *)options;
  34. - (nullable NSData *)objectForKey:(nonnull NSString *)key options:(nullable NSDictionary *)options status:(nullable inout OSStatus *)status;
  35. - (BOOL)setString:(nonnull NSString *)string forKey:(nonnull NSString *)key options:(nullable NSDictionary *)options;
  36. - (nullable NSString *)stringForKey:(nonnull NSString *)key options:(nullable NSDictionary *)options status:(nullable inout OSStatus *)status;
  37. - (OSStatus)containsObjectForKey:(nonnull NSString *)key options:(nullable NSDictionary *)options;
  38. - (nonnull NSSet *)allKeysWithOptions:(nullable NSDictionary *)options;
  39. - (BOOL)removeObjectForKey:(nonnull NSString *)key options:(nullable NSDictionary *)options;
  40. - (BOOL)removeAllObjectsWithOptions:(nullable NSDictionary *)options;
  41. @end