Merge pull request #999 from waku-org/feat/split-message

This commit is contained in:
fryorcraken.eth 2022-11-04 13:40:12 +11:00 committed by GitHub
commit de6415f4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 378 additions and 72 deletions

View File

@ -20,7 +20,7 @@ module.exports = [
}, },
{ {
name: "Asymmetric, symmetric encryption and signature", name: "Asymmetric, symmetric encryption and signature",
path: "packages/core/bundle/lib/waku_message/version_1.js", path: "packages/message-encryption/bundle/index.js",
import: "{ MessageV1, AsymEncoder, AsymDecoder, SymEncoder, SymDecoder }", import: "{ MessageV1, AsymEncoder, AsymDecoder, SymEncoder, SymDecoder }",
}, },
{ {

87
package-lock.json generated
View File

@ -5471,6 +5471,10 @@
"resolved": "packages/interfaces", "resolved": "packages/interfaces",
"link": true "link": true
}, },
"node_modules/@waku/message-encryption": {
"resolved": "packages/message-encryption",
"link": true
},
"node_modules/@waku/tests": { "node_modules/@waku/tests": {
"resolved": "packages/tests", "resolved": "packages/tests",
"link": true "link": true
@ -22506,12 +22510,11 @@
}, },
"packages/core": { "packages/core": {
"name": "@waku/core", "name": "@waku/core",
"version": "0.0.2", "version": "0.0.1",
"license": "MIT OR Apache-2.0", "license": "MIT OR Apache-2.0",
"dependencies": { "dependencies": {
"@chainsafe/libp2p-gossipsub": "^4.1.1", "@chainsafe/libp2p-gossipsub": "^4.1.1",
"@chainsafe/libp2p-noise": "^8.0.1", "@chainsafe/libp2p-noise": "^8.0.1",
"@libp2p/crypto": "^1.0.4",
"@libp2p/interface-connection": "3.0.1", "@libp2p/interface-connection": "3.0.1",
"@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interface-peer-discovery": "^1.0.0",
"@libp2p/interface-peer-id": "^1.0.2", "@libp2p/interface-peer-id": "^1.0.2",
@ -22523,14 +22526,12 @@
"@libp2p/peer-id": "^1.1.10", "@libp2p/peer-id": "^1.1.10",
"@libp2p/websockets": "^3.0.3", "@libp2p/websockets": "^3.0.3",
"@multiformats/multiaddr": "^11.0.6", "@multiformats/multiaddr": "^11.0.6",
"@noble/secp256k1": "^1.3.4", "@waku/byte-utils": "*",
"@waku/byte-utils": "0.0.1", "@waku/interfaces": "*",
"@waku/interfaces": "0.0.1",
"debug": "^4.3.4", "debug": "^4.3.4",
"it-all": "^1.0.6", "it-all": "^1.0.6",
"it-length-prefixed": "^8.0.2", "it-length-prefixed": "^8.0.2",
"it-pipe": "^2.0.4", "it-pipe": "^2.0.4",
"js-sha3": "^0.8.0",
"libp2p": "0.38.0", "libp2p": "0.38.0",
"p-event": "^5.0.1", "p-event": "^5.0.1",
"protons-runtime": "^3.1.0", "protons-runtime": "^3.1.0",
@ -22904,6 +22905,41 @@
"npm": ">=7.0.0" "npm": ">=7.0.0"
} }
}, },
"packages/message-encryption": {
"name": "@waku/message-encryption",
"version": "0.0.1",
"license": "MIT OR Apache-2.0",
"dependencies": {
"@noble/secp256k1": "^1.3.4",
"@waku/byte-utils": "*",
"@waku/interfaces": "*",
"js-sha3": "^0.8.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@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",
"fast-check": "^2.14.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rollup": "^2.75.0",
"ts-loader": "^9.4.1",
"typescript": "^4.6.3"
},
"engines": {
"node": ">=16"
}
},
"packages/tests": { "packages/tests": {
"name": "@waku/tests", "name": "@waku/tests",
"version": "0.0.1", "version": "0.0.1",
@ -22913,7 +22949,8 @@
"@waku/core": "*", "@waku/core": "*",
"@waku/create": "*", "@waku/create": "*",
"@waku/enr": "*", "@waku/enr": "*",
"@waku/interfaces": "*" "@waku/interfaces": "*",
"@waku/message-encryption": "*"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/eslint-plugin": "^5.8.1",
@ -27315,7 +27352,6 @@
"requires": { "requires": {
"@chainsafe/libp2p-gossipsub": "^4.1.1", "@chainsafe/libp2p-gossipsub": "^4.1.1",
"@chainsafe/libp2p-noise": "^8.0.1", "@chainsafe/libp2p-noise": "^8.0.1",
"@libp2p/crypto": "^1.0.4",
"@libp2p/interface-connection": "3.0.1", "@libp2p/interface-connection": "3.0.1",
"@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interface-peer-discovery": "^1.0.0",
"@libp2p/interface-peer-id": "^1.0.2", "@libp2p/interface-peer-id": "^1.0.2",
@ -27327,7 +27363,6 @@
"@libp2p/peer-id": "^1.1.10", "@libp2p/peer-id": "^1.1.10",
"@libp2p/websockets": "^3.0.3", "@libp2p/websockets": "^3.0.3",
"@multiformats/multiaddr": "^11.0.6", "@multiformats/multiaddr": "^11.0.6",
"@noble/secp256k1": "^1.3.4",
"@rollup/plugin-commonjs": "^22.0.0", "@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0", "@rollup/plugin-node-resolve": "^13.3.0",
@ -27340,8 +27375,8 @@
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1", "@typescript-eslint/parser": "^5.8.1",
"@waku/byte-utils": "0.0.1", "@waku/byte-utils": "*",
"@waku/interfaces": "0.0.1", "@waku/interfaces": "*",
"app-root-path": "^3.0.0", "app-root-path": "^3.0.0",
"chai": "^4.3.4", "chai": "^4.3.4",
"cspell": "^5.14.0", "cspell": "^5.14.0",
@ -27359,7 +27394,6 @@
"it-all": "^1.0.6", "it-all": "^1.0.6",
"it-length-prefixed": "^8.0.2", "it-length-prefixed": "^8.0.2",
"it-pipe": "^2.0.4", "it-pipe": "^2.0.4",
"js-sha3": "^0.8.0",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"jsdom-global": "^3.0.2", "jsdom-global": "^3.0.2",
"karma": "^6.3.12", "karma": "^6.3.12",
@ -27631,6 +27665,34 @@
} }
} }
}, },
"@waku/message-encryption": {
"version": "file:packages/message-encryption",
"requires": {
"@noble/secp256k1": "^1.3.4",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"@waku/byte-utils": "*",
"@waku/interfaces": "*",
"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",
"fast-check": "^2.14.0",
"js-sha3": "^0.8.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rollup": "^2.75.0",
"ts-loader": "^9.4.1",
"typescript": "^4.6.3"
}
},
"@waku/tests": { "@waku/tests": {
"version": "file:packages/tests", "version": "file:packages/tests",
"requires": { "requires": {
@ -27641,6 +27703,7 @@
"@waku/create": "*", "@waku/create": "*",
"@waku/enr": "*", "@waku/enr": "*",
"@waku/interfaces": "*", "@waku/interfaces": "*",
"@waku/message-encryption": "*",
"cspell": "^5.14.0", "cspell": "^5.14.0",
"eslint": "^8.6.0", "eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -17,7 +17,7 @@
"doc": "run-s doc:*", "doc": "run-s doc:*",
"doc:html": "typedoc # --treatWarningsAsErrors", "doc:html": "typedoc # --treatWarningsAsErrors",
"doc:cname": "echo 'js.waku.org' > docs/CNAME", "doc:cname": "echo 'js.waku.org' > docs/CNAME",
"release": "lerna run --concurrency 1 release -- --" "release": "multi-semantic-release"
}, },
"devDependencies": { "devDependencies": {
"@semantic-release/changelog": "^6.0.1", "@semantic-release/changelog": "^6.0.1",

View File

@ -25,10 +25,6 @@
"types": "./dist/lib/waku_message/version_0.d.ts", "types": "./dist/lib/waku_message/version_0.d.ts",
"import": "./dist/lib/waku_message/version_0.js" "import": "./dist/lib/waku_message/version_0.js"
}, },
"./lib/waku_message/version_1": {
"types": "./dist/lib/waku_message/version_1.d.ts",
"import": "./dist/lib/waku_message/version_1.js"
},
"./lib/waku_message/topic_only_message": { "./lib/waku_message/topic_only_message": {
"types": "./dist/lib/waku_message/topic_only_message.d.ts", "types": "./dist/lib/waku_message/topic_only_message.d.ts",
"import": "./dist/lib/waku_message/topic_only_message.js" "import": "./dist/lib/waku_message/topic_only_message.js"
@ -87,9 +83,6 @@
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build", "reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build",
"release": "semantic-release" "release": "semantic-release"
}, },
"browser": {
"crypto": false
},
"engines": { "engines": {
"node": ">=16" "node": ">=16"
}, },
@ -97,7 +90,6 @@
"@waku/byte-utils": "*", "@waku/byte-utils": "*",
"@chainsafe/libp2p-gossipsub": "^4.1.1", "@chainsafe/libp2p-gossipsub": "^4.1.1",
"@chainsafe/libp2p-noise": "^8.0.1", "@chainsafe/libp2p-noise": "^8.0.1",
"@libp2p/crypto": "^1.0.4",
"@libp2p/interface-connection": "3.0.1", "@libp2p/interface-connection": "3.0.1",
"@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interface-peer-discovery": "^1.0.0",
"@libp2p/interface-peer-id": "^1.0.2", "@libp2p/interface-peer-id": "^1.0.2",
@ -109,13 +101,11 @@
"@libp2p/peer-id": "^1.1.10", "@libp2p/peer-id": "^1.1.10",
"@libp2p/websockets": "^3.0.3", "@libp2p/websockets": "^3.0.3",
"@multiformats/multiaddr": "^11.0.6", "@multiformats/multiaddr": "^11.0.6",
"@noble/secp256k1": "^1.3.4",
"@waku/interfaces": "*", "@waku/interfaces": "*",
"debug": "^4.3.4", "debug": "^4.3.4",
"it-all": "^1.0.6", "it-all": "^1.0.6",
"it-length-prefixed": "^8.0.2", "it-length-prefixed": "^8.0.2",
"it-pipe": "^2.0.4", "it-pipe": "^2.0.4",
"js-sha3": "^0.8.0",
"libp2p": "0.38.0", "libp2p": "0.38.0",
"p-event": "^5.0.1", "p-event": "^5.0.1",
"protons-runtime": "^3.1.0", "protons-runtime": "^3.1.0",

View File

@ -9,7 +9,6 @@ export default {
"lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js", "lib/predefined_bootstrap_nodes": "dist/lib/predefined_bootstrap_nodes.js",
"lib/wait_for_remote_peer": "dist/lib/wait_for_remote_peer.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_0": "dist/lib/waku_message/version_0.js",
"lib/waku_message/version_1": "dist/lib/waku_message/version_1.js",
"lib/waku_message/topic_only_message": "lib/waku_message/topic_only_message":
"dist/lib/waku_message/topic_only_message.js", "dist/lib/waku_message/topic_only_message.js",
}, },

View File

@ -1,11 +1,5 @@
export { DefaultPubSubTopic } from "./lib/constants"; export { DefaultPubSubTopic } from "./lib/constants";
export {
generatePrivateKey,
generateSymmetricKey,
getPublicKey,
} from "./lib/crypto";
export * as proto_message from "./proto/message"; export * as proto_message from "./proto/message";
export * as proto_topic_only_message from "./proto/topic_only_message"; export * as proto_topic_only_message from "./proto/topic_only_message";

View File

@ -10,9 +10,10 @@ import debug from "debug";
import * as proto from "../../proto/message"; import * as proto from "../../proto/message";
const log = debug("waku:message:version-0"); const log = debug("waku:message:version-0");
const OneMillion = BigInt(1_000_000); const OneMillion = BigInt(1_000_000);
export const Version = 0; export const Version = 0;
export { proto };
export class MessageV0 implements Message { export class MessageV0 implements Message {
constructor(protected proto: proto.WakuMessage) {} constructor(protected proto: proto.WakuMessage) {}

View File

@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json",
},
};

View 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
}

