1
0
mirror of https://github.com/fluencelabs/trust-graph-test synced 2025-03-15 07:51:03 +00:00

rename fluence-identity to fluence-keypair

This commit is contained in:
Alexey Proshutinskiy 2021-08-12 15:49:03 +03:00
parent d99683233d
commit 968b9a95e4
30 changed files with 85 additions and 137 deletions

1
.gitignore vendored

@ -1,2 +1,3 @@
.idea
target/
service/artifacts/*.wasm

112
Cargo.lock generated

@ -95,31 +95,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "1.2.1"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "blake2b_simd"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
dependencies = [
"arrayref",
"arrayvec",
"constant_time_eq",
]
[[package]]
name = "blake2s_simd"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2"
dependencies = [
"arrayref",
"arrayvec",
"constant_time_eq",
]
checksum = "2da1976d75adbe5fbc88130ecd119529cf1cc6a93ae1546d8696ee66f0d21af1"
[[package]]
name = "blake3"
@ -142,7 +120,7 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
dependencies = [
"block-padding 0.1.5",
"block-padding",
"byte-tools",
"byteorder",
"generic-array 0.12.4",
@ -154,7 +132,6 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"block-padding 0.2.1",
"generic-array 0.14.4",
]
@ -167,12 +144,6 @@ dependencies = [
"byte-tools",
]
[[package]]
name = "block-padding"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "boolinator"
version = "2.4.0"
@ -760,7 +731,19 @@ dependencies = [
]
[[package]]
name = "fluence-identity"
name = "fluence-it-types"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5006d09553345421af5dd2334cc945fc34dc2a73d7c1ed842a39a3803699619d"
dependencies = [
"it-to-bytes",
"nom",
"serde",
"wast",
]
[[package]]
name = "fluence-keypair"
version = "0.3.0"
dependencies = [
"asn1_der",
@ -770,7 +753,6 @@ dependencies = [
"fluence-fork-libp2p-core",
"lazy_static",
"libsecp256k1",
"multihash",
"quickcheck",
"rand 0.7.3",
"ring",
@ -784,18 +766,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "fluence-it-types"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5006d09553345421af5dd2334cc945fc34dc2a73d7c1ed842a39a3803699619d"
dependencies = [
"it-to-bytes",
"nom",
"serde",
"wast",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -1164,12 +1134,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "keccak"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -1197,9 +1161,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.98"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
[[package]]
name = "libsecp256k1"
@ -1548,14 +1512,10 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab"
dependencies = [
"blake2b_simd",
"blake2s_simd",
"blake3",
"digest 0.9.0",
"generic-array 0.14.4",
"multihash-derive",
"sha2 0.9.5",
"sha3",
"unsigned-varint 0.5.1",
]
@ -1722,7 +1682,7 @@ dependencies = [
"cfg-if 1.0.0",
"instant",
"libc",
"redox_syscall 0.2.9",
"redox_syscall 0.2.10",
"smallvec",
"winapi",
]
@ -2079,9 +2039,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "redox_syscall"
version = "0.2.9"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
dependencies = [
"bitflags",
]
@ -2352,18 +2312,6 @@ dependencies = [
"opaque-debug 0.3.0",
]
[[package]]
name = "sha3"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809"
dependencies = [
"block-buffer 0.9.0",
"digest 0.9.0",
"keccak",
"opaque-debug 0.3.0",
]
[[package]]
name = "signature"
version = "1.3.1"
@ -2372,9 +2320,9 @@ checksum = "c19772be3c4dd2ceaacf03cb41d5885f2a02c4d8804884918e3a258480803335"
[[package]]
name = "slab"
version = "0.4.3"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
[[package]]
name = "smallvec"
@ -2450,7 +2398,7 @@ dependencies = [
"cfg-if 1.0.0",
"libc",
"rand 0.8.4",
"redox_syscall 0.2.9",
"redox_syscall 0.2.10",
"remove_dir_all",
"winapi",
]
@ -2519,7 +2467,7 @@ dependencies = [
"ed25519-dalek",
"failure",
"fluence-fork-libp2p-core",
"fluence-identity",
"fluence-keypair",
"libsecp256k1",
"log",
"rand 0.7.3",
@ -2540,7 +2488,7 @@ dependencies = [
"bincode",
"boolinator",
"bs58 0.3.1",
"fluence-identity",
"fluence-keypair",
"log",
"marine-rs-sdk",
"marine-rs-sdk-test",
@ -2866,9 +2814,9 @@ dependencies = [
[[package]]
name = "wasmer-runtime-core-fl"
version = "0.17.0"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4630ff544a2d7f76938bcf82ae217e0bd5c9ee078c653459d4f117c2045d315"
checksum = "d0d5ac3e0603e5f0ffaf11cbd854eea7c3b609ab4b676f71968f2bc47f9e3c4a"
dependencies = [
"bincode",
"blake3",
@ -2895,9 +2843,9 @@ dependencies = [
[[package]]
name = "wasmer-runtime-fl"
version = "0.17.0"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e855c8942f998a6938e43c1d0bb11b76a60b1c8341e08db36cc36b97b58bb1e9"
checksum = "5688460204d9f644d846300d041632cf34c4b4f83a955c0a67e600030376d2ee"
dependencies = [
"lazy_static",
"memmap",

@ -11,7 +11,7 @@ repository = "https://github.com/fluencelabs/trust-graph"
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.27.2" }
serde = { version = "=1.0.118", features = ["derive"] }
fluence-identity = { path = "./identity", version = "0.3.0" }
fluence-keypair = { path = "./keypair", version = "0.3.0" }
serde_json = "1.0.58"
bs58 = "0.3.1"
failure = "0.1.6"
@ -30,6 +30,6 @@ rand = "0.7.0"
[workspace]
members = [
"identity",
"keypair",
"service"
]

@ -1,5 +1,5 @@
[package]
name = "fluence-identity"
name = "fluence-keypair"
version = "0.3.0"
authors = ["Fluence Labs"]
edition = "2018"

@ -12,7 +12,7 @@ path = "src/main.rs"
[dependencies]
trust-graph = { version = "0.2.6", path = "../." }
fluence-identity = { version = "0.3.0", path = "../identity" }
fluence-keypair = { version = "0.3.0", path = "../keypair" }
marine-rs-sdk = { version = "0.6.11", features = ["logger"] }
marine-sqlite-connector = "0.5.0"

Binary file not shown.

@ -1,6 +1,6 @@
use marine_rs_sdk::marine;
use fluence_identity::error::DecodingError;
use fluence_identity::{PublicKey, Signature};
use fluence_keypair::error::DecodingError;
use fluence_keypair::{PublicKey, Signature};
use std::convert::TryFrom;
use std::time::Duration;
use thiserror::Error as ThisError;

@ -1,7 +1,7 @@
use crate::dto::{Certificate, DtoConversionError};
use crate::storage_impl::get_data;
use fluence_identity::error::DecodingError;
use fluence_identity::PublicKey;
use fluence_keypair::error::DecodingError;
use fluence_keypair::PublicKey;
use std::convert::{Into, TryInto};
use std::str::FromStr;
use std::time::Duration;

@ -11,7 +11,7 @@ use marine_sqlite_connector;
use marine_sqlite_connector::Connection;
use marine_sqlite_connector::Error as InternalSqliteError;
use marine_sqlite_connector::Value;
use fluence_identity::public_key::PublicKey;
use fluence_keypair::public_key::PublicKey;
use once_cell::sync::OnceCell;
use parking_lot::Mutex;
use rmp_serde::decode::Error as RmpDecodeError;

@ -17,31 +17,31 @@
#[cfg(test)]
mod tests {
use marine_rs_sdk_test::marine_test;
use fluence_identity;
use fluence_keypair;
use std::time::Duration;
#[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")]
fn test() {
let root_kp = Keypai
let root_kp2 = KeyPair::generate();
let second_kp = KeyPair::generate();
let expires_at = Duration::new(15, 15);
let issued_at = Duration::new(5, 5);
let cert = trust_graph::Certificate::issue_root(
&root_kp,
second_kp.public_key(),
expires_at,
issued_at,
);
trast_graph.add_root(root_kp.public().into(), 0).unwrap();
tg.add_root_weight(root_kp2.public().into(), 1).unwrap();
tg.add(cert, Duration::new(10, 10)).unwrap();
let a = tg.get(second_kp.public_key()).unwrap();
let str = format!("{:?}", a);
log::info!("{}", &str);
}
// #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts/")]
// fn test() {
//
// let root_kp = Keypair::
// let root_kp2 = KeyPair::generate();
// let second_kp = KeyPair::generate();
//
// let expires_at = Duration::new(15, 15);
// let issued_at = Duration::new(5, 5);
//
// let cert = trust_graph::Certificate::issue_root(
// &root_kp,
// second_kp.public_key(),
// expires_at,
// issued_at,
// );
// trast_graph.add_root(root_kp.public().into(), 0).unwrap();
// tg.add_root_weight(root_kp2.public().into(), 1).unwrap();
// tg.add(cert, Duration::new(10, 10)).unwrap();
//
// let a = tg.get(second_kp.public_key()).unwrap();
// let str = format!("{:?}", a);
// log::info!("{}", &str);
// }
}

@ -20,8 +20,8 @@ use crate::certificate::CertificateError::{
VerificationError,
};
use crate::trust::{Trust, TrustError};
use fluence_identity::key_pair::KeyPair;
use fluence_identity::public_key::PublicKey;
use fluence_keypair::key_pair::KeyPair;
use fluence_keypair::public_key::PublicKey;
use std::str::FromStr;
use std::time::Duration;
use thiserror::Error as ThisError;
@ -281,7 +281,7 @@ impl FromStr for Certificate {
mod tests {
use super::*;
use crate::misc::current_time;
use fluence_identity::key_pair::KeyPair;
use fluence_keypair::KeyPair;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
pub fn one_second() -> Duration {

@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use fluence_identity::public_key::PublicKey;
use fluence_keypair::PublicKey;
use core::fmt;
use ref_cast::RefCast;
@ -82,7 +81,7 @@ impl Display for PublicKeyHashable {
}
impl FromStr for PublicKeyHashable {
type Err = fluence_identity::error::DecodingError;
type Err = fluence_keypair::error::DecodingError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let pk = PublicKey::from_base58(s)?;

@ -15,9 +15,9 @@
*/
use crate::revoke::RevokeError::IncorrectSignature;
use fluence_identity::key_pair::KeyPair;
use fluence_identity::public_key::PublicKey;
use fluence_identity::signature::Signature;
use fluence_keypair::key_pair::KeyPair;
use fluence_keypair::public_key::PublicKey;
use fluence_keypair::signature::Signature;
use serde::{Deserialize, Serialize};
use std::time::Duration;
use thiserror::Error as ThisError;
@ -28,7 +28,7 @@ pub enum RevokeError {
IncorrectSignature(
#[from]
#[source]
fluence_identity::error::SigningError
fluence_keypair::error::SigningError
),
}

