Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/Enhanced/SecureMessageChannel/
SecurityConfig.rs

1//! Tunables for the secure-message channel - encryption /
2//! HMAC algorithm, key-rotation cadence, nonce / tag sizes,
3//! and the maximum allowed message size (DOS guard).
4
5use ring::aead::{AES_256_GCM, NONCE_LEN};
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Struct {
10	pub encryption_algorithm:String,
11
12	pub key_rotation_interval_hours:u64,
13
14	pub hmac_algorithm:String,
15
16	pub nonce_size_bytes:usize,
17
18	pub auth_tag_size_bytes:usize,
19
20	pub max_message_size_bytes:usize,
21}
22
23impl Default for Struct {
24	fn default() -> Self {
25		Self {
26			encryption_algorithm:"AES-256-GCM".to_string(),
27
28			key_rotation_interval_hours:24,
29
30			hmac_algorithm:"HMAC-SHA256".to_string(),
31
32			nonce_size_bytes:NONCE_LEN,
33
34			auth_tag_size_bytes:AES_256_GCM.tag_len(),
35
36			max_message_size_bytes:10 * 1024 * 1024,
37		}
38	}
39}