UNPKG

1.91 kBMarkdownView Raw
1libp2p-record JavaScript implementation
2=======================================
3
4[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) [[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) ![Build Status](https://travis-ci.org/diasdavid/js-libp2p-record.svg?style=flat-square)](https://travis-ci.org/diasdavid/js-libp2p-record) ![](https://img.shields.io/badge/coverage-%3F-yellow.svg?style=flat-square) [![Dependency Status](https://david-dm.org/diasdavid/js-libp2p-record.svg?style=flat-square)](https://david-dm.org/diasdavid/js-libp2p-record) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
5
6> JavaScript libp2p record object follows specification([IPRS](https://github.com/ipfs/specs/blob/master/records/README.md)) implementation
7
8# Description
9
10# Usage
11
12## Example record
13
14```
15// Record is a IPLD object
16{
17 '@context': {
18 mlink: 'http://merkle-link'
19 },
20 scheme: {
21 mlink: <hash to validity scheme or identifier for hard coded validity scheme>
22 },
23 expires: <data>, // datetime at which record expires
24 value: <data>, // the data that this Record Stores
25}
26```
27
28
29# Record types
30
31A record type should be identified by its validity scheme and a record validity scheme should be a MerkleDAG object containing its validity checking rules, however, for simplicity, we have developed 4 types of records, in which their validity schemes are hardcoded in this module. To identify which validity scheme to use, we use a enum:
32
33- a - signed, valid within a datetime range
34- b - signed, expiring after a Time-To-Live
35- c - signed, based on ancestry (chain)
36- d - signed, with cryptographic freshness
37
38Reference: https://github.com/ipfs/specs/tree/master/records#example-record-types