7.2.2 • Published 2 days ago

@helia/ipns v7.2.2

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
2 days ago

@helia/ipns

ipfs.tech Discuss codecov CI

An implementation of IPNS for Helia

About

IPNS operations using a Helia node

Example - Using libp2p and pubsub routers

With IPNSRouting routers:

import { createHelia } from 'helia'
import { ipns } from '@helia/ipns'
import { libp2p, pubsub } from '@helia/ipns/routing'
import { unixfs } from '@helia/unixfs'

const helia = await createHelia()
const name = ipns(helia, {
 routers: [
   libp2p(helia),
   pubsub(helia)
 ]
})

// create a public key to publish as an IPNS name
const keyInfo = await helia.libp2p.services.keychain.createKey('my-key')
const peerId = await helia.libp2p.services.keychain.exportPeerId(keyInfo.name)

// store some data to publish
const fs = unixfs(helia)
const cid = await fs.add(Uint8Array.from([0, 1, 2, 3, 4]))

// publish the name
await name.publish(peerId, cid)

// resolve the name
const cid = name.resolve(peerId)

Example - Using custom DNS over HTTPS resolvers

With default DNSResolver resolvers:

import { createHelia } from 'helia'
import { ipns } from '@helia/ipns'
import { unixfs } from '@helia/unixfs'
import { dnsOverHttps } from '@helia/ipns/dns-resolvers'

const helia = await createHelia()
const name = ipns(helia, {
 resolvers: [
   dnsOverHttps('https://private-dns-server.me/dns-query'),
 ]
})

const cid = name.resolveDns('some-domain-with-dnslink-entry.com')

Example - Resolving a domain with a dnslink entry

Calling resolveDns with the @helia/ipns instance:

// resolve a CID from a TXT record in a DNS zone file, using the default
// resolver for the current platform eg:
// > dig _dnslink.ipfs.io TXT
// ;; ANSWER SECTION:
// _dnslink.ipfs.io.          60     IN      TXT     "dnslink=/ipns/website.ipfs.io"
// > dig _dnslink.website.ipfs.io TXT
// ;; ANSWER SECTION:
// _dnslink.website.ipfs.io.  60     IN      TXT     "dnslink=/ipfs/QmWebsite"

const cid = name.resolveDns('ipfs.io')

console.info(cid)
// QmWebsite

Example - Using DNS-Over-HTTPS

This example uses the Mozilla provided RFC 1035 DNS over HTTPS service. This uses binary DNS records so requires extra dependencies to process the response which can increase browser bundle sizes.

If this is a concern, use the DNS-JSON-Over-HTTPS resolver instead.

// use DNS-Over-HTTPS
import { dnsOverHttps } from '@helia/ipns/dns-resolvers'

const cid = name.resolveDns('ipfs.io', {
  resolvers: [
    dnsOverHttps('https://mozilla.cloudflare-dns.com/dns-query')
  ]
})

Example - Using DNS-JSON-Over-HTTPS

DNS-JSON-Over-HTTPS resolvers use the RFC 8427 application/dns-json and can result in a smaller browser bundle due to the response being plain JSON.

// use DNS-JSON-Over-HTTPS
import { dnsJsonOverHttps } from '@helia/ipns/dns-resolvers'

const cid = name.resolveDns('ipfs.io', {
  resolvers: [
    dnsJsonOverHttps('https://mozilla.cloudflare-dns.com/dns-query')
  ]
})

Install

$ npm i @helia/ipns

Browser <script> tag

Loading this module through a script tag will make it's exports available as HeliaIpns in the global namespace.

<script src="https://unpkg.com/@helia/ipns/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

npm.io

7.2.2-9fa2427

2 days ago

7.2.2-a8fdfc2

2 days ago

7.2.2-55b9650

4 days ago

7.2.1-b0d50e9

4 days ago

7.2.2

4 days ago

7.2.1-7419dfc

5 days ago

7.2.1-fa9bd4b

5 days ago

7.2.1-6a62d1c

9 days ago

7.2.1-36081e0

9 days ago

7.2.1-2d070b9

10 days ago

7.2.1-e4e67d0

11 days ago

7.2.1-361fbd3

11 days ago

7.2.1-0a528bb

12 days ago

