class BlindCache extends Object
Manages blinded and unblinded key mappings with persistent storage and automatic rollover at midnight UTC. Provides lookup operations for both blinded destinations and their corresponding unblinded hashes.
| Constructor and Description |
|---|
BlindCache(RouterContext ctx)
Caller MUST call startup() to load persistent cache from disk
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToCache(BlindData bd)
Persists immediately if secret or privkey is non-null
|
Hash |
getBlindedHash(Destination dest)
The hash to lookup for a dest.
|
Hash |
getBlindedHash(SigningPublicKey spk)
The hash to lookup for a SPK known to be blinded.
|
List<BlindData> |
getData()
For console ConfigKeyringHelper
|
BlindData |
getData(Destination dest)
The cached data or null
|
BlindData |
getData(SigningPublicKey spk)
The cached data or null
|
Hash |
getHash(Destination dest)
The hash to lookup for a dest.
|
Hash |
getHash(Hash h)
The hash to lookup for a dest hash.
|
BlindData |
getReverseData(SigningPublicKey spk)
The cached data or null
|
boolean |
removeBlindData(SigningPublicKey spk)
For console ConfigKeyringHelper.
|
void |
rollover()
Refresh all the data at midnight
|
void |
setBlinded(Destination dest)
Add the destination to the cache entry.
|
void |
setBlinded(Destination dest,
SigType blindedType,
String secret)
Mark a destination as known to be blinded
|
void |
shutdown()
May be restarted by calling startup() again.
|
void |
startup() |
public BlindCache(RouterContext ctx)
public void addToCache(BlindData bd)
public Hash getBlindedHash(Destination dest)
dest - may or may not be blindedpublic Hash getBlindedHash(SigningPublicKey spk)
spk - known to be blindedIllegalArgumentException - on various errorspublic BlindData getData(Destination dest)
public BlindData getData(SigningPublicKey spk)
spk - the unblinded public keypublic Hash getHash(Destination dest)
dest - may or may not be blindedpublic Hash getHash(Hash h)
h - may or may not be blindedpublic BlindData getReverseData(SigningPublicKey spk)
spk - the blinded public keypublic boolean removeBlindData(SigningPublicKey spk)
spk - the unblinded public keypublic void rollover()
public void setBlinded(Destination dest)
dest - known to be blindedIllegalArgumentException - on various errorspublic void setBlinded(Destination dest, SigType blindedType, String secret)
dest - known to be blindedblindedType - null for defaultsecret - may be nullIllegalArgumentException - on various errorspublic void shutdown()
public void startup()