mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 10:34:20 +01:00
[Wallet/Mint] DLEQ proofs (#175)
* produce dleq * start working on verification * wip dleq * Use C_ instead of C in verify DLEQ! (#176) * Fix comments (DLEQ sign error) * Fix alice_verify_dleq in d_dhke.py * Fix_generate_promise in ledger.py * Fix verify_proofs_dleq in wallet.py * Fix: invalid public key (#182) * Use C_ instead of C in verify DLEQ! * Fix comments (DLEQ sign error) * Fix alice_verify_dleq in d_dhke.py * Fix_generate_promise in ledger.py * Fix verify_proofs_dleq in wallet.py * Fix: invalid public key * Exception: Mint Error: invalid public key * Update cashu/wallet/wallet.py --------- Co-authored-by: calle <93376500+callebtc@users.noreply.github.com> * Update cashu/core/b_dhke.py * Update tests/test_cli.py * verify all constructed proofs * dleq upon receive * serialize without dleq * all tests passing * make format * remove print * remove debug * option to send with dleq * add tests * fix test * deterministic p in step2_dleq and fix mypy error for hash_to_curve * test crypto/hash_e and crypto/step2_bob_dleq * rename A to K in b_dhke.py and test_alice_verify_dleq * rename tests * make format * store dleq in mint db (and readd balance view) * remove `r` from dleq in tests * add pending output * make format * works with pre-dleq mints * fix comments * make format * fix some tests * fix last test * test serialize dleq fix * flake * flake * keyset.id must be str * fix test decorators * start removing the duplicate fields from the dleq * format * remove print * cleanup * add type anotations to dleq functions * remove unnecessary fields from BlindedSignature * tests not working yet * spelling mistakes * spelling mistakes * fix more spelling mistakes * revert to normal * add comments * bdhke: generalize hash_e * remove P2PKSecret changes * revert tests for P2PKSecret * revert tests * revert test fully * revert p2pksecret changes * refactor proof invalidation * store dleq proofs in wallet db * make mypy happy --------- Co-authored-by: moonsettler <moonsettler@protonmail.com>
This commit is contained in:
@@ -352,6 +352,14 @@ async def balance(ctx: Context, verbose):
|
||||
type=str,
|
||||
)
|
||||
@click.option("--lock", "-l", default=None, help="Lock tokens (P2SH).", type=str)
|
||||
@click.option(
|
||||
"--dleq",
|
||||
"-d",
|
||||
default=False,
|
||||
is_flag=True,
|
||||
help="Send with DLEQ proof.",
|
||||
type=bool,
|
||||
)
|
||||
@click.option(
|
||||
"--legacy",
|
||||
"-l",
|
||||
@@ -387,6 +395,7 @@ async def send_command(
|
||||
nostr: str,
|
||||
nopt: str,
|
||||
lock: str,
|
||||
dleq: bool,
|
||||
legacy: bool,
|
||||
verbose: bool,
|
||||
yes: bool,
|
||||
@@ -394,9 +403,18 @@ async def send_command(
|
||||
):
|
||||
wallet: Wallet = ctx.obj["WALLET"]
|
||||
if not nostr and not nopt:
|
||||
await send(wallet, amount, lock, legacy, split=not nosplit)
|
||||
await send(
|
||||
wallet,
|
||||
amount=amount,
|
||||
lock=lock,
|
||||
legacy=legacy,
|
||||
split=not nosplit,
|
||||
include_dleq=dleq,
|
||||
)
|
||||
else:
|
||||
await send_nostr(wallet, amount, nostr or nopt, verbose, yes)
|
||||
await send_nostr(
|
||||
wallet, amount=amount, pubkey=nostr or nopt, verbose=verbose, yes=yes
|
||||
)
|
||||
|
||||
|
||||
@cli.command("receive", help="Receive tokens.")
|
||||
@@ -532,14 +550,15 @@ async def pending(ctx: Context, legacy, number: int, offset: int):
|
||||
enumerate(
|
||||
groupby(
|
||||
sorted_proofs,
|
||||
key=itemgetter("send_id"),
|
||||
key=itemgetter("send_id"), # type: ignore
|
||||
)
|
||||
),
|
||||
offset,
|
||||
number,
|
||||
):
|
||||
grouped_proofs = list(value)
|
||||
token = await wallet.serialize_proofs(grouped_proofs)
|
||||
# TODO: we can't return DLEQ because we don't store it
|
||||
token = await wallet.serialize_proofs(grouped_proofs, include_dleq=False)
|
||||
tokenObj = deserialize_token_from_string(token)
|
||||
mint = [t.mint for t in tokenObj.token][0]
|
||||
# token_hidden_secret = await wallet.serialize_proofs(grouped_proofs)
|
||||
|
||||
Reference in New Issue
Block a user