@helia/ipns 3.0.1 → 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 +46 -9
- package/dist/index.min.js +24 -24
- package/dist/src/index.d.ts +10 -11
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -10
- package/dist/src/index.js.map +1 -1
- package/dist/src/routing/index.d.ts +3 -3
- package/dist/src/routing/index.d.ts.map +1 -1
- package/dist/src/routing/index.js +1 -1
- package/dist/src/routing/index.js.map +1 -1
- package/dist/src/routing/libp2p.d.ts +22 -0
- package/dist/src/routing/libp2p.d.ts.map +1 -0
- package/dist/src/routing/{dht.js → libp2p.js} +10 -6
- package/dist/src/routing/libp2p.js.map +1 -0
- package/dist/src/routing/pubsub.d.ts +9 -2
- package/dist/src/routing/pubsub.d.ts.map +1 -1
- package/dist/src/routing/pubsub.js +9 -9
- package/dist/src/routing/pubsub.js.map +1 -1
- package/dist/src/utils/dns.js +1 -1
- package/dist/src/utils/dns.js.map +1 -1
- package/dist/typedoc-urls.json +3 -1
- package/package.json +22 -18
- package/src/index.ts +11 -12
- package/src/routing/index.ts +3 -3
- package/src/routing/{dht.ts → libp2p.ts} +14 -10
- package/src/routing/pubsub.ts +10 -11
- package/src/utils/dns.ts +1 -1
- package/dist/src/routing/dht.d.ts +0 -18
- package/dist/src/routing/dht.d.ts.map +0 -1
- package/dist/src/routing/dht.js.map +0 -1
package/README.md
CHANGED
|
@@ -17,27 +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
26
|
import { ipns } from '@helia/ipns'
|
|
27
|
-
import {
|
|
27
|
+
import { libp2p, pubsub } from '@helia/ipns/routing'
|
|
28
28
|
import { unixfs } from '@helia/unixfs'
|
|
29
29
|
|
|
30
30
|
const helia = await createHelia()
|
|
31
31
|
const name = ipns(helia, {
|
|
32
32
|
routers: [
|
|
33
|
-
|
|
33
|
+
libp2p(helia),
|
|
34
34
|
pubsub(helia)
|
|
35
35
|
]
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
// create a public key to publish as an IPNS name
|
|
39
|
-
const keyInfo = await helia.libp2p.keychain.createKey('my-key')
|
|
40
|
-
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)
|
|
41
41
|
|
|
42
42
|
// store some data to publish
|
|
43
43
|
const fs = unixfs(helia)
|
|
@@ -50,7 +50,7 @@ await name.publish(peerId, cid)
|
|
|
50
50
|
const cid = name.resolve(peerId)
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
## Example
|
|
53
|
+
## Example - Using custom DNS over HTTPS resolvers
|
|
54
54
|
|
|
55
55
|
With default DNSResolver resolvers:
|
|
56
56
|
|
|
@@ -70,7 +70,7 @@ const name = ipns(helia, {
|
|
|
70
70
|
const cid = name.resolveDns('some-domain-with-dnslink-entry.com')
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
## Example
|
|
73
|
+
## Example - Resolving a domain with a dnslink entry
|
|
74
74
|
|
|
75
75
|
Calling `resolveDns` with the `@helia/ipns` instance:
|
|
76
76
|
|
|
@@ -90,7 +90,7 @@ console.info(cid)
|
|
|
90
90
|
// QmWebsite
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
## Example
|
|
93
|
+
## Example - Using DNS-Over-HTTPS
|
|
94
94
|
|
|
95
95
|
This example uses the Mozilla provided RFC 1035 DNS over HTTPS service. This
|
|
96
96
|
uses binary DNS records so requires extra dependencies to process the
|
|
@@ -109,7 +109,7 @@ const cid = name.resolveDns('ipfs.io', {
|
|
|
109
109
|
})
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
## Example
|
|
112
|
+
## Example - Using DNS-JSON-Over-HTTPS
|
|
113
113
|
|
|
114
114
|
DNS-JSON-Over-HTTPS resolvers use the RFC 8427 `application/dns-json` and can
|
|
115
115
|
result in a smaller browser bundle due to the response being plain JSON.
|
|
@@ -124,3 +124,40 @@ const cid = name.resolveDns('ipfs.io', {
|
|
|
124
124
|
]
|
|
125
125
|
})
|
|
126
126
|
```
|
|
127
|
+
|
|
128
|
+
# Install
|
|
129
|
+
|
|
130
|
+
```console
|
|
131
|
+
$ npm i @helia/ipns
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Browser `<script>` tag
|
|
135
|
+
|
|
136
|
+
Loading this module through a script tag will make it's exports available as `HeliaIpns` in the global namespace.
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<script src="https://unpkg.com/@helia/ipns/dist/index.min.js"></script>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
# API Docs
|
|
143
|
+
|
|
144
|
+
- <https://ipfs.github.io/helia-ipns/modules/_helia_ipns.html>
|
|
145
|
+
|
|
146
|
+
# License
|
|
147
|
+
|
|
148
|
+
Licensed under either of
|
|
149
|
+
|
|
150
|
+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
151
|
+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
152
|
+
|
|
153
|
+
# Contribute
|
|
154
|
+
|
|
155
|
+
Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-ipns/issues).
|
|
156
|
+
|
|
157
|
+
Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.
|
|
158
|
+
|
|
159
|
+
Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
|
|
160
|
+
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
[](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
|