Commit Graph

1602 Commits

Author SHA1 Message Date
lollerfirst
e581dcbf62 feat: tor isolated circuits (#1064)
fixes + tor feature in cdk-cli

fix: call `clone_with_prefs` to get a new isolation token

format

remove `new_isolated` from Transport trait

fix: remove tor dependencies under wasm32, disallow compilation with tor feature and wasm32

tor_transport in its own file

fixes

fmt

format

tor: implement Transport::resolve_dns_txt for TorAsync using DoH over Tor; fix tor transport trait changes after rebase; remove unused as_str() call for TorToggle in cdk-cli. Ensure compilation with features: tor,bip353

format

remove double reference

format

feat: circuits pool

format

tor_transport: deterministically select Tor client per request using index_for_request(endpoint path + query + payload)\n\n- Add index_for_request(&Url, Option<&[u8]>) using FNV-1a 64-bit (dependency-free)\n- Replace round-robin next_index() usage in request() with deterministic index\n- Adjust request() to accept Option<Vec<u8>> body to hash payload bytes\n- Update http_get/http_post/resolve_dns_txt to call new request signature\n- Keep next_index() as dead_code for potential fallback

tor_transport: implement Default by bootstrapping with default pool size (blocking)\n\n- Default now attempts to use existing Tokio runtime handle, or creates a temporary runtime\n- Preserves previous behavior for async constructors (new/with_pool_size)

tor_transport: fix Default to avoid nested runtime panic by initializing on a new thread when no Handle available\n\n- If a runtime is present, block_on via current handle\n- Otherwise, spawn a new OS thread and create a runtime inside it, then join

tor_transport: rework Default to use block_in_place + background thread runtime to avoid nested block_on inside tokio\n\n- Always create runtime on a separate OS thread; if inside tokio, enter block_in_place first\n- Avoids 'Cannot start a runtime from within a runtime' panic

fix

more fixes

tor_transport: lazy-initialize Tor client pool on first use via ensure_pool; make Default non-blocking and remove runtime gymnastics\n\n- Introduce Inner with OnceCell<Arc<Vec<TorClient>>> and configured size\n- Default/new/with_pool_size now cheap; actual arti bootstrap happens on first request\n- request() calls ensure_pool() and uses deterministic index with pool.len()\n- Keeps deterministic endpoint/method/body affinity and DoH TXT resolution\n\nThis avoids nested-runtime/block_in_place complexity and makes Default trivial.

tor_transport: make DEFAULT_TOR_POOL_SIZE public and support custom pool sizes via TorAsync::with_pool_size() (lazy)}

remove unneeded async

