From c3e7932d77e0b23984959c4d7d4e3d1a0c986c0d Mon Sep 17 00:00:00 2001 From: sstone Date: Mon, 27 May 2024 16:19:29 +0200 Subject: [PATCH] Make Musig2.taprootSession() public --- .../kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/commonMain/kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt b/src/commonMain/kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt index 9b99c6a..214cb05 100644 --- a/src/commonMain/kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt +++ b/src/commonMain/kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt @@ -228,7 +228,18 @@ public object Musig2 { return SecretNonce.generate(sessionId, privateKey, privateKey.publicKey(), message = null, keyAggCache, extraInput = null) } - private fun taprootSession(tx: Transaction, inputIndex: Int, inputs: List, publicKeys: List, publicNonces: List, scriptTree: ScriptTree?): Either { + /** + * Create a musig2 session for a given transaction input. + * + * @param tx transaction + * @param inputIndex transaction input index + * @param inputs outputs spent by this transaction + * @param publicKeys signers' public keys + * @param publicNonces signers' public nonces + * @param scriptTree tapscript tree of the transaction's input, if it has script paths. + */ + @JvmStatic + public fun taprootSession(tx: Transaction, inputIndex: Int, inputs: List, publicKeys: List, publicNonces: List, scriptTree: ScriptTree?): Either { return IndividualNonce.aggregate(publicNonces).flatMap { aggregateNonce -> val (aggregatePublicKey, keyAggCache) = KeyAggCache.create(publicKeys) val tweak = when (scriptTree) {