# @libp2p/interface-peer-id

> Peer Identifier interface for libp2p

Latest version **2.0.2** (published 2023-05-04) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @libp2p/interface-peer-id
pnpm add @libp2p/interface-peer-id
yarn add @libp2p/interface-peer-id
bun add @libp2p/interface-peer-id
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-05-04 |
| First published | 2022-06-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 74 |
| Maintainers | jacobheun, npm-service-account-libp2p, alanshaw, vascosantos, achingbrain, daviddias |
| Keywords | interface, libp2p |

## Links

- npm: https://www.npmjs.com/package/@libp2p/interface-peer-id
- Repository: https://github.com/libp2p/js-libp2p-interfaces
- Homepage: https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-peer-id#readme
- Issues: https://github.com/libp2p/js-libp2p-interfaces/issues
- npm.io page: https://npm.io/package/@libp2p/interface-peer-id

## Dependencies (1)

- [multiformats](https://npm.io/package/multiformats.md) ^11.0.0

## Recent versions

- 2.0.2 (latest) — 2023-05-04
- 2.0.2-d853d124 (next) — 2023-06-19
- 2.0.2-ea8a0637 — 2023-06-19
- 2.0.2-ab0e3980 — 2023-06-19
- 2.0.2-3dfc236e — 2023-06-16
- 2.0.2-8c6b6d24 — 2023-06-15
- 2.0.2-d2f1eff4 — 2023-06-15
- 2.0.2-5a9fb4d6 — 2023-06-15
- 2.0.2-883082ca — 2023-06-15
- 2.0.2-1c6702c8 — 2023-06-15
- 2.0.1 — 2023-01-18
- 2.0.0 — 2023-01-06
- 1.1.2 — 2022-12-16
- 1.1.1 — 2022-12-14
- 1.1.0 — 2022-12-07
- … 9 more at https://npm.io/package/@libp2p/interface-peer-id/versions

## README

# @libp2p/interface-peer-id <!-- omit in toc -->

[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![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-interfaces.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-interfaces)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-interfaces/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

> Peer Identifier interface for libp2p

## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Modules that implement the interface](#modules-that-implement-the-interface)
- [Badge](#badge)
- [Usage](#usage)
  - [Node.js](#nodejs)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/interface-peer-id
```

The primary goal of this module is to enable developers to implement PeerId modules. This module and test suite was heavily inspired by earlier implementation of [PeerId](https://github.com/libp2p/js-peer-id).

Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite.

The API is presented with both Node.js and Go primitives, however, there is not actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through different stacks.

## Modules that implement the interface

- [JavaScript libp2p-peer-id](https://github.com/libp2p/js-libp2p-peer-id)

Send a PR to add a new one if you happen to find or write one.

## Badge

Include this badge in your readme if you make a new module that uses interface-peer-id API.

![](/img/badge.png)

## Usage

### Node.js

Install `libp2p-interfaces-compliance-tests` as one of the development dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do:

```js
const tests = require('libp2p-interfaces-compliance-tests/peer-id')

describe('your peer id', () => {
  // use all of the test suits
  tests({
    setup () {
      return YourPeerIdFactory
    },
    teardown () {
      // Clean up any resources created by setup()
    }
  })
})
```

## API Docs

- <https://libp2p.github.io/js-libp2p-interfaces/modules/_libp2p_interface_peer_id.html>

## 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>)

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

---
_Source: https://npm.io/package/@libp2p/interface-peer-id · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
