Skip to content

Commit

Permalink
[v8] Remove dependency on the Promises SDK (#187)
Browse files Browse the repository at this point in the history
* [v8] Replace read keychain API with completion handler based API (#182)

* [v8] Replace write keychain API with completion handler based API (#183)

* [v8] Replace remove keychain API with completion handler based API (#184)

* [v8] Replace remove keychain API with completion handler based API

* Update GoogleUtilities/Environment/SecureStorage/GULKeychainStorage.m

* [v8] Fix tests, docs, and imports following `GULKeychainStorage` API changes (#185)

* [v8] Remove Promises API and dependency specifications (#186)

* [v8] Remove Promises API and dependency specifications

* Remove other header

* [v8] Add changelog for removal of Promises dependency

* [v8] Remove extraneous parameter from removeObject API (#188)
  • Loading branch information
ncooke3 authored Jun 11, 2024
1 parent bf6cc82 commit 2771466
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 427 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
| tvOS | **13.0** |
| macOS | **10.15** |
| watchOS | 7.0 |
- Remove dependency on `FBLPromises`. The following public API have
been removed:
- `- [NSURLSession gul_dataTaskPromiseWithRequest:]`
- `GULURLSessionDataResponse`
The following promise-based public API have been replaced with
completion handler-based alternatives.
- `- [GULKeychainStorage getObjectForKey:objectClass:accessGroup:]`
- `- [GULKeychainStorage setObject:forKey:accessGroup:]`
- `- [GULKeychainStorage removeObjectForKey:accessGroup:]`

# 7.13.3
- Rename parameter placeholder in `GULSecureCoding` unarchiving API to avoid
Expand Down
1 change: 0 additions & 1 deletion GoogleUtilities.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ other Google CocoaPods. They're not intended for direct public usage.
'third_party/IsAppEncrypted/**/*.[mh]'
]
es.public_header_files = 'GoogleUtilities/Environment/Public/GoogleUtilities/*.h'
es.dependency 'PromisesObjC', '>= 1.2', '< 3.0'
es.dependency 'GoogleUtilities/Privacy'
es.frameworks = [
'Security'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#import <Foundation/Foundation.h>

@class FBLPromise<ValueType>;

NS_ASSUME_NONNULL_BEGIN

/// The class provides a convenient, multiplatform abstraction of the Keychain.
Expand All @@ -34,42 +32,46 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithService:(NSString *)service;

/**
* Get an object by key.
* @param key The key.
* @param objectClass The expected object class required by `NSSecureCoding`.
* @param accessGroup The Keychain Access Group.
*
* @return Returns a promise. It is resolved with an object stored by key if exists. It is resolved
* with `nil` when the object not found. It fails on a Keychain error.
*/
- (FBLPromise<id<NSSecureCoding>> *)getObjectForKey:(NSString *)key
objectClass:(Class)objectClass
accessGroup:(nullable NSString *)accessGroup;
/// Get an object by key.
/// @param key The key.
/// @param objectClass The expected object class required by `NSSecureCoding`.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain read is complete. An error is passed to the
/// completion handler if the keychain read fails. Else, the object stored in
/// the keychain, or `nil` if it does not exist, is passed to the completion
/// handler.
- (void)getObjectForKey:(NSString *)key
objectClass:(Class)objectClass
accessGroup:(nullable NSString *)accessGroup
completionHandler:
(void (^)(id<NSSecureCoding> _Nullable obj, NSError *_Nullable error))completionHandler;

/**
* Saves the given object by the given key.
* @param object The object to store.
* @param key The key to store the object. If there is an existing object by the key, it will be
* overridden.
* @param accessGroup The Keychain Access Group.
*
* @return Returns which is resolved with `[NSNull null]` on success.
*/
- (FBLPromise<NSNull *> *)setObject:(id<NSSecureCoding>)object
forKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup;
/// Saves the given object by the given key.
/// @param object The object to store.
/// @param key The key to store the object. If there is an existing object by the key, it will be
/// overridden.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain write is complete. An error is passed to the
/// completion handler if the keychain read fails. Else, the object written to
/// the keychain is passed to the completion handler.
- (void)setObject:(id<NSSecureCoding>)object
forKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup
completionHandler:
(void (^)(id<NSSecureCoding> _Nullable obj, NSError *_Nullable error))completionHandler;

/**
* Removes the object by the given key.
* @param key The key to store the object. If there is an existing object by the key, it will be
* overridden.
* @param accessGroup The Keychain Access Group.
*
* @return Returns which is resolved with `[NSNull null]` on success.
*/
- (FBLPromise<NSNull *> *)removeObjectForKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup;
/// Removes the object by the given key.
/// @param key The key to store the object. If there is an existing object by
/// the key, it will be overridden.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain removal is complete. An error is passed to the
/// completion handler if the keychain removal fails.
- (void)removeObjectForKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup
completionHandler:(void (^)(NSError *_Nullable error))completionHandler;

#if TARGET_OS_OSX
/// If not `nil`, then only this keychain will be used to save and read data (see
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2771466

Please sign in to comment.