From fe7c129ae7f89ea5830efd0d7dc0116bba4ba069 Mon Sep 17 00:00:00 2001 From: Konstantinos Chalkias Date: Fri, 16 Feb 2018 12:32:53 +0000 Subject: [PATCH] CORDA-1038 Update verifySignaturesExcept in api-transactions.rst (#2546) --- docs/source/api-transactions.rst | 18 ++++++++++++++++++ .../java/net/corda/docs/FlowCookbookJava.java | 11 ++++++++++- .../main/kotlin/net/corda/docs/FlowCookbook.kt | 9 ++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/source/api-transactions.rst b/docs/source/api-transactions.rst index 0c02f4b565..888aed09e7 100644 --- a/docs/source/api-transactions.rst +++ b/docs/source/api-transactions.rst @@ -615,6 +615,24 @@ which the signatures are allowed to be missing: :end-before: DOCEND 36 :dedent: 16 +There is also an overload of ``SignedTransaction.verifySignaturesExcept``, which takes a ``Collection`` of the +public keys for which the signatures are allowed to be missing: + +.. container:: codeset + + .. literalinclude:: ../../docs/source/example-code/src/main/kotlin/net/corda/docs/FlowCookbook.kt + :language: kotlin + :start-after: DOCSTART 54 + :end-before: DOCEND 54 + :dedent: 8 + + .. literalinclude:: ../../docs/source/example-code/src/main/java/net/corda/docs/FlowCookbookJava.java + :language: java + :start-after: DOCSTART 54 + :end-before: DOCEND 54 + :dedent: 16 + + If the transaction is missing any signatures without the corresponding public keys being passed in, a ``SignaturesMissingException`` is thrown. diff --git a/docs/source/example-code/src/main/java/net/corda/docs/FlowCookbookJava.java b/docs/source/example-code/src/main/java/net/corda/docs/FlowCookbookJava.java index 9a6f6d6e5f..bf2c58b858 100644 --- a/docs/source/example-code/src/main/java/net/corda/docs/FlowCookbookJava.java +++ b/docs/source/example-code/src/main/java/net/corda/docs/FlowCookbookJava.java @@ -540,12 +540,21 @@ public class FlowCookbookJava { // DOCEND 35 // If the transaction is only partially signed, we have to pass in - // a list of the public keys corresponding to the missing + // a vararg of the public keys corresponding to the missing // signatures, explicitly telling the system not to check them. // DOCSTART 36 onceSignedTx.verifySignaturesExcept(counterpartyPubKey); // DOCEND 36 + // There is also an overload of ``verifySignaturesExcept`` which accepts + // a ``Collection`` of the public keys corresponding to the missing + // signatures. In the example below, we could also use + // ``Arrays.asList(counterpartyPubKey)`` instead of + // ``Collections.singletonList(counterpartyPubKey)``. + // DOCSTART 54 + onceSignedTx.verifySignaturesExcept(Collections.singletonList(counterpartyPubKey)); + // DOCEND 54 + // We can also choose to only check the signatures that are // present. BE VERY CAREFUL - this function provides no guarantees // that the signatures are correct, or that none are missing. diff --git a/docs/source/example-code/src/main/kotlin/net/corda/docs/FlowCookbook.kt b/docs/source/example-code/src/main/kotlin/net/corda/docs/FlowCookbook.kt index f5380582de..e0179281da 100644 --- a/docs/source/example-code/src/main/kotlin/net/corda/docs/FlowCookbook.kt +++ b/docs/source/example-code/src/main/kotlin/net/corda/docs/FlowCookbook.kt @@ -522,12 +522,19 @@ class InitiatorFlow(val arg1: Boolean, val arg2: Int, private val counterparty: // DOCEND 35 // If the transaction is only partially signed, we have to pass in - // a list of the public keys corresponding to the missing + // a vararg of the public keys corresponding to the missing // signatures, explicitly telling the system not to check them. // DOCSTART 36 onceSignedTx.verifySignaturesExcept(counterpartyPubKey) // DOCEND 36 + // There is also an overload of ``verifySignaturesExcept`` which accepts + // a ``Collection`` of the public keys corresponding to the missing + // signatures. + // DOCSTART 54 + onceSignedTx.verifySignaturesExcept(listOf(counterpartyPubKey)) + // DOCEND 54 + // We can also choose to only check the signatures that are // present. BE VERY CAREFUL - this function provides no guarantees // that the signatures are correct, or that none are missing.