Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLT-5866: Remove app_user_uid from the config. #1023

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tomasz-grz
Copy link
Contributor

@tomasz-grz tomasz-grz commented Dec 12, 2024

Problem

Currently app_user_id used for notification center is part of the user provided config for teliod. It shouldn’t be user configurable, we can reuse the the meshnet hardware_id for it instead which should be generated when the device is registered.

Solution

Remove app_user_uid from the user config.
Use a randomly generated UUID instead of the public key for hw_identifier.
Use the hw_identifier as app_user_uid in notification center.

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

@tomasz-grz tomasz-grz self-assigned this Dec 12, 2024
@tomasz-grz tomasz-grz marked this pull request as ready for review December 12, 2024 13:50
@tomasz-grz tomasz-grz requested a review from a team as a code owner December 12, 2024 13:50
let callbacks = Arc::new(Mutex::new(vec![]));

let nc_config = NCConfig {
authentication_token: config.authentication_token.clone(),
app_user_uid: config.app_user_uid,
app_user_uid: *hw_identifier,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe rename NCConfig's app_user_uid to hw_id?

Copy link

@ghztomash ghztomash Dec 18, 2024

Choose a reason for hiding this comment

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

From MQTT API point of view this field is still called app_user_uid. I could change the NCConfig but TokenHttpRequestwould still have to remain app_user_uid otherwise it would break the HTTP request.

I would rather change the new() signature for more consistency.

@matislovas
Copy link
Collaborator

+1

@Hasan6979
Copy link
Contributor

What is the difference between app_user_id and hw_identifier ?
From what I understand is that, one is more device specific, and the other is user specific right ? 1 user can have many devices.

@tomasz-grz
Copy link
Contributor Author

tomasz-grz commented Dec 18, 2024

@Hasan6979 One is used to identify the device on meshnet, and the other to identify the device for MQTT subscriptions.

The parameter app_user_uid has to be an identifier that is unique per device and user. Meaning that it should be different for the same user on different device.

let mut identity_path = dirs::data_local_dir().ok_or(Error::NoDataLocalDir)?;
identity_path.push("teliod");
if !identity_path.exists() {
let _ = create_dir_all(&identity_path);
}
identity_path.push(&format!("{interface_name}.json"));
identity_path.push("data.json");
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the reason behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based from the discussions on slack, we want to destroy the old config if we switch users.
Currently, if you change the interface name in the config file, it will create a new identity file leaving the old one behind.

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.

5 participants