move identity to separate package

This commit is contained in:
DieMyst 2021-01-19 17:20:44 +03:00
parent e8c109df99
commit dd761dd61c
12 changed files with 97 additions and 11 deletions

18
Cargo.lock generated
View File

@ -356,6 +356,23 @@ dependencies = [
"url",
]
[[package]]
name = "fluence-identity"
version = "0.2.0"
dependencies = [
"bs58 0.3.1",
"derivative",
"ed25519-dalek",
"failure",
"fluence-fork-libp2p-core",
"log",
"rand 0.7.3",
"ref-cast",
"serde",
"serde_json",
"signature",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -1325,6 +1342,7 @@ dependencies = [
"ed25519-dalek",
"failure",
"fluence-fork-libp2p-core",
"fluence-identity",
"log",
"rand 0.7.3",
"ref-cast",

View File

@ -9,6 +9,7 @@ license = "Apache-2.0"
[dependencies]
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.26.0" }
serde = { version = "=1.0.118", features = ["derive"] }
fluence-identity = { path = "identity" }
serde_json = "1.0.58"
bs58 = "0.3.1"
failure = "0.1.6"

18
bin/Cargo.lock generated
View File

@ -366,6 +366,23 @@ dependencies = [
"url",
]
[[package]]
name = "fluence-identity"
version = "0.2.0"
dependencies = [
"bs58 0.3.1",
"derivative",
"ed25519-dalek",
"failure",
"fluence-fork-libp2p-core",
"log",
"rand 0.7.3",
"ref-cast",
"serde",
"serde_json",
"signature",
]
[[package]]
name = "fluence-sdk-macro"
version = "0.2.18"
@ -1369,6 +1386,7 @@ dependencies = [
"ed25519-dalek",
"failure",
"fluence-fork-libp2p-core",
"fluence-identity",
"log",
"rand 0.7.3",
"ref-cast",

20
identity/Cargo.toml Normal file
View File

@ -0,0 +1,20 @@
[package]
name = "fluence-identity"
version = "0.2.0"
authors = ["Fluence Labs"]
edition = "2018"
description = "identity"
license = "Apache-2.0"
[dependencies]
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.26.0" }
serde = { version = "=1.0.118", features = ["derive"] }
serde_json = "1.0.58"
bs58 = "0.3.1"
failure = "0.1.6"
log = "0.4.11"
ref-cast = "1.0.2"
derivative = "2.1.1"
ed25519-dalek = "1.0.1"
rand = "0.7.0"
signature = "1.3.0"

33
identity/src/lib.rs Normal file
View File

@ -0,0 +1,33 @@
/*
* Copyright 2020 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#![recursion_limit = "512"]
#![warn(rust_2018_idioms)]
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
pub mod key_pair;
pub use key_pair::KeyPair;
pub(crate) use libp2p_core::identity::ed25519;

View File

@ -15,7 +15,7 @@
*/
use ed25519_dalek::PublicKey;
use crate::key_pair::KeyPair;
use fluence_identity::key_pair::KeyPair;
use crate::trust::{Trust, TRUST_LEN};
use std::str::FromStr;
use std::time::Duration;
@ -237,7 +237,7 @@ mod tests {
use super::*;
use crate::misc::current_time;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use crate::key_pair::KeyPair;
use fluence_identity::key_pair::KeyPair;
pub fn one_second() -> Duration {
Duration::from_secs(1)

View File

@ -28,7 +28,6 @@
mod certificate;
pub mod certificate_serde;
mod key_pair;
mod misc;
mod public_key_hashable;
mod revoke;
@ -37,10 +36,7 @@ mod trust_graph;
mod trust_graph_storage;
mod trust_node;
pub(crate) use libp2p_core::identity::ed25519;
pub use crate::certificate::Certificate;
pub use crate::key_pair::KeyPair;
pub use crate::misc::current_time;
pub use crate::public_key_hashable::PublicKeyHashable;
pub use crate::trust::Trust;

View File

@ -15,8 +15,8 @@
*/
use ed25519_dalek::PublicKey;
use crate::key_pair::KeyPair;
use crate::key_pair::Signature;
use fluence_identity::key_pair::KeyPair;
use fluence_identity::key_pair::Signature;
use crate::trust::{EXPIRATION_LEN, PK_LEN};
use std::time::Duration;

View File

@ -15,7 +15,7 @@
*/
use ed25519_dalek::{PublicKey};
use crate::key_pair::{KeyPair, Signature};
use fluence_identity::key_pair::{KeyPair, Signature};
use derivative::Derivative;
use std::convert::TryInto;
use std::time::Duration;

View File

@ -279,7 +279,7 @@ impl TrustGraph {
#[cfg(test)]
mod tests {
use super::*;
use crate::key_pair::KeyPair;
use fluence_identity::key_pair::KeyPair;
use crate::misc::current_time;
use crate::trust_graph_storage::InMemoryStorage;
use failure::_core::time::Duration;

View File

@ -150,7 +150,7 @@ impl TrustNode {
mod tests {
use std::time::Duration;
use crate::key_pair::KeyPair;
use fluence_identity::key_pair::KeyPair;
use super::*;