Commit Graph

952 Commits

Author SHA1 Message Date
callebtc
0d127f0477 .env.example for mint TOS (#746) 2025-05-10 12:18:56 +02:00
callebtc
4869a280ca add new init test to mint (#743) 2025-05-09 22:06:27 +02:00
callebtc
dc1dccb5e8 Wallet: Fix cli mpp off (#741)
* fix

* tests
2025-05-08 18:01:11 +02:00
callebtc
7a18ac8712 reorganize docker compose files for redis and keycloak (#736) 2025-04-26 00:45:39 +02:00
callebtc
7f962ce63e Wallet: add Wallet.get_melt_proof(), recover reserved state in failed Wallet.melt() (#730)
* manage state of proofs

* test set proofs unreserved

* melt recovers state on error

* fix wallet test

* fix tests

* fix another test

* get_mint_quote returns MintQuote

* fix tests

* refactor

* fix deprecated tests

* add new unset type
2025-04-25 13:12:45 +02:00
lollerfirst
213d5b1eee Mint Keyset Rotation (#734)
* move keysets methods into newly created `LedgerKeysets` + `maybe_update_derivation_path` on init

* keyset rotation

* fix error

* make format

* format

* test keyset rotation + fix bug

* format

* fix for multiple specified derivation paths

* specify return value
2025-04-25 11:37:49 +02:00
callebtc
7abfc68cfa SIG_ALL signature flag for P2PK (#735)
* n_sigs_refund working, tests added

* update requirements

* wip sigall

* wip

* sigall works

* add signatures for refund

* add mint p2pk tests

* add more p2pk tests

* fix tests

* sign htlc pubkeys as well

* fix htlc and add new test

* fix regtest

* fix new tests with deprecated

* remove asserts

* comments

* new wallet p2pk tests

* getting there

* add more tests

* fixes

* refactor htlc and p2pk validation

* reduce code

* melt with sigall

* fix htlcs

* fix deprecated api tests

* Update cashu/mint/conditions.py

Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com>

* refactor sigall validation

---------

Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com>
2025-04-25 11:37:19 +02:00
iwarp
8d94d1097b fix getting the PR (#732) 2025-04-20 16:21:52 +07:00
callebtc
e1220d2329 Cjbeery24/mint copy: Invoice checker background tasks (#722)
* #616: Removed blocking call from ledger startup. Instead added it to a background task that repeats every hour.

* make task interval configurable, remember task and cancel it on shutdown

* comments

* add sleep to tests because the background task is async

---------

Co-authored-by: Caleb Beery <cjbeery@gmail.com>
2025-04-10 21:25:18 +07:00
callebtc
76e2601efd Add terms of service URL to MintInformation class (#715)
* add tos_url according to https://github.com/cashubtc/nuts/pull/205

* add tos_url everywhere
2025-03-28 16:11:04 +01:00
callebtc
f783493e1a Fix mint migrations: Fill in missing keyset IDs in proofs and promises (#729)
* mint migrations: fill in missing keyset ids in proofs and promises

* do not throw exception

* add error where proofs are missing an id but no keyset was found

* fix balance view initialization
2025-03-27 11:33:20 +01:00
callebtc
bae4855915 NUT-04/05: add amount, unit, request to melt and mint quote responses (#719)
* add amount, unit, request to melt and mint responses

* make new fields optional to not break compat with old mints

* make new flags optional for backwards compat
2025-03-08 18:23:34 +00:00
Ofek Lev
3ab1e1dfb2 Upgrade coincurve to version 21.0.0 (#721) 2025-03-08 18:05:29 +00:00
Houdini
7b3f5d01d0 Allow arbitrary denominations in wallet minting (#684)
- Update `mint` method to use allowed amounts from the mint
- Add `get_allowed_amounts` method to fetch supported denominations
- Modify `test_mint_amounts_wrong_order` to expect new error message

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-06 20:15:14 +01:00
lollerfirst
72ac35405c [NUT-15] LND: Try Multiple Routes (#692)
* try multiple routes

* fix

* Lnd gRPC
2025-03-06 00:05:13 +01:00
callebtc
9305905a85 Add LightningPaymentFailedError exception (#706)
* add error code

* fix test
2025-03-06 00:04:37 +01:00
lollerfirst
f72a3f260f [FIX] NUT-15 mpp amount in millisats (#703)
* fix lndrest

* fix clnrest

* fix clnrest and lndrest

* lnd grpc fix

* wallet

* convert amount to millisats in CLI pay invoice

* fix tests

* format

* fix kw arg in regtest test

* fix payment quote validation check

* clean comment

* avoid overwriting variable

* deprecated response with amount

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-05 23:47:03 +01:00
findingsov
8555c020d4 Update README.md-install nutshell into nutshell dir (#713) 2025-03-05 14:35:05 +01:00
findingsov
2107c806c6 Update README.md - Add Redis info? (#714)
* Update README.md - Add Redis info?

Add some Redis info (maybe not all this is needed?)

* use redis docker compose

* clean up

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-04 12:49:51 +01:00
lollerfirst
77de51f336 add cli decode + fix crash when mint is offline (#709) 2025-03-04 12:38:47 +01:00
lollerfirst
0c40bbbc08 Balance Views Grouped By Keyset (#652)
* balance view per keyset + relative changes.
    Still lacking: settings changes

* import unit

* fix 0 balance

* settings

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-02-17 12:55:28 +01:00
callebtc
23a706d873 Set correct blink min fee (#701)
* min fee

* fix tests

* amount_split test
2025-02-13 15:53:26 +01:00
lollerfirst
ec3db81cee Update Error Codes (#702)
* add new error codes

* use the new errors in the code

* fix unsorted import

* fix test wallet
2025-02-13 15:35:06 +01:00
callebtc
a0ef44dba0 Blind authentication (#675)
* auth server

* cleaning up

* auth ledger class

* class variables -> instance variables

* annotations

* add models and api route

* custom amount and api prefix

* add auth db

* blind auth token working

* jwt working

* clean up

* JWT works

* using openid connect server

* use oauth server with password flow

* new realm

* add keycloak docker

* hopefully not garbage

* auth works

* auth kinda working

* fix cli

* auth works for send and receive

* pass auth_db to Wallet

* auth in info

* refactor

* fix supported

* cache mint info

* fix settings and endpoints

* add description to .env.example

* track changes for openid connect client

* store mint in db

* store credentials

* clean up v1_api.py

* load mint info into auth wallet

* fix first login

* authenticate if refresh token fails

* clear auth also middleware

* use regex

* add cli command

* pw works

* persist keyset amounts

* add errors.py

* do not start auth server if disabled in config

* upadte poetry

* disvoery url

* fix test

* support device code flow

* adopt latest spec changes

* fix code flow

* mint max bat dynamic

* mypy ignore

* fix test

* do not serialize amount in authproof

* all auth flows working

* fix tests

* submodule

* refactor

* test

* dont sleep

* test

* add wallet auth tests

* test differently

* test only keycloak for now

* fix creds

* daemon

* fix test

* install everything

* install jinja

* delete wallet for every test

* auth: use global rate limiter

* test auth rate limit

* keycloak hostname

* move keycloak test data

* reactivate all tests

* add readme

* load proofs

* remove unused code

* remove unused code

* implement change suggestions by ok300

* add error codes

* test errors
2025-01-29 22:48:51 -06:00
callebtc
b67ffd8705 bump to 0.16.5 (#699) 2025-01-29 15:25:31 -06:00
lollerfirst
e9952e59ed [FIX] Reject Internal MPP Melt Quote Requests (#697)
* fix

* fix the fix

* make sure the mpp is supported before testing

* adjust message

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-01-29 14:00:35 -06:00
callebtc
320c70060e wallet fix: load proofs before receiving (#698) 2025-01-29 13:32:57 -06:00
lollerfirst
ea96fab9e3 [FIX] Specs conformant error codes (#693)
* error codes must follow spec

* make format
2025-01-21 17:36:22 -06:00
callebtc
4e7917fb20 Fix Redis teardown logic based on usage (#696)
* fix: tear down redis only if used

* fix: close redis only if its used
2025-01-21 17:35:24 -06:00
callebtc
ad7c6b8e0b Issue NUT-08 overpaid Lightning fees for melt quote checks on startup (#688)
* startup: do not rollback unknown melt quote states

* fix: provide overpaid fees on startup

* fix: check if outputs in db

* fix test: expect melt quote pending if payment state is unknown

* fix up comment
2025-01-21 17:28:41 -06:00
Pavol Rusnak
2f19485ad6 config cleanup regarding MPP (#689)
* remove MINT_LND_ENABLE_MPP from .env.example

since it is now default

* remove MINT_LND_ENABLE_MPP from CI regtest workflow

since it is now default

* enable MINT_CLNREST_ENABLE_MPP for CI regtest workflow

by removing false assignment, since it is now default
2025-01-13 14:52:11 -06:00
Pavol Rusnak
09deef107d chore: use poetry the latest 1.8.x poetry consistently (#691) 2025-01-13 09:53:42 -06:00
Pavol Rusnak
2a855920a7 update asyncpg 0.29.0 -> 0.30.0 to make Python 3.13 happy (#690)
asyncpg 0.29.0 is not compatible with Python 3.13
2025-01-13 09:52:32 -06:00
callebtc
d77376b367 restart redis docker (#687) 2025-01-04 00:06:52 +01:00
callebtc
c108bb1935 add NUT-19 example (#686) 2025-01-03 23:50:01 +01:00
callebtc
5e5a1a57d9 bump to 0.16.4 (#685) 2025-01-03 22:45:16 +01:00
whileunless
aced665d9e Add period at the end of the phrase (#681) 2024-12-19 17:48:19 +01:00
lollerfirst
d98d166df1 Support NUT-XX (signatures on quotes) for mint and wallet side (#670)
* nut-19 sign mint quote

* ephemeral key for quote

* `mint` adjustments + crypto/nut19.py

* wip: mint side working

* fix import

* post-merge fixups

* more fixes

* make format

* move nut19 to nuts directory

* `key` -> `privkey` and `pubkey`

* make format

* mint_info method for nut-19 support

* fix tests imports

* fix signature missing positional argument + fix db migration format not correctly escaped + pass in NUT-19 keypair to `request_mint` `request_mint_with_callback`

* make format

* fix `get_invoice_status`

* rename to xx

* nutxx -> nut20

* mypy

* remove `mint_quote_signature_required` as per spec

* wip edits

* clean up

* fix tests

* fix deprecated api tests

* fix redis tests

* fix cache tests

* fix regtest mint external

* fix mint regtest

* add test without signature

* test pubkeys in quotes

* wip

* add compat

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-12-15 00:39:53 +01:00
lollerfirst
399c201552 NUT-19: Cached Requests and Responses (#624)
* fast-api-cache setup

* testing the cache

* fix

* still not working

* asynccontextmanager

* move test

* use redis & custom caching setup (like CDK)

* make format

* poetry lock

* fix format string + log when a cached response is found

* log when a cahced response is found

* fix tests

* poetry lock

* try tests on github

* use docker compose

* maybe we dont need docker

* fix types

* create_task instead of run

* how about we start postgres

* mint features

* format

* remove deprecated setex call

* use global expiry for all cached routes

* refactor feature map and set default to 1 week

* refactor feature construction

* Cache NUT-19

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-12-03 16:03:01 +03:00
ok300
ee90d840ab Add HTTP compression middleware (#676)
* Add HTTP compression middleware

* Apply fixes from `make format`
2024-11-25 13:08:46 +01:00
callebtc
2b233fd67e fix: NUT-15 setting remove mpp boolean (#673)
* fix: NUT-15 setting remove mpp boolean

* remove mpp flag
2024-11-24 16:55:17 +01:00
callebtc
0a230a1aa3 catch websocket disconenct errors (#674) 2024-11-24 16:48:39 +01:00
callebtc
0e2bdb0438 recommend openssl for key generation (#678) 2024-11-22 17:47:03 +01:00
callebtc
c4b639b068 parse env example (#677) 2024-11-21 18:38:59 +01:00
callebtc
901b16713c add methods key to info endpoitn a la https://github.com/cashubtc/nuts/pull/190 (#672) 2024-11-15 16:21:54 +01:00
callebtc
6a4f1bdbe9 bump version to 0.16.3 (#669) 2024-11-14 14:55:22 +01:00
callebtc
91976634a1 format (#668) 2024-11-06 18:45:34 +01:00
callebtc
d8a90d4c80 turn on mpp by default (#667) 2024-11-05 15:40:17 +01:00
David Caseria
2ad6d831e9 Add FakeWallet invoice features tag for supported payment secret (#609) 2024-11-05 15:03:41 +01:00
Pavol Rusnak
0de574e006 NUT-06: add urls field (#638) 2024-11-05 15:03:23 +01:00