View File

@ -0,0 +1,4 @@
build
bundle
dist
node_modules

View 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",
},
});
};

View File

@ -0,0 +1,99 @@
{
"name": "@waku/message-encryption",
"version": "0.0.1",
"description": "Waku Message Payload Encryption",
"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/message-encryption#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"
},
"browser": {
"crypto": false
},
"dependencies": {
"@noble/secp256k1": "^1.3.4",
"@waku/byte-utils": "*",
"@waku/interfaces": "*",
"js-sha3": "^0.8.0"
},
"devDependencies": {
"fast-check": "^2.14.0",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@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",
"ts-loader": "^9.4.1",
"typescript": "^4.6.3"
},
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [
"dist",
"bundle",
"src/**/*.ts",
"!**/*.spec.*",
"!**/*.json",
"CHANGELOG.md",
"LICENSE",
"README.md"
]
}

View 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,
}),
],
};

View File

@ -4,7 +4,7 @@ import * as secp from "@noble/secp256k1";
import { concat } from "@waku/byte-utils"; import { concat } from "@waku/byte-utils";
import sha3 from "js-sha3"; import sha3 from "js-sha3";
import { Asymmetric, Symmetric } from "./waku_message/constants"; import { Asymmetric, Symmetric } from "./constants.js";
declare const self: Record<string, any> | undefined; declare const self: Record<string, any> | undefined;
const crypto: { node?: any; web?: any } = { const crypto: { node?: any; web?: any } = {

View File

@ -1,7 +1,7 @@
import * as secp from "@noble/secp256k1"; import * as secp from "@noble/secp256k1";
import { concat, hexToBytes } from "@waku/byte-utils"; import { concat, hexToBytes } from "@waku/byte-utils";
import { getSubtle, randomBytes, sha256 } from "../crypto"; import { getSubtle, randomBytes, sha256 } from "./crypto.js";
/** /**
* HKDF as implemented in go-ethereum. * HKDF as implemented in go-ethereum.
*/ */

View File

@ -1,7 +1,7 @@
import { expect } from "chai"; import { expect } from "chai";
import fc from "fast-check"; import fc from "fast-check";
import { getPublicKey } from "../crypto"; import { getPublicKey } from "./crypto.js";
import { import {
AsymDecoder, AsymDecoder,
@ -14,7 +14,7 @@ import {
preCipher, preCipher,
SymDecoder, SymDecoder,
SymEncoder, SymEncoder,
} from "./version_1"; } from "./index.js";
const TestContentTopic = "/test/1/waku-message/utf8"; const TestContentTopic = "/test/1/waku-message/utf8";

View File

@ -1,15 +1,24 @@
import * as secp from "@noble/secp256k1"; import * as secp from "@noble/secp256k1";
import { concat, hexToBytes } from "@waku/byte-utils"; import { concat, hexToBytes } from "@waku/byte-utils";
import {
DecoderV0,
MessageV0,
proto,
} from "@waku/core/lib/waku_message/version_0";
import type { Decoder, Encoder, Message, ProtoMessage } from "@waku/interfaces"; import type { Decoder, Encoder, Message, ProtoMessage } from "@waku/interfaces";
import debug from "debug"; import debug from "debug";
import * as proto from "../../proto/message"; import { Symmetric } from "./constants.js";
import { keccak256, randomBytes, sign } from "../crypto"; import {
generatePrivateKey,
import { Symmetric } from "./constants"; generateSymmetricKey,
import * as ecies from "./ecies"; getPublicKey,
import * as symmetric from "./symmetric"; keccak256,
import { DecoderV0, MessageV0 } from "./version_0"; randomBytes,
sign,
} from "./crypto.js";
import * as ecies from "./ecies.js";
import * as symmetric from "./symmetric.js";
const log = debug("waku:message:version-1"); const log = debug("waku:message:version-1");
@ -20,6 +29,8 @@ const PaddingTarget = 256;
const SignatureLength = 65; const SignatureLength = 65;
const OneMillion = BigInt(1_000_000); const OneMillion = BigInt(1_000_000);
export { generatePrivateKey, generateSymmetricKey, getPublicKey };
export const Version = 1; export const Version = 1;
export type Signature = { export type Signature = {

View File

@ -1,6 +1,5 @@
import { getSubtle, randomBytes } from "../crypto";
import { Symmetric } from "./constants"; import { Symmetric } from "./constants";
import { getSubtle, randomBytes } from "./crypto.js";
export async function encrypt( export async function encrypt(
iv: Uint8Array, iv: Uint8Array,

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "esnext",
"noEmit": true
},
"exclude": []
}

View 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
}
}

View File

@ -59,7 +59,8 @@
"@waku/enr": "*", "@waku/enr": "*",
"@waku/create": "*", "@waku/create": "*",
"@waku/interfaces": "*", "@waku/interfaces": "*",
"@waku/byte-utils": "*" "@waku/byte-utils": "*",
"@waku/message-encryption": "*"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/eslint-plugin": "^5.8.1",

View File

@ -1,26 +1,24 @@
import { PeerId } from "@libp2p/interface-peer-id"; import { PeerId } from "@libp2p/interface-peer-id";
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils"; import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
import { import { DefaultPubSubTopic } from "@waku/core";
DefaultPubSubTopic,
generatePrivateKey,
generateSymmetricKey,
getPublicKey,
} from "@waku/core";
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer"; import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
import { import {
DecoderV0, DecoderV0,
EncoderV0, EncoderV0,
MessageV0, MessageV0,
} from "@waku/core/lib/waku_message/version_0"; } from "@waku/core/lib/waku_message/version_0";
import {
AsymDecoder,
AsymEncoder,
SymDecoder,
SymEncoder,
} from "@waku/core/lib/waku_message/version_1";
import { createPrivacyNode } from "@waku/create"; import { createPrivacyNode } from "@waku/create";
import type { Message, WakuPrivacy } from "@waku/interfaces"; import type { Message, WakuPrivacy } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces"; import { Protocols } from "@waku/interfaces";
import {
AsymDecoder,
AsymEncoder,
generatePrivateKey,
generateSymmetricKey,
getPublicKey,
SymDecoder,
SymEncoder,
} from "@waku/message-encryption";
import { expect } from "chai"; import { expect } from "chai";
import debug from "debug"; import debug from "debug";

View File

@ -1,21 +1,19 @@
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils"; import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
import {
generatePrivateKey,
generateSymmetricKey,
getPublicKey,
} from "@waku/core";
import { PageDirection } from "@waku/core"; import { PageDirection } from "@waku/core";
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer"; import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer";
import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0"; import { DecoderV0, EncoderV0 } from "@waku/core/lib/waku_message/version_0";
import {
AsymDecoder,
AsymEncoder,
SymDecoder,
SymEncoder,
} from "@waku/core/lib/waku_message/version_1";
import { createFullNode } from "@waku/create"; import { createFullNode } from "@waku/create";
import type { Message, WakuFull } from "@waku/interfaces"; import type { Message, WakuFull } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces"; import { Protocols } from "@waku/interfaces";
import {
AsymDecoder,
AsymEncoder,
generatePrivateKey,
generateSymmetricKey,
getPublicKey,
SymDecoder,
SymEncoder,
} from "@waku/message-encryption";
import { expect } from "chai"; import { expect } from "chai";
import debug from "debug"; import debug from "debug";

View File

@ -1,12 +1,15 @@
import type { PeerId } from "@libp2p/interface-peer-id"; import type { PeerId } from "@libp2p/interface-peer-id";
import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils"; import { bytesToUtf8, utf8ToBytes } from "@waku/byte-utils";
import { generateSymmetricKey } from "@waku/core";
import { PeerDiscoveryStaticPeers } from "@waku/core/lib/peer_discovery_static_list"; import { PeerDiscoveryStaticPeers } from "@waku/core/lib/peer_discovery_static_list";
import { waitForRemotePeer } from "@waku/core/lib/wait_for_remote_peer"; 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"; import { createLightNode, createPrivacyNode } from "@waku/create";
import type { Message, Waku, WakuLight, WakuPrivacy } from "@waku/interfaces"; import type { Message, Waku, WakuLight, WakuPrivacy } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces"; import { Protocols } from "@waku/interfaces";
import {
generateSymmetricKey,
SymDecoder,
SymEncoder,
} from "@waku/message-encryption";
import { expect } from "chai"; import { expect } from "chai";
import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src/"; import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src/";

View File

@ -6,7 +6,8 @@
"packages/create", "packages/create",
"packages/dns-discovery", "packages/dns-discovery",
"packages/enr", "packages/enr",
"packages/interfaces" "packages/interfaces",
"packages/message-encryption"
], ],
"out": "docs", "out": "docs",
"exclude": ["**/*.spec.ts"], "exclude": ["**/*.spec.ts"],