Skip to content

Conversation

Miaourt
Copy link

@Miaourt Miaourt commented Oct 6, 2025

Hello!

I'm in the need of decrypting ranges without using the io.Readers provided, I ended up with this solution by adding an option in the sio.Config. If you have something better that comes to mind, I can draft it too!

I wrote the logic inside dare.go as it looked like the most "idiomatic" way of doing so in this repo (every function opening an AuthDec with the provided sio.Config -> then not touching the sio.Config again)

But if you prefer, I can limit the option to decryptBufferV20() by modifying:

if !ad.finalized {
	return nil, errUnexpectedEOF
}

into something like:

if !ad.finalized && (config != nil && config.EndSequenceNumber != nil && *config.EndSequenceNumber == ad.SeqNum-1) { 
	return nil, errUnexpectedEOF
}

But it's a bit more cryptic imho...

Thanks for your time reviewing this PR!

Add EndSequenceNumber config that act like SequenceNumber but for the last expected package

DARE's header flag take priority over this option
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.

1 participant