Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: consolidate interface modules #1833

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 4 additions & 5 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,15 +89,14 @@
"generate": "protons ./src/keys/keys.proto"
},
"dependencies": {
"@libp2p/interface-keys": "^1.0.0",
"@libp2p/interfaces": "^3.0.0",
"@libp2p/interface": "~0.0.1",
"@noble/ed25519": "^1.6.0",
"@noble/secp256k1": "^1.5.4",
"multiformats": "^11.0.2",
"multiformats": "^12.0.1",
"node-forge": "^1.1.0",
"protons-runtime": "^5.0.0",
"uint8arraylist": "^2.4.3",
"uint8arrays": "^4.0.3"
"uint8arrays": "^4.0.4"
},
"devDependencies": {
"@types/mocha": "^10.0.0",
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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"
}
]
}
111 changes: 0 additions & 111 deletions packages/interface-address-manager/CHANGELOG.md

This file was deleted.

43 changes: 0 additions & 43 deletions packages/interface-address-manager/README.md

This file was deleted.

53 changes: 0 additions & 53 deletions packages/interface-address-manager/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages/interface-address-manager/tsconfig.json

This file was deleted.

9 changes: 9 additions & 0 deletions packages/interface-compliance-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Usage](#usage)
- [API Docs](#api-docs)
- [License](#license)
Expand All @@ -21,6 +22,14 @@
$ npm i @libp2p/interface-compliance-tests
```

### Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `Libp2pInterfaceComplianceTests` in the global namespace.

```html
<script src="https://unpkg.com/@libp2p/interface-compliance-tests/dist/index.min.js"></script>
```

## Usage

Each [interface](https://npmjs.org/packages/@libp2p/interfaces) has its documentation on how to use the compliance tests and should be used as the source of truth.
Expand Down
Loading