7.2.1-f6bcbd4

12 days ago

7.2.1-52dbcf2

13 days ago

7.2.1-f7f71bb

12 days ago

7.2.1-5e98950

12 days ago

7.2.1-0ecb529

13 days ago

7.2.1-5d62dfb

13 days ago

7.2.1-338885f

14 days ago

7.2.1-59de059

14 days ago

7.2.0-9ea934e

20 days ago

7.2.0-9c8a2c0

20 days ago

7.2.0-5323724

20 days ago

7.2.1

20 days ago

7.2.0-ba4b7ba

26 days ago

7.2.0-b67ac5f

25 days ago

7.2.0-b1c761d

26 days ago

7.2.0-395cd9e

26 days ago

7.2.0-532d6c4

26 days ago

7.2.0-7cd012a

26 days ago

7.2.0-e582c63

1 month ago

7.2.0-329652a

1 month ago

7.1.0-1561e4a

1 month ago

7.2.0-6ddefb0

1 month ago

7.2.0

1 month ago

7.2.0-5cf216b

1 month ago

7.1.0-9ac5909

1 month ago

7.1.0-d1c497b

1 month ago

7.1.0

2 months ago

7.0.0-b6765fe

2 months ago

7.0.0

2 months ago

7.0.0-ecf5394

2 months ago

6.0.1-adc5589

2 months ago

6.0.1-a0d651c

2 months ago

6.0.1-2c71b6e

2 months ago

6.0.1-8c9bb7d

2 months ago

6.0.1-a64e5de

2 months ago

6.0.1-c69913c

2 months ago

6.0.1-90c6feb

2 months ago

6.0.0-c3f2ed1

2 months ago

6.0.0-6f8c15b

2 months ago

6.0.0-77e34fc

2 months ago

6.0.1

2 months ago

6.0.0-1319c61

2 months ago

6.0.0-917a1bc

2 months ago

6.0.0-1ee6a4a

2 months ago

6.0.0-2d965be

2 months ago

6.0.0-7c3ce21

2 months ago

6.0.0-dc2e7a6

2 months ago

6.0.0-28d62f7

2 months ago

6.0.0-7c07e11

2 months ago

6.0.0-a04e041

2 months ago

6.0.0-754c7af

3 months ago

6.0.0-8db7792

3 months ago

6.0.0-31cdfa8

3 months ago

6.0.0-75d0a5b

3 months ago

6.0.0-9b1ddf8

3 months ago

6.0.0-7a7c0c1

3 months ago

6.0.0-3283a5c

3 months ago

6.0.0-f58d467

3 months ago

6.0.0-3851fe2

3 months ago

6.0.0-5c0c39c

3 months ago

6.0.0-6c88ee1

3 months ago

6.0.0-f243de2

3 months ago

6.0.0-8a5bc6f

3 months ago

6.0.0

3 months ago

5.0.0-ca8d5eb

3 months ago

5.0.0-e554493

3 months ago

5.0.0-94b0cd1

3 months ago

5.0.0-44f4e88

3 months ago

5.0.0

3 months ago

4.0.0-99c94f4

3 months ago

4.0.0-4836d52

4 months ago

4.0.0-db7d091

4 months ago

4.0.0-19bf9ce

4 months ago

4.0.0-031519c

4 months ago

4.0.0-4943c5b

4 months ago

4.0.0-f2853f8

4 months ago

4.0.0-163df38

4 months ago

4.0.0-a2229bd

4 months ago

4.0.0-3477b27

4 months ago

4.0.0-a966706

4 months ago

4.0.0-843fba4

4 months ago

4.0.0-ce74026

4 months ago

4.0.0-76220cd

4 months ago

4.0.0-5a87bbd

4 months ago

4.0.0-ece384a

4 months ago

4.0.0-5c6a066

4 months ago

4.0.0-5c4fd54

4 months ago

4.0.0-3f4c6bf

4 months ago

4.0.0-10272b4

4 months ago

4.0.0

4 months ago

4.0.0-a0692f9

4 months ago

3.0.1

5 months ago

3.0.0

5 months ago

1.1.7

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.1

7 months ago

2.0.0

8 months ago

1.1.1

1 year ago

1.1.3

12 months ago

1.1.2

12 months ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.0

1 year ago