fabiocaccamo / FCUUID

:iphone: :id:  iOS UUID / Universally Unique Identifiers library as alternative to UDID and identifierForVendor.
MIT License
1.61k stars 226 forks source link

FCUUIDDelegate to use your own Keychain Wrapper #1

Closed jingx23 closed 9 years ago

jingx23 commented 9 years ago

I added a protocol to use own keychain wrapper instead of the hardwired UICKeyChainStore. Example Implementation using FDKeychain:

//FCUUIDWithKeychain.h
@interface FCUUIDWithKeychain : FCUUID
@end
//FCUUIDWithKeychain.m
#import "FCUUIDWithKeychain.h"
#import "FDKeychain.h"
@implementation FCUUIDWithKeychain
- (NSString *)fcuuidKeychainStringForKey:(NSString *)key {
    return [FDKeychain itemForKey:key forService:oxtgKeychainServiceType error:nil];
}

- (NSString *)fcuuidKeychainStringForKey:(NSString *)key service:(NSString *)service accessGroup:(NSString *)accessGroup {
    return [FDKeychain itemForKey:key forService:service inAccessGroup:accessGroup error:nil];
}

- (BOOL)fcuuidKeychainSetString:(NSString *)value forKey:(NSString *)key {
    return [FDKeychain saveItem:value forKey:key forService:oxtgKeychainServiceType error:nil];
}
@end
fabiocaccamo commented 9 years ago

@jingx23 KeyChain has an important role in this library, so I think it's wrong to delegate core functions. Any Keychain wrapper does almost the same things and the final result is always the same, so what is your problem with UICKeyChainStore?

jingx23 commented 9 years ago

That´s right the Keychain wrappers do almost the same thing but I made this abstraction layer because I didn´t want another dependency in my project.

fabiocaccamo commented 9 years ago

In any case you will have the UICKeyChainStore dependency in your project because it would be used as default KeyChain wrapper.