Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
docs: publish api docs (#39)
Browse files Browse the repository at this point in the history
Updates project config to publish api docs
  • Loading branch information
achingbrain committed Dec 16, 2022
1 parent 1d5c3b7 commit 4477f4b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
node_modules
coverage
.nyc_output
build
dist
.docs
.coverage
node_modules
package-lock.json
yarn.lock
docs
dist
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# @libp2p/peer-record <!-- omit in toc -->

[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-peer-record.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-record)
[![CI](https://img.shields.io/github/workflow/status/libp2p/js-libp2p-interfaces/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-peer-record/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

> Used to transfer signed peer data across the network
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Description](#description)
- [Envelope](#envelope)
- [Usage](#usage)
Expand All @@ -22,16 +22,24 @@
- [Subsystem receiving a record](#subsystem-receiving-a-record)
- [Subsystem providing a record](#subsystem-providing-a-record)
- [Future Work](#future-work)
- [Example](#example)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/peer-record
```

### Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `Libp2pPeerRecord` in the global namespace.

```html
<script src="https://unpkg.com/@libp2p/peer-record/dist/index.min.js"></script>
```

## Description

Libp2p nodes need to store data in a public location (e.g. a DHT), or rely on potentially untrustworthy intermediaries to relay information over its lifetime. Accordingly, libp2p nodes need to be able to verify that the data came from a specific peer and that it hasn't been tampered with.
Expand Down Expand Up @@ -163,15 +171,9 @@ When a subsystem wants to provide a record, it will get it from the AddressBook,
- With the modular dialer, users should easily be able to configure precedence. With dialer v1, anything we do to prioritise dials is gonna be spaghetti and adhoc. With the modular dialer, you’d be able to specify the order of dials when instantiating the pipeline.
- Multiple parallel dials. We already have the issue where new addresses aren't added to existing dials.

## Example
## API Docs

```JavaScript
import { trackedMap } from '@libp2p/tracked-map'

const map = trackedMap<string, string>({ metrics })

map.set('key', 'value')
```
- <https://libp2p.github.io/js-libp2p-peer-record>

## License

Expand All @@ -180,6 +182,6 @@ Licensed under either of
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribute
## Contribution

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.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist/src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
Expand Down Expand Up @@ -142,7 +142,8 @@
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release"
"release": "aegir release",
"docs": "aegir docs"
},
"dependencies": {
"@libp2p/crypto": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/envelope/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Record, Envelope } from '@libp2p/interface-record'
import { Uint8ArrayList } from 'uint8arraylist'
import { unsigned } from 'uint8-varint'

export interface EnvelopeInit {
export interface RecordEnvelopeInit {
peerId: PeerId
payloadType: Uint8Array
payload: Uint8Array
Expand Down Expand Up @@ -82,7 +82,7 @@ export class RecordEnvelope implements Envelope {
* The Envelope is responsible for keeping an arbitrary signed record
* by a libp2p peer.
*/
constructor (init: EnvelopeInit) {
constructor (init: RecordEnvelopeInit) {
const { peerId, payloadType, payload, signature } = init

this.peerId = peerId
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

export { RecordEnvelope } from './envelope/index.js'
export type { RecordEnvelopeInit } from './envelope/index.js'
export { PeerRecord } from './peer-record/index.js'
export type { PeerRecordInit } from './peer-record/index.js'

0 comments on commit 4477f4b

Please sign in to comment.