Socket
Socket
Sign inDemoInstall

multiaddr

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiaddr - npm Package Compare versions

Comparing version 2.2.3 to 2.3.0

2

package.json
{
"name": "multiaddr",
"version": "2.2.3",
"version": "2.3.0",
"description": "multiaddr implementation (binary + string representation of network addresses)",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -109,3 +109,3 @@ 'use strict'

return extend(protocols(code))
// copy to prevent users from modifying the internal objs.
// copy to prevent users from modifying the internal objs.
})

@@ -239,3 +239,3 @@ }

*
* @return {String} peerId - The id of the peer
* @return {String|null} peerId - The id of the peer or null if invalid or missing from the ma
* @example

@@ -245,18 +245,19 @@ * const mh1 = Multiaddr('/ip4/8.8.8.8/tcp/1080/ipfs/QmValidBase58string')

*
* const peerId
*
* try {
* peerId = mh1.getPeerId()
* } catch (err) {
* // not a valid base58 address
* }
* // should return QmValidBase58string or null if the id is missing or invalid
* const peerId = mh1.getPeerId()
*/
Multiaddr.prototype.getPeerId = function getPeerId () {
let b58str = this.stringTuples().filter((tuple) => {
if (tuple[0] === protocols.names['ipfs'].code) {
return true
}
})[0][1]
let b58str = null
try {
b58str = this.stringTuples().filter((tuple) => {
if (tuple[0] === protocols.names['ipfs'].code) {
return true
}
})[0][1]
bs58.decode(b58str)
bs58.decode(b58str)
} catch (e) {
b58str = null
}
return b58str

@@ -263,0 +264,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc