mirror of
https://github.com/corda/corda.git
synced 2024-12-20 05:28:21 +00:00
pass x500 of node to enclave client
This commit is contained in:
parent
f838a969d3
commit
e1a6b5fd09
@ -2,7 +2,7 @@
|
||||
# because some versions here need to be matched by app authors in
|
||||
# their own projects. So don't get fancy with syntax!
|
||||
|
||||
cordaVersion=4.8.5.5-CONCLAVE-SNAPSHOT
|
||||
cordaVersion=4.8.5.6-CONCLAVE-SNAPSHOT
|
||||
versionSuffix=
|
||||
gradlePluginsVersion=5.0.12
|
||||
kotlinVersion=1.2.71
|
||||
|
@ -3,6 +3,7 @@ package net.corda.core.conclave.common
|
||||
import net.corda.core.conclave.common.dto.ConclaveLedgerTxModel
|
||||
import net.corda.core.conclave.common.dto.EncryptedVerifiableTxAndDependencies
|
||||
import net.corda.core.flows.FlowException
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.transactions.EncryptedTransaction
|
||||
import java.util.*
|
||||
@ -112,7 +113,7 @@ interface CordaEnclaveClient {
|
||||
fun encryptEncryptedTransactionForRemote(invokeId: UUID, locallyEncryptedTx: EncryptedTransaction): EncryptedTransaction
|
||||
}
|
||||
|
||||
class DummyCordaEnclaveClient: CordaEnclaveClient, SingletonSerializeAsToken() {
|
||||
class DummyCordaEnclaveClient(val x500: CordaX500Name): CordaEnclaveClient, SingletonSerializeAsToken() {
|
||||
|
||||
override fun getEnclaveInstanceInfo(): ByteArray {
|
||||
throw UnsupportedOperationException("Add your custom enclave client implementation")
|
||||
|
@ -5,12 +5,13 @@ import net.corda.core.conclave.common.DummyCordaEnclaveClient
|
||||
import net.corda.core.conclave.common.CordaEnclaveClient
|
||||
import net.corda.core.conclave.common.dto.ConclaveLedgerTxModel
|
||||
import net.corda.core.conclave.common.dto.EncryptedVerifiableTxAndDependencies
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.internal.FlowStateMachine
|
||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||
import net.corda.core.transactions.EncryptedTransaction
|
||||
import java.util.*
|
||||
|
||||
class EncryptedTransactionService(val enclaveClient: CordaEnclaveClient = DummyCordaEnclaveClient()) : SingletonSerializeAsToken() {
|
||||
class EncryptedTransactionService(val enclaveClient: CordaEnclaveClient = DummyCordaEnclaveClient(CordaX500Name("PartyDummy", "London", "GB" ))) : SingletonSerializeAsToken() {
|
||||
|
||||
private fun getCurrentFlowIdOrGenerateNewInvokeId(): UUID {
|
||||
val currentFiber = Fiber.currentFiber() as? FlowStateMachine<*>
|
||||
|
@ -1068,8 +1068,10 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return clazz?.let {
|
||||
EncryptedTransactionService(Class.forName(it).getDeclaredConstructor().newInstance() as CordaEnclaveClient)
|
||||
EncryptedTransactionService(Class.forName(it).getDeclaredConstructor(CordaX500Name::class.java).newInstance(configuration.myLegalName) as CordaEnclaveClient)
|
||||
} ?: run {
|
||||
EncryptedTransactionService()
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ open class MockServices private constructor(
|
||||
identityService,
|
||||
*arrayOf(initialIdentity.keyPair) + moreKeys
|
||||
),
|
||||
override val encryptedTransactionService : EncryptedTransactionService = makeEncryptedTransactionService(cordappLoader)
|
||||
override val encryptedTransactionService : EncryptedTransactionService = makeEncryptedTransactionService(cordappLoader, initialIdentity)
|
||||
) : ServiceHub {
|
||||
|
||||
companion object {
|
||||
@ -288,7 +288,7 @@ open class MockServices private constructor(
|
||||
attachment
|
||||
}
|
||||
|
||||
internal fun makeEncryptedTransactionService(cordappLoader: CordappLoader): EncryptedTransactionService {
|
||||
internal fun makeEncryptedTransactionService(cordappLoader: CordappLoader, initialIdentity: TestIdentity): EncryptedTransactionService {
|
||||
val clazz = cordappLoader.cordapps
|
||||
.map {
|
||||
it.cordappClasses
|
||||
@ -303,7 +303,7 @@ open class MockServices private constructor(
|
||||
}
|
||||
|
||||
return clazz?.let {
|
||||
EncryptedTransactionService(Class.forName(it).getDeclaredConstructor().newInstance() as CordaEnclaveClient)
|
||||
EncryptedTransactionService(Class.forName(it).getDeclaredConstructor(CordaX500Name::class.java).newInstance(initialIdentity.name) as CordaEnclaveClient)
|
||||
} ?: run {
|
||||
EncryptedTransactionService()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user