Console: Support deleting blinded entries on /configkeyring

This commit is contained in:
zzz
2019-05-30 14:26:11 +00:00
parent 6b3896c1f8
commit f049319500
6 changed files with 94 additions and 19 deletions

View File

@ -187,4 +187,13 @@ public abstract class NetworkDatabaseFacade implements Service {
public List<BlindData> getBlindData() {
return null;
}
/**
* For console ConfigKeyringHelper
* @return true if removed
* @since 0.9.41
*/
public boolean removeBlindData(SigningPublicKey spk) {
return false;
}
}

View File

@ -249,6 +249,28 @@ class BlindCache {
return rv;
}
/**
* For console ConfigKeyringHelper.
* Persists immediately if removed.
*
* @param spk the unblinded public key
* @return true if removed
* @since 0.9.41
*/
public boolean removeBlindData(SigningPublicKey spk) {
boolean rv = false;
BlindData bd = _cache.remove(spk);
if (bd != null) {
rv = true;
_reverseCache.remove(bd.getBlindedPubKey());
Hash h = bd.getDestHash();
if (h != null)
_hashCache.remove(h);
store();
}
return rv;
}
/**
* Load from file.
* Format:

View File

@ -501,6 +501,16 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
public List<BlindData> getBlindData() {
return _blindCache.getData();
}
/**
* For console ConfigKeyringHelper
* @param spk the unblinded public key
* @return true if removed
* @since 0.9.41
*/
public boolean removeBlindData(SigningPublicKey spk) {
return _blindCache.removeBlindData(spk);
}
/**
* @return RouterInfo, LeaseSet, or null, validated