Commit Graph

43 Commits

Author SHA1 Message Date
C
cdd59359b9 Introduce a generic pubsub mod in cdk-common (#1098)
* pubsub: consolidate into Spec, adopt Arc<SubscriptionId>, and wire through  wallet/mint/WS/FFI

Refactor the pub/sub engine to a single Spec trait, move Event alongside it,
and propagate Arc-backed subscription IDs across the stack. This simplifies
generics, clarifies responsibilities, and preserves coalescing +
latest-on-subscribe semantics.

-   **Single source of truth:** `Spec` owns `Topic`, `Event`, `SubscriptionId`,
    `Context`, new_instance, and fetch_events.
-   **Lean & explicit API:** Remove Topic trait split;
    `Subscriber::send(Event)` carries sub-ID internally.
-   **Performance/ergonomics:** `Arc<SubscriptionId>` avoids heavy clones and
    makes channel/task hops trivial.

-   Introduce `pub_sub/typ.rs` with:
    -   trait `Spec`
    -   trait `Event` colocated with Spec.
-   Remove `pub_sub/event.rs` fold `Event` into `typ.rs`.
-   Make `Pubsub<S>` generic over `Spec` and store `Arc<S>`.
-   The subscriber holds `Arc<SubscriptionId>` and deduplicates the latest
    entry per subscription.
-   SubscriptionRequest: rename SubscriptionName → SubscriptionId; return
    `Arc<...>` from `subscription_name()`.
-   Remote consumer (Transport) now parameterized by `Spec`; control types
    updated:
    -   `StreamCtrl<S>`, `SubscribeMessage<S>`, internal caches keyed by
        `S::Topic`.
-   Mint/wallet:
    -   Mint: `MintPubSubSpec` (Context = `DynMintDatabase`),
        `PubSubManager(Pubsub<MintPubSubSpec>)`.
    -   Wallet: lightweight MintSubTopics Spec with `Context = ()`.
-   IDs go Arc end-to-end:
    -   cdk-axum WS maps `HashMap<Arc<SubId>, JoinHandle<()>>`, publisher sends
        `(Arc<SubId>, NotificationPayload)`.
    -   `subscription::{Params, WalletParams}` now use `Arc<...>`.
    -   cdk-ffi conversions & wallet glue updated.
    -   Integration tests updated for new types.

-   Coalescing unchanged: multiple local subs to the same topic are combined
    into a single remote sub.
-   Backfill via `Spec::fetch_events(topics, Subscriber)`; Subscriber enforces
    latest-only dedupe per subscription.

**Result:** a slimmer, more maintainable pub/sub core that’s easier to embed
across mint, wallet, transports, and FFI without sacrificing performance or
semantics.


---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-10-08 09:33:45 +01:00
gudnuf
2c9333449a fix: replace std::time with instant for wasm (#1060) 2025-09-13 11:12:41 +01:00
lollerfirst
f1118b1c7b compatibility for migrating Nutshell Mints quote ids (#984) 2025-08-27 17:12:35 +01:00
vnprc
951ff054fb feat: zeroize cryptographic secrets on drop
implement zeroize on Drop for Secret, Wallet, and MultiMintWallet
this erases sensitive memory addresses before deallocation
2025-08-21 11:26:52 -04:00
thesimplekid
2e424e629f feat: uuid version (#891)
* feat: uuid version

* feat: rustls version
2025-08-18 16:25:24 +01:00
thesimplekid
ae6c107809 feat: bolt12 2025-07-13 18:48:35 +01: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
e84d6ea7ab chore: Update rust-version (MSRV) to 1.75.0 (#623) 2025-03-05 10:32:41 +00: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
4cbf833999 chore: pin uuid 2025-02-05 14:00:58 +00:00
ok300
fe223c4ce6 Remove dependency on rand 2025-01-24 16:46:59 +01: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
5cd03b0027 refactor: consolidate to one CDK crate
Having the two crates adds complexity without
benefit since features can be used instead
2024-04-10 22:48:53 +01:00
thesimplekid
e5a531dca1 refactor: reduce number of features
Features for NUTs without extra deps expand the
feature matrix without much benefit.
2024-04-10 21:09:56 +01:00
Yuki Kishimoto
3831a4f3bb cashu: adj. dependencies
* Remove `k256`, `bip32`, `hex`, `log`, `rand` and `itertools` deps
* Add `once_cell` and `instant` deps
* Downgrade `bitcoin` to `v0.30` and `base64` to `v0.21`
* Replace `utils` module with `util`
* Remove `utils` from `cashu-sdk`
* Some cleanups

Closes https://github.com/thesimplekid/cashu-crab/issues/35

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
2024-04-10 17:55:40 +02:00
thesimplekid
b77ea560e6 refactor: getrandom as workspace dep 2024-03-31 18:58:55 +01:00
thesimplekid
35ce004230 refactor: remove unused 2024-03-31 17:15:33 +01:00
thesimplekid
d82ff1105d chore: update 2024-03-30 21:49:29 +00:00
thesimplekid
a6e77c62af feat(NUT12): verify DLEQ on blinded signatures 2024-03-24 22:46:40 +00:00
thesimplekid
a0a3a80377 feat: r and secret from seed 2024-03-22 16:17:57 +00:00
thesimplekid
a891613bb3 feat: nut09 structs 2024-03-22 16:17:57 +00:00
thesimplekid
b5d583d4b8 feat: cashu nut11 2024-03-03 15:15:41 +00:00
thesimplekid
ee0a60e40c feat: nut-10 2024-03-03 15:15:41 +00:00
thesimplekid
d0d3a6732f feat: skip errors on keyset response
This is needed in the case that a non v1 keyset id is returned
in a response. They are simply ignored.
2024-01-04 22:53:31 +00:00
thesimplekid
bde170b3ca feat: add mint and melt quotes in mint 2024-01-03 15:59:25 +00:00
thesimplekid
9b5e9b2ea4 feat: derive secret from path and seed 2023-12-31 16:24:22 +00:00
thesimplekid
2508f4ed36 refactor: mint/quote v1 urls 2023-12-27 21:02:32 +00:00
thesimplekid
e557d3ec6d refactor: remove nut09 feature 2023-12-22 17:25:34 +00:00
thesimplekid
3f6e7bfdd5 improve: export nut structs, add nut08 2023-11-16 20:37:59 +00:00
thesimplekid
f85df7316f improve: use thiserror 2023-11-10 18:39:11 +00:00
thesimplekid
f4d0160b5b improve: use features for optional nuts 2023-11-04 09:20:33 +00:00
thesimplekid
dafa0079e8 deps: update invoice 2023-10-15 11:40:45 +01:00
thesimplekid
1f77966384 bump MSRV to 1.70.0
It would be better to have a lower MSRV.
However I would like to whole workspace to have the same version,
and uniffi requires at least 1.70.0
2023-09-17 08:06:12 +01:00
thesimplekid
0013e040d6 MSRV 2023-09-16 09:56:17 +01:00
thesimplekid
6f84f5620d chore: update deps 2023-09-10 18:45:43 +01:00
thesimplekid
4e3268a7c7 cashu improve: add keyset id type 2023-09-09 11:37:06 +01:00
thesimplekid
fd955f22cb fix: public key serialization
This removes deserialixation from the secret key
and related types as it is not needed and it's
broken. It would be best to fix this at some point.
2023-09-03 14:14:30 +01:00
thesimplekid
1aedf3f2bc sdk: add blocking client and wallet as feature 2023-08-17 13:58:19 +01:00
thesimplekid
9ead2ea507 chore: remove unused log dep 2023-08-17 11:32:27 +01:00
thesimplekid
3aeb6b6ab4 refactor: split into cashu and cashu-sdk 2023-08-16 22:51:00 +01:00