-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: deterministic message hashing #1233
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
76d1d4f
chore: new empty message-hash package
fryorcraken fe57461
feat: implement deterministic message hash logic
fryorcraken 7198503
test: fix karma config
fryorcraken c781e49
chore: improve var name
fryorcraken c8c2cbf
chore: ignore changelog file as it's handled by release please
fryorcraken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: "./tsconfig.dev.json", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extension": ["ts"], | ||
"spec": "src/**/*.spec.ts", | ||
"require": ["ts-node/register", "isomorphic-fetch"], | ||
"loader": "ts-node/esm", | ||
"node-option": [ | ||
"experimental-specifier-resolution=node", | ||
"loader=ts-node/esm" | ||
], | ||
"exit": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build | ||
bundle | ||
dist | ||
node_modules | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[![NPM](https://nodei.co/npm/@waku/message-hash.png)](https://npmjs.org/package/@waku/message-hash) | ||
|
||
![GitHub Action](https://img.shields.io/github/workflow/status/waku-org/js-waku/CI) | ||
[![Discord chat](https://img.shields.io/discord/864066763682218004.svg?logo=discord&colorB=7289DA)](https://discord.gg/Nrac59MfSX) | ||
|
||
# @waku/message-hash | ||
|
||
TypeScript implementation of the _Deterministic Message Hashing_ as specified in [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/). | ||
|
||
See [JS-Waku README](https://github.com/waku-org/js-waku) for more information. | ||
|
||
## Contributing | ||
|
||
See [CONTRIBUTING.md](https://github.com/waku-org/js-waku/blob/master/CONTRIBUTING.md). | ||
|
||
## License | ||
|
||
Licensed and distributed under either of | ||
|
||
- MIT license: [LICENSE-MIT](https://github.com/waku-org/js-waku/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT | ||
|
||
or | ||
|
||
- Apache License, Version 2.0, ([LICENSE-APACHE-v2](https://github.com/waku-org/js-waku/blob/master/LICENSE-APACHE-v2) or http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
at your option. These files may not be copied, modified, or distributed except according to those terms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/**/!(node).spec.ts"], | ||
preprocessors: { | ||
"src/**/!(node).spec.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", | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"name": "@waku/message-hash", | ||
"version": "0.1.0", | ||
"description": "TypeScript implementation of the Deterministic Message Hashing as specified in 14/WAKU2-MESSAGE", | ||
"types": "./dist/index.d.ts", | ||
"module": "./dist/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js" | ||
} | ||
}, | ||
"type": "module", | ||
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/message-hash#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", | ||
"decentralised", | ||
"communication", | ||
"web3", | ||
"ethereum", | ||
"dapps" | ||
], | ||
"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 *.js --fix", | ||
"check": "run-s check:*", | ||
"check:tsc": "tsc -p tsconfig.dev.json", | ||
"check:lint": "eslint src *.js", | ||
"check:prettier": "prettier . --list-different", | ||
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"", | ||
"test": "run-s test:*", | ||
"test:node": "TS_NODE_PROJECT=./tsconfig.dev.json mocha", | ||
"test:browser": "karma start karma.conf.cjs", | ||
"watch:build": "tsc -p tsconfig.json -w", | ||
"watch:test": "mocha --watch", | ||
"prepublish": "npm run build", | ||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"@noble/hashes": "^1.2.0", | ||
"@waku/utils": "*" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@types/chai": "^4.3.4", | ||
"@types/debug": "^4.1.7", | ||
"@types/mocha": "^10.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.54.1", | ||
"@typescript-eslint/parser": "^5.51.0", | ||
"@waku/build-utils": "*", | ||
"@waku/interfaces": "*", | ||
"chai": "^4.3.7", | ||
"cspell": "^6.28.0", | ||
"eslint": "^8.35.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-functional": "^5.0.4", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"fast-check": "^3.7.0", | ||
"ignore-loader": "^0.1.2", | ||
"isomorphic-fetch": "^3.0.0", | ||
"karma": "^6.4.1", | ||
"karma-chrome-launcher": "^3.1.1", | ||
"karma-mocha": "^2.0.1", | ||
"karma-webpack": "^5.0.0", | ||
"mocha": "^10.2.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.8.4", | ||
"process": "^0.11.10", | ||
"puppeteer": "^19.7.2", | ||
"rollup": "^3.15.0", | ||
"ts-loader": "^9.4.2", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.5" | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts" | ||
}, | ||
"files": [ | ||
"dist", | ||
"bundle", | ||
"src/*.ts", | ||
"src/lib/**/*.ts", | ||
"!**/*.spec.*", | ||
"!**/*.json", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"README.md" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import json from "@rollup/plugin-json"; | ||
import { nodeResolve } from "@rollup/plugin-node-resolve"; | ||
import { extractExports } from "@waku/build-utils"; | ||
|
||
import * as packageJson from "./package.json" assert { type: "json" }; | ||
|
||
const input = extractExports(packageJson); | ||
|
||
export default { | ||
input, | ||
output: { | ||
dir: "bundle", | ||
format: "esm", | ||
}, | ||
plugins: [ | ||
commonjs(), | ||
json(), | ||
nodeResolve({ | ||
browser: true, | ||
preferBuiltins: false, | ||
}), | ||
], | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add CHANGELOG to ignore