-
Notifications
You must be signed in to change notification settings - Fork 20
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
WASM bindings #78
WASM bindings #78
Conversation
1d6b304
to
87ad212
Compare
umbral-pre/src/bindings_wasm.rs
Outdated
|
||
#[wasm_bindgen] | ||
pub struct SecretKey { | ||
backend: umbral_pre::SecretKey, |
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.
Why did you switch from anonymous fields to backend
?
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.
I had some issues with serde_wasm_bindgen
, where anonymous fields would not be properly serialized o JSON. But I don't think this is relevant anymore. And I'm going to switch to builder patterns anyway.
I will change it back.
} | ||
|
||
impl SecretKey { | ||
pub fn inner(&self) -> &umbral_pre::SecretKey { |
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.
Is that for use in nucypher_core
? Perhaps it can be done similarly to the Python bindings (AsBackend
and FromBackend
traits)
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.
I will try this out, thanks!
} | ||
|
||
#[wasm_bindgen] | ||
#[derive(Serialize, Deserialize)] |
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.
Are those for use in nucypher_core
as well?
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.
Yes.
umbral-pre/Cargo.toml
Outdated
base64 = { version = "0.13", default-features = false, features = ["alloc"] } | ||
pyo3 = { version = "0.15", optional = true } | ||
js-sys = { version = "0.3", optional = true } | ||
wasm-bindgen = {version = "0.2.74", optional = true } | ||
wee_alloc = { version = "0.4", optional = true } |
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.
Does it need to be here? It's only used in umbral-pre-wasm
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.
wee_alloc
can go, but I need to keep others there because I need #[wasm-bindgen]
and mapping errors with js_sys::Error
. I feel like this is similar to keeping pyo3
for python-bindings
here, no?
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.
Ah yes, I agree about the other too, I was asking about wee_alloc specifically
@fjarri Thank you for your comments. I think some of the things you've pointed out will be solved when I switch some of the |
d699a14
to
45331a7
Compare
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
==========================================
- Coverage 67.75% 60.23% -7.52%
==========================================
Files 16 17 +1
Lines 1290 1451 +161
==========================================
Hits 874 874
- Misses 416 577 +161
Continue to review full report at Codecov.
|
347814c
to
321cbc3
Compare
e3092da
to
e4aba6b
Compare
Refers to: nucypher/nucypher-core#1