1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Boo Usage Examples
//!
//! Demonstrates secure string handling with compile-time encryption
//! and runtime decryption.
extern crate alloc;
extern crate boo_rs;
// Initialize encryption with project-specific keys
boo_init!;
/// Wraps an encrypted string in a function. Equivalent to:
///
/// ```
/// static SECRET: &str = "secret-api-key";
/// ```
///
/// but with runtime decryption per access.
///
/// # Example
///
/// ```
/// let key = api_key(); // Decrypted in memory
/// authenticate(&key); // Used while decrypted
/// drop(key); // Memory is secured after dropping
/// ```
///
/// # Note
///
/// Each call decrypts the string, no persistent decrypted state.