Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
move to schnorrkel github -- this is broken until schnorr is updated …
Browse files Browse the repository at this point in the history
…in crates
  • Loading branch information
kianenigma committed Feb 15, 2019
2 parents ec1da79 + eff430d commit 36f28c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ crate-type = ["cdylib"]
wasm-bindgen = { version = "0.2" }
wasm-bindgen-test = { version = "0.2" }
sha2 = { version = "0.8"}
schnorrkel = { git = "https://github.com/w3f/schnorrkel.git", features = ["nightly"]}
schnorrkel = { version = "0.0", features = ["nightly"]}

[dev-dependencies]
rand = { version = "0.6.5", features = ["wasm-bindgen"] }
7 changes: 3 additions & 4 deletions src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ use schnorrkel::SignatureError;
// We must make sure that this is the same as declared in the substrate source code.
const SIGNING_CTX: &'static [u8] = b"substrate transaction";


pub fn __sign(secret: &[u8], message: &[u8]) -> [u8; SIGNATURE_LENGTH] {
let secret_key = SecretKey::from_bytes(secret).unwrap();
pub fn __sign(secret: &[u8], message: &[u8]) -> Result<[u8; SIGNATURE_LENGTH], SignatureError> {
let secret_key = SecretKey::from_bytes(secret)?;
let kp = secret_key.to_keypair();
let context = signing_context(SIGNING_CTX);
kp.sign(context.bytes(message)).to_bytes()
Ok(kp.sign(context.bytes(message)).to_bytes())
}

pub fn __verify(signature: &[u8], message: &[u8], pubkey: &[u8]) -> bool {
Expand Down

0 comments on commit 36f28c6

Please sign in to comment.