This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
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.
peer-id-lite
removes thelibp2p-crypto
dependency to reduce the total bundle size significantly.peer-id-lite
will exportwindow.PeerId
if available (in browser) or in Node it'll tryrequire('peer-id')
. It allows people to bring their own full fatpeer-id
and fallback to the lite version if not.PASS ./dist/index.min.js: 133.94KB < maxSize 232KB (gzip)(97.17KB smaller than master, good job!)
What does this mean?
PeerId
cannot be used to create aPeerId
instance with a public and/or private key.PeerId.create
will always fail with errorPeerId.createFromPubKey
will always fail with errorPeerId.createFromPrivKey
will always fail with errorPeerId.createFromJSON
will fail if passed object hasprivKey
orpubKey
propertiesArguably, we should stop exporting
PeerId
because the instance we're exporting isn't real.Right now, in terms of actually using
PeerId
lite instances returned byipfs-http-client
, the only issue you'll come across is:privKey
orpubKey
onPeerId
lite instancesPossibly un-obvious behaviour of
PeerId
lite:marshalPubKey
andmarshalPrivKey
will always returnundefined
because an instance can not have a public or private key - this is no different to the behaviour of the real implementation when an instance has no public/private keytoJSON
will not haveprivKey
orpubKey
because an instance can not have a public or private key - this is no different to the behaviour of the real implementation when an instance has no public/private key