Socket
Socket
Sign inDemoInstall

is-ipfs

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ipfs - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [3.0.0](https://github.com/ipfs/is-ipfs/compare/v2.0.0...v3.0.0) (2021-02-03)
### Features
* dnsaddr support in peerMultiaddr ([#35](https://github.com/ipfs/is-ipfs/issues/35)) ([4a4710d](https://github.com/ipfs/is-ipfs/commit/4a4710d13b546d8271c6b5f60f214c9010139666))
* **subdomain:** support inlined DNSLink names ([#36](https://github.com/ipfs/is-ipfs/issues/36)) ([7ab7125](https://github.com/ipfs/is-ipfs/commit/7ab712538fa9a8aee4a3d2cd3496371a8cf0e78b))
<a name="2.0.0"></a>

@@ -2,0 +12,0 @@ # [2.0.0](https://github.com/ipfs/is-ipfs/compare/v1.0.3...v2.0.0) (2020-08-10)

20

package.json
{
"name": "is-ipfs",
"version": "2.0.0",
"version": "3.0.0",
"description": "A set of utilities to help identify IPFS resources on the web",

@@ -44,16 +44,16 @@ "keywords": [

"dependencies": {
"cids": "^1.0.0",
"iso-url": "~0.4.7",
"mafmt": "^8.0.0",
"multiaddr": "^8.0.0",
"multibase": "^3.0.0",
"multihashes": "^3.0.1",
"uint8arrays": "^1.1.0"
"cids": "^1.1.5",
"iso-url": "^1.0.0",
"mafmt": "^8.0.4",
"multiaddr": "^8.1.2",
"multibase": "^3.1.1",
"multihashes": "^3.1.2",
"uint8arrays": "^2.0.5"
},
"devDependencies": {
"aegir": "^25.0.0",
"aegir": "^30.3.0",
"pre-commit": "^1.2.2"
},
"engines": {
"node": ">=10.0.0",
"node": ">=14.0.0",
"npm": ">=6.0.0"

@@ -60,0 +60,0 @@ },

@@ -117,3 +117,5 @@ is-ipfs 🕵️

isIPFS.peerMultiaddr('/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj') // true
isIPFS.peerMultiaddr('/ip4/127.0.0.1/udp/1234') // false
isIPFS.peerMultiaddr('/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN') // true
isIPFS.peerMultiaddr('/dnsaddr/bootstrap.libp2p.io') // true (key resolved via DNS)
isIPFS.peerMultiaddr('/ip4/127.0.0.1/udp/1234') // false (key missing)
```

@@ -220,3 +222,3 @@

Returns `true` if the provided `string`, [`Multiaddr`](https://github.com/multiformats/js-multiaddr) or `Uint8Array` represents a valid "IPFS Peer" multiaddr (matching [`IPFS` format from `mafmt`](https://github.com/multiformats/js-mafmt#api)) or `false` otherwise.
Returns `true` if the provided `string`, [`Multiaddr`](https://github.com/multiformats/js-multiaddr) or `Uint8Array` represents a valid libp2p peer multiaddr (matching [`P2P` format from `mafmt`](https://github.com/multiformats/js-mafmt#api)) or `false` otherwise.

@@ -223,0 +225,0 @@ # License

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

function isPeerMultiaddr (input) {
return isMultiaddr(input) && mafmt.IPFS.matches(input)
return isMultiaddr(input) && (mafmt.P2P.matches(input) || mafmt.DNS.matches(input))
}

@@ -119,2 +119,8 @@

try {
if (!ipnsId.includes('.') && ipnsId.includes('-')) {
// name without tld, assuming its inlined into a single DNS label
// (https://github.com/ipfs/in-web-browsers/issues/169)
// en-wikipedia--on--ipfs-org → en.wikipedia-on-ipfs.org
ipnsId = ipnsId.replace(/--/g, '@').replace(/-/g, '.').replace(/@/g, '-')
}
// URL implementation in web browsers forces lowercase of the hostname

@@ -121,0 +127,0 @@ const { hostname } = new URL(`http://${ipnsId}`) // eslint-disable-line no-new

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