diff --git a/packages/libp2p-peer-id-factory/README.md b/packages/libp2p-peer-id-factory/README.md index 820ffc4..08c30ae 100644 --- a/packages/libp2p-peer-id-factory/README.md +++ b/packages/libp2p-peer-id-factory/README.md @@ -1,18 +1,24 @@ -# libp2p-peer-id-factory +# @libp2p/peer-id-factory [![test & maybe release](https://github.com/libp2p/js-libp2p-peer-id/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-peer-id/actions/workflows/js-test-and-release.yml) -> create peer-ids in JavaScript +> Create PeerId instances -## Table of Contents +## Table of contents +- [Install](#install) - [Description](#description) - [Example](#example) -- [Installation](#installation) - - [License](#license) - - [Contribution](#contribution) +- [License](#license) + - [Contribution](#contribution) -# Description +## Install + +```console +$ npm i @libp2p/peer-id-factory +``` + +## Description Generate, import, and export PeerIDs, for use with [IPFS](https://github.com/ipfs/ipfs). @@ -20,7 +26,7 @@ A Peer ID is the SHA-256 [multihash](https://github.com/multiformats/multihash) The public key is a base64 encoded string of a protobuf containing an RSA DER buffer. This uses a node buffer to pass the base64 encoded public key protobuf to the multihash for ID generation. -# Example +## Example ```JavaScript import { createEd25519PeerId } from '@libp2p/peer-id-factory' @@ -33,18 +39,12 @@ console.log(id.toString()) 12D3KooWRm8J3iL796zPFi2EtGGtUJn58AG67gcqzMFHZnnsTzqD ``` -# Installation - -```console -$ npm i libp2p-peer-id-factory -``` - ## 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 diff --git a/packages/libp2p-peer-id-factory/package.json b/packages/libp2p-peer-id-factory/package.json index c333766..62495ff 100644 --- a/packages/libp2p-peer-id-factory/package.json +++ b/packages/libp2p-peer-id-factory/package.json @@ -1,7 +1,7 @@ { "name": "@libp2p/peer-id-factory", "version": "1.0.11", - "description": "IPFS Peer Id implementation in Node.js", + "description": "Create PeerId instances", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/libp2p/js-libp2p-peer-id/tree/master/packages/libp2p-peer-id-factory#readme", "repository": { @@ -139,7 +139,8 @@ }, "dependencies": { "@libp2p/crypto": "^0.22.8", - "@libp2p/interfaces": "^2.0.0", + "@libp2p/interface-keys": "^0.0.1", + "@libp2p/interface-peer-id": "^0.0.1", "@libp2p/peer-id": "^1.1.0", "multiformats": "^9.6.3", "protons-runtime": "^1.0.4", diff --git a/packages/libp2p-peer-id-factory/src/index.ts b/packages/libp2p-peer-id-factory/src/index.ts index 7a78750..ed751ec 100644 --- a/packages/libp2p-peer-id-factory/src/index.ts +++ b/packages/libp2p-peer-id-factory/src/index.ts @@ -2,8 +2,8 @@ import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicK import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id' import { PeerIdProto } from './proto.js' -import type { PublicKey, PrivateKey } from '@libp2p/interfaces/keys' -import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/interfaces/peer-id' +import type { PublicKey, PrivateKey } from '@libp2p/interface-keys' +import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/interface-peer-id' export const createEd25519PeerId = async (): Promise => { const key = await generateKeyPair('Ed25519') diff --git a/packages/libp2p-peer-id/README.md b/packages/libp2p-peer-id/README.md index 7a7fde8..d53c739 100644 --- a/packages/libp2p-peer-id/README.md +++ b/packages/libp2p-peer-id/README.md @@ -1,22 +1,28 @@ -# libp2p-peer-id +# @libp2p/peer-id [![test & maybe release](https://github.com/libp2p/js-libp2p-peer-id/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-peer-id/actions/workflows/js-test-and-release.yml) -> peer-ids in JavaScript +> Implementation of @libp2p/interface-peer-d -## Table of Contents +## Table of contents +- [Install](#install) - [Description](#description) - [Example](#example) -- [Installation](#installation) - - [License](#license) - - [Contribution](#contribution) +- [License](#license) + - [Contribution](#contribution) -# Description +## Install + +```console +$ npm i @libp2p/peer-id +``` + +## Description A basic implementation of a peer id -# Example +## Example ```JavaScript import { PeerId } from '@libp2p/peer-id' @@ -26,18 +32,12 @@ const id = new PeerId(...) console.log(id.toCid()) ``` -# Installation - -```console -$ npm i libp2p-peer-id -``` - ## 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 diff --git a/packages/libp2p-peer-id/package.json b/packages/libp2p-peer-id/package.json index b188868..de69625 100644 --- a/packages/libp2p-peer-id/package.json +++ b/packages/libp2p-peer-id/package.json @@ -1,7 +1,7 @@ { "name": "@libp2p/peer-id", "version": "1.1.11", - "description": "libp2p PeerId implementation in JavaScript", + "description": "Implementation of @libp2p/interface-peer-d", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/libp2p/js-libp2p-peer-id/tree/master/packages/libp2p-peer-id#readme", "repository": { @@ -133,7 +133,7 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/interfaces": "^2.0.0", + "@libp2p/interface-peer-id": "^0.0.1", "err-code": "^3.0.1", "multiformats": "^9.6.3", "uint8arrays": "^3.0.0" diff --git a/packages/libp2p-peer-id/src/index.ts b/packages/libp2p-peer-id/src/index.ts index d868e4d..867b015 100644 --- a/packages/libp2p-peer-id/src/index.ts +++ b/packages/libp2p-peer-id/src/index.ts @@ -6,10 +6,10 @@ import { identity } from 'multiformats/hashes/identity' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { sha256 } from 'multiformats/hashes/sha2' import errcode from 'err-code' -import { Ed25519PeerId, RSAPeerId, Secp256k1PeerId, symbol } from '@libp2p/interfaces/peer-id' +import { Ed25519PeerId, RSAPeerId, Secp256k1PeerId, symbol } from '@libp2p/interface-peer-id' import type { MultibaseDecoder } from 'multiformats/bases/interface' import type { MultihashDigest } from 'multiformats/hashes/interface' -import type { PeerId } from '@libp2p/interfaces/peer-id' +import type { PeerId } from '@libp2p/interface-peer-id' const baseDecoder = Object .values(bases)