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

Handle reset signal from the admin app #188

Merged
merged 7 commits into from
Nov 20, 2023

Conversation

sosthene-nitrokey
Copy link
Collaborator

Built on top of #187. Only the last commit matters.

src/card.rs Outdated Show resolved Hide resolved
src/card.rs Outdated Show resolved Hide resolved
Copy link
Member

@robin-nitrokey robin-nitrokey left a comment

Choose a reason for hiding this comment

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

Please add a changelog entry and check if we need to clear the volatile state before resetting the state. Otherwise LGTM!

}
}
}

self.state.volatile.clear(self.backend.client_mut());
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this in the factory reset case in handle too? Maybe introduce a helper method reset_state?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This clear method removes the private keys in volatile memory. Since the Factory Reset has already cleared all the filesystems, including the volatile, it will fail.

It was actually a mistake to do it after a factory reset.

src/card.rs Outdated
Comment on lines 96 to 97
self.state = State::default();
reset_signal.ack_factory_reset();
Copy link
Member

Choose a reason for hiding this comment

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

nit: We could also return after this because we don’t need to reset the state again.

src/state.rs Outdated
#[derive(Clone, Debug, Default, Eq, PartialEq)]
#[derive(Clone, Debug, Default)]
Copy link
Member

Choose a reason for hiding this comment

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

nit: no more need to remove the derives, but doesn’t make a difference

Copy link
Member

@robin-nitrokey robin-nitrokey left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, looks good!

@sosthene-nitrokey sosthene-nitrokey merged commit a824c64 into main Nov 20, 2023
1 check passed
@sosthene-nitrokey sosthene-nitrokey deleted the admin-app-factory-reset branch November 20, 2023 09:35
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.

2 participants