Commit Graph

63 Commits

Author SHA1 Message Date
thesimplekid
9beb0b4256 chore: update readmes (#773) 2025-05-29 09:38:10 -04:00
C
ade48cd8a9 Introduce a SignatoryManager service. (#509)
* WIP: Introduce a SignatoryManager service.

The SignatoryManager manager provides an API to interact with keysets, private
keys, and all key-related operations, offering segregation between the mint and
the most sensible part of the mind: the private keys.

Although the default signatory runs in memory, it is completely isolated from
the rest of the system and can only be communicated through the interface
offered by the signatory manager. Only messages can be sent from the mintd to
the Signatory trait through the Signatory Manager.

This pull request sets the foundation for eventually being able to run the
Signatory and all the key-related operations in a separate service, possibly in
a foreign service, to offload risks, as described in #476.

The Signatory manager is concurrent and deferred any mechanism needed to handle
concurrency to the Signatory trait.

* Fixed missing default feature for signatory

* Do not read keys from the DB

* Removed KeysDatabase Trait from MintDatabase

All Keys operations should be done through the signatory

* Make sure signatory has all the keys in memory

Drop also foreign constraints on sqlite

* Fix race condition

* Adding debug info to failing test

* Add `sleep` in test

* Fixed issue with active auth keyset

* Fixed dependency

* Move all keys and keysets to an ArcSwap.

Since the keys and keysets exist in RAM, most wrapping functions are infallible
and synchronous, improving performance and adding breaking API changes.

The signatory will provide this information on the boot and update when the
`rotate_keyset` is executed.

Todo: Implement a subscription key to reload the keys when the GRPC server
changes the keys. For the embedded mode, that makes no sense since there is a
single way to rotate keys, and that bit is already covered.

* Implementing https://github.com/cashubtc/nuts/pull/250

* Add CLI for cdk-signatory to spawn an external signatory

Add to the pipeline the external signatory

* Update tests

* Apply suggestions from code review

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
Co-authored-by: thesimplekid <tsk@thesimplekid.com>

* Minor change

* Update proto buf to use the newest format

* Rename binary

* Add instrumentations

* Add more comments

* Use a single database for the signatory

Store all keys, even auth keys, in a single database. Leave the MintAuthDatabse
trait implementation for the CDK but not the signagtory

This commit also moves the cli mod to its own file

* Update dep

* Add `test_mint_keyset_gen` test

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-05-28 11:43:30 -04:00
thesimplekid
abf10da330 chore: update deps (#761) 2025-05-20 10:27:52 +01:00
thesimplekid
b63dc1045d refactor: nut04 and nut05 (#749) 2025-05-19 09:49:11 +01:00
lollerfirst
dafdf757af CORS Headers in Responses (#719)
* access control headers for CORS request from in-browser wallets

* cargo fmt

* handle preflight requests
2025-04-10 13:47:35 +01:00
thesimplekid
5484e7c33a Merge pull request #690 from thesimplekid/request_without_dleq
Request without dleq
2025-03-27 08:45:02 +00:00
thesimplekid
7b4951041e Rust docs (#681) 2025-03-25 23:27:38 +00:00
thesimplekid
c63fc02a5a Prepare v0.8.0 (#672)
* chore: Bump cdk dependency to v0.8.0

* chore: add docker publish to ci

* chore: add doc test build to ci
2025-03-24 18:40:08 +00:00
thesimplekid
be93ff2384 Clear and Blind Auth (#510)
* feat: auth

* chore: corret error codes

* chore: corret error codes

* fix: feature auth in cdk-axum

* refactor: auth logging

* feat: include dleq in auth proof

* feat: mint max auth proofs

* chore: clippy
2025-03-24 11:13:22 +00:00
thesimplekid
27636c86b7 chore: zip version (#668)
* chore: zip version
2025-03-23 21:18:02 +00:00
thesimplekid
e84d6ea7ab chore: Update rust-version (MSRV) to 1.75.0 (#623) 2025-03-05 10:32:41 +00:00
codingpeanut157
606385f44a fix openApi attributes to keyset id to present it as a string
The attribute `schema(as = String)` does not result in the expected
behaviour.
It does not convert Id to being represented as a simple string, but
rather simply rename the type `Id` to `String`.

This commit removes the attribute that implements utoipa::ToSchema trait
for type `Id` and adds attribute to all the types that have a keyset id
    as inner type to represent it as string.
2025-02-20 16:27:43 +01:00
thesimplekid
7b7def17ee chore: release v0.7.1 2025-02-13 10:44:09 +00:00
thesimplekid
be5e5d2371 chore: prepare v0.7.0 2025-02-06 13:12:16 +00:00
thesimplekid
47ee54d7f5 feat: mint management rpc server and client cli 2025-02-06 12:05:13 +00:00
thesimplekid
5481286ec9 refactor: move mint_info to database 2025-01-29 23:29:25 +00:00
thesimplekid
67be74abb8 feat: tests on lnd node 2025-01-24 14:55:02 +00:00
C
8fe0982c6d Introduce cashu to host the shared types, traits and other common code (#519)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-01-12 12:50:05 +00:00
thesimplekid
0e12314643 chore: Release 0.6.0 2024-12-17 08:18:32 -05:00
C
dcca57dbd1 Introduce pluggable backend cache for the HTTP layer. (#495)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2024-12-17 07:39:03 -05:00
Cesar Rodas
760564cee0 Introduce subscription support in the Wallet crate.
The main goal is to add a subscription to CDK Mint updates into the wallet.
This feature will be particularly useful for improving the code whenever loops
hit the mint server to check status changes.

The goal is to add an easy-to-use interface that will hide the fact that we're
connecting to WebSocket and subscribing to events. This will also hide the fact
that the CDK-mint server may not support WebSocket updates.

To be fully backward compatible, the HttpClientMethods traits have a new
method, `subscribe,` which will return an object that implements
`ActiveSubscription.`

In the primary implementation, there is a `SubscriptionClient` that will
attempt to connect through WebSocket and will fall to the HTTP-status pull and
sleep approach (the current approach), but upper stream code will receive
updates as if they come from a stream of updates through WebSocket. This
`SubscriptionClient` struct will also manage reconnections to WebSockets (with
automatic resubscriptions) and all the low-level stuff, providing an
easy-to-use interface and leaving the upper-level code with a nice interface
that is hard to misuse. When `ActiveSubscription` is dropped, it will
automatically unsubscribe.

Fixed bug with Default as described in https://github.com/cashubtc/cdk/pull/473#discussion_r1871032297
2024-12-08 16:25:00 +00:00
Timothée Delabrouille
7d87c4806c feat: use Uuid as mint and melt quote ids (#469) 2024-12-05 09:58:53 +00:00
César D. Rodas
7d15587e3f Minor improvement cache avoid clone (#479)
Avoid cloning to serialize to JSON; instead, dereference the object, as Serde
needs a reference to the object.
2024-11-30 14:57:12 +00:00
thesimplekid
d1b03d39c5 chore: update to 0.5.0 2024-11-19 09:55:46 +00:00
thesimplekid
6dd023a71c chore: cargo fmt 2024-11-15 19:38:59 +00:00
César D. Rodas
cc5b267367 fix: Send current state of the subscriptions (#444) 2024-11-10 12:08:44 +00:00
César D. Rodas
6973e53799 Mint Websockets (NUT-17) (#394)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2024-11-06 14:36:13 +00:00
Mubarak Muhammad Aminu
0164a8801c chore:change function name to reflect route action (#439)
* chore:change function name to reflect route action

* change mint function name to reflect route action
2024-11-05 21:24:25 +00:00
ok300
dffc30233c mintd: add utoipa swagger UI 2024-10-22 08:32:56 +02:00
thesimplekid
515991f8d2 fix: cache melt response 2024-10-06 07:53:13 +02:00
lollerfirst
c25bf79e8c Cache SwapResponse, MeltBolt11Response and MintBolt11Response (#361)
* added cache to mint state and post request wrapper macro.
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2024-10-05 11:18:23 +02:00
thesimplekid
27eed93e3c feat: remove old nut05 response 2024-10-03 08:51:39 +02:00
thesimplekid
008c913583 refactor: ln backends within mint 2024-09-27 10:04:33 +02:00
thesimplekid
5139c47dac feat: check outgoing payment status flow 2024-09-25 20:28:05 +02:00
Pavol Rusnak
11fa39a003 chore: remove unused deps 2024-09-20 08:43:13 +02:00
thesimplekid
f9bb5eb913 feat: itests
fix: melt change promises amount
2024-09-19 11:43:43 +02:00
thesimplekid
725f59af04 fix: melt transaction balanced 2024-09-18 16:28:14 +02:00
thesimplekid
88b79eb9e9 fix: melt verify error response 2024-09-15 08:57:35 +01:00
thesimplekid
a4af725458 fix: router check melt status paid 2024-09-14 12:15:50 +01:00
thesimplekid
fba609f28a feat: add unit to PayInvoiceResponse 2024-09-14 11:25:58 +01:00
lollerfirst
7e860c71f2 NUT-04 Mint Quote Description (#337) 2024-09-12 12:27:52 +01:00
thesimplekid
3bf1a3b28f chore: version cdk in other crates 2024-09-08 22:12:06 +01:00
thesimplekid
f7e4ea3a6c Release 0.4.0 2024-09-08 21:48:51 +01:00
thesimplekid
9b78305722 refactor: calc fee 2024-09-08 13:34:54 +01:00
thesimplekid
2fdf48cc72 feat: remove mint and wallet errors 2024-09-08 11:48:52 +01:00
thesimplekid
1f81b24f40 feat: try_sum for amounts 2024-09-05 18:42:11 +01:00
Pavol Rusnak
e67dc15ce6 feat: implement nut-06 time 2024-09-03 17:00:57 +01:00
thesimplekid
1eb14703a5 refactor: cdk MSRV 2024-09-03 12:35:35 +01:00
thesimplekid
5f87df2cef refactor: use MintUrl::from_str 2024-09-03 11:36:28 +01:00
thesimplekid
847eab8e07 chore: fmt 2024-08-29 15:09:59 +01:00