remove legacy mode and bind api to emitter #83
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
In secret-stack I recently added support for more identifiers so that we can different kinds of IDs depending on the muxrpc transformer used (secret-handshake? no-auth? secret-handshake-extended? etc)
Problem
muxrpc still used
where "context" is
{ _emit, id }
which means theid
is hard-coded. Thisid
comes from secret-stack and then is available for reading asthis.id
where thethis
is referring to the remote peer. Concrete use case here.The problem is that with diverse IDs,
this.shse.pubkey
is not available, because thecontext
object doesn't have that information. We need to bind to the emitter instead:Solution
I started by binding to the emitter, and that made the
context
useless (unused anywhere) which in turn led me to remove the legacy mode and some of theindex.js
, which in turn led to adapting all the tests (they all assumed the legacy mode), that's why this PR looks big. It's all a domino effect from binding to the emitter.This PR is a breaking change and should be published as a new major version.
Tests
All tests passed when I ran them locally. Standard linting also passed.