Skip to content

Remove secio usage and cleanup exports #519

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

Merged
merged 4 commits into from
Feb 8, 2021
Merged

Remove secio usage and cleanup exports #519

merged 4 commits into from
Feb 8, 2021

Conversation

dryajov
Copy link
Contributor

@dryajov dryajov commented Feb 5, 2021

Note, as the title state, this removes secio usage and would quit if it's attempted to be used with newStandardSwitch - maybe quitting is a bit too drastic?

@dryajov dryajov requested a review from sinkingsugar February 5, 2021 19:02
Copy link
Contributor

@sinkingsugar sinkingsugar left a comment

Choose a reason for hiding this comment

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

Fine for me about the quit.
Also LGTM

@dryajov dryajov merged commit 4dea23c into master Feb 8, 2021
@dryajov dryajov deleted the exports-cleanup branch February 8, 2021 20:33
@@ -54,7 +48,7 @@ proc newStandardSwitch*(privKey = none(PrivateKey),
of SecureProtocol.Noise:
secureManagerInstances &= newNoise(rng, seckey).Secure
of SecureProtocol.Secio:
secureManagerInstances &= newSecio(rng, seckey).Secure
quit("Secio is deprecated!") # use of secio is unsafe
Copy link
Contributor

Choose a reason for hiding this comment

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

instead, might be able to mark the Secio enum value with {.deprecated.} - if not, might want to provide instructions for how to use secio anyway since it's needed to access old go implementations like ipfs etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, secio has been removed everywhere, since it's been marked insecure

multiaddress, crypto, lpstream, bufferstream
minprotobuf, varint,switch, peerid, peerinfo,
connection, multiaddress, crypto, lpstream,
bufferstream, bearssl, muxer, mplex, transport,
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure internals like bearssl and varint necessarily should be exported, they're not part of the public api exposed in this module and pollute the global namespace with many ambiguous symbols - the rule is basically "anything that forms part of the public api should be exported"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with bearssl, but though I expose it since it's now used as the default RNG provider.

Varint seems like a good candidate to export tho, since it's used extensively across libp2p and can be useful for custom parsers and such?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with bearssl, but though I expose it since it's now used as the default RNG provider.

ok - if any bear type appears in public API needed by this module, then yes

Varint seems like a good candidate to export tho,

depends - ie libp2p consumes varint but presents a more sane API to to user that doesn't expose any varints, so I would tend towards no, for pollution reasons (ie if the user is using another varint library, of which there are plenty, they'll get into symbol trouble which is annoying and easily causes breakage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

depends - ie libp2p consumes varint but presents a more sane API to to user that doesn't expose any varints, so I would tend towards no, for pollution reasons (ie if the user is using another varint library, of which there are plenty, they'll get into symbol trouble which is annoying and easily causes breakage

OK, I don't disagree since it can be imported implicitly.

Copy link
Contributor Author

@dryajov dryajov Feb 8, 2021

Choose a reason for hiding this comment

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

ok - if any bear type appears in public API needed by this module, then yes

Yeah, we need BrHmacDrbgContext which seems to be part of bearssl and is returned by newRng().

@dryajov dryajov mentioned this pull request Feb 8, 2021
arnetheduck added a commit that referenced this pull request Mar 19, 2024
Secio has been deprecated in nim-libp2p since
[2021](#519) - farewell.
@arnetheduck arnetheduck mentioned this pull request Mar 19, 2024
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.

3 participants