Introduce Ristretto signing (#1730)

* first draft of ristretto crypto module #1685

* adds better comments and code-style

* remove the last evil unwrap

* remove a mistakenly committed lockfile

* add a fresh new lockfile --will probably need a manual merge later

* fix an invalid old test vector

* Wire in ristretto

* Update comment

* Fix use.

* new Signature type api alias to be compatible with substrate

* Add new keyring, fix node executor tests

* Bump version.

* Remove all hashes.

* Update core/primitives/src/sr25519.rs

Co-Authored-By: gavofyork <github@gavwood.com>

* Revert back to Ed25519 (until JS UI is ready)

* Fix test
This commit is contained in:
Gav Wood
2019-02-13 10:10:17 +01:00
committed by GitHub
parent 9e2710246f
commit a61c218cc3
20 changed files with 1474 additions and 250 deletions
+18
View File
@@ -266,6 +266,24 @@ impl From<H512> for Ed25519Signature {
}
}
/// Sr25519 signature verify.
#[derive(Eq, PartialEq, Clone, Default, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
pub struct Sr25519Signature(pub H512);
impl Verify for Sr25519Signature {
type Signer = H256;
fn verify<L: Lazy<[u8]>>(&self, mut msg: L, signer: &Self::Signer) -> bool {
runtime_io::sr25519_verify((self.0).as_fixed_bytes(), msg.get(), &signer.as_bytes())
}
}
impl From<H512> for Sr25519Signature {
fn from(h: H512) -> Sr25519Signature {
Sr25519Signature(h)
}
}
/// Context for executing a call into the runtime.
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode)]
#[cfg_attr(feature = "std", derive(Debug, Serialize))]