You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the entry data structure after being serialized.
118
+
Returns the `IPNSRecord` after being serialized.
119
119
120
120
### Validator
121
121
@@ -129,15 +129,15 @@ Contains an object with `validate (marshalledData, key)` and `select (dataA, dat
129
129
130
130
The `validate` async function aims to verify if an IPNS record is valid. First the record is unmarshalled, then the public key is obtained and finally the record is validated (`signatureV2` of CBOR `data` is verified).
131
131
132
-
The `select` function is responsible for deciding which ipns record is the best (newer) between two records. Both records are unmarshalled and their sequence numbers are compared. If the first record provided is the newer, the operation result will be `0`, otherwise the operation result will be `1`.
132
+
The `select` function is responsible for deciding which IPNS record is the best (newer) between two records. Both records are unmarshalled and their sequence numbers are compared. If the first record provided is the newer, the operation result will be `0`, otherwise the operation result will be `1`.
Returns a `Promise` that resolves to an object with the entry's properties eg:
151
-
152
-
```js
153
-
{
154
-
value:Uint8Array,
155
-
signature:Uint8Array, // V1 (legacy, ignored)
156
-
validityType:0,
157
-
validity:Uint8Array,
158
-
sequence:2,
159
-
signatureV2:Uint8Array, // V2 signature of data field
160
-
data:Uint8Array// DAG-CBOR that was signed
161
-
}
162
-
```
151
+
Returns a `Promise` that resolves to an object with a `IPNSRecord`.
163
152
164
153
### Validate record
165
154
166
155
```js
167
-
ipns.validate(publicKey, ipnsEntry)
156
+
ipns.validate(publicKey, ipnsRecord)
168
157
```
169
158
170
159
Validate an IPNS record previously stored in a protocol buffer.
171
160
172
161
-`publicKey` (`PubKey`[RSA Instance](https://github.com/libp2p/js-libp2p-crypto/blob/master/src/keys/rsa-class.js)): key to be used for cryptographic operations.
173
-
-`ipnsEntry` (Object): ipns entry record (obtained using the create function).
162
+
-`ipnsRecord` (`IPNSRecord`): ipns record record (obtained using the create function).
174
163
175
164
Returns a `Promise`, which may be rejected if the validation was not successful.
176
165
177
166
### Marshal data with proto buffer
178
167
179
168
```js
180
-
constmarshalledData=ipns.marshal(entryData)
169
+
constmarshalledData=ipns.marshal(ipnsRecord)
181
170
```
182
171
183
-
Returns the entry data serialized.
172
+
Returns the serialized IPNS record.
184
173
185
-
-`entryData` (Object): ipns entry record (obtained using the create function).
174
+
-`ipnsRecord` (`IPNSRecord`): ipns record (obtained using the create function).
186
175
187
176
### Unmarshal data from proto buffer
188
177
189
178
```js
190
179
constdata=ipns.unmarshal(storedData)
191
180
```
192
181
193
-
Returns the entry data structure after being serialized.
182
+
Returns a `IPNSRecord` after being serialized.
194
183
195
-
-`storedData` (Uint8Array): ipns entry record serialized.
184
+
-`storedData` (Uint8Array): ipns record serialized.
-`ipnsEntry` (Object): ipns entry record (obtained using the create function).
195
+
-`ipnsRecord` (`IPNSRecord`): ipns record (obtained using the create function).
207
196
208
197
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.
0 commit comments