How to access Corda Notary's Publickey?

Hello. I’m new to Corda, (and Slack as well).

I’m creating an app using corda open source 4.8.5. There is a requirement for me to store the actual public key of the notary who approved the transaction once the transaction has been recorded in the node’s vaults. I want to send the notary’s public key as part of the response when the client calls the API. Please tell me how do I obtain it.

Thanks.

Do you need to do this every time you are sending a transaction? Or you just need to once in a while?

Because each transaction (once finalized, meaning stored in the vault) will state what signatures it has on it. If you are doing a transaction involving two parties, and the notary, you will see three signatures in the transaction, under the Signatures section.

For example:

And you gotta do some checking to find which the pub key belongs to the notary. but that is not really difficult.

[Follow up question]:

I’m returning FlowLogic from my flow to the spring-boot controller (RPC) that I have. When I try doing:

val signedTx =proxy.startTrackedFlow(::NewLoadFlowInitiator,req).returnValue.getOrThrow()
val notaryPublicKey = signedTx.notary.owningKey

The value which I get inside the notaryPublicKey variable looks something like this:
net.i2p.crypto.eddsa.EdDSAPublicKey@d90c5d88

How do I get the public key from here?

RPC cant deserialize the content that was serialized by Corda node. If you want to do it via code, you gotta implmeent a new flow that get the keys (signers) from the node directly via a flow.