12
12
- [ Install] ( #install )
13
13
- [ Browser ` <script> ` tag] ( #browser-script-tag )
14
14
- [ Usage] ( #usage )
15
- - - [ Create record] ( #create-record )
16
- - [ Validate record] ( #validate-record )
17
- - [ Embed public key to record] ( #embed-public-key-to-record )
18
- - [ Extract public key from record] ( #extract-public-key-from-record )
19
- - [ Datastore key] ( #datastore-key )
20
- - [ Marshal data with proto buffer] ( #marshal-data-with-proto-buffer )
21
- - [ Unmarshal data from proto buffer] ( #unmarshal-data-from-proto-buffer )
22
- - [ Validator] ( #validator )
15
+ - [ Create record] ( #create-record )
16
+ - [ Validate record] ( #validate-record )
17
+ - [ Embed public key to record] ( #embed-public-key-to-record )
18
+ - [ Extract public key from record] ( #extract-public-key-from-record )
19
+ - [ Datastore key] ( #datastore-key )
20
+ - [ Marshal data with proto buffer] ( #marshal-data-with-proto-buffer )
21
+ - [ Unmarshal data from proto buffer] ( #unmarshal-data-from-proto-buffer )
22
+ - [ Validator] ( #validator )
23
23
- [ API] ( #api )
24
- - - [ Create record] ( #create-record-1 )
25
- - [ Validate record] ( #validate-record-1 )
26
- - [ Datastore key] ( #datastore-key-1 )
27
- - [ Marshal data with proto buffer] ( #marshal-data-with-proto-buffer-1 )
28
- - [ Unmarshal data from proto buffer] ( #unmarshal-data-from-proto-buffer-1 )
29
- - [ Embed public key to record] ( #embed-public-key-to-record-1 )
30
- - [ Extract public key from record] ( #extract-public-key-from-record-1 )
31
- - [ Namespace] ( #namespace )
32
- - [ Contribute] ( #contribute )
24
+ - [ Create record] ( #create-record-1 )
25
+ - [ Validate record] ( #validate-record-1 )
26
+ - [ Marshal data with proto buffer] ( #marshal-data-with-proto-buffer-1 )
27
+ - [ Unmarshal data from proto buffer] ( #unmarshal-data-from-proto-buffer-1 )
28
+ - [ Extract public key from record] ( #extract-public-key-from-record-1 )
29
+ - [ Namespace] ( #namespace )
33
30
- [ API Docs] ( #api-docs )
34
31
- [ License] ( #license )
35
- - [ Contribute] ( #contribute-1 )
32
+ - [ Contribute] ( #contribute )
36
33
37
34
## Install
38
35
@@ -50,21 +47,17 @@ Loading this module through a script tag will make it's exports available as `Ip
50
47
51
48
This module contains all the necessary code for creating, understanding and validating IPNS records.
52
49
53
- ## Lead Maintainer <!-- omit in toc -->
54
-
55
- [ Vasco Santos] ( https://github.com/vasco-santos ) .
56
-
57
50
## Usage
58
51
59
- #### Create record
52
+ ### Create record
60
53
61
54
``` js
62
55
import * as ipns from ' ipns'
63
56
64
57
const entryData = await ipns .create (privateKey, value, sequenceNumber, lifetime)
65
58
```
66
59
67
- #### Validate record
60
+ ### Validate record
68
61
69
62
``` js
70
63
import * as ipns from ' ipns'
@@ -73,23 +66,23 @@ await ipns.validate(publicKey, ipnsEntry)
73
66
// if no error thrown, the record is valid
74
67
```
75
68
76
- #### Embed public key to record
69
+ ### Embed public key to record
77
70
78
71
``` js
79
72
import * as ipns from ' ipns'
80
73
81
74
const ipnsEntryWithEmbedPublicKey = await ipns .embedPublicKey (publicKey, ipnsEntry)
82
75
```
83
76
84
- #### Extract public key from record
77
+ ### Extract public key from record
85
78
86
79
``` js
87
80
import * as ipns from ' ipns'
88
81
89
82
const publicKey = await ipns .extractPublicKey (peerId, ipnsEntry)
90
83
```
91
84
92
- #### Datastore key
85
+ ### Datastore key
93
86
94
87
``` js
95
88
import * as ipns from ' ipns'
@@ -101,7 +94,7 @@ Returns a key to be used for storing the ipns entry locally, that is:
101
94
102
95
/ipns/${base32(<HASH>)}
103
96
104
- #### Marshal data with proto buffer
97
+ ### Marshal data with proto buffer
105
98
106
99
``` js
107
100
import * as ipns from ' ipns'
@@ -114,7 +107,7 @@ const marshalledData = ipns.marshal(entryData)
114
107
115
108
Returns the entry data serialized.
116
109
117
- #### Unmarshal data from proto buffer
110
+ ### Unmarshal data from proto buffer
118
111
119
112
``` js
120
113
import * as ipns from ' ipns'
@@ -124,7 +117,7 @@ const data = ipns.unmarshal(storedData)
124
117
125
118
Returns the entry data structure after being serialized.
126
119
127
- #### Validator
120
+ ### Validator
128
121
129
122
``` js
130
123
import * as ipns from ' ipns'
@@ -140,7 +133,7 @@ The `select` function is responsible for deciding which ipns record is the best
140
133
141
134
## API
142
135
143
- #### Create record
136
+ ### Create record
144
137
145
138
``` js
146
139
@@ -168,7 +161,7 @@ Returns a `Promise` that resolves to an object with the entry's properties eg:
168
161
}
169
162
```
170
163
171
- #### Validate record
164
+ ### Validate record
172
165
173
166
``` js
174
167
ipns .validate (publicKey, ipnsEntry)
@@ -181,7 +174,7 @@ Validate an IPNS record previously stored in a protocol buffer.
181
174
182
175
Returns a ` Promise ` , which may be rejected if the validation was not successful.
183
176
184
- #### Marshal data with proto buffer
177
+ ### Marshal data with proto buffer
185
178
186
179
``` js
187
180
const marshalledData = ipns .marshal (entryData)
@@ -191,7 +184,7 @@ Returns the entry data serialized.
191
184
192
185
- ` entryData ` (Object): ipns entry record (obtained using the create function).
193
186
194
- #### Unmarshal data from proto buffer
187
+ ### Unmarshal data from proto buffer
195
188
196
189
``` js
197
190
const data = ipns .unmarshal (storedData)
@@ -201,7 +194,7 @@ Returns the entry data structure after being serialized.
201
194
202
195
- ` storedData ` (Uint8Array): ipns entry record serialized.
203
196
204
- #### Extract public key from record
197
+ ### Extract public key from record
205
198
206
199
``` js
207
200
const publicKey = await ipns .extractPublicKey (peerId, ipnsEntry)
@@ -214,7 +207,7 @@ Extract a public key from an IPNS entry.
214
207
215
208
Returns a ` Promise ` which resolves to public key ([ ` PublicKey ` ] ( https://github.com/libp2p/js-libp2p-interfaces/blob/master/packages/interface-keys/src/index.ts ) ): may be used for cryptographic operations.
216
209
217
- #### Namespace
210
+ ### Namespace
218
211
219
212
Namespace constants for records.
220
213
@@ -229,6 +222,7 @@ ipns.namespaceLength
229
222
230
223
// 6
231
224
```
225
+
232
226
## API Docs
233
227
234
228
- < https://ipfs.github.io/js-ipns >
0 commit comments