mirror of
https://github.com/fluencelabs/trust-graph
synced 2024-12-04 23:30:19 +00:00
non-test code compiles
This commit is contained in:
parent
a0261bc331
commit
256cf96436
@ -14,12 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
extern crate rand;
|
||||
|
||||
use crate::ed25519::{Keypair as Libp2pKeyPair};
|
||||
use ed25519_dalek::SignatureError;
|
||||
use ed25519_dalek::{PublicKey, Signer};
|
||||
use signature::{Signature as SigSignature};
|
||||
|
||||
use core::fmt::{Debug};
|
||||
use std::fmt;
|
||||
use rand::rngs::OsRng;
|
||||
@ -77,10 +75,8 @@ impl KeyPair {
|
||||
pub fn verify(pk: &PublicKey, msg: &[u8], signature: Signature) -> Result<(), String> {
|
||||
// let signature = ed25519_dalek::Signature::from_bytes(signature)
|
||||
// .map_err(|err| format!("Cannot convert bytes to a signature: {:?}", err))?;
|
||||
let result = pk.verify_strict(msg, &signature)
|
||||
.map_err(|err| format!("Signature verification failed: {:?}", err))?;
|
||||
|
||||
Err("Signature is not valid.".to_string())
|
||||
pk.verify_strict(msg, &signature)
|
||||
.map_err(|err| format!("Signature verification failed: {:?}", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ impl <'de>serde::Deserialize<'de> for PublicKeyHashable {
|
||||
impl<'de> Visitor<'de> for PKVisitor {
|
||||
type Value = PublicKeyHashable;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
formatter.write_str("byte array or base58 string")
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,8 @@ impl TrustGraph {
|
||||
// - that trust must converge to one of the root weights
|
||||
// - there should be more than 1 trust in the chain
|
||||
let self_signed = last.issued_by == last.trust.issued_for;
|
||||
let converges_to_root = roots.contains(last.issued_by.as_ref());
|
||||
let issued_by: &PublicKeyHashable = last.issued_by.as_ref();
|
||||
let converges_to_root = roots.contains(issued_by);
|
||||
|
||||
if self_signed && converges_to_root && cur_chain.len() > 1 {
|
||||
terminated_chains.push(cur_chain);
|
||||
|
Loading…
Reference in New Issue
Block a user