pub struct SecurityManager {
pub verifier: Arc<MessageVerifier>,
pub encryption: Arc<ConditionalEncryption>,
pub config: SecurityConfig,
}Expand description
Security manager that combines all security functionality
Fields§
§verifier: Arc<MessageVerifier>Message verifier for signature verification
encryption: Arc<ConditionalEncryption>Conditional encryption for data at rest
config: SecurityConfigSecurity configuration
Implementations§
Source§impl SecurityManager
impl SecurityManager
Sourcepub fn new(config: SecurityConfig) -> SecurityResult<Self>
pub fn new(config: SecurityConfig) -> SecurityResult<Self>
Create a new security manager without persistence
Sourcepub async fn new_with_persistence(
config: SecurityConfig,
db_ops: Arc<DbOperationsV2>,
) -> SecurityResult<Self>
pub async fn new_with_persistence( config: SecurityConfig, db_ops: Arc<DbOperationsV2>, ) -> SecurityResult<Self>
Create a new security manager with database persistence
Sourcepub async fn register_system_public_key(
&self,
request: KeyRegistrationRequest,
) -> SecurityResult<KeyRegistrationResponse>
pub async fn register_system_public_key( &self, request: KeyRegistrationRequest, ) -> SecurityResult<KeyRegistrationResponse>
Register the system-wide public key
Sourcepub fn verify_message(
&self,
signed_message: &SignedMessage,
) -> SecurityResult<VerificationResult>
pub fn verify_message( &self, signed_message: &SignedMessage, ) -> SecurityResult<VerificationResult>
Verify a signed message
Sourcepub fn verify_message_with_permissions(
&self,
signed_message: &SignedMessage,
required_permissions: &[String],
) -> SecurityResult<VerificationResult>
pub fn verify_message_with_permissions( &self, signed_message: &SignedMessage, required_permissions: &[String], ) -> SecurityResult<VerificationResult>
Verify a message with required permissions
Sourcepub fn encrypt_data(&self, data: &[u8]) -> SecurityResult<Option<EncryptedData>>
pub fn encrypt_data(&self, data: &[u8]) -> SecurityResult<Option<EncryptedData>>
Encrypt data if encryption is enabled
Sourcepub fn encrypt_json(
&self,
json_data: &Value,
) -> SecurityResult<Option<EncryptedData>>
pub fn encrypt_json( &self, json_data: &Value, ) -> SecurityResult<Option<EncryptedData>>
Encrypt JSON data if encryption is enabled
Sourcepub fn decrypt_data(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<Vec<u8>>
pub fn decrypt_data( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<Vec<u8>>
Decrypt data
Sourcepub fn decrypt_json(
&self,
encrypted_data: &EncryptedData,
) -> SecurityResult<Value>
pub fn decrypt_json( &self, encrypted_data: &EncryptedData, ) -> SecurityResult<Value>
Decrypt JSON data
Sourcepub fn is_encryption_enabled(&self) -> bool
pub fn is_encryption_enabled(&self) -> bool
Check if encryption is enabled
Sourcepub fn get_system_public_key(&self) -> SecurityResult<Option<PublicKeyInfo>>
pub fn get_system_public_key(&self) -> SecurityResult<Option<PublicKeyInfo>>
Get the system public key if it exists.
Sourcepub async fn remove_system_public_key(&self) -> SecurityResult<()>
pub async fn remove_system_public_key(&self) -> SecurityResult<()>
Remove the system public key
Auto Trait Implementations§
impl Freeze for SecurityManager
impl !RefUnwindSafe for SecurityManager
impl Send for SecurityManager
impl Sync for SecurityManager
impl Unpin for SecurityManager
impl !UnwindSafe for SecurityManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.