Skip to content

Conversation

@vmenge
Copy link
Collaborator

@vmenge vmenge commented Nov 26, 2025

use secure storage for storing wifi profiles

todo

  • use in-memory secure storage on tests
  • use optee secure storage on bin
  • test on an orb
  • optee app in orb-os
  • new user for optee app

@TheButlah TheButlah marked this pull request as ready for review December 16, 2025 21:31
@TheButlah TheButlah requested a review from a team as a code owner December 16, 2025 21:31
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/worldcoin_bus_socket
Environment=RUST_BACKTRACE=1
ExecStart=/usr/local/bin/orb-connd
ExecStart=/usr/local/bin/orb-connd connd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to just default to the main entry point and make this subcommand the default

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good point 👍


let sp = SettingsProxy::new(&self.conn).await?;
let path = sp.add_connection(settings).await?;
let path = if persist {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a better idea to delete the persistence codepaths now, wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather leave this one in for now, it's an NM abstraction, its not supposed to be specific to connd 😅


let path = self.store_path.join(Self::FILENAME);
fs::write(path, bytes).await?;
self.secure_storage.put(Self::KEY.into(), bytes).await?;
Copy link
Collaborator

@TheButlah TheButlah Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend wrap_erring all the spots that interact with secure_storage so that if there are errors, we can more easily identify them

pub fn new(cancel: CancellationToken) -> Self {
self::subprocess::spawn(1, cancel)
pub fn new(
exe_path: impl AsRef<Path> + 'static,
Copy link
Collaborator

@TheButlah TheButlah Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just &Path? IMO its overcomplicating things to use generics for these sorts of things. Most of the stdlib uses &str not AsRef for example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i honestly don't think it matters here at all 😅

went ahead and changed it to PathBuf to avoid lifetime complaints

(EntryPoint::SecureStorage as u8).to_string(),
)
let mut child = tokio::process::Command::new(exe_path.as_ref())
.arg("ssd")
Copy link
Collaborator

@TheButlah TheButlah Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo we should not make names too short, its not clear what ssd is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, switched it to secure-storage-worker

result
}

fn connectivity_daemon() -> Result<()> {
Copy link
Collaborator

@TheButlah TheButlah Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might rename it to just main_entry. Its kinda confusing to call it a daemon, it implies its not the primary process. I would also prefer to refer to the secure storage stuff as a "worker" rather than a daemon, to avoid confusion with systemd daemons.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i prefer to keep it connectivity_daemon here, i feel like its less ambiguous

when we run the binary it'll either be a connectivity daemon or a secure storage worker, i'd rather keep that explicit for anyone looking in from main.rs 🙏

.bin("orb-connd")
.current_target()
.current_release()
.manifest_path(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.manifest_path(concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml"))
.manifest_path(env!("CARGO_MANIFEST_PATH))

@TheButlah
Copy link
Collaborator

I am really happy with how the tests all turned out. I think you should give a presentation about your approaches to testing in rust.

@vmenge
Copy link
Collaborator Author

vmenge commented Dec 17, 2025

I am really happy with how the tests all turned out. I think you should give a presentation about your approaches to testing in rust.

ty!! i want to try to prepare something for January to help out with this and answer any questions 🙏

@TheButlah
Copy link
Collaborator

ready to merge, we are just blocked on CI

@TheButlah TheButlah force-pushed the vm/wifi-profile-encryption branch from b79375d to ab78f69 Compare December 31, 2025 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants