-
-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(rust): comment and add tests
- Loading branch information
1 parent
e3df53f
commit 23055f6
Showing
21 changed files
with
687 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
implementations/rust/ockam/ockam_api/src/cli_state/enrollments_repository.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::cli_state::enrollments::IdentityEnrollment; | ||
use ockam::identity::Identifier; | ||
use ockam_core::async_trait; | ||
use ockam_core::Result; | ||
|
||
/// This trait stores the enrollment status for identities | ||
/// If an identity has been enrolled it is possible to retrieve: | ||
/// | ||
/// - its name (if it has one) | ||
/// - if this the default identity | ||
/// - if an identity was enrolled and when the local node was informed | ||
/// | ||
/// | ||
#[async_trait] | ||
pub trait EnrollmentsRepository: Send + Sync + 'static { | ||
/// Set the identifier as enrolled, and set a timestamp to record the information | ||
async fn set_as_enrolled(&self, identifier: &Identifier) -> Result<()>; | ||
|
||
/// Get the list of enrolled identities | ||
async fn get_enrolled_identities(&self) -> Result<Vec<IdentityEnrollment>>; | ||
|
||
/// Get the enrollment statuses for all known identities | ||
async fn get_all_identities_enrollments(&self) -> Result<Vec<IdentityEnrollment>>; | ||
|
||
/// Return true if the default identity is enrolled | ||
async fn is_default_identity_enrolled(&self) -> Result<bool>; | ||
|
||
/// Return true if the identity with the given name is enrolled | ||
async fn is_identity_enrolled(&self, name: &str) -> Result<bool>; | ||
} |
Oops, something went wrong.