add salt to keyed circuit selection
2025-10-03 15:39:57 +02:00
thesimplekid
b5dfa120a4 chore: update flake (#1150) 2025-10-02 13:14:58 +01:00
David Caseria
ca3444939e Add MultiMintWallet check and wait for mint quotes (#1146)
* Add MultiMintWallet check and wait for mint quotes
2025-10-02 12:24:36 +01:00
C
81a47d5d12 Fix bug with websocket close (#1144)
* Fix bug with websocket close

Fixes #1111

* Do not connect to ws if there are no active subscription
2025-10-02 10:12:17 +01:00
benthecarman
6bffd78233 Make sorting Transactions a stable sort (#1147)
If you had 2 Transactions that had the same timestamp the sort could be
unstable and could cause annoying issues. Now it will compare the ids if
they are equal and should always have a stable sorting implementation
now.
2025-10-02 10:11:47 +01:00
benthecarman
144f1da6c5 Allow passing metadata to a melt (#1148) 2025-10-02 10:11:08 +01:00
thesimplekid
9ad5238323 chore: remove min deps after msrv (#1143) 2025-10-01 10:08:46 +01:00
stefanbitcr
166c96ff88 Fix htlc witness deserialization (#1138)
* Add prior signatures if they exist
2025-09-30 14:49:52 +01:00
asmo
cb2e534f81 feat: added postgres to ffi (#1117)
* feat: added postgres to ffi
2025-09-30 14:14:28 +01:00
David Caseria
ddec3bb212 Update README with missing crates (#1140) 2025-09-30 09:12:53 +01:00
thesimplekid
5e93529398 fix: show ammounts (#1136) 2025-09-30 09:12:29 +01:00
thesimplekid
f323544040 fix: lnbits msats error (#1134)
* fix: lnbits msats error

* fix: lnbits msats error
2025-09-28 15:24:55 +01:00
thesimplekid
4b04d10383 Check change unique (#1112)
* fix(cdk): prevent duplicate blinded message processing with database constraints

Add unique constraints on blinded_message column in both PostgreSQL and SQLite databases, and implement application-level checks to prevent duplicate blinded messages from being processed. Also ensure proper cleanup of melt requests after successful processing.

* feat: db tests for unique

* refactor(cdk-sql): consolidate blinded messages into blind signature table

Migrate from separate blinded_messages table to unified blind_signature table.
Add signed_time column and make c column nullable to track both pending
blind messages (c=NULL) and completed signatures. Update insert/update
logic to handle upsert scenarios for blind signature completion.

* refactor(cdk-sql): remove unique constraint migration and filter queries for signed messages

Remove database-level unique constraint on blinded_message and instead filter
queries to only consider messages with signatures (c IS NOT NULL

* refactor(database): improve blinded message duplicate detection using database constraints

Replace manual duplicate checking with database constraint handling for better
reliability and simplified code flow in melt request processing.

* refactor(cdk-sql): optimize blind signature processing with batch queries

Replace individual queries per blinded message with single batch query
and HashMap lookup to eliminate N+1 query performance issue.

* fix: signed time to swap sigs

* refactor(cdk): split blinded message handling and improve duplicate detection

- Split add_melt_request_and_blinded_messages into separate methods
- Add blinded messages to database before signing in swap operations
- Improve duplicate output detection with proper error handling
- Make add_blinded_messages method accept optional quote_id for flexibility

* refactor(cdk): add BlindedMessageWriter for improved transaction rollback

- Add BlindedMessageWriter component for managing blinded message state
- Implement proper rollback mechanisms in swap operations
- Add delete_blinded_messages database interface for cleanup
- Improve error handling with better state management
2025-09-27 23:51:24 +01:00
lollerfirst
6d0003a4fc token: add spending-condition inspection helpers and token_secrets() (#1124)
* token: add Token::token_secrets() and spending-condition helpers

- New helpers on Token that do not require mint keysets:
  - spending_conditions()
  - p2pk_pubkeys()
  - p2pk_refund_pubkeys()
  - htlc_hashes()
  - locktimes()
- Introduce token_secrets() to unify V3/V4 proof traversal and avoid duplication
- Bypass short->long keyset-id mapping since only Secret is needed for conditions
- Use &Secret for TryFrom to fix compile error
2025-09-26 20:56:01 +01:00
thesimplekid
676463f730 Revert "feat: remove redis cache (#1096)" (#1129)
This reverts commit be7c83689d.
2025-09-26 14:43:34 +01:00
thesimplekid
05acb914fe feat: remove delete fns for quotes (#1122) 2025-09-26 14:37:43 +01:00
David Caseria
f48660f344 Make Uniffi Records Codable in Swift (#1125) 2025-09-25 18:59:01 +01:00
gudnuf
500d162f67 fix: handle fiat melt amount conversions (#1109)
* fix: handle fiat melt amount conversions

* feat: add check that processor returns quote unit

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-09-25 18:57:54 +01:00
thesimplekid
caba6978e7 refactor(cdk): simplify mint addition in MultiMintWallet (#1121)
Remove unnecessary mint info fetching and keyset refresh during mint addition,
and improve error propagation in token restoration flow
2025-09-25 16:18:37 +01:00
gudnuf
9d4559a47a fix: only settle same unit quote internally (#1115) 2025-09-25 08:57:41 +01:00
thesimplekid
e07a9c8e1e feat(cdk): add WebSocket authentication support (#1116)
* feat(cdk): add WebSocket authentication support with comprehensive configuration

- Add WebSocket auth token injection for client connections
- Implement server-side WebSocket authentication verification
- Add configuration options for per-endpoint WebSocket auth types
- Include comprehensive documentation and example configuration
- Support clear, blind, and no-auth modes for WebSocket endpoin
2025-09-25 08:31:57 +01:00
asmo
f41ce0a3fb optional client identity in grpc payment processor (#1084)
* fix: update TLS configuration to handle missing client certificates gracefully
2025-09-24 14:56:51 +01:00
C
0f0b78c0b0 Include supported amounts instead of assuming the power of 2 (#1055)
* Include supported amounts instead of assuming the power of 2

The mint's signatory defines the amounts and the wallet, and the mint, when
paying, should use them instead of assuming the supported amounts are
2^(0..32), which is not part of the spec.

* Introduce FeeAndAmount struct
2025-09-24 13:02:24 +01:00
thesimplekid
bf6b672fdc chore: add tag to 0.13.0 2025-09-23 15:05:16 +01:00
thesimplekid
6ad2c3a67e chore: ffi to release 2025-09-23 14:59:29 +01:00
thesimplekid
fb84343993 Bump v0.13 (#1106) 2025-09-23 14:46:38 +01:00
thesimplekid
35a4be1429 feat(docker): add LDK Node mint service with dedicated Docker setup (#1108)
* feat(docker): add LDK Node mint service with dedicated Docker setup

- Add Dockerfile.ldk-node and Dockerfile.ldk-node.arm for LDK Node builds
- Add GitHub Actions workflows for publishing LDK Node Docker images
- Add docker-compose.ldk-node.yaml for standalone LDK Node deployment
- Integrate LDK Node service into main docker-compose.yaml with profile
- Update cdk-mintd README with LDK Node Docker configuration

* feat: use docker tags
2025-09-23 14:23:06 +01:00
asmo
1e6102f494 add FFI types for NUT-04 and NUT-05 (#1101)
* feat: add FFI types and conversion logic for NUT-04 and NUT-05 settings in `cdk-ffi`

* feat: remove auth feature and deafult to having auth

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-09-23 11:44:11 +01:00
juejinyuxitu
fdd99e1afc chore: fix typo in comment (#1107)
Signed-off-by: juejinyuxitu <juejinyuxitu@outlook.com>
2025-09-23 10:54:09 +01:00
thesimplekid
6b80b74cb1 feat: remove features from auth (#1103) 2025-09-23 09:27:07 +01:00
thesimplekid
c1e35f964b Remove cashu ffi (#1102)
* feat: remove cdk-common and cashu from cdk-ffi
2025-09-22 16:50:51 +01:00
thesimplekid
3ad860c908 fix(cdk): improve error handling when adding mint to MultiMintWallet (#1099)
Add proper error handling and logging for add_mint operation instead of
propagating errors, preventing wallet operations from failing completely
when a mint cannot be added.
2025-09-22 13:53:32 +01:00
thesimplekid
be7c83689d feat: remove redis cache (#1096)
* feat: remove redis cache

* feat: remove redis cache
2025-09-21 20:04:27 +01:00
thesimplekid
df2f9d1c2a Psgl auth db (#1095)
* feat(cdk-mintd): add dedicated auth database configuration support
2025-09-21 16:56:12 +01:00
C
075e25682e Remove generated files (#1097)
After #1088, generated migrations files should not be versioned
2025-09-21 16:55:48 +01:00
vnprc
853f13fc85 fix(build): use OUT_DIR for migration files (#1088)
- write generated migration files to OUT_DIR instead of source directory
- copy migration SQL files to OUT_DIR for inclusion in build artifacts
- use absolute paths from OUT_DIR in include_str! macros
- update consumer modules to include from OUT_DIR using concat! macro

these changes enable cdk to support nix sandbox builds
2025-09-20 16:50:54 +01:00
thesimplekid
2becc4be21 chore: doc fmt (#1094) 2025-09-20 16:49:53 +01:00
thesimplekid
aeafab9a10 fix: config overwrite on start up (#1081)
* fix: config overwrite on start up
2025-09-20 16:49:37 +01:00
thesimplekid
f4c5de7f36 fix: add free space to auth test (#1091) 2025-09-19 10:32:54 +01:00
David Caseria
12164a0764 Fix Async FFI Constructors (#1085)
* Fix unused async in FFI

* Fix FFI async constructor

* Fix FFI MultiMintWallet async constructor
2025-09-18 20:42:00 +01:00
thesimplekid
944cf2ae0b fix: error respose detail (#1090) 2025-09-18 20:40:26 +01:00
David Caseria
23cba67c3b MultiMintWallet Refactor (#1001) 2025-09-17 17:27:54 +01:00
thesimplekid
62fcb1730e chore: remove mintd quick start 2025-09-17 09:33:54 +01:00
thesimplekid
c64797ac6f chore: some docs (#1083) 2025-09-17 09:32:22 +01:00
thesimplekid
049ce64462 feat(cdk): add amount_mintable method and improve mint quote validation (#1075)
* feat(cdk): add amount_mintable method and improve mint quote validation

- Add MintQuote::amount_mintable() method to calculate available mint amount
- Update mint issue logic to use centralized amount calculation
- Add validation for Bolt11 payment amounts matching quote amounts
- Improve error handling and logging for quote amount mismatches
2025-09-16 17:26:19 +01:00
thesimplekid
9d25d963ee refactor: check mint request (#1079) 2025-09-16 17:25:43 +01:00
thesimplekid
5ee405de89 Store last pay index (#1077) 2025-09-16 14:08:43 +01:00
thesimplekid
2dbb418db7 feat: store melt_request (#1045) 2025-09-16 10:55:36 +01:00
gudnuf
5650050f32 fix: make http wallet subscriptions wasm compatible (#1062) 2025-09-16 09:02:31 +01:00
C
c3c8e87164 Add resolve_dns_txt to HttpTransport and MintConnector (#1068)
* Add `resolve_dns_txt` to HttpTransport and MintConnector

Fixes #1036

* Use `hickory_resolver` to resolve DNS entries

* Remote default implementation of methods

* Fix build for wasm
2025-09-16 09:01:34 +01:00