@ -16,9 +16,9 @@
use crate::trust::TrustError::{Base58DecodeError, DecodePublicKeyError, ParseError, SignatureError, DecodeErrorInvalidSize};
use derivative::Derivative;
use fluence_identity::key_pair::KeyPair;
use fluence_identity::public_key::PublicKey;
use fluence_identity::signature::Signature;
use fluence_keypair::key_pair::KeyPair;
use fluence_keypair::public_key::PublicKey;
use fluence_keypair::signature::Signature;
use std::convert::TryInto;
use std::num::ParseIntError;
use std::time::Duration;
@ -65,12 +65,12 @@ pub enum TrustError {
SignatureError(
#[from]
#[source]
fluence_identity::error::SigningError,
fluence_keypair::error::SigningError,
),
/// Errors occurred on trust decoding from different formats
#[error("Cannot decode the public key: {0} in the trust: {1}")]
DecodePublicKeyError(String, #[source] fluence_identity::error::DecodingError),
DecodePublicKeyError(String, #[source] fluence_keypair::error::DecodingError),
#[error("Cannot parse `{0}` field in the trust '{1}': {2}")]
ParseError(String, String, #[source] ParseIntError),
@ -82,7 +82,7 @@ pub enum TrustError {
PublicKeyError(
#[from]
#[source]
fluence_identity::error::DecodingError,
fluence_keypair::error::DecodingError,
),
#[error("Cannot decode `{0}` field in the trust: invalid size")]

@ -26,7 +26,7 @@ use crate::trust_graph::TrustGraphError::{
use crate::trust_graph_storage::Storage;
use crate::trust_node::{Auth, TrustNode};
use crate::StorageError;
use fluence_identity::public_key::PublicKey;
use fluence_keypair::public_key::PublicKey;
use std::borrow::Borrow;
use std::collections::{HashSet, VecDeque};
use std::convert::{From, Into};
@ -339,7 +339,7 @@ mod tests {
use crate::misc::current_time;
use crate::trust_graph_storage::InMemoryStorage;
use failure::_core::time::Duration;
use fluence_identity::key_pair::KeyPair;
use fluence_keypair::key_pair::KeyPair;
use std::collections::HashMap;
pub fn one_minute() -> Duration {

@ -3,7 +3,7 @@ use crate::revoke::Revoke;
use crate::trust_graph::Weight;
use crate::trust_graph_storage::InMemoryStorageError::RevokeError;
use crate::trust_node::{Auth, TrustNode};
use fluence_identity::public_key::PublicKey;
use fluence_keypair::public_key::PublicKey;
use std::collections::HashMap;
use std::fmt::Display;
use std::time::Duration;

@ -18,7 +18,7 @@ use crate::public_key_hashable::PublicKeyHashable;
use crate::revoke::Revoke;
use crate::trust::Trust;
use failure::_core::time::Duration;
use fluence_identity::public_key::PublicKey;
use fluence_keypair::public_key::PublicKey;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::collections::HashMap;
@ -154,7 +154,7 @@ impl TrustNode {
mod tests {
use std::time::Duration;
use fluence_identity::key_pair::KeyPair;
use fluence_keypair::key_pair::KeyPair;
use super::*;