mirror of
https://github.com/fluencelabs/trust-graph-test
synced 2025-03-14 17:40:57 +00:00
minor fixes
This commit is contained in:
parent
83dea9f8d6
commit
6e114ca7af
@ -4,4 +4,4 @@
|
||||
"name:sqlite3",
|
||||
"name:trust-graph"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -26,39 +26,39 @@
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
mod secp256k1;
|
||||
mod ed25519;
|
||||
pub mod error;
|
||||
pub mod key_pair;
|
||||
pub mod public_key;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod rsa;
|
||||
pub mod key_pair;
|
||||
pub mod error;
|
||||
pub mod public_key;
|
||||
mod secp256k1;
|
||||
pub mod signature;
|
||||
|
||||
pub use key_pair::KeyPair;
|
||||
pub use key_pair::KeyFormat;
|
||||
pub use crate::public_key::PublicKey;
|
||||
pub use crate::signature::Signature;
|
||||
pub use key_pair::KeyFormat;
|
||||
pub use key_pair::KeyPair;
|
||||
|
||||
pub mod peerid_serializer {
|
||||
use libp2p_core::PeerId;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::str::FromStr;
|
||||
use libp2p_core::PeerId;
|
||||
|
||||
pub fn serialize<S>(value: &PeerId, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
value.to_base58().serialize(serializer)
|
||||
}
|
||||
|
||||
pub fn deserialize<'de, D>(deserializer: D) -> Result<PeerId, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let str = String::deserialize(deserializer)?;
|
||||
PeerId::from_str(&str).map_err(|e| {
|
||||
serde::de::Error::custom(format!("peer id deserialization failed for {:?}", e))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
#V2
|
||||
in
|
||||
interface
|
@ -31,4 +31,4 @@ serde_bencode = "^0.2.3"
|
||||
thiserror = "1.0.23"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.1.11"
|
||||
marine-rs-sdk-test = "0.1.11"
|
||||
|
@ -12,7 +12,6 @@ use marine_rs_sdk::{marine, CallParameters};
|
||||
#[marine]
|
||||
/// add a certificate in string representation to trust graph if it is valid
|
||||
/// see `trust_graph::Certificate` class for string encoding/decoding
|
||||
// TODO change `timestamp_sec` to time service
|
||||
fn insert_cert_raw(certificate: String, timestamp_sec: u64) -> InsertResult {
|
||||
insert_cert_impl_raw(certificate, timestamp_sec).into()
|
||||
}
|
||||
@ -24,7 +23,7 @@ fn insert_cert(certificate: Certificate, timestamp_sec: u64) -> InsertResult {
|
||||
insert_cert_impl(certificate, timestamp_sec).into()
|
||||
}
|
||||
|
||||
// TODO: pass current timestamp, return only valid, delete expired, return max weight
|
||||
// TODO: return only valid, delete expired, return max weight
|
||||
#[marine]
|
||||
fn get_weight(peer_id: String, timestamp_sec: u64) -> WeightResult {
|
||||
get_weight_impl(peer_id.clone(), timestamp_sec)
|
||||
@ -32,7 +31,7 @@ fn get_weight(peer_id: String, timestamp_sec: u64) -> WeightResult {
|
||||
.into()
|
||||
}
|
||||
|
||||
// TODO: pass current timestamp, return only valid, delete expired
|
||||
// TODO: return only valid, delete expired
|
||||
#[marine]
|
||||
fn get_all_certs(issued_for: String, timestamp_sec: u64) -> AllCertsResult {
|
||||
get_all_certs_impl(issued_for, timestamp_sec).into()
|
||||
|
@ -1,58 +0,0 @@
|
||||
data AddRootResult:
|
||||
success: bool
|
||||
error: string
|
||||
|
||||
data AddTrustResult:
|
||||
success: bool
|
||||
error: string
|
||||
weight: u32
|
||||
|
||||
data Trust:
|
||||
issued_for: string
|
||||
expires_at: u64
|
||||
signature: string
|
||||
sig_type: string
|
||||
issued_at: u64
|
||||
|
||||
data Certificate:
|
||||
chain: []Trust
|
||||
|
||||
data AllCertsResult:
|
||||
success: bool
|
||||
certificates: []Certificate
|
||||
error: string
|
||||
|
||||
data GetTrustMetadataResult:
|
||||
success: bool
|
||||
error: string
|
||||
result: []u8
|
||||
|
||||
data InsertResult:
|
||||
success: bool
|
||||
error: string
|
||||
|
||||
data IssueTrustResult:
|
||||
success: bool
|
||||
error: string
|
||||
trust: Trust
|
||||
|
||||
data VerifyTrustResult:
|
||||
success: bool
|
||||
error: string
|
||||
|
||||
data WeightResult:
|
||||
success: bool
|
||||
weight: u32
|
||||
peer_id: string
|
||||
error: string
|
||||
|
||||
service TrustGraph("trust-graph"):
|
||||
add_root(peer_id: string, weight: u32) -> AddRootResult
|
||||
add_trust(trust: Trust, issuer_peer_id: string, timestamp_sec: u64) -> AddTrustResult
|
||||
get_all_certs(issued_for: string, timestamp_sec: u64) -> AllCertsResult
|
||||
get_trust_metadata(issued_for_peer_id: string, expires_at_sec: u64, issued_at_sec: u64) -> GetTrustMetadataResult
|
||||
get_weight(peer_id: string, timestamp_sec: u64) -> WeightResult
|
||||
insert_cert(certificate: Certificate, timestamp_sec: u64) -> InsertResult
|
||||
insert_cert_raw(certificate: string, timestamp_sec: u64) -> InsertResult
|
||||
issue_trust(issued_for_peer_id: string, expires_at_sec: u64, issued_at_sec: u64, signed_metadata: []u8) -> IssueTrustResult
|
||||
verify_trust(trust: Trust, issuer_peer_id: string, timestamp_sec: u64) -> VerifyTrustResult
|
Loading…
x
Reference in New Issue
Block a user