Skip to content

Commit

Permalink
fix!: consolidate interface modules
Browse files Browse the repository at this point in the history
Consolidates all interface modules to `@libp2p/interface-libp2p` for
external (eg. user-consumable) interfaces and `@libp2p/interface-internal`
for interfaces implemented or consumed by internal libp2p modules
(services, etc).

Closes #824
  • Loading branch information
achingbrain committed Jun 16, 2023
1 parent 3dfc236 commit fd76f2e
Show file tree
Hide file tree
Showing 545 changed files with 1,755 additions and 12,876 deletions.
26 changes: 16 additions & 10 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
{
"packages/peer-discovery-bootstrap": "8.0.0",
"packages/crypto": "1.0.17",
"packages/interface-address-manager":"3.0.1","packages/interface-compliance-tests":"3.0.7","packages/interface-connection":"5.1.1","packages/interface-connection-compliance-tests":"2.0.9","packages/interface-connection-encrypter":"4.0.1","packages/interface-connection-encrypter-compliance-tests":"5.0.1","packages/interface-connection-gater":"3.0.1","packages/interface-connection-manager":"3.0.1","packages/interface-content-routing":"2.1.1","packages/interface-dht":"2.0.3","packages/interface-keychain":"2.0.5","packages/interface-keys":"1.0.8","packages/interface-libp2p":"3.2.0","packages/interface-metrics":"4.0.8","packages/interface-mocks":"12.0.1","packages/interface-peer-discovery":"2.0.0","packages/interface-peer-discovery-compliance-tests":"2.0.8","packages/interface-peer-id":"2.0.2","packages/interface-peer-info":"1.0.10","packages/interface-peer-routing":"1.1.1","packages/interface-peer-store":"2.0.4","packages/interface-pubsub":"4.0.1","packages/interface-pubsub-compliance-tests":"5.0.9","packages/interface-record":"2.0.7","packages/interface-record-compliance-tests":"2.0.5","packages/interface-registrar":"2.0.12","packages/interface-stream-muxer":"4.1.2","packages/interface-stream-muxer-compliance-tests":"7.0.3","packages/interface-transport":"4.0.3","packages/interface-transport-compliance-tests":"4.0.2","packages/interfaces":"3.3.2",
"packages/interface-compliance-tests":"3.0.7",
"packages/interface-compliance-tests-connection":"2.0.9",
"packages/interface-compliance-tests-connection-encrypter":"5.0.1",
"packages/interface-compliance-tests-peer-discovery":"2.0.8",
"packages/interface-compliance-tests-stream-muxer":"7.0.3",
"packages/interface-compliance-tests-transport":"4.0.2",
"packages/interface-libp2p":"3.2.0",
"packages/interface-mocks":"12.0.1",
"packages/interface-peer-id":"2.0.2",
"packages/kad-dht": "9.3.6",
"packages/keychain": "2.0.1",
"packages/libp2p":"0.45.9",
"packages/logger":"2.1.1",
"packages/peer-discovery-mdns":"8.0.0",
"packages/stream-multiplexer-mplex":"8.0.4",
"packages/metrics-prometheus":"1.1.5",
"packages/multistream-select":"3.1.9",
"packages/peer-collections":"3.0.2",
"packages/peer-discovery-bootstrap": "8.0.0",
"packages/peer-discovery-mdns":"8.0.0",
"packages/peer-id":"2.0.3",
"packages/peer-id-factory":"2.0.3",
"packages/peer-record":"5.0.4",
"packages/peer-store":"8.2.1",
"packages/metrics-prometheus":"1.1.5",
"packages/record":"3.0.4",
"packages/transport-tcp":"7.0.3",
"packages/topology":"4.0.3",
"packages/stream-multiplexer-mplex":"8.0.4",
"packages/tracked-map":"3.0.3",
"packages/utils": "3.0.12",
"packages/transport-tcp":"7.0.3",
"packages/transport-webrtc":"2.0.10",
"packages/transport-websockets":"6.0.3",
"packages/transport-webtransport":"2.0.2"
"packages/transport-webtransport":"2.0.2",
"packages/utils": "3.0.12"
}
34 changes: 5 additions & 29 deletions .release-please.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,15 @@
"group-pull-request-title-pattern": "chore: release ${component}",
"packages": {
"packages/crypto": {},
"packages/interface-address-manager": {},
"packages/interface-compliance-tests": {},
"packages/interface-connection": {},
"packages/interface-connection-compliance-tests": {},
"packages/interface-connection-encrypter": {},
"packages/interface-connection-encrypter-compliance-tests": {},
"packages/interface-connection-gater": {},
"packages/interface-connection-manager": {},
"packages/interface-content-routing": {},
"packages/interface-dht": {},
"packages/interface-keychain": {},
"packages/interface-keys": {},
"packages/interface-compliance-tests-connection": {},
"packages/interface-compliance-tests-connection-encrypter": {},
"packages/interface-compliance-tests-peer-discovery": {},
"packages/interface-compliance-tests-stream-muxer": {},
"packages/interface-compliance-tests-transport": {},
"packages/interface-libp2p": {},
"packages/interface-metrics": {},
"packages/interface-mocks": {},
"packages/interface-peer-discovery": {},
"packages/interface-peer-discovery-compliance-tests": {},
"packages/interface-peer-id": {},
"packages/interface-peer-info": {},
"packages/interface-peer-routing": {},
"packages/interface-peer-store": {},
"packages/interface-pubsub": {},
"packages/interface-pubsub-compliance-tests": {},
"packages/interface-record": {},
"packages/interface-record-compliance-tests": {},
"packages/interface-registrar": {},
"packages/interface-stream-muxer": {},
"packages/interface-stream-muxer-compliance-tests": {},
"packages/interface-transport": {},
"packages/interface-transport-compliance-tests": {},
"packages/interfaces": {},
"packages/kad-dht": {},
"packages/keychain": {},
"packages/libp2p": {},
Expand All @@ -49,9 +27,7 @@
"packages/peer-id-factory": {},
"packages/peer-record": {},
"packages/peer-store": {},
"packages/record": {},
"packages/stream-multiplexer-mplex": {},
"packages/topology": {},
"packages/tracked-map": {},
"packages/transport-tcp": {},
"packages/transport-webrtc": {},
Expand Down
6 changes: 2 additions & 4 deletions doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- [Modules](#modules)
- [Transport](#transport)
- [Stream Multiplexing](#stream-multiplexing)
- [Muxer Selection](#muxer-selection)
- [Connection Encryption](#connection-encryption)
- [Peer Discovery](#peer-discovery)
- [Content Routing](#content-routing)
Expand Down Expand Up @@ -32,7 +31,6 @@
- [Configuring PeerStore](#configuring-peerstore)
- [Customizing Transports](#customizing-transports)
- [Configuring AutoNAT](#configuring-autonat)
- [Configuring UPnP NAT Traversal](#configuring-upnp-nat-traversal)
- [Browser support](#browser-support)
- [UPnP and NAT-PMP](#upnp-and-nat-pmp)
- [Configuring protocol name](#configuring-protocol-name)
Expand Down Expand Up @@ -590,7 +588,7 @@ Libp2p allows you to setup a secure keychain to manage your keys. The keychain c
| pass | `string` | Passphrase to use in the keychain (minimum of 20 characters). |
| dek | `DEKConfig` | the default options for generating the derived encryption key, which, along with the passphrase are input to the PBKDF2 function. For more info see: https://github.com/libp2p/js-libp2p-keychain |

The keychain will store keys encrypted in the datastore which default is an in memory datastore. If you want to store the keys on disc you need to initialize libp2p with a suitable datastore implementation.
The keychain will store keys encrypted in the datastore which default is an in memory datastore. If you want to store the keys on disc you need to initialize libp2p with a suitable datastore implementation.

```js
import { createLibp2p } from 'libp2p'
Expand Down Expand Up @@ -786,7 +784,7 @@ import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { FaultTolerance } from '@libp2p/interface-transport'
import { FaultTolerance } from '@libp2p/interface-libp2p/transport'

const node = await createLibp2p({
transports: [
Expand Down
2 changes: 1 addition & 1 deletion doc/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const node = await createLibp2p({
To define component metrics first get a reference to the metrics object:

```ts
import type { Metrics } from '@libp2p/interface-metrics'
import type { Metrics } from '@libp2p/interface-libp2p/metrics'

interface MyClassComponents {
metrics: Metrics
Expand Down
5 changes: 2 additions & 3 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"scripts": {
"clean": "aegir clean",
"lint": "aegir lint",
"dep-check": "aegir dep-check -i protons",
"dep-check": "aegir dep-check",
"build": "aegir build",
"test": "aegir test",
"test:chrome": "aegir test -t browser",
Expand All @@ -89,8 +89,7 @@
"generate": "protons ./src/keys/keys.proto"
},
"dependencies": {
"@libp2p/interface-keys": "^1.0.0",
"@libp2p/interfaces": "^3.0.0",
"@libp2p/interface-libp2p": "^3.2.0",
"@noble/ed25519": "^1.6.0",
"@noble/secp256k1": "^1.5.4",
"multiformats": "^11.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/aes/cipher-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'

const CIPHER_MODES = {
16: 'aes-128-ctr',
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/ecdh-browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/ecdh.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from 'crypto'
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import type { ECDHKey, ECDHKeyPair } from './interface.js'

const curves = {
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/ed25519-class.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { base58btc } from 'multiformats/bases/base58'
import { identity } from 'multiformats/hashes/identity'
import { sha256 } from 'multiformats/hashes/sha2'
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/src/keys/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'node-forge/lib/asn1.js'
import 'node-forge/lib/pbe.js'
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
// @ts-expect-error types are missing
import forge from 'node-forge/lib/forge.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
Expand All @@ -11,7 +11,7 @@ import { keyStretcher } from './key-stretcher.js'
import * as keysPBM from './keys.js'
import * as RSA from './rsa-class.js'
import * as Secp256k1 from './secp256k1-class.js'
import type { PrivateKey, PublicKey } from '@libp2p/interface-keys'
import type { PrivateKey, PublicKey } from '@libp2p/interface-libp2p/keys'

export { keyStretcher }
export { generateEphemeralKeyPair }
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/key-stretcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as hmac from '../hmac/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/rsa-browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import randomBytes from '../random-bytes.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/rsa-class.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { sha256 } from 'multiformats/hashes/sha2'
// @ts-expect-error types are missing
import forge from 'node-forge/lib/forge.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/rsa-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'node-forge/lib/asn1.js'
import 'node-forge/lib/rsa.js'
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
// @ts-expect-error types are missing
import forge from 'node-forge/lib/forge.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/rsa.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from 'crypto'
import { promisify } from 'util'
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import randomBytes from '../random-bytes.js'
import * as utils from './rsa-utils.js'
import type { JWKKeyPair } from './interface.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/secp256k1-class.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { sha256 } from 'multiformats/hashes/sha2'
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/keys/secp256k1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import * as secp from '@noble/secp256k1'
import { sha256 } from 'multiformats/hashes/sha2'

Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/pbkdf2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
// @ts-expect-error types are missing
import forgePbkdf2 from 'node-forge/lib/pbkdf2.js'
// @ts-expect-error types are missing
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/random-bytes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError } from '@libp2p/interfaces/errors'
import { CodeError } from '@libp2p/interface-libp2p/errors'
import { utils } from '@noble/secp256k1'

export default function randomBytes (length: number): Uint8Array {
Expand Down
5 changes: 1 addition & 4 deletions packages/crypto/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
],
"references": [
{
"path": "../interface-keys"
},
{
"path": "../interfaces"
"path": "../interface-libp2p"
}
]
}
111 changes: 0 additions & 111 deletions packages/interface-address-manager/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit fd76f2e

Please sign in to comment.