mirror of
https://github.com/waku-org/js-waku.git
synced 2025-02-17 06:47:29 +00:00
Merge pull request #995 from waku-org/feat/split-dns-discovery
feat!: extract utils, dns discovery and enr from core
This commit is contained in:
commit
d1476d6e1c
@ -25,7 +25,7 @@ module.exports = [
|
||||
},
|
||||
{
|
||||
name: "DNS discovery",
|
||||
path: "packages/core/bundle/lib/peer_discovery_dns.js",
|
||||
path: "packages/dns-discovery/bundle/index.js",
|
||||
import: "{ PeerDiscoveryDns }",
|
||||
},
|
||||
{
|
||||
|
509
package-lock.json
generated
509
package-lock.json
generated
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "root",
|
||||
"name": "@waku/root",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "root",
|
||||
"name": "@waku/root",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
@ -182,9 +182,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.0.tgz",
|
||||
"integrity": "sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg==",
|
||||
"version": "7.20.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.1.tgz",
|
||||
"integrity": "sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
@ -5272,6 +5272,10 @@
|
||||
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@waku/byte-utils": {
|
||||
"resolved": "packages/byte-utils",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@waku/core": {
|
||||
"resolved": "packages/core",
|
||||
"link": true
|
||||
@ -5280,6 +5284,14 @@
|
||||
"resolved": "packages/create",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@waku/dns-discovery": {
|
||||
"resolved": "packages/dns-discovery",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@waku/enr": {
|
||||
"resolved": "packages/enr",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@waku/interfaces": {
|
||||
"resolved": "packages/interfaces",
|
||||
"link": true
|
||||
@ -22345,6 +22357,64 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"packages/byte-utils": {
|
||||
"name": "@waku/byte-utils",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"packages/byte-utils/node_modules/multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/byte-utils/node_modules/uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"dependencies": {
|
||||
"multiformats": "^10.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@waku/core",
|
||||
"version": "0.0.1",
|
||||
@ -22352,7 +22422,6 @@
|
||||
"dependencies": {
|
||||
"@chainsafe/libp2p-gossipsub": "^4.1.1",
|
||||
"@chainsafe/libp2p-noise": "^8.0.1",
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-connection": "3.0.1",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
@ -22366,10 +22435,9 @@
|
||||
"@libp2p/websockets": "^3.0.3",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
"@waku/byte-utils": "*",
|
||||
"@waku/interfaces": "*",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"hi-base32": "^0.5.1",
|
||||
"it-all": "^1.0.6",
|
||||
"it-length-prefixed": "^8.0.2",
|
||||
"it-pipe": "^2.0.4",
|
||||
@ -22378,11 +22446,10 @@
|
||||
"p-event": "^5.0.1",
|
||||
"protons-runtime": "^3.1.0",
|
||||
"uint8arraylist": "^2.3.2",
|
||||
"uint8arrays": "^3.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
@ -22457,7 +22524,16 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/core/node_modules/@multiformats/multiaddr/node_modules/uint8arrays": {
|
||||
"packages/core/node_modules/multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/core/node_modules/uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
@ -22469,15 +22545,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/core/node_modules/multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/create": {
|
||||
"name": "@waku/create",
|
||||
"version": "0.0.1",
|
||||
@ -22516,6 +22583,186 @@
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"packages/dns-discovery": {
|
||||
"name": "@waku/dns-discovery",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
"@libp2p/interface-peer-info": "^1.0.1",
|
||||
"@libp2p/interfaces": "^3.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@waku/byte-utils": "*",
|
||||
"@waku/enr": "*",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"hi-base32": "^0.5.1",
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"chai": "^4.3.4",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"packages/dns-discovery/node_modules/@chainsafe/is-ip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@chainsafe/is-ip/-/is-ip-2.0.1.tgz",
|
||||
"integrity": "sha512-nqSJ8u2a1Rv9FYbyI8qpDhTYujaKEyLknNrTejLYoSWmdeg+2WB7R6BZqPZYfrJzDxVi3rl6ZQuoaEvpKRZWgQ==",
|
||||
"dev": true
|
||||
},
|
||||
"packages/dns-discovery/node_modules/@multiformats/multiaddr": {
|
||||
"version": "11.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@multiformats/multiaddr/-/multiaddr-11.0.7.tgz",
|
||||
"integrity": "sha512-rCqYS3Qz/dm4H/1Lvda11OBZf1tH8rst69GWK9jDy8AY+3n+NBBdErA/SRtdcRx6hPtQ8lAB5UhHlzIVbViv1Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@chainsafe/is-ip": "^2.0.1",
|
||||
"dns-over-http-resolver": "^2.1.0",
|
||||
"err-code": "^3.0.1",
|
||||
"multiformats": "^10.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"varint": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/dns-discovery/node_modules/multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/dns-discovery/node_modules/uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"dependencies": {
|
||||
"multiformats": "^10.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/enr": {
|
||||
"name": "@waku/enr",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-peer-id": "^1.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
"@waku/byte-utils": "*",
|
||||
"js-sha3": "^0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"chai": "^4.3.6",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"ts-loader": "^9.4.1",
|
||||
"typescript": "^4.6.3",
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"packages/enr/node_modules/@multiformats/multiaddr": {
|
||||
"version": "11.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@multiformats/multiaddr/-/multiaddr-11.0.6.tgz",
|
||||
"integrity": "sha512-5TvEdCc5uFqcwGA+IwSw49swyHtUbwjhjwF3WQcV9vkzTv1C8oEWhoD2QcsiomDRk8rdqqRyDH6wlZExvLnxjw==",
|
||||
"dependencies": {
|
||||
"@chainsafe/is-ip": "^1.0.0",
|
||||
"dns-over-http-resolver": "^2.1.0",
|
||||
"err-code": "^3.0.1",
|
||||
"multiformats": "^10.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"varint": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/enr/node_modules/multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A==",
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/enr/node_modules/uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"dependencies": {
|
||||
"multiformats": "^10.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"packages/interfaces": {
|
||||
"name": "@waku/interfaces",
|
||||
"version": "0.0.1",
|
||||
@ -22765,9 +23012,9 @@
|
||||
}
|
||||
},
|
||||
"@babel/parser": {
|
||||
"version": "7.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.0.tgz",
|
||||
"integrity": "sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg==",
|
||||
"version": "7.20.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.1.tgz",
|
||||
"integrity": "sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw==",
|
||||
"dev": true
|
||||
},
|
||||
"@chainsafe/is-ip": {
|
||||
@ -26835,12 +27082,56 @@
|
||||
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@waku/byte-utils": {
|
||||
"version": "file:packages/byte-utils",
|
||||
"requires": {
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3",
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A=="
|
||||
},
|
||||
"uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"requires": {
|
||||
"multiformats": "^10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@waku/core": {
|
||||
"version": "file:packages/core",
|
||||
"requires": {
|
||||
"@chainsafe/libp2p-gossipsub": "^4.1.1",
|
||||
"@chainsafe/libp2p-noise": "^8.0.1",
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-connection": "3.0.1",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
@ -26851,7 +27142,6 @@
|
||||
"@libp2p/interfaces": "^3.0.2",
|
||||
"@libp2p/mplex": "^5.1.1",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@libp2p/websockets": "^3.0.3",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
@ -26873,12 +27163,12 @@
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"@waku/byte-utils": "*",
|
||||
"@waku/interfaces": "*",
|
||||
"app-root-path": "^3.0.0",
|
||||
"chai": "^4.3.4",
|
||||
"cspell": "^5.14.0",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
@ -26887,7 +27177,6 @@
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"fast-check": "^2.14.0",
|
||||
"gh-pages": "^3.2.3",
|
||||
"hi-base32": "^0.5.1",
|
||||
"ignore-loader": "^0.1.2",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"it-all": "^1.0.6",
|
||||
@ -26919,7 +27208,7 @@
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.6.3",
|
||||
"uint8arraylist": "^2.3.2",
|
||||
"uint8arrays": "^3.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -26934,22 +27223,20 @@
|
||||
"multiformats": "^10.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"varint": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"requires": {
|
||||
"multiformats": "^10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A=="
|
||||
},
|
||||
"uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"requires": {
|
||||
"multiformats": "^10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -26984,6 +27271,152 @@
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
},
|
||||
"@waku/dns-discovery": {
|
||||
"version": "file:packages/dns-discovery",
|
||||
"requires": {
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
"@libp2p/interface-peer-info": "^1.0.1",
|
||||
"@libp2p/interfaces": "^3.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"@waku/byte-utils": "*",
|
||||
"@waku/enr": "*",
|
||||
"chai": "^4.3.4",
|
||||
"cspell": "^5.14.0",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"hi-base32": "^0.5.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3",
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@chainsafe/is-ip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@chainsafe/is-ip/-/is-ip-2.0.1.tgz",
|
||||
"integrity": "sha512-nqSJ8u2a1Rv9FYbyI8qpDhTYujaKEyLknNrTejLYoSWmdeg+2WB7R6BZqPZYfrJzDxVi3rl6ZQuoaEvpKRZWgQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@multiformats/multiaddr": {
|
||||
"version": "11.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@multiformats/multiaddr/-/multiaddr-11.0.7.tgz",
|
||||
"integrity": "sha512-rCqYS3Qz/dm4H/1Lvda11OBZf1tH8rst69GWK9jDy8AY+3n+NBBdErA/SRtdcRx6hPtQ8lAB5UhHlzIVbViv1Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@chainsafe/is-ip": "^2.0.1",
|
||||
"dns-over-http-resolver": "^2.1.0",
|
||||
"err-code": "^3.0.1",
|
||||
"multiformats": "^10.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"varint": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A=="
|
||||
},
|
||||
"uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"requires": {
|
||||
"multiformats": "^10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@waku/enr": {
|
||||
"version": "file:packages/enr",
|
||||
"requires": {
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-peer-id": "^1.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"@waku/byte-utils": "*",
|
||||
"chai": "^4.3.6",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"ts-loader": "^9.4.1",
|
||||
"typescript": "^4.6.3",
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@multiformats/multiaddr": {
|
||||
"version": "11.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@multiformats/multiaddr/-/multiaddr-11.0.6.tgz",
|
||||
"integrity": "sha512-5TvEdCc5uFqcwGA+IwSw49swyHtUbwjhjwF3WQcV9vkzTv1C8oEWhoD2QcsiomDRk8rdqqRyDH6wlZExvLnxjw==",
|
||||
"requires": {
|
||||
"@chainsafe/is-ip": "^1.0.0",
|
||||
"dns-over-http-resolver": "^2.1.0",
|
||||
"err-code": "^3.0.1",
|
||||
"multiformats": "^10.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"varint": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"multiformats": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/multiformats/-/multiformats-10.0.2.tgz",
|
||||
"integrity": "sha512-nJEHLFOYhO4L+aNApHhCnWqa31FyqAHv9Q77AhmwU3KsM2f1j7tuJpCk5ByZ33smzycNCpSG5klNIejIyfFx2A=="
|
||||
},
|
||||
"uint8arrays": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-4.0.2.tgz",
|
||||
"integrity": "sha512-8CWXXZdOvVrIL4SeY/Gnp+idxxiGK4XFkP4FY26Sx/fpTz/b6vv4BVWELMDzQweSyyhdcuAcU14H6izzB6k1Cw==",
|
||||
"requires": {
|
||||
"multiformats": "^10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@waku/interfaces": {
|
||||
"version": "file:packages/interfaces",
|
||||
"requires": {
|
||||
|
6
packages/byte-utils/.eslintrc.cjs
Normal file
6
packages/byte-utils/.eslintrc.cjs
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: "./tsconfig.dev.json",
|
||||
},
|
||||
};
|
4
packages/byte-utils/.prettierignore
Normal file
4
packages/byte-utils/.prettierignore
Normal file
@ -0,0 +1,4 @@
|
||||
build
|
||||
bundle
|
||||
dist
|
||||
node_modules
|
179
packages/byte-utils/package.json
Normal file
179
packages/byte-utils/package.json
Normal file
@ -0,0 +1,179 @@
|
||||
{
|
||||
"name": "@waku/byte-utils",
|
||||
"version": "0.0.1",
|
||||
"description": "Utilities to manipulate and convert byte arrays",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Waku Team",
|
||||
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/byte-utils#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/waku-org/js-waku.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/waku-org/js-waku/issues"
|
||||
},
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"keywords": [
|
||||
"waku",
|
||||
"decentralized",
|
||||
"secure",
|
||||
"communication",
|
||||
"web3",
|
||||
"ethereum",
|
||||
"dapps",
|
||||
"privacy"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "run-s build:**",
|
||||
"build:esm": "tsc",
|
||||
"build:bundle": "rollup --config rollup.config.js",
|
||||
"fix": "run-s fix:*",
|
||||
"fix:prettier": "prettier . --write",
|
||||
"fix:lint": "eslint src --ext .ts --ext .cjs --fix",
|
||||
"check": "run-s check:*",
|
||||
"check:lint": "eslint src --ext .ts",
|
||||
"check:prettier": "prettier . --list-different",
|
||||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.dev.json",
|
||||
"prepublish": "npm run build",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
|
||||
"release": "semantic-release"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"uint8arrays": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"release": {
|
||||
"branches": [
|
||||
"master"
|
||||
],
|
||||
"extends": "semantic-release-monorepo",
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"releaseRules": [
|
||||
{
|
||||
"breaking": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"revert": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "feat",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "deps",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "no-release",
|
||||
"release": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/release-notes-generator",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"presetConfig": {
|
||||
"types": [
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes"
|
||||
},
|
||||
{
|
||||
"type": "chore",
|
||||
"section": "Trivial Changes"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"section": "Documentation"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"section": "Tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/github",
|
||||
"@semantic-release/git"
|
||||
]
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "./src/index.ts"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bundle",
|
||||
"src/*.ts",
|
||||
"src/lib/**/*.ts",
|
||||
"src/proto/**/*.ts",
|
||||
"!**/*.spec.*",
|
||||
"!**/*.json",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
]
|
||||
}
|
21
packages/byte-utils/rollup.config.js
Normal file
21
packages/byte-utils/rollup.config.js
Normal file
@ -0,0 +1,21 @@
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
||||
|
||||
export default {
|
||||
input: {
|
||||
index: "dist/index.js",
|
||||
},
|
||||
output: {
|
||||
dir: "bundle",
|
||||
format: "esm",
|
||||
},
|
||||
plugins: [
|
||||
commonjs(),
|
||||
json(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
preferBuiltins: false,
|
||||
}),
|
||||
],
|
||||
};
|
8
packages/byte-utils/tsconfig.dev.json
Normal file
8
packages/byte-utils/tsconfig.dev.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": []
|
||||
}
|
54
packages/byte-utils/tsconfig.json
Normal file
54
packages/byte-utils/tsconfig.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"target": "es2020",
|
||||
"outDir": "dist/",
|
||||
"rootDir": "src",
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
"resolveJsonModule": true /* Include modules imported with .json extension. */,
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo",
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
"strictFunctionTypes": true /* Enable strict checking of function types. */,
|
||||
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
||||
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
||||
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
||||
|
||||
/* Additional Checks */
|
||||
"noUnusedLocals": true /* Report errors on unused locals. */,
|
||||
"noUnusedParameters": true /* Report errors on unused parameters. */,
|
||||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
||||
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/* Debugging Options */
|
||||
"traceResolution": false /* Report module resolution log messages. */,
|
||||
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
|
||||
"listFiles": false /* Print names of files part of the compilation. */,
|
||||
"pretty": true /* Stylize errors and messages using color and context. */,
|
||||
|
||||
// Due to broken types in indirect dependencies
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
||||
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
||||
|
||||
"lib": ["es2020", "dom"],
|
||||
"types": ["node", "mocha"],
|
||||
"typeRoots": ["node_modules/@types", "src/types"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.spec.ts", "src/test_utils"],
|
||||
"compileOnSave": false,
|
||||
"ts-node": {
|
||||
"files": true
|
||||
}
|
||||
}
|
@ -18,24 +18,9 @@ module.exports = function (config) {
|
||||
},
|
||||
},
|
||||
webpack: {
|
||||
mode: "production",
|
||||
mode: "development",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(js|tsx?)$/,
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
options: { configFile: "tsconfig.karma.json" },
|
||||
},
|
||||
],
|
||||
exclude: /(node_modules)|(node\.spec\.ts)/,
|
||||
},
|
||||
{
|
||||
test: /node\.spec\.ts$/,
|
||||
use: "ignore-loader",
|
||||
},
|
||||
],
|
||||
rules: [{ test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" }],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
@ -46,7 +31,12 @@ module.exports = function (config) {
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
extensions: [".ts", ".tsx", ".js"],
|
||||
extensionAlias: {
|
||||
".js": [".js", ".ts"],
|
||||
".cjs": [".cjs", ".cts"],
|
||||
".mjs": [".mjs", ".mts"],
|
||||
},
|
||||
},
|
||||
stats: { warnings: false },
|
||||
devtool: "inline-source-map",
|
||||
|
@ -9,14 +9,6 @@
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./lib/enr": {
|
||||
"types": "./dist/lib/enr/index.d.ts",
|
||||
"import": "./dist/lib/enr/index.js"
|
||||
},
|
||||
"./lib/peer_discovery_dns": {
|
||||
"types": "./dist/lib/peer_discovery_dns/index.d.ts",
|
||||
"import": "./dist/lib/peer_discovery_dns/index.js"
|
||||
},
|
||||
"./lib/peer_discovery_static_list": {
|
||||
"types": "./dist/lib/peer_discovery_static_list.d.ts",
|
||||
"import": "./dist/lib/peer_discovery_static_list.js"
|
||||
@ -25,10 +17,6 @@
|
||||
"types": "./dist/lib/predefined_bootstrap_nodes.d.ts",
|
||||
"import": "./dist/lib/predefined_bootstrap_nodes.js"
|
||||
},
|
||||
"./lib/utils": {
|
||||
"types": "./dist/lib/utils.d.ts",
|
||||
"import": "./dist/lib/utils.js"
|
||||
},
|
||||
"./lib/wait_for_remote_peer": {
|
||||
"types": "./dist/lib/wait_for_remote_peer.d.ts",
|
||||
"import": "./dist/lib/wait_for_remote_peer.js"
|
||||
@ -106,9 +94,9 @@
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@waku/byte-utils": "*",
|
||||
"@chainsafe/libp2p-gossipsub": "^4.1.1",
|
||||
"@chainsafe/libp2p-noise": "^8.0.1",
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-connection": "3.0.1",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
@ -124,8 +112,6 @@
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
"@waku/interfaces": "*",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"hi-base32": "^0.5.1",
|
||||
"it-all": "^1.0.6",
|
||||
"it-length-prefixed": "^8.0.2",
|
||||
"it-pipe": "^2.0.4",
|
||||
@ -134,11 +120,10 @@
|
||||
"p-event": "^5.0.1",
|
||||
"protons-runtime": "^3.1.0",
|
||||
"uint8arraylist": "^2.3.2",
|
||||
"uint8arrays": "^3.0.0",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
|
@ -5,11 +5,8 @@ import json from "@rollup/plugin-json";
|
||||
export default {
|
||||
input: {
|
||||
index: "dist/index.js",
|
||||
"lib/enr": "dist/lib/enr/index.js",
|
||||
"lib/peer_discovery_dns": "dist/lib/peer_discovery_dns/index.js",
|
||||
"lib/peer_discovery_static_list": "dist/lib/peer_discovery_static_list.js",
|
||||
"lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js",
|
||||
"lib/utils": "dist/lib/utils.js",
|
||||
"lib/wait_for_remote_peer": "dist/lib/wait_for_remote_peer.js",
|
||||
"lib/waku_message/version_0": "dist/lib/waku_message/version_0.js",
|
||||
"lib/waku_message/version_1": "dist/lib/waku_message/version_1.js",
|
||||
|
@ -6,10 +6,6 @@ export {
|
||||
getPublicKey,
|
||||
} from "./lib/crypto";
|
||||
|
||||
export * as enr from "./lib/enr";
|
||||
|
||||
export * as utils from "./lib/utils";
|
||||
|
||||
export * as proto_message from "./proto/message";
|
||||
export * as proto_topic_only_message from "./proto/topic_only_message";
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import nodeCrypto from "crypto";
|
||||
|
||||
import * as secp from "@noble/secp256k1";
|
||||
import { concat } from "@waku/byte-utils";
|
||||
import sha3 from "js-sha3";
|
||||
|
||||
import { concat } from "./utils";
|
||||
import { Asymmetric, Symmetric } from "./waku_message/constants";
|
||||
|
||||
declare const self: Record<string, any> | undefined;
|
||||
@ -74,27 +74,3 @@ export async function sign(
|
||||
export function keccak256(input: Uint8Array): Uint8Array {
|
||||
return new Uint8Array(sha3.keccak256.arrayBuffer(input));
|
||||
}
|
||||
|
||||
export function compressPublicKey(publicKey: Uint8Array): Uint8Array {
|
||||
if (publicKey.length === 64) {
|
||||
publicKey = concat([new Uint8Array([4]), publicKey], 65);
|
||||
}
|
||||
const point = secp.Point.fromHex(publicKey);
|
||||
return point.toRawBytes(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify an ECDSA signature.
|
||||
*/
|
||||
export function verifySignature(
|
||||
signature: Uint8Array,
|
||||
message: Uint8Array | string,
|
||||
publicKey: Uint8Array
|
||||
): boolean {
|
||||
try {
|
||||
const _signature = secp.Signature.fromCompact(signature.slice(0, 64));
|
||||
return secp.verify(_signature, message, publicKey);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
export * from "./constants";
|
||||
export * from "./enr";
|
||||
export * from "./types";
|
||||
export * from "./keypair";
|
||||
export * from "./waku2_codec";
|
@ -1,7 +1,7 @@
|
||||
import * as secp from "@noble/secp256k1";
|
||||
import { concat, hexToBytes } from "@waku/byte-utils";
|
||||
|
||||
import { getSubtle, randomBytes, sha256 } from "../crypto";
|
||||
import { concat, hexToBytes } from "../utils";
|
||||
/**
|
||||
* HKDF as implemented in go-ethereum.
|
||||
*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
import * as secp from "@noble/secp256k1";
|
||||
import { concat, hexToBytes } from "@waku/byte-utils";
|
||||
import type { Decoder, Encoder, Message, ProtoMessage } from "@waku/interfaces";
|
||||
import debug from "debug";
|
||||
|
||||
import * as proto from "../../proto/message";
|
||||
import { keccak256, randomBytes, sign } from "../crypto";
|
||||
import { concat, hexToBytes } from "../utils";
|
||||
|
||||
import { Symmetric } from "./constants";
|
||||
import * as ecies from "./ecies";
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.dev",
|
||||
"compilerOptions": {
|
||||
"noEmit": false
|
||||
}
|
||||
}
|
6
packages/dns-discovery/.eslintrc.cjs
Normal file
6
packages/dns-discovery/.eslintrc.cjs
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: "./tsconfig.dev.json",
|
||||
},
|
||||
};
|
4
packages/dns-discovery/.prettierignore
Normal file
4
packages/dns-discovery/.prettierignore
Normal file
@ -0,0 +1,4 @@
|
||||
build
|
||||
bundle
|
||||
dist
|
||||
node_modules
|
45
packages/dns-discovery/karma.conf.cjs
Normal file
45
packages/dns-discovery/karma.conf.cjs
Normal file
@ -0,0 +1,45 @@
|
||||
process.env.CHROME_BIN = require("puppeteer").executablePath();
|
||||
const webpack = require("webpack");
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
frameworks: ["webpack", "mocha"],
|
||||
files: ["src/**/*.ts"],
|
||||
preprocessors: {
|
||||
"src/**/*.ts": ["webpack"],
|
||||
},
|
||||
envPreprocessor: ["CI"],
|
||||
reporters: ["progress"],
|
||||
browsers: ["ChromeHeadless"],
|
||||
singleRun: true,
|
||||
client: {
|
||||
mocha: {
|
||||
timeout: 6000, // Default is 2s
|
||||
},
|
||||
},
|
||||
webpack: {
|
||||
mode: "development",
|
||||
module: {
|
||||
rules: [{ test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" }],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.CI": process.env.CI || false,
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: "process/browser.js",
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js"],
|
||||
extensionAlias: {
|
||||
".js": [".js", ".ts"],
|
||||
".cjs": [".cjs", ".cts"],
|
||||
".mjs": [".mjs", ".mts"],
|
||||
},
|
||||
},
|
||||
stats: { warnings: false },
|
||||
devtool: "inline-source-map",
|
||||
},
|
||||
});
|
||||
};
|
196
packages/dns-discovery/package.json
Normal file
196
packages/dns-discovery/package.json
Normal file
@ -0,0 +1,196 @@
|
||||
{
|
||||
"name": "@waku/dns-discovery",
|
||||
"version": "0.0.1",
|
||||
"description": "DNS Peer Discovery (EIP-1459)",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"dist/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Waku Team",
|
||||
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/dns-discovery#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/waku-org/js-waku.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/waku-org/js-waku/issues"
|
||||
},
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"keywords": [
|
||||
"waku",
|
||||
"decentralized",
|
||||
"secure",
|
||||
"communication",
|
||||
"web3",
|
||||
"ethereum",
|
||||
"dapps",
|
||||
"privacy"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "run-s build:**",
|
||||
"build:esm": "tsc",
|
||||
"build:bundle": "rollup --config rollup.config.js",
|
||||
"fix": "run-s fix:*",
|
||||
"fix:prettier": "prettier . --write",
|
||||
"fix:lint": "eslint src --ext .ts --ext .cjs --fix",
|
||||
"check": "run-s check:*",
|
||||
"check:lint": "eslint src --ext .ts",
|
||||
"check:prettier": "prettier . --list-different",
|
||||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.dev.json",
|
||||
"prepublish": "npm run build",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
|
||||
"release": "semantic-release"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@waku/enr": "*",
|
||||
"@waku/byte-utils": "*",
|
||||
"hi-base32": "^0.5.1",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"uint8arrays": "^4.0.2",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
"@libp2p/interface-peer-info": "^1.0.1",
|
||||
"@libp2p/interfaces": "^3.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"chai": "^4.3.4",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"release": {
|
||||
"branches": [
|
||||
"master"
|
||||
],
|
||||
"extends": "semantic-release-monorepo",
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"releaseRules": [
|
||||
{
|
||||
"breaking": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"revert": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "feat",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "deps",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "no-release",
|
||||
"release": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/release-notes-generator",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"presetConfig": {
|
||||
"types": [
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes"
|
||||
},
|
||||
{
|
||||
"type": "chore",
|
||||
"section": "Trivial Changes"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"section": "Documentation"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"section": "Tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/github",
|
||||
"@semantic-release/git"
|
||||
]
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "./src/index.ts"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bundle",
|
||||
"src/**/*.ts",
|
||||
"!**/*.spec.*",
|
||||
"!**/*.json",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
]
|
||||
}
|
21
packages/dns-discovery/rollup.config.js
Normal file
21
packages/dns-discovery/rollup.config.js
Normal file
@ -0,0 +1,21 @@
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
||||
|
||||
export default {
|
||||
input: {
|
||||
index: "dist/index.js",
|
||||
},
|
||||
output: {
|
||||
dir: "bundle",
|
||||
format: "esm",
|
||||
},
|
||||
plugins: [
|
||||
commonjs(),
|
||||
json(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
preferBuiltins: false,
|
||||
}),
|
||||
],
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { DnsClient, DnsNodeDiscovery } from "./dns";
|
||||
import { DnsClient, DnsNodeDiscovery } from "./dns.js";
|
||||
import testData from "./testdata.json" assert { type: "json" };
|
||||
|
||||
const mockData = testData.dns;
|
@ -1,13 +1,12 @@
|
||||
import { ENR } from "@waku/enr";
|
||||
import debug from "debug";
|
||||
|
||||
import { ENR } from "../enr";
|
||||
|
||||
import { DnsOverHttps } from "./dns_over_https";
|
||||
import { ENRTree } from "./enrtree";
|
||||
import { DnsOverHttps } from "./dns_over_https.js";
|
||||
import { ENRTree } from "./enrtree.js";
|
||||
import {
|
||||
fetchNodesUntilCapabilitiesFulfilled,
|
||||
yieldNodesUntilCapabilitiesFulfilled,
|
||||
} from "./fetch_nodes";
|
||||
} from "./fetch_nodes.js";
|
||||
|
||||
const log = debug("waku:discovery:dns");
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { bytesToUtf8 } from "@waku/byte-utils";
|
||||
import debug from "debug";
|
||||
import { Endpoint, query, toEndpoint } from "dns-query";
|
||||
|
||||
import { bytesToUtf8 } from "../utils";
|
||||
|
||||
import { DnsClient } from "./dns";
|
||||
import { DnsClient } from "./dns.js";
|
||||
|
||||
const log = debug("waku:dns-over-https");
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { ENRTree } from "./enrtree";
|
||||
import { ENRTree } from "./enrtree.js";
|
||||
import testData from "./testdata.json" assert { type: "json" };
|
||||
|
||||
const dns = testData.dns;
|
@ -1,10 +1,9 @@
|
||||
import { utf8ToBytes } from "@waku/byte-utils";
|
||||
import { ENR } from "@waku/enr";
|
||||
import { keccak256, verifySignature } from "@waku/enr";
|
||||
import base32 from "hi-base32";
|
||||
import { fromString } from "uint8arrays/from-string";
|
||||
|
||||
import { keccak256, verifySignature } from "../crypto";
|
||||
import { ENR } from "../enr";
|
||||
import { utf8ToBytes } from "../utils";
|
||||
|
||||
export type ENRRootValues = {
|
||||
eRoot: string;
|
||||
lRoot: string;
|
@ -1,10 +1,9 @@
|
||||
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import { ENR, Waku2 } from "@waku/enr";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { ENR, Waku2 } from "../enr";
|
||||
|
||||
import { fetchNodesUntilCapabilitiesFulfilled } from "./fetch_nodes";
|
||||
import { fetchNodesUntilCapabilitiesFulfilled } from "./fetch_nodes.js";
|
||||
|
||||
async function createEnr(waku2: Waku2): Promise<ENR> {
|
||||
const peerId = await createSecp256k1PeerId();
|
@ -1,8 +1,7 @@
|
||||
import { ENR, Waku2 } from "@waku/enr";
|
||||
import debug from "debug";
|
||||
|
||||
import { ENR, Waku2 } from "../enr";
|
||||
|
||||
import { NodeCapabilityCount } from "./dns";
|
||||
import { NodeCapabilityCount } from "./dns.js";
|
||||
|
||||
const log = debug("waku:discovery:fetch_nodes");
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { getPseudoRandomSubset } from "../random_subset";
|
||||
import { getPseudoRandomSubset } from "./random_subset.js";
|
||||
|
||||
describe("Discovery", () => {
|
||||
it("returns all values when wanted number matches available values", function () {
|
@ -5,12 +5,11 @@ import type {
|
||||
import { symbol } from "@libp2p/interface-peer-discovery";
|
||||
import type { PeerInfo } from "@libp2p/interface-peer-info";
|
||||
import { CustomEvent, EventEmitter } from "@libp2p/interfaces/events";
|
||||
import { ENR } from "@waku/enr";
|
||||
import debug from "debug";
|
||||
|
||||
import { ENR } from "../enr";
|
||||
import { multiaddrsToPeerInfo } from "../multiaddr_to_peer_info";
|
||||
|
||||
import { DnsNodeDiscovery, NodeCapabilityCount } from "./dns";
|
||||
import { DnsNodeDiscovery, NodeCapabilityCount } from "./dns.js";
|
||||
import { multiaddrsToPeerInfo } from "./multiaddr_to_peer_info.js";
|
||||
|
||||
const log = debug("waku:peer-discovery-dns");
|
||||
|
17
packages/dns-discovery/src/multiaddr_to_peer_info.ts
Normal file
17
packages/dns-discovery/src/multiaddr_to_peer_info.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { PeerInfo } from "@libp2p/interface-peer-info";
|
||||
import { peerIdFromString } from "@libp2p/peer-id";
|
||||
import { Multiaddr } from "@multiformats/multiaddr";
|
||||
|
||||
export function multiaddrsToPeerInfo(mas: Multiaddr[]): PeerInfo[] {
|
||||
return mas
|
||||
.map((ma) => {
|
||||
const peerIdStr = ma.getPeerId();
|
||||
const protocols: string[] = [];
|
||||
return {
|
||||
id: peerIdStr ? peerIdFromString(peerIdStr) : null,
|
||||
multiaddrs: [ma.decapsulateCode(421)],
|
||||
protocols,
|
||||
};
|
||||
})
|
||||
.filter((peerInfo): peerInfo is PeerInfo => peerInfo.id !== null);
|
||||
}
|
30
packages/dns-discovery/src/random_subset.ts
Normal file
30
packages/dns-discovery/src/random_subset.ts
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Return pseudo random subset of the input.
|
||||
*/
|
||||
export function getPseudoRandomSubset<T>(
|
||||
values: T[],
|
||||
wantedNumber: number
|
||||
): T[] {
|
||||
if (values.length <= wantedNumber || values.length <= 1) {
|
||||
return values;
|
||||
}
|
||||
|
||||
return shuffle(values).slice(0, wantedNumber);
|
||||
}
|
||||
|
||||
function shuffle<T>(arr: T[]): T[] {
|
||||
if (arr.length <= 1) {
|
||||
return arr;
|
||||
}
|
||||
const randInt = (): number => {
|
||||
return Math.floor(Math.random() * Math.floor(arr.length));
|
||||
};
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const j = randInt();
|
||||
const tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
}
|
||||
return arr;
|
||||
}
|
8
packages/dns-discovery/tsconfig.dev.json
Normal file
8
packages/dns-discovery/tsconfig.dev.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": []
|
||||
}
|
54
packages/dns-discovery/tsconfig.json
Normal file
54
packages/dns-discovery/tsconfig.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"target": "es2020",
|
||||
"outDir": "dist/",
|
||||
"rootDir": "src",
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
"resolveJsonModule": true /* Include modules imported with .json extension. */,
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo",
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
"strictFunctionTypes": true /* Enable strict checking of function types. */,
|
||||
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
||||
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
||||
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
||||
|
||||
/* Additional Checks */
|
||||
"noUnusedLocals": true /* Report errors on unused locals. */,
|
||||
"noUnusedParameters": true /* Report errors on unused parameters. */,
|
||||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
||||
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/* Debugging Options */
|
||||
"traceResolution": false /* Report module resolution log messages. */,
|
||||
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
|
||||
"listFiles": false /* Print names of files part of the compilation. */,
|
||||
"pretty": true /* Stylize errors and messages using color and context. */,
|
||||
|
||||
// Due to broken types in indirect dependencies
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
||||
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
||||
|
||||
"lib": ["es2020", "dom"],
|
||||
"types": ["node", "mocha"],
|
||||
"typeRoots": ["node_modules/@types", "src/types"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.spec.ts", "src/test_utils"],
|
||||
"compileOnSave": false,
|
||||
"ts-node": {
|
||||
"files": true
|
||||
}
|
||||
}
|
6
packages/enr/.eslintrc.cjs
Normal file
6
packages/enr/.eslintrc.cjs
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: "./tsconfig.dev.json",
|
||||
},
|
||||
};
|
11
packages/enr/.mocharc.json
Normal file
11
packages/enr/.mocharc.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extension": ["ts"],
|
||||
"spec": "src/**/*.spec.ts",
|
||||
"require": ["ts-node/register", "isomorphic-fetch", "jsdom-global/register"],
|
||||
"loader": "ts-node/esm",
|
||||
"node-option": [
|
||||
"experimental-specifier-resolution=node",
|
||||
"loader=ts-node/esm"
|
||||
],
|
||||
"exit": true
|
||||
}
|
4
packages/enr/.prettierignore
Normal file
4
packages/enr/.prettierignore
Normal file
@ -0,0 +1,4 @@
|
||||
build
|
||||
bundle
|
||||
dist
|
||||
node_modules
|
45
packages/enr/karma.conf.cjs
Normal file
45
packages/enr/karma.conf.cjs
Normal file
@ -0,0 +1,45 @@
|
||||
process.env.CHROME_BIN = require("puppeteer").executablePath();
|
||||
const webpack = require("webpack");
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
frameworks: ["webpack", "mocha"],
|
||||
files: ["src/**/*.ts"],
|
||||
preprocessors: {
|
||||
"src/**/*.ts": ["webpack"],
|
||||
},
|
||||
envPreprocessor: ["CI"],
|
||||
reporters: ["progress"],
|
||||
browsers: ["ChromeHeadless"],
|
||||
singleRun: true,
|
||||
client: {
|
||||
mocha: {
|
||||
timeout: 6000, // Default is 2s
|
||||
},
|
||||
},
|
||||
webpack: {
|
||||
mode: "development",
|
||||
module: {
|
||||
rules: [{ test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" }],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.CI": process.env.CI || false,
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: "process/browser.js",
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js"],
|
||||
extensionAlias: {
|
||||
".js": [".js", ".ts"],
|
||||
".cjs": [".cjs", ".cts"],
|
||||
".mjs": [".mjs", ".mts"],
|
||||
},
|
||||
},
|
||||
stats: { warnings: false },
|
||||
devtool: "inline-source-map",
|
||||
},
|
||||
});
|
||||
};
|
191
packages/enr/package.json
Normal file
191
packages/enr/package.json
Normal file
@ -0,0 +1,191 @@
|
||||
{
|
||||
"name": "@waku/enr",
|
||||
"version": "0.0.1",
|
||||
"description": "ENR (EIP-778) for Waku",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Waku Team",
|
||||
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/enr#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/waku-org/js-waku.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/waku-org/js-waku/issues"
|
||||
},
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"keywords": [
|
||||
"waku",
|
||||
"decentralized",
|
||||
"secure",
|
||||
"communication",
|
||||
"web3",
|
||||
"ethereum",
|
||||
"dapps",
|
||||
"privacy"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "run-s build:**",
|
||||
"build:esm": "tsc",
|
||||
"build:bundle": "rollup --config rollup.config.js",
|
||||
"fix": "run-s fix:*",
|
||||
"fix:prettier": "prettier . --write",
|
||||
"fix:lint": "eslint src --ext .ts --ext .cjs --fix",
|
||||
"check": "run-s check:*",
|
||||
"check:lint": "eslint src --ext .ts",
|
||||
"check:prettier": "prettier . --list-different",
|
||||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.dev.json",
|
||||
"test": "run-s test:*",
|
||||
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha",
|
||||
"test:browser": "karma start karma.conf.cjs",
|
||||
"prepublish": "npm run build",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
|
||||
"release": "semantic-release"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.4",
|
||||
"@libp2p/interface-peer-id": "^1.0.2",
|
||||
"@libp2p/peer-id": "^1.1.10",
|
||||
"@multiformats/multiaddr": "^11.0.6",
|
||||
"@noble/secp256k1": "^1.3.4",
|
||||
"@waku/byte-utils": "*",
|
||||
"js-sha3": "^0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"uint8arrays": "^4.0.2",
|
||||
"@libp2p/peer-id-factory": "^1.0.15",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^8.0.6",
|
||||
"@semantic-release/npm": "^9.0.1",
|
||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"@typescript-eslint/parser": "^5.8.1",
|
||||
"chai": "^4.3.6",
|
||||
"cspell": "^5.14.0",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-functional": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.1",
|
||||
"rollup": "^2.75.0",
|
||||
"semantic-release": "^19.0.5",
|
||||
"semantic-release-monorepo": "^7.0.5",
|
||||
"ts-loader": "^9.4.1",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"release": {
|
||||
"branches": [
|
||||
"master"
|
||||
],
|
||||
"extends": "semantic-release-monorepo",
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"releaseRules": [
|
||||
{
|
||||
"breaking": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"revert": true,
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "feat",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "deps",
|
||||
"release": "patch"
|
||||
},
|
||||
{
|
||||
"scope": "no-release",
|
||||
"release": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/release-notes-generator",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"presetConfig": {
|
||||
"types": [
|
||||
{
|
||||
"type": "feat",
|
||||
"section": "Features"
|
||||
},
|
||||
{
|
||||
"type": "fix",
|
||||
"section": "Bug Fixes"
|
||||
},
|
||||
{
|
||||
"type": "chore",
|
||||
"section": "Trivial Changes"
|
||||
},
|
||||
{
|
||||
"type": "doc",
|
||||
"section": "Documentation"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"section": "Tests"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
"@semantic-release/github",
|
||||
"@semantic-release/git"
|
||||
]
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "./src/index.ts"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bundle",
|
||||
"src/**/*.ts",
|
||||
"!**/*.spec.*",
|
||||
"!**/*.json",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
]
|
||||
}
|
21
packages/enr/rollup.config.js
Normal file
21
packages/enr/rollup.config.js
Normal file
@ -0,0 +1,21 @@
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
||||
|
||||
export default {
|
||||
input: {
|
||||
index: "dist/index.js",
|
||||
},
|
||||
output: {
|
||||
dir: "bundle",
|
||||
format: "esm",
|
||||
},
|
||||
plugins: [
|
||||
commonjs(),
|
||||
json(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
preferBuiltins: false,
|
||||
}),
|
||||
],
|
||||
};
|
61
packages/enr/src/crypto.ts
Normal file
61
packages/enr/src/crypto.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import * as secp from "@noble/secp256k1";
|
||||
import { concat } from "@waku/byte-utils";
|
||||
import sha3 from "js-sha3";
|
||||
|
||||
export const randomBytes = secp.utils.randomBytes;
|
||||
|
||||
/**
|
||||
* Return the public key for the given private key, to be used for asymmetric
|
||||
* encryption.
|
||||
*/
|
||||
export const getPublicKey = secp.getPublicKey;
|
||||
|
||||
/**
|
||||
* ECDSA Sign a message with the given private key.
|
||||
*
|
||||
* @param message The message to sign, usually a hash.
|
||||
* @param privateKey The ECDSA private key to use to sign the message.
|
||||
*
|
||||
* @returns The signature and the recovery id concatenated.
|
||||
*/
|
||||
export async function sign(
|
||||
message: Uint8Array,
|
||||
privateKey: Uint8Array
|
||||
): Promise<Uint8Array> {
|
||||
const [signature, recoveryId] = await secp.sign(message, privateKey, {
|
||||
recovered: true,
|
||||
der: false,
|
||||
});
|
||||
return concat(
|
||||
[signature, new Uint8Array([recoveryId])],
|
||||
signature.length + 1
|
||||
);
|
||||
}
|
||||
|
||||
export function keccak256(input: Uint8Array): Uint8Array {
|
||||
return new Uint8Array(sha3.keccak256.arrayBuffer(input));
|
||||
}
|
||||
|
||||
export function compressPublicKey(publicKey: Uint8Array): Uint8Array {
|
||||
if (publicKey.length === 64) {
|
||||
publicKey = concat([new Uint8Array([4]), publicKey], 65);
|
||||
}
|
||||
const point = secp.Point.fromHex(publicKey);
|
||||
return point.toRawBytes(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify an ECDSA signature.
|
||||
*/
|
||||
export function verifySignature(
|
||||
signature: Uint8Array,
|
||||
message: Uint8Array | string,
|
||||
publicKey: Uint8Array
|
||||
): boolean {
|
||||
try {
|
||||
const _signature = secp.Signature.fromCompact(signature.slice(0, 64));
|
||||
return secp.verify(_signature, message, publicKey);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,15 +1,14 @@
|
||||
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import { bytesToHex, hexToBytes, utf8ToBytes } from "@waku/byte-utils";
|
||||
import { assert, expect } from "chai";
|
||||
import { equals } from "uint8arrays/equals";
|
||||
|
||||
import { getPublicKey } from "../crypto";
|
||||
import { bytesToHex, hexToBytes, utf8ToBytes } from "../utils";
|
||||
|
||||
import { ERR_INVALID_ID } from "./constants";
|
||||
import { ENR } from "./enr";
|
||||
import { createKeypairFromPeerId, IKeypair } from "./keypair";
|
||||
import { Waku2 } from "./waku2_codec";
|
||||
import { ERR_INVALID_ID } from "./constants.js";
|
||||
import { getPublicKey } from "./crypto.js";
|
||||
import { ENR } from "./enr.js";
|
||||
import { createKeypairFromPeerId, IKeypair } from "./keypair/index.js";
|
||||
import { Waku2 } from "./waku2_codec.js";
|
||||
|
||||
describe("ENR", function () {
|
||||
describe("Txt codec", () => {
|
@ -5,14 +5,22 @@ import {
|
||||
convertToBytes,
|
||||
convertToString,
|
||||
} from "@multiformats/multiaddr/convert";
|
||||
import {
|
||||
bytesToHex,
|
||||
bytesToUtf8,
|
||||
hexToBytes,
|
||||
utf8ToBytes,
|
||||
} from "@waku/byte-utils";
|
||||
import debug from "debug";
|
||||
import { fromString } from "uint8arrays/from-string";
|
||||
import { toString } from "uint8arrays/to-string";
|
||||
|
||||
import { compressPublicKey, keccak256, verifySignature } from "../crypto";
|
||||
import { bytesToHex, bytesToUtf8, hexToBytes, utf8ToBytes } from "../utils";
|
||||
|
||||
import { ERR_INVALID_ID, ERR_NO_SIGNATURE, MAX_RECORD_SIZE } from "./constants";
|
||||
import {
|
||||
ERR_INVALID_ID,
|
||||
ERR_NO_SIGNATURE,
|
||||
MAX_RECORD_SIZE,
|
||||
} from "./constants.js";
|
||||
import { compressPublicKey, keccak256, verifySignature } from "./crypto.js";
|
||||
import {
|
||||
createKeypair,
|
||||
createKeypairFromPeerId,
|
6
packages/enr/src/index.ts
Normal file
6
packages/enr/src/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from "./constants.js";
|
||||
export * from "./enr.js";
|
||||
export * from "./types.js";
|
||||
export * from "./keypair/index.js";
|
||||
export * from "./waku2_codec.js";
|
||||
export * from "./crypto.js";
|
@ -3,12 +3,12 @@ import { supportedKeys } from "@libp2p/crypto/keys";
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { peerIdFromKeys } from "@libp2p/peer-id";
|
||||
|
||||
import { Secp256k1Keypair } from "./secp256k1";
|
||||
import { IKeypair, KeypairType } from "./types";
|
||||
import { Secp256k1Keypair } from "./secp256k1.js";
|
||||
import { IKeypair, KeypairType } from "./types.js";
|
||||
|
||||
export const ERR_TYPE_NOT_IMPLEMENTED = "Keypair type not implemented";
|
||||
export * from "./types";
|
||||
export * from "./secp256k1";
|
||||
export * from "./types.js";
|
||||
export * from "./secp256k1.js";
|
||||
|
||||
export function createKeypair(
|
||||
type: KeypairType,
|
@ -1,8 +1,8 @@
|
||||
import * as secp from "@noble/secp256k1";
|
||||
|
||||
import { compressPublicKey, randomBytes } from "../../crypto";
|
||||
import { compressPublicKey, randomBytes } from "../crypto.js";
|
||||
|
||||
import { IKeypair, KeypairType } from "./types";
|
||||
import { IKeypair, KeypairType } from "./types.js";
|
||||
|
||||
export class Secp256k1Keypair implements IKeypair {
|
||||
readonly type: KeypairType;
|
@ -1,7 +1,7 @@
|
||||
import { convertToBytes } from "@multiformats/multiaddr/convert";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { multiaddrFromFields } from "./multiaddr_from_fields";
|
||||
import { multiaddrFromFields } from "./multiaddr_from_fields.js";
|
||||
|
||||
describe("Multiaddr from fields", () => {
|
||||
it("tcp ip4 address", function () {
|
@ -1,7 +1,7 @@
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec";
|
||||
import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec.js";
|
||||
|
||||
describe("ENR multiaddrs codec", function () {
|
||||
it("Sample", async () => {
|
@ -1,7 +1,7 @@
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import type { Multiaddr } from "@multiformats/multiaddr";
|
||||
|
||||
import { MULTIADDR_LENGTH_SIZE } from "./constants";
|
||||
import { MULTIADDR_LENGTH_SIZE } from "./constants.js";
|
||||
|
||||
export function decodeMultiaddrs(bytes: Uint8Array): Multiaddr[] {
|
||||
const multiaddrs = [];
|
@ -1,9 +1,8 @@
|
||||
import * as secp from "@noble/secp256k1";
|
||||
import { bytesToHex } from "@waku/byte-utils";
|
||||
|
||||
import { keccak256 } from "../crypto";
|
||||
import { bytesToHex } from "../utils";
|
||||
|
||||
import { NodeId } from "./types";
|
||||
import { keccak256 } from "./crypto.js";
|
||||
import { NodeId } from "./types.js";
|
||||
|
||||
export async function sign(
|
||||
privKey: Uint8Array,
|
@ -1,6 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { decodeWaku2, encodeWaku2, Waku2 } from "./waku2_codec";
|
||||
import { decodeWaku2, encodeWaku2, Waku2 } from "./waku2_codec.js";
|
||||
|
||||
const waku2FieldEncodings = {
|
||||
relay: 1,
|
8
packages/enr/tsconfig.dev.json
Normal file
8
packages/enr/tsconfig.dev.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": []
|
||||
}
|
54
packages/enr/tsconfig.json
Normal file
54
packages/enr/tsconfig.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"incremental": true,
|
||||
"target": "es2020",
|
||||
"outDir": "dist/",
|
||||
"rootDir": "src",
|
||||
"moduleResolution": "node",
|
||||
"module": "es2020",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
"resolveJsonModule": true /* Include modules imported with .json extension. */,
|
||||
"tsBuildInfoFile": "dist/.tsbuildinfo",
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
"strictFunctionTypes": true /* Enable strict checking of function types. */,
|
||||
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
||||
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
||||
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
||||
|
||||
/* Additional Checks */
|
||||
"noUnusedLocals": true /* Report errors on unused locals. */,
|
||||
"noUnusedParameters": true /* Report errors on unused parameters. */,
|
||||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
||||
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/* Debugging Options */
|
||||
"traceResolution": false /* Report module resolution log messages. */,
|
||||
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
|
||||
"listFiles": false /* Print names of files part of the compilation. */,
|
||||
"pretty": true /* Stylize errors and messages using color and context. */,
|
||||
|
||||
// Due to broken types in indirect dependencies
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
|
||||
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,
|
||||
|
||||
"lib": ["es2020", "dom"],
|
||||
"types": ["node", "mocha"],
|
||||
"typeRoots": ["node_modules/@types", "src/types"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.spec.ts", "src/test_utils"],
|
||||
"compileOnSave": false,
|
||||
"ts-node": {
|
||||
"files": true
|
||||
}
|
||||
}
|
@ -56,8 +56,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@waku/core": "*",
|
||||
"@waku/enr": "*",
|
||||
"@waku/create": "*",
|
||||
"@waku/interfaces": "*"
|
||||
"@waku/interfaces": "*",
|
||||
"@waku/byte-utils": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
|
@ -3,8 +3,8 @@ import { ChildProcess, spawn } from "child_process";
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { peerIdFromString } from "@libp2p/peer-id";
|
||||
import { Multiaddr, multiaddr } from "@multiformats/multiaddr";
|
||||
import { bytesToHex, hexToBytes } from "@waku/byte-utils";
|
||||
import { DefaultPubSubTopic } from "@waku/core";
|
||||
import { utils } from "@waku/core";
|
||||
import appRoot from "app-root-path";
|
||||
import debug from "debug";
|
||||
import portfinder from "portfinder";
|
||||
@ -13,8 +13,6 @@ import { existsAsync, mkdirAsync, openAsync } from "./async_fs";
|
||||
import { delay } from "./delay";
|
||||
import waitForLine from "./log_file";
|
||||
|
||||
const { bytesToHex, hexToBytes } = utils;
|
||||
|
||||
const log = debug("waku:nwaku");
|
||||
|
||||
const WAKU_SERVICE_NODE_DIR =
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ENR } from "@waku/core/lib/enr";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { createPrivacyNode } from "@waku/create";
|
||||
import { ENR } from "@waku/enr";
|
||||
import type { WakuPrivacy } from "@waku/interfaces";
|
||||
import { Protocols } from "@waku/interfaces";
|
||||
import { expect } from "chai";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import { createFullNode } from "@waku/create";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import { createFullNode } from "@waku/create";
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||
import {
|
||||
DefaultPubSubTopic,
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "@waku/core";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import {
|
||||
DecoderV0,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||
import {
|
||||
generatePrivateKey,
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "@waku/core";
|
||||
import { PageDirection } from "@waku/core";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
|
||||
import {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
|
||||
import { generateSymmetricKey } from "@waku/core";
|
||||
import { PeerDiscoveryStaticPeers } from "@waku/core/lib/peer_discovery_static_list";
|
||||
import { bytesToUtf8, utf8ToBytes } from "@waku/core/lib/utils";
|
||||
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
|
||||
import { SymDecoder, SymEncoder } from "@waku/core/lib/waku_message/version_1";
|
||||
import { createLightNode, createPrivacyNode } from "@waku/create";
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.dev",
|
||||
"compilerOptions": {
|
||||
"noEmit": false
|
||||
}
|
||||
}
|
@ -1,6 +1,13 @@
|
||||
{
|
||||
"entryPointStrategy": "packages",
|
||||
"entryPoints": ["packages/core", "packages/interfaces", "packages/create"],
|
||||
"entryPoints": [
|
||||
"packages/byte-utils",
|
||||
"packages/core",
|
||||
"packages/create",
|
||||
"packages/dns-discovery",
|
||||
"packages/enr",
|
||||
"packages/interfaces"
|
||||
],
|
||||
"out": "docs",
|
||||
"exclude": ["**/*.spec.ts"],
|
||||
"excludeInternal": true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user