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

Commit

Permalink
chore: update interface deps (#1)
Browse files Browse the repository at this point in the history
Updates to latest interfaces, also lints readme file.
  • Loading branch information
achingbrain committed Jun 10, 2022
1 parent 7827da3 commit 3cf652d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 40 deletions.
32 changes: 16 additions & 16 deletions packages/libp2p-peer-id-factory/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
# libp2p-peer-id-factory <!-- omit in toc -->
# @libp2p/peer-id-factory <!-- omit in toc -->

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

- [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).

A Peer ID is the SHA-256 [multihash](https://github.com/multiformats/multihash) of a public key.

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'
Expand All @@ -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) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

### Contribution

Expand Down
5 changes: 3 additions & 2 deletions packages/libp2p-peer-id-factory/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-peer-id-factory/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ed25519PeerId> => {
const key = await generateKeyPair('Ed25519')
Expand Down
32 changes: 16 additions & 16 deletions packages/libp2p-peer-id/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# libp2p-peer-id <!-- omit in toc -->
# @libp2p/peer-id <!-- omit in toc -->

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

- [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'
Expand All @@ -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) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

### Contribution

Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-peer-id/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions packages/libp2p-peer-id/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3cf652d

Please sign in to comment.