Select Git revision
-
Vincent Texier authoredVincent Texier authored
identities.rs 12.05 KiB
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Identities stored index.
use crate::constants::*;
use crate::paging::PagingFilter;
use crate::*;
use dubp_common_doc::traits::Document;
use dubp_common_doc::{BlockNumber, Blockstamp};
use dubp_user_docs::documents::identity::IdentityDocumentV10;
use dup_crypto::keys::*;
use durs_dbs_tools::DbError;
use durs_wot::WotId;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
/// Identities filter
pub struct IdentitiesFilter {
/// Pagination parameters
pub paging: PagingFilter,
/// Filter identities by public key
pub by_pubkey: Option<PubKey>,
}
impl Default for IdentitiesFilter {
fn default() -> Self {
IdentitiesFilter {
paging: PagingFilter::default(),
by_pubkey: None,
}
}
}
impl IdentitiesFilter {
/// Create "by pubkey" filter
pub fn by_pubkey(pubkey: PubKey) -> Self {
IdentitiesFilter {
paging: PagingFilter::default(),
by_pubkey: Some(pubkey),
}
}
}
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)]
/// Identity state
pub enum DbIdentityState {
/// Member
Member(Vec<usize>),
/// Expire Member
ExpireMember(Vec<usize>),
/// Explicit Revoked
ExplicitRevoked(Vec<usize>),
/// Explicit Revoked after expire
ExplicitExpireRevoked(Vec<usize>),
/// Implicit revoked
ImplicitRevoked(Vec<usize>),