Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

feat: support wasm32 target #26

Merged
merged 6 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
target: thumbv6m-none-eabi
override: true

- name: Install toolchain WASM
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Install Cargo.toml linter
uses: baptiste0928/cargo-install@v1
with:
Expand Down Expand Up @@ -73,6 +80,24 @@ jobs:
command: build
args: --verbose --target thumbv6m-none-eabi --no-default-features --features random

- name: Build WASM
vlopes11 marked this conversation as resolved.
Show resolved Hide resolved
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target wasm32-unknown-unknown --no-default-features

- name: Build WASM alloc
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target wasm32-unknown-unknown --no-default-features --features alloc

- name: Build WASM random
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target wasm32-unknown-unknown --no-default-features --features random

- name: Run tests all features
uses: actions-rs/cargo@v1
with:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ description = "Fuel cryptographic primitives."
borrown = "0.1"
fuel-types = { version = "0.5", default-features = false }
lazy_static = { version = "1.4", optional = true }
rand = { version = "0.8", default-features = false, features = ["std_rng"], optional = true }
# `rand-std` is used to further protect the blinders from side-channel attacks and won't compromise
# the deterministic arguments of the signature (key, nonce, message), as defined in the RFC-6979
secp256k1 = { version = "0.20", features = [ "rand-std", "recovery" ], optional = true }
rand = { version = "0.8", default-features = false, optional = true }
secp256k1 = { version = "0.20", default-features = false, features = ["recovery"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
sha2 = { version = "0.9", default-features = false }

[dev-dependencies]
bincode = { version = "1.3", default-features = false }
criterion = "0.3"
fuel-crypto = { path = ".", default-features = false, features = ["random"] }
k256 = { version = "0.10", features = [ "ecdsa" ] }
k256 = { version = "0.10", features = ["ecdsa"] }
rand = { version = "0.8", default-features = false, features = ["std_rng"] }
sha2 = "0.9"

[features]
default = ["fuel-types/default", "std"]
alloc = ["rand/alloc", "secp256k1/alloc"]
random = ["fuel-types/random", "rand"]
serde = ["dep:serde", "fuel-types/serde"]
std = ["fuel-types/std", "lazy_static", "secp256k1", "serde?/default"]
std = ["alloc", "fuel-types/std", "lazy_static", "secp256k1/rand-std", "serde?/default"]
wasm = ["secp256k1/rand"]

[[test]]
name = "test-serde"
Expand Down
6 changes: 2 additions & 4 deletions tests/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,9 @@ fn signer() {

signature
.verify(public_p.as_ref(), &message)
.err()
.expect("Wrong key should fail verification");
.expect_err("Wrong key should fail verification");

signature_p
.verify(public.as_ref(), &message)
.err()
.expect("Wrong key should fail verification");
.expect_err("Wrong key should fail verification");
}