From 970748216f0108c43dc2285cd9a85fe75106c2d3 Mon Sep 17 00:00:00 2001
From: callebtc <93376500+callebtc@users.noreply.github.com>
Date: Fri, 28 Oct 2022 19:34:04 +0200
Subject: [PATCH] split doesnt work yet
---
lnbits/extensions/cashu/static/js/dhke.js | 12 +-
.../cashu/templates/cashu/wallet.html | 417 +++++++++++-------
lnbits/extensions/cashu/views_api.py | 1 -
3 files changed, 269 insertions(+), 161 deletions(-)
diff --git a/lnbits/extensions/cashu/static/js/dhke.js b/lnbits/extensions/cashu/static/js/dhke.js
index c9e2d146e..c35a34e9d 100644
--- a/lnbits/extensions/cashu/static/js/dhke.js
+++ b/lnbits/extensions/cashu/static/js/dhke.js
@@ -19,17 +19,15 @@ async function hashToCurve(secretMessage) {
return point
}
-async function step1Bob(secretMessage) {
+async function step1Alice(secretMessage) {
const Y = await hashToCurve(secretMessage)
- const randomBlindingFactor = bytesToNumber(
- nobleSecp256k1.utils.randomPrivateKey()
- )
- const P = nobleSecp256k1.Point.fromPrivateKey(randomBlindingFactor)
+ const r = bytesToNumber(nobleSecp256k1.utils.randomPrivateKey())
+ const P = nobleSecp256k1.Point.fromPrivateKey(r)
const B_ = Y.add(P)
- return {B_: B_.toHex(true), randomBlindingFactor}
+ return {B_: B_.toHex(true), r}
}
-function step3Bob(C_, r, A) {
+function step3Alice(C_, r, A) {
const rInt = BigInt(r)
const C = C_.subtract(A.multiply(rInt))
return C
diff --git a/lnbits/extensions/cashu/templates/cashu/wallet.html b/lnbits/extensions/cashu/templates/cashu/wallet.html
index ee243c1f4..4af9c1485 100644
--- a/lnbits/extensions/cashu/templates/cashu/wallet.html
+++ b/lnbits/extensions/cashu/templates/cashu/wallet.html
@@ -426,6 +426,10 @@ page_container %}
}
{% endblock %} {% block scripts %}
+
+
+
+
-
-
-
-
{% endblock %}
diff --git a/lnbits/extensions/cashu/views_api.py b/lnbits/extensions/cashu/views_api.py
index d4654c55a..4d3e854c6 100644
--- a/lnbits/extensions/cashu/views_api.py
+++ b/lnbits/extensions/cashu/views_api.py
@@ -347,7 +347,6 @@ async def split(
proofs = payload.proofs
amount = payload.amount
outputs = payload.outputs.blinded_messages
- # backwards compatibility with clients < v0.2.2
assert outputs, Exception("no outputs provided.")
split_return = None
try: