diff --git a/README.md b/README.md index 58a3f2c..f0a3b1c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,16 @@ -# js-libp2p-peer-record +# @libp2p/peer-record -[![test & maybe release](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-peer-record/actions/workflows/js-test-and-release.yml) +[![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) -> Peer records are signed records that contain the address information of network peers +> Used to transfer signed peer data across the network -## Table of Contents +## Table of contents +- [Install](#install) - [Description](#description) - [Envelope](#envelope) - [Usage](#usage) @@ -18,9 +23,14 @@ - [Subsystem providing a record](#subsystem-providing-a-record) - [Future Work](#future-work) - [Example](#example) -- [Installation](#installation) - [License](#license) - - [Contribution](#contribution) +- [Contribution](#contribution) + +## Install + +```console +$ npm i @libp2p/peer-record +``` ## Description @@ -122,7 +132,7 @@ The identify service is responsible for creating the self record when the identi #### Self record Updates -**_NOT_YET_IMPLEMENTED_** +***NOT\_YET\_IMPLEMENTED*** While creating peer records is fairly trivial, addresses are not static and might be modified at arbitrary times. This can happen via an Address Manager API, or even through AutoRelay/AutoNAT. @@ -163,19 +173,13 @@ const map = trackedMap({ metrics }) map.set('key', 'value') ``` -## Installation - -```console -$ npm i @libp2p/peer-record -``` - ## License 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) +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) -### Contribution +## 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. diff --git a/package.json b/package.json index fdb0728..95fffda 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ ], "exports": { ".": { + "types": "./src/index.d.ts", "import": "./dist/src/index.js" } }, @@ -140,10 +141,11 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/crypto": "^0.22.8", - "@libp2p/interfaces": "^2.0.0", + "@libp2p/crypto": "^1.0.0", + "@libp2p/interface-peer-id": "^1.0.2", + "@libp2p/interface-record": "^1.0.1", "@libp2p/logger": "^1.1.0", - "@libp2p/peer-id": "^1.1.0", + "@libp2p/peer-id": "^1.1.13", "@libp2p/utils": "^1.0.9", "@multiformats/multiaddr": "^10.1.5", "err-code": "^3.0.1", diff --git a/src/envelope/index.ts b/src/envelope/index.ts index f76095d..77b6031 100644 --- a/src/envelope/index.ts +++ b/src/envelope/index.ts @@ -7,8 +7,8 @@ import { equals as uint8arraysEquals } from 'uint8arrays/equals' import { codes } from '../errors.js' import { Envelope as Protobuf } from './envelope.js' import { peerIdFromKeys } from '@libp2p/peer-id' -import type { PeerId } from '@libp2p/interfaces/peer-id' -import type { Record, Envelope } from '@libp2p/interfaces/record' +import type { PeerId } from '@libp2p/interface-peer-id' +import type { Record, Envelope } from '@libp2p/interface-record' export interface EnvelopeInit { peerId: PeerId diff --git a/src/peer-record/index.ts b/src/peer-record/index.ts index 57ab0e6..41b079f 100644 --- a/src/peer-record/index.ts +++ b/src/peer-record/index.ts @@ -1,5 +1,5 @@ import { Multiaddr } from '@multiformats/multiaddr' -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' import { arrayEquals } from '@libp2p/utils/array-equals' import { peerIdFromBytes } from '@libp2p/peer-id' import { PeerRecord as Protobuf } from './peer-record.js' diff --git a/test/envelope.spec.ts b/test/envelope.spec.ts index 87648b0..f876f8d 100644 --- a/test/envelope.spec.ts +++ b/test/envelope.spec.ts @@ -4,8 +4,8 @@ import { equals as uint8arrayEquals } from 'uint8arrays/equals' import { RecordEnvelope } from '../src/envelope/index.js' import { codes as ErrorCodes } from '../src/errors.js' import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import type { Record } from '@libp2p/interfaces/record' -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { Record } from '@libp2p/interface-record' +import type { PeerId } from '@libp2p/interface-peer-id' const domain = 'libp2p-testing' const codec = uint8arrayFromString('/libp2p/testdata') diff --git a/test/peer-record.spec.ts b/test/peer-record.spec.ts index 0d02ac3..f9dd8e3 100644 --- a/test/peer-record.spec.ts +++ b/test/peer-record.spec.ts @@ -8,7 +8,7 @@ import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { RecordEnvelope } from '../src/envelope/index.js' import { PeerRecord } from '../src/peer-record/index.js' import { unmarshalPrivateKey } from '@libp2p/crypto/keys' -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' describe('interface-record compliance', () => { tests({