Skip to content

Commit

Permalink
Merge pull request sjhoeksma#9 from MobilityTiago/master
Browse files Browse the repository at this point in the history
Delete items from keychain when key is deleted. [iOS]
  • Loading branch information
sjhoeksma committed Dec 5, 2016
2 parents 375f85a + de52145 commit ce8f43b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ios/KeychainWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
- (void)mySetObject:(id)inObject forKey:(id)key;
- (id)myObjectForKey:(id)key;
- (void)writeToKeychain;
- (void)resetKeychainItem;

@end
8 changes: 8 additions & 0 deletions src/ios/TouchID.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ - (void)save:(CDVInvokedUrlCommand*)command{
-(void)delete:(CDVInvokedUrlCommand*)command{
self.TAG = (NSString*)[command.arguments objectAtIndex:0];
@try {

if(self.TAG && [[NSUserDefaults standardUserDefaults] objectForKey:self.TAG])
{
self.MyKeychainWrapper = [[KeychainWrapper alloc]init];
[self.MyKeychainWrapper resetKeychainItem];
}


[[NSUserDefaults standardUserDefaults] removeObjectForKey:self.TAG];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
Expand Down

0 comments on commit ce8f43b

Please sign in to comment.