Expand remote keystore interface to allow for hybrid mode (#7628)

* update to latest master

* updates on docs, license, meta

* hide ssrs behind feature flag

* implement remaining functions on the server

* sign server line length fix

* fix tests

* fixup in-memory-keystore

* adding failsafe

* skipping ecdsa test for now

* remote keystore param

* remote sign urls made available

* integrating keystore remotes features

* don't forget the dependency

* remove old cruft

* reset local keystore

* applying suggestions

* Switch to single remote, minor grumbles

* minor grumbles, docs
This commit is contained in:
Benjamin Kampmann
2020-12-09 10:52:56 +01:00
committed by GitHub
parent 7a43cca875
commit 5ce8c33368
15 changed files with 99 additions and 22 deletions
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
sp-core = { version = "2.0.0", default-features = false, path = "../../core" }
sp-keystore = { version = "0.8.0", path = "../../keystore" }
sp-keystore = { version = "0.8.0", path = "../../keystore", default-features = false }
substrate-test-runtime-client = { version = "2.0.0", path = "../../../test-utils/runtime/client" }
sp-runtime = { version = "2.0.0", path = "../../runtime" }
sp-api = { version = "2.0.0", path = "../../api" }
+1 -1
View File
@@ -96,11 +96,11 @@ std = [
"base58",
"substrate-bip39",
"tiny-bip39",
"serde",
"byteorder/std",
"rand",
"sha2/std",
"schnorrkel/std",
"schnorrkel/serde",
"regex",
"num-traits/std",
"tiny-keccak",
+3
View File
@@ -1029,6 +1029,7 @@ pub trait CryptoType {
Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode, PassByInner,
crate::RuntimeDebug
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct KeyTypeId(pub [u8; 4]);
impl From<u32> for KeyTypeId {
@@ -1058,10 +1059,12 @@ impl<'a> TryFrom<&'a str> for KeyTypeId {
/// An identifier for a specific cryptographic algorithm used by a key pair
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct CryptoTypeId(pub [u8; 4]);
/// A type alias of CryptoTypeId & a public key
#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Encode, Decode)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct CryptoTypePublicPair(pub CryptoTypeId, pub Vec<u8>);
#[cfg(feature = "std")]
+10 -1
View File
@@ -20,10 +20,19 @@ futures = { version = "0.3.1" }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false }
merlin = { version = "2.0", default-features = false }
parking_lot = { version = "0.10.0", default-features = false }
serde = { version = "1.0", optional = true}
sp-core = { version = "2.0.0", path = "../core" }
sp-externalities = { version = "0.8.0", path = "../externalities", default-features = false }
[dev-dependencies]
rand = "0.7.2"
rand_chacha = "0.2.2"
[features]
default = ["std"]
std = [
"serde",
"schnorrkel/std",
"schnorrkel/serde",
]
+3
View File
@@ -20,9 +20,11 @@
use codec::Encode;
use merlin::Transcript;
use schnorrkel::vrf::{VRFOutput, VRFProof};
/// An enum whose variants represent possible
/// accepted values to construct the VRF transcript
#[derive(Clone, Encode)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum VRFTranscriptValue {
/// Value is an array of bytes
Bytes(Vec<u8>),
@@ -38,6 +40,7 @@ pub struct VRFTranscriptData {
pub items: Vec<(&'static str, VRFTranscriptValue)>,
}
/// VRF signature data
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct VRFSignature {
/// The VRFOutput serialized
pub output: VRFOutput,