File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,13 @@ asimov-signal-reader
3636
3737## ⚙ Configuration
3838
39- This module requires no configuration.
39+ ### Encryption Key
40+
41+ ``` bash
42+ export ASIMOV_SIGNAL_KEY=feedc0dedecafbadcafebabecafed00dfeedc0dedecafbadcafebabecafed00d
43+ ```
44+
45+ The key must be 64 hexadecimal characters, meaning 32 bytes (256 bits).
4046
4147## 📚 Reference
4248
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ compile_error!("asimov-signal-reader requires the 'std' feature");
66use asimov_module:: {
77 SysexitsError :: { self , * } ,
88 json:: SkipNulls ,
9+ secrecy:: ExposeSecret ,
910} ;
1011use clap:: Parser ;
1112use clientele:: StandardOptions ;
@@ -55,8 +56,14 @@ pub fn main() -> Result<SysexitsError, Box<dyn Error>> {
5556 #[ cfg( feature = "tracing" ) ]
5657 asimov_module:: init_tracing_subscriber ( & options. flags ) . expect ( "failed to initialize logging" ) ;
5758
59+ let key = asimov_module:: getenv:: var_secret ( "ASIMOV_SIGNAL_KEY" ) ;
60+
5861 let conn = Connection :: open ( & options. path ) ?;
5962
63+ if let Some ( key) = key {
64+ conn. pragma_update ( None , "key" , format ! ( "x'{}'" , key. expose_secret( ) ) ) ?;
65+ }
66+
6067 let mut stmt = conn. prepare ( "SELECT id, type, json FROM conversations" ) ?;
6168 let mut rows = stmt. query ( [ ] ) ?;
6269
You can’t perform that action at this time.
0 commit comments