From f20e5c349b61db43b77634a2f9281080686e4542 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Thu, 7 Nov 2024 20:00:53 +0100 Subject: [PATCH 1/2] offer: be able to create an offer with description Signed-off-by: Vincenzo Palazzo --- .../kotlin/fr/acinq/lightning/NodeParams.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt b/modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt index a088bee87..50f22086c 100644 --- a/modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt +++ b/modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt @@ -271,4 +271,18 @@ data class NodeParams( // If we add a new feature that we would like to use by default, we will need to explicitly create a new offer. return OfferTypes.Offer.createBlindedOffer(amount = null, description = null, this, trampolineNodeId, Features.empty, sessionKey) } + + /** + * FIXME(vincenzopalazzo): Add docs + */ + fun offer(amount: MilliSatoshi?, description: String?, trampolineNodeId: PublicKey): Pair { + // We generate a deterministic blindingSecret based on: + // - a custom tag indicating that this is used in the Bolt 12 context + // - our trampoline node, which is used as an introduction node for the offer's blinded path + // - our private key, which ensures that nobody else can generate the same blindingSecret + // FIXME: there is some problem if I change the string prefix? yes I tried and the LSP was rejecting my code + val blindingSecret = PrivateKey(Crypto.sha256("bolt 12 default offer".toByteArray(Charsets.UTF_8).byteVector() + trampolineNodeId.value + nodePrivateKey.value).byteVector32()) + // FIXME: it should be included some additional feature + return OfferTypes.Offer.createBlindedOffer(amount = amount, description = description, this, trampolineNodeId, Features.empty, blindingSecret) + } } From 52d65f491df1077fc683b5cd543beb9c950755c2 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 20 Nov 2024 17:13:37 +0100 Subject: [PATCH 2/2] meta: bump the package version Signed-off-by: Vincenzo Palazzo --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 84a6272d5..3e2b1a09b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=fr.acinq.lightning -version=1.8.5-SNAPSHOT +version=1.8.6-SNAPSHOT # gradle org.gradle.jvmargs=-Xmx1536m org.gradle.parallel=true