Skip to content
Snippets Groups Projects
Commit 1d5aa03f authored by Cédric Moreau's avatar Cédric Moreau
Browse files

refact: remove warnings

parent 2667e754
No related branches found
No related tags found
No related merge requests found
......@@ -39,11 +39,11 @@ pub fn lookup2identities(lookup_result: &LookupResult) -> Vec<LookupIdentity> {
let pubkey = result["pubkey"].as_str().unwrap();
let empty: &Vec<Value> = &Vec::new();
let uids: &Vec<Value> = result["uids"].as_array().unwrap_or(empty);
for anUid in uids.iter() {
let uid = anUid["uid"].as_str().unwrap();
let blockstamp = anUid["meta"]["timestamp"].as_str().unwrap();
let signature = anUid["self"].as_str().unwrap();
let revoked = anUid["revoked"].as_bool().unwrap();
for an_uid in uids.iter() {
let uid = an_uid["uid"].as_str().unwrap();
let blockstamp = an_uid["meta"]["timestamp"].as_str().unwrap();
let signature = an_uid["self"].as_str().unwrap();
let revoked = an_uid["revoked"].as_bool().unwrap();
identities.push(LookupIdentity::new(pubkey, uid, blockstamp, signature,revoked));
}
}
......
use std::error::Error;
use reqwest;
use std::fmt::Display;
pub use crate::bma::node::BmaNode;
use serde_json::Value;
use reqwest::blocking::Response;
use crate::bma::lookup_identity::{LookupIdentity, lookup2identities, lookup_print, LookupResult};
use std::process::id;
mod node;
pub mod lookup_identity;
......
use std::fmt::{Display, Formatter};
use reqwest::{blocking, StatusCode};
use serde::{Deserialize, Serialize};
use crate::bma::BmaNode;
use crate::bma::lookup_identity::LookupIdentity;
#[derive(Serialize, Deserialize)]
struct BmaCertification {
......@@ -18,7 +16,7 @@ impl Display for BmaCertification {
}
pub fn certify(node: &BmaNode, idty: &String, sig: &String) -> Result<(), String> {
let mut cert = BmaCertification { cert: format!("{}{}\n", idty, sig) };
let cert = BmaCertification { cert: format!("{}{}\n", idty, sig) };
let address = node.get_address();
let client = reqwest::blocking::Client::new();
let resp = client.post(format!("{}/wot/certify", address))
......
use crate::bma::BmaNode;
use crate::bma::lookup_identity::{LookupResult, lookup2identities, lookup_print};
use duniter_mini_client::crypto::scrypt_duniter_key::ScryptDuniterKey;
use duniter_mini_client::crypto::duniter_key::ToDuniterKey;
use duniter_mini_client::dubp::documents::certification::Certification;
use duniter_mini_client::crypto::signable::Signable;
use crate::crypto::scrypt_duniter_key::ScryptDuniterKey;
use crate::crypto::duniter_key::ToDuniterKey;
use crate::dubp::documents::certification::Certification;
use crate::crypto::signable::Signable;
pub fn certify(node: BmaNode, uid_or_pub: String) -> Result<(), String> {
let address = node.get_address();
......
......@@ -4,7 +4,7 @@ use crate::cli::Command::*;
use crate::bma::BmaNode;
use std::env;
pub(crate) mod certify;
pub mod certify;
const DEFAULT_NODE: &str = "https://g1-test.duniter.org";
......
......@@ -6,8 +6,8 @@ pub struct DuniterSignature([u8; SIGNATURE_LENGTH]);
/// A DuniterSignature wraps an actuel signature (64 bytes data)
impl DuniterSignature {
pub fn new(signature: [u8; SIGNATURE_LENGTH]) -> DuniterSignature {
DuniterSignature(signature)
pub fn new(signature: [u8; SIGNATURE_LENGTH]) -> Self {
Self(signature)
}
pub fn as_bytes(&self) -> [u8; SIGNATURE_LENGTH] {
self.0
......
pub mod crypto;
pub mod dubp;
pub mod cli;
pub mod bma;
use crate::crypto::duniter_key::{ToDuniterKey};
......
use std::env;
use duniter_mini_client::{compute_pub, compute_sec, compute_key};
use crate::cli::Command;
use crate::cli::Command::*;
use duniter_mini_client::{compute_pub, compute_sec, compute_key, cli, bma};
use duniter_mini_client::cli::Command;
use duniter_mini_client::cli::Command::{UNKNOWN, PUB, SEC, KEYRING, LOOKUP, CERTIFY};
use duniter_mini_client::crypto::duniter_key::ScryptDuniterKey;
mod cli;
mod crypto;
mod bma;
fn main() {
let command = Command::from(env::args());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment