fix tor addressing for realzies

This commit is contained in:
Aiden McClelland
2021-09-08 19:13:36 -06:00
committed by Aiden McClelland
parent 296c2a98c3
commit 45d945db2e
5 changed files with 49 additions and 22 deletions

View File

@@ -36,12 +36,19 @@ impl Interfaces {
if iface.tor_config.is_some() || iface.lan_config.is_some() {
let key = TorSecretKeyV3::generate();
let key_vec = key.as_bytes().to_vec();
let key_row = sqlx::query!(
"INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?) RETURNING key AS \"key!:Vec<u8>\"",
sqlx::query!(
"INSERT OR IGNORE INTO tor (package, interface, key) VALUES (?, ?, ?)",
**package_id,
**id,
key_vec,
)
.execute(&mut *secrets)
.await?;
let key_row = sqlx::query!(
"SELECT key FROM tor WHERE package = ? AND interface = ?",
**package_id,
**id,
)
.fetch_one(&mut *secrets)
.await?;
let mut key = [0_u8; 64];