-
Notifications
You must be signed in to change notification settings - Fork 14
Wasm bindings #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Wasm bindings #49
Conversation
|
|
| [env] | ||
| AR = "/opt/homebrew/opt/llvm/bin/llvm-ar" | ||
| CC = "/opt/homebrew/opt/llvm/bin/clang" No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not everyone building is going to use homebrew. You probably don't want to commit your own environment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is something we've been noting in the readme on wasm libs since it's mac specific
|
Original error: More helpful notes from Dan: There's a separate https-in-websocket implementation and support on the relay so we can avoid it in the browser That implementation is here: https://github.com/MutinyWallet/mutiny-node/pull/820/files#diff-9bd1c92f85da5773c1cf3b66662d28004dd0c00ab719781af7d7a77aa712fb20R140-R187 and could be part of a wasm feature exclusive function You could get ohttp-keys out of band and encode the binary in your js blob to make smoke tests work without JIT fetching that's done with fetch_ohttp_keys Gotta just disable the |
|
@DanGould I noted your comment: You also mentioned the possibility of passing keys through bip21 OH1 param, who would be doing the passing here? would this be an additional QR shared between receiver and sender? I was thinking keys come from the relay. Anyway, I'm working to understand this better now, but any hints would be appreciated |
Read fetch_ohttp_keys to get the binary (file). You can get it with a GET request in your browser or with curl
Which user? OhttpKeys (OHTTP Key Configurations ) replace TLS certificates.
Yes, they expire, but are long lived so hard coding will work for demo purposes. If you control the directory server for the purposes of a demo you control when the keys are refreshed.
|
ok cool, makes sense now. they are gateway keys, not session keys. I added a convenience method to the cli for this payjoin/rust-payjoin#589 |
Experimenting with exposing just the Uri type with WASM bindings first Want to test "wasm" feature flag for WASM specific modifications to methods the .cargo/config settings are mac specific Hitting issue with the proxy
Need to sort out how to handle errors
…ate type output files
Just remove redundant (hopefully) rlib type
starting with only string inputs/outputs err: getting null rust pointer in browser when trying to call .id() or .to_json()
9e2eb80 to
46d7102
Compare
Need to pass in system time from JS conotext for WASM todo: turst current time logic into a helper method
wrap PdkRequest and make js getters err: currently getting a timeout error when actually making the request, probably the url or body is the issue
|
little comment: |
|
@darioAnongba I had used reqwest in this mutiny payjoin implementation. The only place it's used in the payjoin library is with the |
bdd7574 to
3a1b489
Compare
minimal implementations, assume happy path for now
partial implementation
|
What's the plan for rebase / review here? It'd be nice if there were some piece of this we could start with, like a feature that enables just a small surface of the API, maybe even a single struct since reviewing it all at once is going to be a lot harder, and the underlying payjoin-ffi crate keeps changing making rebases harder as the tip of this diverges. |
the browser demo is fully working now only supports v2 doesn't yet fully validate checks limited options
|
https://mutinynet.com/tx/f90380bdb2284a7586a386017177257d2454aab100f2a21d5ed2a6e3baf48f6e I'll start looking at merge conflicts to rebase and work up a minimal smaller pr to start. |
Required enabling OhttpKeys constructor from bytes
WIP!
Closes #46
!!! Attention !!!
There is no immediate plan to move forward with these WASM bindings at this time. Here are some notes on the current state of them, hopefully this will make it easy enough to revisit in the future:
We never found an exciting use case for the WASM bindings, so I’m not planning to get a grant to work on them. To even get a change to rust-payjoin merged to support them I’d need to fully update them to include the v0.23.0 persistence changes, that’s a lot of work I have no motivation to do.
rn bindings work as shown in this demo: GitHub - riverKanies/payjoin-wasm-example-app at v1 which depends on npm modules generated by wasm-pack for bdk-wasm and payjoin-ffi (see deps for links to those module repos)
the actual Bindings are generated by this branch of payjoin-ffi:
Wasm bindings by riverKanies · Pull Request #49 · LtbLightning/payjoin-ffi at commit
1ca33df084694f34e0a7412193cd5a1ab595c292the PR links to my local version of rust-payjoin for dev/testing, the version used to build payjoin-ffi is Use web_time::SystemTime by riverKanies · Pull Request #596 · payjoin/rust-payjoin (but we probably want to do something more like Add Receiver.new_with_time by riverKanies · Pull Request #594 · payjoin/rust-payjoin tho)
unfortunately it seems this is the state I’ll have to leave it in for now as updating for merge and then ongoing maintenance is not currently justified by any actual integrations of the bindings.
also one outstanding question for these bindings is how to manage ohttp key fetching, Dan commented:
"you can compile a TLS stack to wasm by including the
rustlsdependency. It's a duplicate dep, since the browser already has TLS that it doesn't let you access, but it is a complete security story. I'm not sure if you can use HTTPS-in-HTTPS with CONNECT method to do it but you can definitely do HTTPS-in-WSS to, as demonstrated in Mutiny"!!! End !!!
Original comment:
WASM bindings are now building (only on Uri type rn)
the payjoinError depended on io so I modified that to just handle strings for now, need to sort out what we actually want to do here