fix: Convert vendor/pezkuwi-subxt from submodule to regular directory
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/target
|
||||
+1194
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "nostd-tests"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
# This crate is not a part of the workspace, to ensure that no features
|
||||
# are enabled for it at the workspace level; which conflict with this test.
|
||||
subxt-signer = { path = "../../", default-features = false, features = [
|
||||
"sr25519",
|
||||
"ecdsa",
|
||||
"unstable-eth",
|
||||
] }
|
||||
|
||||
# this shouldn't be needed, it's in workspace.exclude, but still
|
||||
# I get the complaint unless I add it...
|
||||
[workspace]
|
||||
@@ -0,0 +1,51 @@
|
||||
#![no_std]
|
||||
|
||||
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||
|
||||
// Run the tests by calling:
|
||||
//
|
||||
// ```text
|
||||
// cargo test
|
||||
// ```
|
||||
//
|
||||
// These are independent of any other package to ensure that nothing
|
||||
// else enabled the same feature flag that subxt-signer needs to work ok
|
||||
// (subxt seems to, for instance).
|
||||
|
||||
#[test]
|
||||
fn sr25519_signing_works() {
|
||||
let alice = sr25519::dev::alice();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(sr25519::verify(
|
||||
&signature,
|
||||
b"Hello there",
|
||||
&alice.public_key()
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ecdsa_signing_works() {
|
||||
let alice = ecdsa::dev::alice();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(ecdsa::verify(
|
||||
&signature,
|
||||
b"Hello there",
|
||||
&alice.public_key()
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eth_signing_works() {
|
||||
let alice = eth::dev::alith();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(eth::verify(&signature, b"Hello there", &alice.public_key()));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
/target
|
||||
+1521
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "wasm-tests"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.24"
|
||||
tracing-wasm = "0.2.1"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
|
||||
# This crate is not a part of the workspace, because we want to
|
||||
# enable the "web" feature here but don't want it enabled as part
|
||||
# of workspace builds. Also disable the "subxt" feature here because
|
||||
# we want to ensure it works in isolation of that.
|
||||
subxt-signer = { path = "../../", default-features = false, features = [
|
||||
"web",
|
||||
"sr25519",
|
||||
"ecdsa",
|
||||
"unstable-eth",
|
||||
"std",
|
||||
] }
|
||||
|
||||
# this shouldn't be needed, it's in workspace.exclude, but still
|
||||
# I get the complaint unless I add it...
|
||||
[workspace]
|
||||
@@ -0,0 +1,54 @@
|
||||
#![cfg(target_arch = "wasm32")]
|
||||
|
||||
use pezkuwi_subxt_signer::{ecdsa, eth, sr25519};
|
||||
use wasm_bindgen_test::*;
|
||||
|
||||
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
|
||||
|
||||
// Run the tests by calling:
|
||||
//
|
||||
// ```text
|
||||
// wasm-pack test --firefox --headless
|
||||
// ```
|
||||
//
|
||||
// These are independent of any other package to ensure that nothing
|
||||
// else enabled the same feature flag that subxt-signer needs to work ok
|
||||
// (subxt seems to, for instance).
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
async fn wasm_sr25519_signing_works() {
|
||||
let alice = sr25519::dev::alice();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(sr25519::verify(
|
||||
&signature,
|
||||
b"Hello there",
|
||||
&alice.public_key()
|
||||
));
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
async fn wasm_ecdsa_signing_works() {
|
||||
let alice = ecdsa::dev::alice();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(ecdsa::verify(
|
||||
&signature,
|
||||
b"Hello there",
|
||||
&alice.public_key()
|
||||
));
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
async fn wasm_eth_signing_works() {
|
||||
let alice = eth::dev::alith();
|
||||
|
||||
// There's some non-determinism in the signing, so this ensures that
|
||||
// the rand stuff is configured properly to run ok in wasm.
|
||||
let signature = alice.sign(b"Hello there");
|
||||
assert!(eth::verify(&signature, b"Hello there", &alice.public_key()));
|
||||
}
|
||||
Reference in New Issue
Block a user