Skip to content

Add cdk-wasm crate with browser wallet support#1660

Closed
crodas wants to merge 1 commit intocashubtc:mainfrom
crodas:feature/wasm-prototype
Closed

Add cdk-wasm crate with browser wallet support#1660
crodas wants to merge 1 commit intocashubtc:mainfrom
crodas:feature/wasm-prototype

Conversation

@crodas
Copy link
Collaborator

@crodas crodas commented Feb 19, 2026

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

@crodas crodas requested a review from thesimplekid February 19, 2026 14:54
@github-project-automation github-project-automation bot moved this to Backlog in CDK Feb 19, 2026
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.
@crodas crodas force-pushed the feature/wasm-prototype branch from 07d6328 to 62e721f Compare February 19, 2026 14:57
Copy link
Collaborator

@thesimplekid thesimplekid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@crodas
Copy link
Collaborator Author

crodas commented Feb 21, 2026

Closed in flavour of #1665

@crodas crodas closed this Feb 21, 2026
@github-project-automation github-project-automation bot moved this from In progress to Done in CDK Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants