added "delete passphrase" method to keychain access

This commit is contained in:
Tobias Hagemann
2016-08-31 01:08:58 +02:00
parent 902b29ee0a
commit d61e5c5a08
4 changed files with 24 additions and 0 deletions

View File

@@ -16,4 +16,11 @@ public interface KeychainAccess {
*/
CharSequence loadPassphrase(String key);
/**
* Deletes a passphrase with a given key.
*
* @param key Unique key previously used while {@link #storePassphrase(String, CharSequence) storing a passphrase}.
*/
void deletePassphrase(String key);
}

View File

@@ -38,4 +38,9 @@ class MacSystemKeychainAccess implements KeychainAccessStrategy {
return SystemUtils.IS_OS_MAC_OSX && keychain != null;
}
@Override
public void deletePassphrase(String key) {
keychain.deletePassword(key);
}
}

View File

@@ -37,6 +37,12 @@ class WindowsSystemKeychainAccess implements KeychainAccessStrategy {
return null;
}
@Override
public void deletePassphrase(String key) {
// TODO Auto-generated method stub
}
@Override
public boolean isSupported() {
return SystemUtils.IS_OS_WINDOWS && keyStore != null;

View File

@@ -17,6 +17,12 @@ class MapKeychainAccess implements KeychainAccessStrategy {
return map.get(key);
}
@Override
public void deletePassphrase(String key) {
// TODO Auto-generated method stub
}
@Override
public boolean isSupported() {
return true;