Giter VIP home page Giter VIP logo

Comments (12)

d-e-s-o avatar d-e-s-o commented on May 30, 2024 1

...
Please not that the comment continues after the three dots, even if Github thinks that’s a signature. Also, as I cannot edit comments submitted by mail, I want to make clear that nitrokey-app only sets the time once a device is connected, not with every OTP generation.

Thanks for the explanation @robinkrahl ! No more questions at this point, your honor.

In conclusion, I think my previous suggestion is still valid. But we could use the *_soft function per default. If it fails, the user has to pass --ignore-time to continue anyway or --reset-time for a “hard” reset.

Sounds good to me!

Internal clock synchronization should be required only once per device's power cycle. It should keep the time then for further TOTP work. I do not know, how much its clock drifts with time, but never seen any issues during normal usage. Devices have no battery, hence the clock is reset on each boot.

Thanks for the clarification @szszszsz !

from nitrocli.

d-e-s-o avatar d-e-s-o commented on May 30, 2024

Sounds good! In retrospect I would really have liked to cut a release earlier. We are cramming a lot of features into this one, for no real reason. In my opinion it would have been much better to ship, say the pws and volume command introduction and that's it. The rest would come as smaller incremental updates. That would have allowed us to focus on testing (I expect it to be much harder to roll out proper testing now and to think about the corner cases that we would have more easily thought of during feature development) and less features would have meant an easier time getting the documentation up to date (although admittedly that is not a big deal).

But we have what we have (and lack of testing hardware certainly was a factor), so no pulling back now. So yes, given that this sounds like an impediment to the functioning of already merged functionality we should add support for clock synchronization. Will that require an additional dependency (if we decide go with reading the host time)?

from nitrocli.

robinkrahl avatar robinkrahl commented on May 30, 2024

from nitrocli.

d-e-s-o avatar d-e-s-o commented on May 30, 2024

To be honest, I just forgot about this issue because it was six months since I implemented the OTP support in nitrokey. After thinking about the issue some more, I think it would be best to add a --time option to the otp get command. Then we could always set the time before generating the OTP – either to the system time or to the given timestamp if --time is set.

Sure, no worries. My remarks were more of a general nature than specific to this issue (so perhaps that wasn't the best place to articulate them). So the interface you propose is:

  • nitrocli otp get --time would automatically sync the time to the host time, if it is out of sync.
  • nitrocli otp get would warn if out-of-sync.

Is that right? I think I may have to understand OTP a little more. What would be considered out-of-sync? Is that time window dependent?

Will that require an additional dependency (if we decide go with reading the host time)?
No. We can use std::time::SystemTime.

Ah, perfect!

All in all, this is only a minor change. I just wanted to file an issue so that we do not forget about it.

Absolutely.

from nitrocli.

robinkrahl avatar robinkrahl commented on May 30, 2024

from nitrocli.

d-e-s-o avatar d-e-s-o commented on May 30, 2024

Many thanks for the explanation!

There are two more things that I am confused about, I guess.

  1. From your description it appears that the Nitrokey (or any TOTP capable device) really needs to have a way to keep time. But the device has no battery (from what I know), so it cannot do anything of that sort if it is unplugged. Is that why you would want to set the time by default? Because it is very likely out of sync?
  2. Are there other services that use the time? If OTP is the sole user I think unconditionally syncing it is fine.

Possible problems with this solution are:

  • We have one more command to send to the device (set time). But on the other hand, we should always check the time, so it does not make any difference.

We would also need to retrieve the currently set time window, wouldn't we? (though that may come along with the time; not that this is a problem, I just want to understand)

from nitrocli.

robinkrahl avatar robinkrahl commented on May 30, 2024

from nitrocli.

robinkrahl avatar robinkrahl commented on May 30, 2024

Please not that the comment continues after the three dots, even if Github thinks that’s a signature. Also, as I cannot edit comments submitted by mail, I want to make clear that nitrokey-app only sets the time once a device is connected, not with every OTP generation.

In conclusion, I think my previous suggestion is still valid. But we could use the *_soft function per default. If it fails, the user has to pass --ignore-time to continue anyway or --reset-time for a “hard” reset.

from nitrocli.

szszszsz avatar szszszsz commented on May 30, 2024

Hi! Just wanted to add two words.
Internal clock synchronization should be required only once per device's power cycle. It should keep the time then for further TOTP work. I do not know, how much its clock drifts with time, but never seen any issues during normal usage. Devices have no battery, hence the clock is reset on each boot.

from nitrocli.

d-e-s-o avatar d-e-s-o commented on May 30, 2024

Do you mind taking this issue, @robinkrahl ? I guess you already may have started work on it

from nitrocli.

robinkrahl avatar robinkrahl commented on May 30, 2024

from nitrocli.

d-e-s-o avatar d-e-s-o commented on May 30, 2024

Merged. Thanks for bringing up this issue and resolving it @robinkrahl !

from nitrocli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.