mirror of
https://github.com/status-im/js-waku.git
synced 2025-02-20 17:08:15 +00:00
Sort out ENR key generation, upgrade to @libp2p/crypto
This commit is contained in:
parent
dcb3a65a5b
commit
9e27a0082e
364
package-lock.json
generated
364
package-lock.json
generated
@ -12,6 +12,7 @@
|
||||
"@chainsafe/libp2p-gossipsub": "^2.0.0",
|
||||
"@chainsafe/libp2p-noise": "^7.0.0",
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.0",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
"@libp2p/interface-peer-id": "^1.0.2",
|
||||
"@libp2p/interface-peer-info": "^1.0.1",
|
||||
@ -30,7 +31,6 @@
|
||||
"it-pipe": "^1.1.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"libp2p": "^0.37.3",
|
||||
"libp2p-crypto": "^0.21.2",
|
||||
"multiformats": "^9.6.5",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0",
|
||||
@ -39,6 +39,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
"@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",
|
||||
@ -668,26 +669,6 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chainsafe/libp2p-gossipsub/node_modules/@libp2p/logger": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/logger/-/logger-2.0.0.tgz",
|
||||
@ -816,26 +797,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chainsafe/libp2p-noise/node_modules/@libp2p/logger": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/logger/-/logger-2.0.0.tgz",
|
||||
@ -1524,11 +1485,11 @@
|
||||
"integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw=="
|
||||
},
|
||||
"node_modules/@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"dependencies": {
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
@ -1543,28 +1504,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/crypto/node_modules/@libp2p/interfaces": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-2.0.4.tgz",
|
||||
"integrity": "sha512-MfwkTFyHJtvwNxkjOjzkXyIVvKFtEW2Q3IGRJPyPQMrtB6ll0rGMTlyJ3BQS1bcD0YkNhggFm+8XiU2/0LCBhQ==",
|
||||
"dependencies": {
|
||||
"@multiformats/multiaddr": "^10.1.5",
|
||||
"err-code": "^3.0.1",
|
||||
"interface-datastore": "^6.1.0",
|
||||
"it-pushable": "^2.0.1",
|
||||
"it-stream-types": "^1.0.4",
|
||||
"multiformats": "^9.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/crypto/node_modules/it-pushable": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz",
|
||||
"integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw=="
|
||||
},
|
||||
"node_modules/@libp2p/interface-address-manager": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interface-address-manager/-/interface-address-manager-1.0.2.tgz",
|
||||
@ -2226,26 +2165,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/peer-id-factory/node_modules/@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/peer-record": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/peer-record/-/peer-record-1.0.12.tgz",
|
||||
@ -2274,6 +2193,26 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/peer-record/node_modules/@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"dependencies": {
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/peer-record/node_modules/@libp2p/interfaces": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-2.0.4.tgz",
|
||||
@ -2393,26 +2332,6 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/pubsub/node_modules/@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@libp2p/pubsub/node_modules/abortable-iterator": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/abortable-iterator/-/abortable-iterator-4.0.2.tgz",
|
||||
@ -2933,27 +2852,32 @@
|
||||
"node_modules/@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
|
||||
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/base64": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
|
||||
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
|
||||
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/codegen": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
|
||||
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
|
||||
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/eventemitter": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
|
||||
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
|
||||
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/fetch": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
|
||||
"integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@protobufjs/aspromise": "^1.1.1",
|
||||
"@protobufjs/inquire": "^1.1.0"
|
||||
@ -2962,27 +2886,32 @@
|
||||
"node_modules/@protobufjs/float": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
|
||||
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
|
||||
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/inquire": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
|
||||
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
|
||||
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/path": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
|
||||
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
|
||||
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/pool": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
|
||||
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
|
||||
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@protobufjs/utf8": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@rollup/plugin-commonjs": {
|
||||
"version": "22.0.0",
|
||||
@ -3395,7 +3324,8 @@
|
||||
"node_modules/@types/long": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
|
||||
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
|
||||
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/minimist": {
|
||||
"version": "1.2.2",
|
||||
@ -8762,22 +8692,24 @@
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"node_modules/libp2p/node_modules/@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"dependencies": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/libp2p/node_modules/@libp2p/interfaces": {
|
||||
@ -9216,7 +9148,8 @@
|
||||
"node_modules/long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/loose-envify": {
|
||||
"version": "1.4.0",
|
||||
@ -10897,6 +10830,7 @@
|
||||
"version": "6.11.2",
|
||||
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz",
|
||||
"integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@protobufjs/aspromise": "^1.1.2",
|
||||
@ -14135,22 +14069,6 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"requires": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@libp2p/logger": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/logger/-/logger-2.0.0.tgz",
|
||||
@ -14265,22 +14183,6 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"requires": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@libp2p/logger": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/logger/-/logger-2.0.0.tgz",
|
||||
@ -14864,11 +14766,11 @@
|
||||
}
|
||||
},
|
||||
"@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"requires": {
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
@ -14877,26 +14779,6 @@
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/interfaces": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-2.0.4.tgz",
|
||||
"integrity": "sha512-MfwkTFyHJtvwNxkjOjzkXyIVvKFtEW2Q3IGRJPyPQMrtB6ll0rGMTlyJ3BQS1bcD0YkNhggFm+8XiU2/0LCBhQ==",
|
||||
"requires": {
|
||||
"@multiformats/multiaddr": "^10.1.5",
|
||||
"err-code": "^3.0.1",
|
||||
"interface-datastore": "^6.1.0",
|
||||
"it-pushable": "^2.0.1",
|
||||
"it-stream-types": "^1.0.4",
|
||||
"multiformats": "^9.6.3"
|
||||
}
|
||||
},
|
||||
"it-pushable": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz",
|
||||
"integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@libp2p/interface-address-manager": {
|
||||
@ -15418,24 +15300,6 @@
|
||||
"multiformats": "^9.6.3",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"requires": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@libp2p/peer-record": {
|
||||
@ -15462,6 +15326,22 @@
|
||||
"varint": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"requires": {
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@libp2p/interfaces": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-2.0.4.tgz",
|
||||
@ -15569,22 +15449,6 @@
|
||||
"uint8arrays": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-1.0.0.tgz",
|
||||
"integrity": "sha512-oV/KaHE8XaJQDH+iDq4Kn4GaVWRsEXJnLXTpN+8hz00tuxxsE3+4g0OYaFCauAYeX1IcGPwMvUhdgujnKzpAbg==",
|
||||
"requires": {
|
||||
"@libp2p/interface-keys": "^1.0.2",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"abortable-iterator": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/abortable-iterator/-/abortable-iterator-4.0.2.tgz",
|
||||
@ -15968,27 +15832,32 @@
|
||||
"@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
|
||||
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/base64": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
|
||||
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
|
||||
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/codegen": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
|
||||
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
|
||||
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/eventemitter": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
|
||||
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
|
||||
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/fetch": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
|
||||
"integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@protobufjs/aspromise": "^1.1.1",
|
||||
"@protobufjs/inquire": "^1.1.0"
|
||||
@ -15997,27 +15866,32 @@
|
||||
"@protobufjs/float": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
|
||||
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
|
||||
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/inquire": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
|
||||
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
|
||||
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/path": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
|
||||
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
|
||||
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/pool": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
|
||||
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
|
||||
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=",
|
||||
"dev": true
|
||||
},
|
||||
"@protobufjs/utf8": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=",
|
||||
"dev": true
|
||||
},
|
||||
"@rollup/plugin-commonjs": {
|
||||
"version": "22.0.0",
|
||||
@ -16385,7 +16259,8 @@
|
||||
"@types/long": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
|
||||
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
|
||||
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/minimist": {
|
||||
"version": "1.2.2",
|
||||
@ -20412,6 +20287,22 @@
|
||||
"xsalsa20": "^1.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@libp2p/crypto": {
|
||||
"version": "0.22.14",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/crypto/-/crypto-0.22.14.tgz",
|
||||
"integrity": "sha512-5RyGh5ovfqrDD8Io3n5rvVnsTHBf1exIMZ/5eBw7Eoy21xkmzdF1Hy701SoSNmiCuTPXYmxT5WMy2VUDBUG6oQ==",
|
||||
"requires": {
|
||||
"@libp2p/interfaces": "^2.0.1",
|
||||
"@noble/ed25519": "^1.6.0",
|
||||
"@noble/secp256k1": "^1.5.4",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.1.0",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@libp2p/interfaces": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-2.0.4.tgz",
|
||||
@ -20467,21 +20358,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"libp2p-crypto": {
|
||||
"version": "0.21.2",
|
||||
"resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.21.2.tgz",
|
||||
"integrity": "sha512-EXFrhSpiHtJ+/L8xXDvQNK5VjUMG51u878jzZcaT5XhuN/zFg6PWJFnl/qB2Y2j7eMWnvCRP7Kp+ua2H36cG4g==",
|
||||
"requires": {
|
||||
"@noble/ed25519": "^1.5.1",
|
||||
"@noble/secp256k1": "^1.3.0",
|
||||
"err-code": "^3.0.1",
|
||||
"iso-random-stream": "^2.0.0",
|
||||
"multiformats": "^9.4.5",
|
||||
"node-forge": "^1.2.1",
|
||||
"protobufjs": "^6.11.2",
|
||||
"uint8arrays": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"lilconfig": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.4.tgz",
|
||||
@ -20761,7 +20637,8 @@
|
||||
"long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
|
||||
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
|
||||
"dev": true
|
||||
},
|
||||
"loose-envify": {
|
||||
"version": "1.4.0",
|
||||
@ -21999,6 +21876,7 @@
|
||||
"version": "6.11.2",
|
||||
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz",
|
||||
"integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@protobufjs/aspromise": "^1.1.2",
|
||||
"@protobufjs/base64": "^1.1.2",
|
||||
|
@ -69,6 +69,7 @@
|
||||
"@chainsafe/libp2p-gossipsub": "^2.0.0",
|
||||
"@chainsafe/libp2p-noise": "^7.0.0",
|
||||
"@ethersproject/rlp": "^5.5.0",
|
||||
"@libp2p/crypto": "^1.0.0",
|
||||
"@libp2p/interface-peer-discovery": "^1.0.0",
|
||||
"@libp2p/interface-peer-id": "^1.0.2",
|
||||
"@libp2p/interface-peer-info": "^1.0.1",
|
||||
@ -87,7 +88,6 @@
|
||||
"it-pipe": "^1.1.0",
|
||||
"js-sha3": "^0.8.0",
|
||||
"libp2p": "^0.37.3",
|
||||
"libp2p-crypto": "^0.21.2",
|
||||
"multiformats": "^9.6.5",
|
||||
"protons-runtime": "^1.0.4",
|
||||
"uint8arrays": "^3.0.0",
|
||||
@ -96,6 +96,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
||||
"@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",
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
|
||||
import { Multiaddr } from "@multiformats/multiaddr";
|
||||
import { expect } from "chai";
|
||||
import PeerId from "peer-id";
|
||||
|
||||
import { ENR, Waku2 } from "../enr";
|
||||
|
||||
import fetchNodesUntilCapabilitiesFulfilled from "./fetch_nodes";
|
||||
|
||||
async function createEnr(waku2: Waku2): Promise<ENR> {
|
||||
const peerId = await PeerId.create({ keyType: "secp256k1" });
|
||||
const peerId = await createSecp256k1PeerId();
|
||||
const enr = await ENR.createFromPeerId(peerId);
|
||||
enr.setLocationMultiaddr(new Multiaddr("/ip4/18.223.219.100/udp/9000"));
|
||||
enr.multiaddrs = [
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../../test_utils";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
|
||||
import { ENR } from "./enr";
|
||||
|
||||
@ -25,9 +25,10 @@ describe("ENR Interop: nwaku", function () {
|
||||
});
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.Relay]);
|
||||
|
||||
@ -56,9 +57,10 @@ describe("ENR Interop: nwaku", function () {
|
||||
});
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.Relay]);
|
||||
|
||||
@ -87,9 +89,10 @@ describe("ENR Interop: nwaku", function () {
|
||||
});
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.Relay]);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createSecp256k1PeerId } from "@libp2p/peer-id-factory";
|
||||
import { Multiaddr } from "@multiformats/multiaddr";
|
||||
import { assert, expect } from "chai";
|
||||
import PeerId from "peer-id";
|
||||
|
||||
import { getPublicKey } from "../crypto";
|
||||
import { bytesToHex, hexToBytes, utf8ToBytes } from "../utils";
|
||||
@ -13,9 +13,9 @@ import { Waku2 } from "./waku2_codec";
|
||||
describe("ENR", function () {
|
||||
describe("Txt codec", () => {
|
||||
it("should encodeTxt and decodeTxt", async () => {
|
||||
const peerId = await PeerId.create({ keyType: "secp256k1" });
|
||||
const peerId = await createSecp256k1PeerId();
|
||||
const enr = await ENR.createFromPeerId(peerId);
|
||||
const keypair = createKeypairFromPeerId(peerId);
|
||||
const keypair = await createKeypairFromPeerId(peerId);
|
||||
enr.setLocationMultiaddr(new Multiaddr("/ip4/18.223.219.100/udp/9000"));
|
||||
enr.multiaddrs = [
|
||||
new Multiaddr(
|
||||
@ -109,9 +109,9 @@ describe("ENR", function () {
|
||||
|
||||
it("should throw error - no id", async () => {
|
||||
try {
|
||||
const peerId = await PeerId.create({ keyType: "secp256k1" });
|
||||
const peerId = await createSecp256k1PeerId();
|
||||
const enr = await ENR.createFromPeerId(peerId);
|
||||
const keypair = createKeypairFromPeerId(peerId);
|
||||
const keypair = await createKeypairFromPeerId(peerId);
|
||||
enr.setLocationMultiaddr(new Multiaddr("/ip4/18.223.219.100/udp/9000"));
|
||||
|
||||
enr.set("id", new Uint8Array([0]));
|
||||
@ -307,7 +307,7 @@ describe("ENR", function () {
|
||||
let enr: ENR;
|
||||
|
||||
before(async function () {
|
||||
peerId = await PeerId.create({ keyType: "secp256k1" });
|
||||
peerId = await createSecp256k1PeerId();
|
||||
enr = await ENR.createFromPeerId(peerId);
|
||||
enr.ip = ip4;
|
||||
enr.ip6 = ip6;
|
||||
@ -387,9 +387,9 @@ describe("ENR", function () {
|
||||
let keypair: IKeypair;
|
||||
|
||||
beforeEach(async function () {
|
||||
peerId = await PeerId.create({ keyType: "secp256k1" });
|
||||
peerId = await createSecp256k1PeerId();
|
||||
enr = await ENR.createFromPeerId(peerId);
|
||||
keypair = createKeypairFromPeerId(peerId);
|
||||
keypair = await createKeypairFromPeerId(peerId);
|
||||
waku2Protocols = {
|
||||
relay: false,
|
||||
store: false,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as RLP from "@ethersproject/rlp";
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { Multiaddr } from "@multiformats/multiaddr";
|
||||
import {
|
||||
convertToBytes,
|
||||
@ -6,7 +7,6 @@ import {
|
||||
} from "@multiformats/multiaddr/src/convert";
|
||||
import { names } from "@multiformats/multiaddr/src/protocols-table";
|
||||
import debug from "debug";
|
||||
import PeerId from "peer-id";
|
||||
import { fromString } from "uint8arrays/from-string";
|
||||
import { toString } from "uint8arrays/to-string";
|
||||
import { encode as varintEncode } from "varint";
|
||||
@ -79,11 +79,11 @@ export class ENR extends Map<ENRKey, ENRValue> {
|
||||
});
|
||||
}
|
||||
|
||||
static createFromPeerId(
|
||||
static async createFromPeerId(
|
||||
peerId: PeerId,
|
||||
kvs: Record<ENRKey, ENRValue> = {}
|
||||
): Promise<ENR> {
|
||||
const keypair = createKeypairFromPeerId(peerId);
|
||||
const keypair = await createKeypairFromPeerId(peerId);
|
||||
switch (keypair.type) {
|
||||
case KeypairType.secp256k1:
|
||||
return ENR.createV4(keypair.publicKey, kvs);
|
||||
|
@ -1,20 +1,22 @@
|
||||
import { Secp256k1PublicKey } from "@libp2p/crypto/dist/src/keys/secp256k1-class";
|
||||
import { peerIdFromKeys } from "@libp2p/peer-id";
|
||||
import { expect } from "chai";
|
||||
import { keys } from "libp2p-crypto";
|
||||
import PeerId from "peer-id";
|
||||
|
||||
import { createPeerIdFromKeypair, generateKeypair, KeypairType } from "./index";
|
||||
|
||||
const { supportedKeys } = keys;
|
||||
import {
|
||||
createPeerIdFromKeypair,
|
||||
generateKeypair,
|
||||
KeypairType,
|
||||
Secp256k1Keypair,
|
||||
} from "./index";
|
||||
|
||||
describe("createPeerIdFromKeypair", function () {
|
||||
it("should properly create a PeerId from a secp256k1 keypair with private key", async function () {
|
||||
const keypair = await generateKeypair(KeypairType.secp256k1);
|
||||
const privKey = new supportedKeys.secp256k1.Secp256k1PrivateKey(
|
||||
keypair.privateKey,
|
||||
keypair.publicKey
|
||||
);
|
||||
|
||||
const expectedPeerId = await PeerId.createFromPrivKey(privKey.bytes);
|
||||
const expectedPeerId = await peerIdFromKeys(
|
||||
keypair.publicKey,
|
||||
keypair.privateKey
|
||||
);
|
||||
const actualPeerId = await createPeerIdFromKeypair(keypair);
|
||||
|
||||
expect(actualPeerId).to.be.deep.equal(expectedPeerId);
|
||||
@ -22,12 +24,10 @@ describe("createPeerIdFromKeypair", function () {
|
||||
|
||||
it("should properly create a PeerId from a secp256k1 keypair without private key", async function () {
|
||||
const keypair = await generateKeypair(KeypairType.secp256k1);
|
||||
delete (keypair as any)._privateKey;
|
||||
const pubKey = new supportedKeys.secp256k1.Secp256k1PublicKey(
|
||||
keypair.publicKey
|
||||
);
|
||||
delete (keypair as Secp256k1Keypair)._privateKey;
|
||||
const pubKey = new Secp256k1PublicKey(keypair.publicKey);
|
||||
|
||||
const expectedPeerId = await PeerId.createFromPubKey(pubKey.bytes);
|
||||
const expectedPeerId = await peerIdFromKeys(pubKey.bytes);
|
||||
const actualPeerId = await createPeerIdFromKeypair(keypair);
|
||||
|
||||
expect(actualPeerId).to.be.deep.equal(expectedPeerId);
|
||||
|
@ -1,16 +1,20 @@
|
||||
import { keys } from "libp2p-crypto";
|
||||
import { identity } from "multiformats/hashes/identity";
|
||||
import PeerId from "peer-id";
|
||||
import {
|
||||
marshalPrivateKey,
|
||||
marshalPublicKey,
|
||||
unmarshalPrivateKey,
|
||||
unmarshalPublicKey,
|
||||
} 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";
|
||||
|
||||
const { keysPBM, supportedKeys } = keys;
|
||||
|
||||
export const ERR_TYPE_NOT_IMPLEMENTED = "Keypair type not implemented";
|
||||
export * from "./types";
|
||||
export * from "./secp256k1";
|
||||
|
||||
// TODO: Check if @libp2p/crypto methods can be used instead.
|
||||
export async function generateKeypair(type: KeypairType): Promise<IKeypair> {
|
||||
switch (type) {
|
||||
case KeypairType.secp256k1:
|
||||
@ -39,30 +43,44 @@ export async function createPeerIdFromKeypair(
|
||||
switch (keypair.type) {
|
||||
case KeypairType.secp256k1: {
|
||||
// manually create a peer id to avoid expensive ops
|
||||
const privKey = keypair.hasPrivateKey()
|
||||
? new supportedKeys.secp256k1.Secp256k1PrivateKey(
|
||||
keypair.privateKey,
|
||||
keypair.publicKey
|
||||
)
|
||||
const privateKey = keypair.hasPrivateKey()
|
||||
? marshalPrivateKey({ bytes: keypair.privateKey })
|
||||
: undefined;
|
||||
|
||||
const pubKey = new supportedKeys.secp256k1.Secp256k1PublicKey(
|
||||
keypair.publicKey
|
||||
return peerIdFromKeys(
|
||||
marshalPublicKey({ bytes: keypair.publicKey }),
|
||||
privateKey
|
||||
);
|
||||
const id = await identity.digest(pubKey.bytes);
|
||||
return new PeerId(id.bytes, privKey, pubKey);
|
||||
}
|
||||
default:
|
||||
throw new Error(ERR_TYPE_NOT_IMPLEMENTED);
|
||||
}
|
||||
}
|
||||
|
||||
export function createKeypairFromPeerId(peerId: PeerId): IKeypair {
|
||||
// pub/private key bytes from peer-id are encoded in protobuf format
|
||||
const pub = keysPBM.PublicKey.decode(peerId.pubKey.bytes);
|
||||
return createKeypair(
|
||||
pub.Type as KeypairType,
|
||||
peerId.privKey ? peerId.privKey.marshal() : undefined,
|
||||
pub.Data
|
||||
);
|
||||
export async function createKeypairFromPeerId(
|
||||
peerId: PeerId
|
||||
): Promise<IKeypair> {
|
||||
let keypairType;
|
||||
switch (peerId.type) {
|
||||
case "RSA":
|
||||
keypairType = KeypairType.rsa;
|
||||
break;
|
||||
case "Ed25519":
|
||||
keypairType = KeypairType.ed25519;
|
||||
break;
|
||||
case "secp256k1":
|
||||
keypairType = KeypairType.secp256k1;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unsupported peer id type");
|
||||
}
|
||||
|
||||
const publicKey = peerId.publicKey
|
||||
? unmarshalPublicKey(peerId.publicKey)
|
||||
: undefined;
|
||||
const privateKey = peerId.privateKey
|
||||
? await unmarshalPrivateKey(peerId.privateKey)
|
||||
: undefined;
|
||||
|
||||
return createKeypair(keypairType, privateKey?.bytes, publicKey?.bytes);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
import { delay } from "../test_utils/delay";
|
||||
|
||||
import { generateSymmetricKey } from "./crypto";
|
||||
import { Protocols, Waku } from "./waku";
|
||||
import { createWaku, Protocols, Waku } from "./waku";
|
||||
import { WakuMessage } from "./waku_message";
|
||||
|
||||
const TestContentTopic = "/test/1/waku/utf8";
|
||||
@ -31,9 +31,10 @@ describe("Waku Dial [node only]", function () {
|
||||
await nwaku.start();
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.Relay]);
|
||||
|
||||
@ -58,10 +59,11 @@ describe("Waku Dial [node only]", function () {
|
||||
await nwaku.start();
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
bootstrap: { peers: [multiAddrWithId] },
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
const connectedPeerID: PeerId = await new Promise((resolve) => {
|
||||
waku.libp2p.connectionManager.addEventListener(
|
||||
@ -81,7 +83,7 @@ describe("Waku Dial [node only]", function () {
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
await nwaku.start();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
bootstrap: {
|
||||
getPeers: async () => {
|
||||
@ -89,6 +91,7 @@ describe("Waku Dial [node only]", function () {
|
||||
},
|
||||
},
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
const connectedPeerID: PeerId = await new Promise((resolve) => {
|
||||
waku.libp2p.connectionManager.addEventListener(
|
||||
@ -117,11 +120,13 @@ describe("Decryption Keys", () => {
|
||||
beforeEach(async function () {
|
||||
this.timeout(5000);
|
||||
[waku1, waku2] = await Promise.all([
|
||||
Waku.create({ staticNoiseKey: NOISE_KEY_1 }),
|
||||
Waku.create({
|
||||
createWaku({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
||||
waku.start().then(() => waku)
|
||||
),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
]);
|
||||
|
||||
waku1.addPeerToAddressBook(
|
||||
@ -191,9 +196,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start();
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await delay(1000);
|
||||
await waku.waitForRemotePeer([Protocols.Relay]);
|
||||
@ -210,9 +216,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start();
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
const waitPromise = waku.waitForRemotePeer([Protocols.Relay]);
|
||||
await delay(1000);
|
||||
@ -229,19 +236,21 @@ describe("Wait for remote peer / get peers", function () {
|
||||
|
||||
it("Relay - times out", function (done) {
|
||||
this.timeout(5000);
|
||||
Waku.create({
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
}).then((waku) => {
|
||||
waku.waitForRemotePeer([Protocols.Relay], 200).then(
|
||||
() => {
|
||||
throw "Promise expected to reject on time out";
|
||||
},
|
||||
(reason) => {
|
||||
expect(reason).to.eq("Timed out waiting for a remote peer.");
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
})
|
||||
.then((waku) => waku.start().then(() => waku))
|
||||
.then((waku) => {
|
||||
waku.waitForRemotePeer([Protocols.Relay], 200).then(
|
||||
() => {
|
||||
throw "Promise expected to reject on time out";
|
||||
},
|
||||
(reason) => {
|
||||
expect(reason).to.eq("Timed out waiting for a remote peer.");
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("Store - dialed first", async function () {
|
||||
@ -250,9 +259,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start({ persistMessages: true });
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await delay(1000);
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
@ -270,9 +280,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start({ persistMessages: true });
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
const waitPromise = waku.waitForRemotePeer([Protocols.Store], 2000);
|
||||
await delay(1000);
|
||||
await waku.dial(multiAddrWithId);
|
||||
@ -292,9 +303,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start({ lightpush: true });
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.LightPush]);
|
||||
|
||||
@ -314,9 +326,10 @@ describe("Wait for remote peer / get peers", function () {
|
||||
await nwaku.start({ filter: true });
|
||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(multiAddrWithId);
|
||||
await waku.waitForRemotePeer([Protocols.Filter]);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { PeerId } from "@libp2p/interface-peer-id";
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Waku } from "./waku";
|
||||
import { createWaku, Waku } from "./waku";
|
||||
|
||||
describe("Waku Dial", function () {
|
||||
describe("Bootstrap [live data]", function () {
|
||||
@ -22,9 +22,10 @@ describe("Waku Dial", function () {
|
||||
// This dependence must be removed once DNS discovery is implemented
|
||||
this.timeout(20_000);
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
bootstrap: { default: true },
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
const connectedPeerID: PeerId = await new Promise((resolve) => {
|
||||
waku.libp2p.connectionManager.addEventListener(
|
||||
|
@ -168,10 +168,6 @@ export class Waku {
|
||||
});
|
||||
}
|
||||
|
||||
start(): void {
|
||||
this.libp2p.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dials to the provided peer.
|
||||
*
|
||||
@ -225,6 +221,10 @@ export class Waku {
|
||||
this.libp2p.peerStore.addressBook.set(peer, addresses);
|
||||
}
|
||||
|
||||
async start(): Promise<void> {
|
||||
await this.libp2p.start();
|
||||
}
|
||||
|
||||
async stop(): Promise<void> {
|
||||
this.stopAllKeepAlives();
|
||||
await this.libp2p.stop();
|
||||
@ -444,9 +444,10 @@ export class Waku {
|
||||
const awaitTimeout = (ms: number, rejectReason: string): Promise<void> =>
|
||||
new Promise((_resolve, reject) => setTimeout(() => reject(rejectReason), ms));
|
||||
|
||||
const rejectOnTimeout = (
|
||||
promise: Promise<any>,
|
||||
async function rejectOnTimeout<T>(
|
||||
promise: Promise<T>,
|
||||
timeoutMs: number,
|
||||
rejectReason: string
|
||||
): Promise<void> =>
|
||||
Promise.race([promise, awaitTimeout(timeoutMs, rejectReason)]);
|
||||
): Promise<void> {
|
||||
await Promise.race([promise, awaitTimeout(timeoutMs, rejectReason)]);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import debug from "debug";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../../test_utils";
|
||||
import { delay } from "../../test_utils/delay";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
import { WakuMessage } from "../waku_message";
|
||||
|
||||
const log = debug("waku:test");
|
||||
@ -23,10 +23,11 @@ describe("Waku Filter", () => {
|
||||
this.timeout(10000);
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
await nwaku.start({ filter: true });
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Filter, Protocols.Relay]);
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ import debug from "debug";
|
||||
|
||||
import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../../test_utils";
|
||||
import { delay } from "../../test_utils/delay";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
import { WakuMessage } from "../waku_message";
|
||||
|
||||
const dbg = debug("waku:test:lightpush");
|
||||
@ -25,9 +25,10 @@ describe("Waku Light Push [node only]", () => {
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
await nwaku.start({ lightpush: true });
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.LightPush]);
|
||||
|
||||
@ -60,10 +61,11 @@ describe("Waku Light Push [node only]", () => {
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
await nwaku.start({ lightpush: true, topics: customPubSubTopic });
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
pubSubTopic: customPubSubTopic,
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.LightPush]);
|
||||
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
getPublicKey,
|
||||
} from "../crypto";
|
||||
import { bytesToHex, bytesToUtf8, hexToBytes, utf8ToBytes } from "../utils";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
|
||||
import { DecryptionMethod, WakuMessage } from "./index";
|
||||
|
||||
@ -29,9 +29,10 @@ describe("Waku Message [node only]", function () {
|
||||
|
||||
beforeEach(async function () {
|
||||
this.timeout(30_000);
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
dbg("Starting nwaku node");
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "../crypto";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
import { DecryptionMethod, WakuMessage } from "../waku_message";
|
||||
|
||||
const log = debug("waku:test");
|
||||
@ -39,11 +39,13 @@ describe("Waku Relay [node only]", () => {
|
||||
|
||||
log("Starting JS Waku instances");
|
||||
[waku1, waku2] = await Promise.all([
|
||||
Waku.create({ staticNoiseKey: NOISE_KEY_1 }),
|
||||
Waku.create({
|
||||
createWaku({ staticNoiseKey: NOISE_KEY_1 }).then((waku) =>
|
||||
waku.start().then(() => waku)
|
||||
),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
]);
|
||||
log("Instances started, adding waku2 to waku1's address book");
|
||||
waku1.addPeerToAddressBook(
|
||||
@ -258,18 +260,18 @@ describe("Waku Relay [node only]", () => {
|
||||
|
||||
// 1 and 2 uses a custom pubsub
|
||||
const [waku1, waku2, waku3] = await Promise.all([
|
||||
Waku.create({
|
||||
createWaku({
|
||||
pubSubTopic: pubSubTopic,
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
}),
|
||||
Waku.create({
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
createWaku({
|
||||
pubSubTopic: pubSubTopic,
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
libp2p: { addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] } },
|
||||
}),
|
||||
Waku.create({
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
]);
|
||||
|
||||
waku1.addPeerToAddressBook(
|
||||
@ -323,9 +325,10 @@ describe("Waku Relay [node only]", () => {
|
||||
|
||||
beforeEach(async function () {
|
||||
this.timeout(30_000);
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
|
||||
nwaku = new Nwaku(this.test?.ctx?.currentTest?.title + "");
|
||||
await nwaku.start();
|
||||
@ -415,12 +418,12 @@ describe("Waku Relay [node only]", () => {
|
||||
it("Js publishes, other Js receives", async function () {
|
||||
this.timeout(60_000);
|
||||
[waku1, waku2] = await Promise.all([
|
||||
Waku.create({
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
}),
|
||||
Waku.create({
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
]);
|
||||
|
||||
nwaku = new Nwaku(makeLogFileName(this));
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
generateSymmetricKey,
|
||||
getPublicKey,
|
||||
} from "../crypto";
|
||||
import { Protocols, Waku } from "../waku";
|
||||
import { createWaku, Protocols, Waku } from "../waku";
|
||||
import { DecryptionMethod, WakuMessage } from "../waku_message";
|
||||
|
||||
import { PageDirection } from "./history_rpc";
|
||||
@ -46,9 +46,10 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
const messages = await waku.store.queryHistory([]);
|
||||
@ -78,9 +79,10 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
|
||||
@ -117,9 +119,10 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
|
||||
@ -153,9 +156,10 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
|
||||
@ -191,10 +195,11 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
pubSubTopic: customPubSubTopic,
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
|
||||
@ -259,12 +264,12 @@ describe("Waku Store", () => {
|
||||
dbg("Messages have been encrypted");
|
||||
|
||||
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
||||
Waku.create({
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
}),
|
||||
Waku.create({
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
nwaku.getMultiaddrWithId(),
|
||||
]);
|
||||
|
||||
@ -363,12 +368,12 @@ describe("Waku Store", () => {
|
||||
dbg("Messages have been encrypted");
|
||||
|
||||
const [waku1, waku2, nimWakuMultiaddr] = await Promise.all([
|
||||
Waku.create({
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
}),
|
||||
Waku.create({
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
createWaku({
|
||||
staticNoiseKey: NOISE_KEY_2,
|
||||
}),
|
||||
}).then((waku) => waku.start().then(() => waku)),
|
||||
nwaku.getMultiaddrWithId(),
|
||||
]);
|
||||
|
||||
@ -450,9 +455,10 @@ describe("Waku Store", () => {
|
||||
).to.be.true;
|
||||
}
|
||||
|
||||
waku = await Waku.create({
|
||||
waku = await createWaku({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
});
|
||||
await waku.start();
|
||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||
await waku.waitForRemotePeer([Protocols.Store]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user