Add RPC operation for resolving well known identity

This commit is contained in:
Ross Nicoll 2017-08-09 14:11:25 +01:00
parent 9103b3b962
commit fdb63b7611
3 changed files with 15 additions and 3 deletions

View File

@ -241,6 +241,15 @@ interface CordaRPCOps : RPCOps {
// TODO These need rethinking. Instead of these direct calls we should have a way of replicating a subset of
// the node's state locally and query that directly.
/**
* Returns the well known identity from an abstract party. This is intended to resolve the well known identity
* from a confidential identity, however it transparently handles returning the well known identity back if
* a well known identity is passed in.
*
* @param party identity to determine well known identity for.
* @return well known identity, if found.
*/
fun partyFromAnonymous(party: AbstractParty): Party?
/**
* Returns the [Party] corresponding to the given key, if found.
*/

View File

@ -109,10 +109,12 @@ interface IdentityService {
fun partyFromX500Name(principal: X500Name): Party?
/**
* Resolve the well known identity of a party. If the party passed in is already a well known identity
* (i.e. a [Party]) this returns it as-is.
* Returns the well known identity from an abstract party. This is intended to resolve the well known identity
* from a confidential identity, however it transparently handles returning the well known identity back if
* a well known identity is passed in.
*
* @return the well known identity, or null if unknown.
* @param party identity to determine well known identity for.
* @return well known identity, if found.
*/
fun partyFromAnonymous(party: AbstractParty): Party?

View File

@ -149,6 +149,7 @@ class CordaRPCOpsImpl(
override fun deauthoriseContractUpgrade(state: StateAndRef<*>) = services.vaultService.deauthoriseContractUpgrade(state)
override fun currentNodeTime(): Instant = Instant.now(services.clock)
override fun waitUntilRegisteredWithNetworkMap() = services.networkMapCache.mapServiceRegistered
override fun partyFromAnonymous(party: AbstractParty): Party? = services.identityService.partyFromAnonymous(party)
override fun partyFromKey(key: PublicKey) = services.identityService.partyFromKey(key)
@Suppress("DEPRECATION")
@Deprecated("Use partyFromX500Name instead")