@helia/ipns 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,26 +17,27 @@
17
17
 
18
18
  IPNS operations using a Helia node
19
19
 
20
- ## Example
20
+ ## Example - Using libp2p and pubsub routers
21
21
 
22
22
  With IPNSRouting routers:
23
23
 
24
24
  ```typescript
25
25
  import { createHelia } from 'helia'
26
- import { dht, pubsub } from '@helia/ipns/routing'
26
+ import { ipns } from '@helia/ipns'
27
+ import { libp2p, pubsub } from '@helia/ipns/routing'
27
28
  import { unixfs } from '@helia/unixfs'
28
29
 
29
30
  const helia = await createHelia()
30
31
  const name = ipns(helia, {
31
32
  routers: [
32
- dht(helia),
33
+ libp2p(helia),
33
34
  pubsub(helia)
34
35
  ]
35
36
  })
36
37
 
37
38
  // create a public key to publish as an IPNS name
38
- const keyInfo = await helia.libp2p.keychain.createKey('my-key')
39
- const peerId = await helia.libp2p.keychain.exportPeerId(keyInfo.name)
39
+ const keyInfo = await helia.libp2p.services.keychain.createKey('my-key')
40
+ const peerId = await helia.libp2p.services.keychain.exportPeerId(keyInfo.name)
40
41
 
41
42
  // store some data to publish
42
43
  const fs = unixfs(helia)
@@ -49,14 +50,15 @@ await name.publish(peerId, cid)
49
50
  const cid = name.resolve(peerId)
50
51
  ```
51
52
 
52
- ## Example
53
+ ## Example - Using custom DNS over HTTPS resolvers
53
54
 
54
55
  With default DNSResolver resolvers:
55
56
 
56
57
  ```typescript
57
58
  import { createHelia } from 'helia'
58
- import { dht, pubsub } from '@helia/ipns/routing'
59
+ import { ipns } from '@helia/ipns'
59
60
  import { unixfs } from '@helia/unixfs'
61
+ import { dnsOverHttps } from '@helia/ipns/dns-resolvers'
60
62
 
61
63
  const helia = await createHelia()
62
64
  const name = ipns(helia, {
@@ -68,7 +70,7 @@ const name = ipns(helia, {
68
70
  const cid = name.resolveDns('some-domain-with-dnslink-entry.com')
69
71
  ```
70
72
 
71
- ## Example
73
+ ## Example - Resolving a domain with a dnslink entry
72
74
 
73
75
  Calling `resolveDns` with the `@helia/ipns` instance:
74
76
 
@@ -88,7 +90,7 @@ console.info(cid)
88
90
  // QmWebsite
89
91
  ```
90
92
 
91
- ## Example
93
+ ## Example - Using DNS-Over-HTTPS
92
94
 
93
95
  This example uses the Mozilla provided RFC 1035 DNS over HTTPS service. This
94
96
  uses binary DNS records so requires extra dependencies to process the
@@ -107,7 +109,7 @@ const cid = name.resolveDns('ipfs.io', {
107
109
  })
108
110
  ```
109
111
 
110
- ## Example
112
+ ## Example - Using DNS-JSON-Over-HTTPS
111
113
 
112
114
  DNS-JSON-Over-HTTPS resolvers use the RFC 8427 `application/dns-json` and can
113
115
  result in a smaller browser bundle due to the response being plain JSON.
@@ -123,21 +125,13 @@ const cid = name.resolveDns('ipfs.io', {
123
125
  })
124
126
  ```
125
127
 
126
- ## Table of contents <!-- omit in toc -->
127
-
128
- - [Install](#install)
129
- - [Browser `<script>` tag](#browser-script-tag)
130
- - [API Docs](#api-docs)
131
- - [License](#license)
132
- - [Contribute](#contribute)
133
-
134
- ## Install
128
+ # Install
135
129
 
136
130
  ```console
137
131
  $ npm i @helia/ipns
138
132
  ```
139
133
 
140
- ### Browser `<script>` tag
134
+ ## Browser `<script>` tag
141
135
 
142
136
  Loading this module through a script tag will make it's exports available as `HeliaIpns` in the global namespace.
143
137
 
@@ -145,18 +139,18 @@ Loading this module through a script tag will make it's exports available as `He
145
139
  <script src="https://unpkg.com/@helia/ipns/dist/index.min.js"></script>
146
140
  ```
147
141
 
148
- ## API Docs
142
+ # API Docs
149
143
 
150
144
  - <https://ipfs.github.io/helia-ipns/modules/_helia_ipns.html>
151
145
 
152
- ## License
146
+ # License
153
147
 
154
148
  Licensed under either of
155
149
 
156
150
  - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
157
151
  - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
158
152
 
159
- ## Contribute
153
+ # Contribute
160
154
 
161
155
  Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-ipns/issues).
162
156