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

feat!: update to latest interfaces #3

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# js-libp2p-peer-record <!-- omit in toc -->
# @libp2p/peer-record <!-- omit in toc -->

[![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 <!-- omit in toc -->
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Description](#description)
- [Envelope](#envelope)
- [Usage](#usage)
Expand All @@ -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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -163,19 +173,13 @@ const map = trackedMap<string, string>({ 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) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/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.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
],
"exports": {
".": {
"types": "./src/index.d.ts",
"import": "./dist/src/index.js"
}
},
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/envelope/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/peer-record/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 2 additions & 2 deletions test/envelope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion test/peer-record.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down