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

Commit 3448776

Browse files
authored
feat!: update to latest interfaces (#3)
BREAKING CHANGE: uses new single-issue libp2p interface modules
1 parent b5d5b0d commit 3448776

File tree

6 files changed

+31
-25
lines changed

6 files changed

+31
-25
lines changed

README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
# js-libp2p-peer-record <!-- omit in toc -->
1+
# @libp2p/peer-record <!-- omit in toc -->
22

3-
[![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)
3+
[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
4+
[![IRC](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
5+
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
6+
[![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)
7+
[![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)
48

5-
> Peer records are signed records that contain the address information of network peers
9+
> Used to transfer signed peer data across the network
610
7-
## Table of Contents <!-- omit in toc -->
11+
## Table of contents <!-- omit in toc -->
812

13+
- [Install](#install)
914
- [Description](#description)
1015
- [Envelope](#envelope)
1116
- [Usage](#usage)
@@ -18,9 +23,14 @@
1823
- [Subsystem providing a record](#subsystem-providing-a-record)
1924
- [Future Work](#future-work)
2025
- [Example](#example)
21-
- [Installation](#installation)
2226
- [License](#license)
23-
- [Contribution](#contribution)
27+
- [Contribution](#contribution)
28+
29+
## Install
30+
31+
```console
32+
$ npm i @libp2p/peer-record
33+
```
2434

2535
## Description
2636

@@ -122,7 +132,7 @@ The identify service is responsible for creating the self record when the identi
122132

123133
#### Self record Updates
124134

125-
**_NOT_YET_IMPLEMENTED_**
135+
***NOT\_YET\_IMPLEMENTED***
126136

127137
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.
128138

@@ -163,19 +173,13 @@ const map = trackedMap<string, string>({ metrics })
163173
map.set('key', 'value')
164174
```
165175

166-
## Installation
167-
168-
```console
169-
$ npm i @libp2p/peer-record
170-
```
171-
172176
## License
173177

174178
Licensed under either of
175179

176-
* Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0)
177-
* MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT)
180+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
181+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
178182

179-
### Contribution
183+
## Contribution
180184

181185
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.

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
],
2929
"exports": {
3030
".": {
31+
"types": "./src/index.d.ts",
3132
"import": "./dist/src/index.js"
3233
}
3334
},
@@ -140,10 +141,11 @@
140141
"release": "aegir release"
141142
},
142143
"dependencies": {
143-
"@libp2p/crypto": "^0.22.8",
144-
"@libp2p/interfaces": "^2.0.0",
144+
"@libp2p/crypto": "^1.0.0",
145+
"@libp2p/interface-peer-id": "^1.0.2",
146+
"@libp2p/interface-record": "^1.0.1",
145147
"@libp2p/logger": "^1.1.0",
146-
"@libp2p/peer-id": "^1.1.0",
148+
"@libp2p/peer-id": "^1.1.13",
147149
"@libp2p/utils": "^1.0.9",
148150
"@multiformats/multiaddr": "^10.1.5",
149151
"err-code": "^3.0.1",

src/envelope/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { equals as uint8arraysEquals } from 'uint8arrays/equals'
77
import { codes } from '../errors.js'
88
import { Envelope as Protobuf } from './envelope.js'
99
import { peerIdFromKeys } from '@libp2p/peer-id'
10-
import type { PeerId } from '@libp2p/interfaces/peer-id'
11-
import type { Record, Envelope } from '@libp2p/interfaces/record'
10+
import type { PeerId } from '@libp2p/interface-peer-id'
11+
import type { Record, Envelope } from '@libp2p/interface-record'
1212

1313
export interface EnvelopeInit {
1414
peerId: PeerId

src/peer-record/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Multiaddr } from '@multiformats/multiaddr'
2-
import type { PeerId } from '@libp2p/interfaces/peer-id'
2+
import type { PeerId } from '@libp2p/interface-peer-id'
33
import { arrayEquals } from '@libp2p/utils/array-equals'
44
import { peerIdFromBytes } from '@libp2p/peer-id'
55
import { PeerRecord as Protobuf } from './peer-record.js'

test/envelope.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { equals as uint8arrayEquals } from 'uint8arrays/equals'
44
import { RecordEnvelope } from '../src/envelope/index.js'
55
import { codes as ErrorCodes } from '../src/errors.js'
66
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
7-
import type { Record } from '@libp2p/interfaces/record'
8-
import type { PeerId } from '@libp2p/interfaces/peer-id'
7+
import type { Record } from '@libp2p/interface-record'
8+
import type { PeerId } from '@libp2p/interface-peer-id'
99

1010
const domain = 'libp2p-testing'
1111
const codec = uint8arrayFromString('/libp2p/testdata')

test/peer-record.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createEd25519PeerId } from '@libp2p/peer-id-factory'
88
import { RecordEnvelope } from '../src/envelope/index.js'
99
import { PeerRecord } from '../src/peer-record/index.js'
1010
import { unmarshalPrivateKey } from '@libp2p/crypto/keys'
11-
import type { PeerId } from '@libp2p/interfaces/peer-id'
11+
import type { PeerId } from '@libp2p/interface-peer-id'
1212

1313
describe('interface-record compliance', () => {
1414
tests({

0 commit comments

Comments
 (0)