WIP: Add cdk-wasm crate with browser wallet support #1660

Closed
crodas wants to merge 1 commit from feature/wasm-prototype into main
crodas commented 2026-02-19 14:54:45 +00:00 (Migrated from github.com)

Introduce the cdk-wasm crate providing WebAssembly bindings for the CDK wallet. This enables running Cashu wallets directly in browsers and Node.js environments.

Key components:

  • Wallet and WalletRepository wasm_bindgen bindings
  • LocalStorage-backed database with swappable storage backend
  • Token parsing, encoding, and inspection
  • Full WASM type system mirroring cdk-common types
  • HTTP client implementation for wasm32 (fetch API)
  • Demo pages (www/) for browser testing
  • CI workflow for wasm32 build checks

Also adapts cdk-http-client to compile for wasm32 by gating native dependencies and adding a fetch-based transport behind the wasm32 target.

Description


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

Introduce the cdk-wasm crate providing WebAssembly bindings for the CDK wallet. This enables running Cashu wallets directly in browsers and Node.js environments. Key components: - Wallet and WalletRepository wasm_bindgen bindings - LocalStorage-backed database with swappable storage backend - Token parsing, encoding, and inspection - Full WASM type system mirroring cdk-common types - HTTP client implementation for wasm32 (fetch API) - Demo pages (www/) for browser testing - CI workflow for wasm32 build checks Also adapts cdk-http-client to compile for wasm32 by gating native dependencies and adding a fetch-based transport behind the wasm32 target. ### Description <!-- Describe the purpose of this PR, what's being adding and/or fixed --> ----- ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [ ] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [ ] I ran `just final-check` before committing
thesimplekid (Migrated from github.com) requested changes 2026-02-19 15:35:56 +00:00
thesimplekid (Migrated from github.com) left a comment

We need to split of this PR into multiple smaller PRs so it can be reviewed. It seems to do multiple things; change deps in signatory, modify the http client as well as introduce js bindings. The changes to the http client should be its own pr as they do not depend on the bindings.

On the bindings I have a strong preference for not redefining all these wasm types that we already have defined in cdk-ffi, it creates much more code to maintain. I know other projects have had recent success reusing their uniffi bindings with wasm using this project. I think this would be better for us since we already support uniffi. Did you look into wasm support via uniffi and there is a specefic reason we cannot use it?

We need to split of this PR into multiple smaller PRs so it can be reviewed. It seems to do multiple things; change deps in signatory, modify the http client as well as introduce js bindings. The changes to the http client should be its own pr as they do not depend on the bindings. On the bindings I have a strong preference for not redefining all these wasm types that we already have defined in cdk-ffi, it creates much more code to maintain. I know other projects have had recent success reusing their uniffi bindings with wasm using this [project](https://github.com/jhugman/uniffi-bindgen-react-native). I think this would be better for us since we already support uniffi. Did you look into wasm support via uniffi and there is a specefic reason we cannot use it?
crodas commented 2026-02-21 14:07:10 +00:00 (Migrated from github.com)

Closed in flavour of #1665

Closed in flavour of #1665

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!1660
No description provided.