Want cooked hs desc parse-and-decode
IRC conversation about what to do with the result of HsDesc::parse
. We should do as discussed.
18:18 <+nickm> Diziet: I maintain that SignatureGated is an okay type to get
back from HsDesc::parse. It takes a blinded_onion_id to make
sure that you got the descriptor that you want, and returns a
SignatureGated.
18:18 <+nickm> That SignatureGated has all the keys it needs to check the
signatures; you don't need to add any more
18:18 <+Diziet> nickm: So, re validation, the thing I'm missing is a function
that takes the output of HsDesc::parse plus all necessary keys
(client secrets, expected HsId and HsBlindId) and gives you the
inner content to use.
18:19 <+Diziet> Oh, so it promises that if you get Ok all you have to do is
check some self-signature ?
18:19 <+Diziet> Isn't there more than one signature in this thing ?
18:19 <+nickm> Right. So you call
HsDesc::parse(s).check_signature()?.check_valid_at(&now)? and
then you have an EncryptedHsDesc.
18:20 <+nickm> then you call _decrypt_ on that, and you need to check _its_
inner signatures and time-bounds, since they are on the inner
part too
18:20 <+Diziet> Which you then call decrypt on. And then .check_signature and
...
18:20 <+nickm> yup
18:21 <+nickm> the parse_desc_good() test goes all the way from a string to a
decrypted HsDesc. It uses unwrap, but other than that the logic
is right
18:21 <+Diziet> OK, I wasn't confident from the doc comments and API types that
that would be correct. (Indeed, you have to quite follow some
breadcrumbs to even find it.)
18:21 <+nickm> Feel free to add more doc comments?
18:22 <+Diziet> nickm: OK how about we invent a function that does all these
things ? :-)
18:22 <+Diziet> And also some doc comments yes.
18:22 <+nickm> Like, HsDesc::parse_decrypt_and_check() ? That would be ok.
18:22 <+Diziet> Yes, that.
18:22 <+Diziet> It would give you a TimerangeBound.
18:23 <+Diziet> Perhaps several, since maybe you want bits from the middle or
outer too.
18:23 <+Diziet> Oh HsDesc is already that
18:23 <+nickm> yup
18:23 <+Diziet> OK great.
18:24 <+Diziet> I will make a ticket containing this conversation.
18:24 <+Diziet> Thanks for explaining