Skip to content
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 #1

Merged
merged 21 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/nucypher-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ jobs:
- run: cargo check --all-features
- run: cargo test --release --all-features

wasm-test:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.56.0 # MSRV
- stable
target:
- wasm32-unknown-unknown

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo install wasm-pack
- run: wasm-pack test --node

trigger-wheels:
runs-on: ubuntu-latest
needs: test
Expand Down
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
members = [
"nucypher-core",
"nucypher-core-python",
"nucypher-core-wasm",
]

# Prevents feature conflicts between [dependencies] and [dev-dependencies]
# Will be the default in 2021 edition.
resolver = "2"
2 changes: 1 addition & 1 deletion nucypher-core-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = "0.15"
nucypher-core = { path = "../nucypher-core" }
umbral-pre = { version = "0.5", features = ["bindings-python", "serde-support"] }
umbral-pre = { version = "0.5.1", features = ["bindings-python", "serde-support"] }

[build-dependencies]
pyo3-build-config = "*"
2 changes: 1 addition & 1 deletion nucypher-core-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl TreasureMap {
.into_iter()
.map(|(address_bytes, (key, vkfrag))| {
try_make_address(address_bytes)
.map(|address| (address, (key.backend, vkfrag.backend)))
.map(|address| (address, (key.backend, vkfrag.backend.clone())))
})
.collect::<PyResult<Vec<_>>>()?;
Ok(Self {
Expand Down
1 change: 1 addition & 0 deletions nucypher-core-wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg
34 changes: 34 additions & 0 deletions nucypher-core-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "nucypher-core-wasm"
version = "0.1.0"
authors = [
"Bogdan Opanchuk <bogdan@opanchuk.net>",
"Piotr Roslaniec <p.roslaniec@gmail.com>"
]
edition = "2021"
license = "GPL-3.0-only"
description = "NuCypher network core data structures"
repository = "https://github.com/nucypher/nucypher-core/tree/master/nucypher-core-wasm"
readme = "README.md"
categories = ["cryptography", "no-std"]

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook"]

[dependencies]
umbral-pre = { version = "0.5.1", features = ["bindings-wasm"] }
nucypher-core = { path = "../nucypher-core" }
wasm-bindgen = { version = "0.2.74", features = ["serde-serialize"] }
js-sys = "0.3.51"
wee_alloc = "0.4"
ethereum-types = "0.12.1"
serde-wasm-bindgen = "0.3.1"
serde = { version = "1.0.130", features = ["derive"] }
console_error_panic_hook = { version = "0.1.6", optional = true }

[dev-dependencies]
console_error_panic_hook = "0.1.7"
wasm-bindgen-test = "0.3.28"
Loading