Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/build/
*.swp
dist/
.DS_Store
.eslintcache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
>=20.x
>=24.x
28,150 changes: 9,141 additions & 19,009 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sideEffects": false,
"scripts": {
"build": "torus-scripts build",
"lint": "eslint --fix 'src/**/*.ts'",
"lint": "torus-scripts lint --fix",
"release": "torus-scripts release",
"test:ci": "npm run test:node && npm run test:browsers",
"test:node": "vitest run --config test/configs/node.config.mts --coverage",
Expand Down Expand Up @@ -40,26 +40,26 @@
},
"homepage": "https://github.com/torusresearch/eccrypto",
"devDependencies": {
"@babel/runtime": "^7.26.9",
"@toruslabs/config": "^3.1.0",
"@toruslabs/eslint-config-node": "^4.1.0",
"@toruslabs/eslint-config-typescript": "^4.1.0",
"@toruslabs/torus-scripts": "^7.1.1",
"@babel/runtime": "^7.28.6",
"@toruslabs/config": "^4.0.0",
"@toruslabs/eslint-config-node": "^5.0.0",
"@toruslabs/eslint-config-typescript": "^5.0.0",
"@toruslabs/torus-scripts": "^8.0.0",
"@types/elliptic": "^6.4.18",
"@vitest/browser": "^3.0.7",
"@vitest/coverage-istanbul": "^3.0.7",
"browserify": "^17.0.1",
"eslint": "^9.21.0",
"playwright": "^1.50.1",
"typescript": "^5.7.3",
"vitest": "^3.0.7"
"@vitest/browser-playwright": "^4.0.17",
"@vitest/coverage-istanbul": "^4.0.17",
"buffer": "^6.0.3",
"eslint": "^9.39.2",
"playwright": "^1.57.0",
"typescript": "^5.9.3",
"vitest": "^4.0.17"
},
"overrides": {
"esbuild": "^0.25.0"
},
"engines": {
"node": ">=20.x",
"npm": ">=9.x"
"node": ">=22.x",
"npm": ">=10.x"
},
"dependencies": {
"elliptic": "^6.6.1"
Expand Down
3 changes: 2 additions & 1 deletion test/configs/browsers.config.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { playwright } from "@vitest/browser-playwright";
import { defineConfig } from "vitest/config";

export default defineConfig({
Expand All @@ -8,7 +9,7 @@ export default defineConfig({
browser: {
screenshotFailures: false,
headless: true,
provider: "playwright",
provider: playwright(),
enabled: true,
testerHtmlPath: "./test/test.html",
instances: [
Expand Down
File renamed without changes.
48 changes: 38 additions & 10 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
<!--
To run the test, you need to run the following command:
npx vite .
This will start a development server at http://localhost:5173/
then open the browser and go to http://localhost:5173/test/index.html
you should see the test result in the console.
This is a simple test to verify that the eccrypto library is working in the browser.
It will generate a private key, get the public key, sign a message, and verify the signature.
It will then log the result to the console.
If the signature is verified, it will log "Signature verified" to the console.
If the signature is not verified, it will log the error to the console.
-->
<!DOCTYPE html>
<html>

<head>
Eccrypto Test
<title>Eccrypto Test</title>
<script type="importmap">
{
"imports": {
"elliptic": "https://esm.sh/elliptic@6.6.1"
}
}
</script>
</head>

<body>
<script src="../dist/eccrypto.umd.min.js"></script>
<script>
(async () => {
const priv = Eccrypto.generatePrivate();
const pub = Eccrypto.getPublic(priv);
const msg = Eccrypto.generatePrivate();
const sig = await Eccrypto.sign(priv, msg);
Eccrypto.verify(pub, msg, sig).then(console.log).catch(console.error);
})();
<script type="module">
// Buffer polyfill for browser
import { Buffer } from 'https://esm.sh/buffer@6.0.3';
window.Buffer = Buffer;

// Now import eccrypto
const eccrypto = await import('../dist/lib.esm/index.js');

const priv = eccrypto.generatePrivate();
const pub = eccrypto.getPublic(priv);
const msg = eccrypto.generatePrivate();
const sig = await eccrypto.sign(priv, msg);
eccrypto.verify(pub, msg, sig).then(() => console.log('Signature verified')).catch(console.error);
</script>
</body>

</html>
File renamed without changes.
Loading