Remove deregisterIdentity()

Remove the ability to remove registered identities. Once registered, identities are part
of a permanent record (for example you would want to ensure parties to contracts cannot
"disappear" by removing themselves from the identity service).
This commit is contained in:
Ross Nicoll 2016-04-27 11:43:10 +01:00
parent 652e3a80e9
commit c8865c1b40
3 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,11 @@ import java.security.PublicKey
*/
interface IdentityService {
fun registerIdentity(party: Party)
fun deregisterIdentity(party: Party)
// There is no method for removing identities, as once we are made aware of a Party we want to keep track of them
// indefinitely. It may be that in the long term we need to drop or archive very old Party information for space,
// but for now this is not supported.
fun partyFromKey(key: PublicKey): Party?
fun partyFromName(name: String): Party?
}

View File

@ -17,10 +17,7 @@ class InMemoryIdentityService() : IdentityService {
keyToParties[party.owningKey] = party
nameToParties[party.name] = party
}
override fun deregisterIdentity(party: Party) {
keyToParties.remove(party.owningKey)
nameToParties.remove(party.name)
}
override fun partyFromKey(key: PublicKey): Party? = keyToParties[key]
override fun partyFromName(name: String): Party? = nameToParties[name]
}

View File

@ -19,7 +19,6 @@ class MockIdentityService(val identities: List<Party>) : IdentityService {
get() = synchronized(identities) { identities.associateBy { it.name } }
override fun registerIdentity(party: Party) { throw UnsupportedOperationException() }
override fun deregisterIdentity(party: Party) { throw UnsupportedOperationException() }
override fun partyFromKey(key: PublicKey): Party? = keyToParties[key]
override fun partyFromName(name: String): Party? = nameToParties[name]
}