summaryrefslogtreecommitdiff
path: root/crates/tor-hscrypto/src/time.rs
Commit message (Collapse)AuthorAgeFilesLines
* hs time handling: Make TimePeriod contain length as IntegerMinutesIan Jackson2023-02-091-9/+20
| | | | | | Locally, the only functional effect is that now we refuse to handle non-whole-number-of-minutes lengths - but since the consensus parameter can't represent those, there's no overall functional change.
* netdir: Implement ring-param constructors and time period accessorsNick Mathewson2023-01-281-0/+16
| | | | | | | | | | | | | | This logic is a bit tricky, so I've tried to document it and add fairly good tests. The silver lining is that the external API for all of this logic will make it invisible and hidden. There are some cases where I added functions that I think might eventually get lowered into MdConsensus: But I don't want to lower too much right now, since the convention for our netdoc accessors is that they are fairly unsophisticated, and they show you the document as it is. Closes #686
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* hscrypto: add a note about maybe replacing epoch_offset with voting_intervalNick Mathewson2023-01-251-0/+3
|
* hscrypto: Note that maybe Duration is the wrong type to use.Nick Mathewson2023-01-251-0/+5
|
* hscrypto: Note the need for a Result rather than an OptionNick Mathewson2023-01-251-0/+4
|
* hscrypto: Revise TimePeriod to account for variable offset.Nick Mathewson2023-01-241-21/+30
| | | | | | | | Previously, the offset was set to 12 hours unconditionally (like the spec says). But based on a conversation on tor-dev, it seems that the offset should actually be 12 times the voting interval. I'm also opening an MR to change the spec.
* hscrypto: Add our standard clippy warningsNick Mathewson2023-01-241-0/+10
| | | | | | (I have squashed the fixes for these warnings into the earlier commits in this branch, so it will look like I did everything right the first time.)
* hscrypto: Implement key blinding.Nick Mathewson2023-01-241-2/+2
| | | | | This implementation was made based on the specification, and then validated against itself, and against C Tor.
* hscrypto: Add an implementation for TimePeriodNick Mathewson2023-01-241-11/+118
| | | | | This required some API tweaks, which is probably to be expected; these time periods are a wonky kind of thing.
* hscrypto: Add several derivesNick Mathewson2023-01-111-0/+1
| | | | | The important addition here is the Copy derives, which affect API design. I'm applying them to the types that are 32 byte or smaller.
* Create a new tor-hscrypto crate.Nick Mathewson2023-01-061-0/+46
This module has types and operations needed in multiple places for an onion service implementation. There are a bunch of TODO hs-crypto comments that we'll need to fill in.