-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8494cb9
commit ac9d720
Showing
29 changed files
with
1,010 additions
and
1,014 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/node_modules | ||
/target | ||
/Cargo.lock | ||
/pkg | ||
/dist | ||
/pkg |
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.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import dts from 'bun-plugin-dts'; | ||
import Logger from '@rabbit-company/logger'; | ||
import fs from 'fs/promises'; | ||
|
||
await fs.rm('./browser', {recursive: true, force: true}); | ||
await fs.rm('./module', {recursive: true, force: true}); | ||
await fs.rm('./dist', {recursive: true, force: true}); | ||
|
||
Logger.info('Start bulding browser...'); | ||
let browserBuild = await Bun.build({ | ||
entrypoints: ['./src/argon2id.ts', './src/argon2id_worker.ts'], | ||
outdir: './browser', | ||
target: 'browser', | ||
format: 'esm', | ||
minify: { | ||
identifiers: false, | ||
syntax: true, | ||
whitespace: true | ||
}, | ||
plugins: [], | ||
}); | ||
|
||
await Bun.write(Bun.file('./browser/argon2id_wasm_bg.wasm'), Bun.file('./src/argon2id_wasm_bg.wasm')); | ||
|
||
if(browserBuild.success){ | ||
Logger.info('Bulding browser complete'); | ||
}else{ | ||
Logger.error('Bulding browser failed'); | ||
} | ||
|
||
Logger.info('Start bulding module...'); | ||
let moduleBuild = await Bun.build({ | ||
entrypoints: ['./src/argon2id.ts', './src/argon2id_worker.ts'], | ||
outdir: './module', | ||
target: 'browser', | ||
format: 'esm', | ||
minify: false, | ||
plugins: [ | ||
dts({output: {noBanner: true}}) | ||
], | ||
}); | ||
|
||
await Bun.write(Bun.file('./module/argon2id_wasm_bg.wasm'), Bun.file('./src/argon2id_wasm_bg.wasm')); | ||
|
||
if(moduleBuild.success){ | ||
Logger.info('Bulding module complete'); | ||
}else{ | ||
Logger.error('Bulding module failed'); | ||
} | ||
|
||
fs.cp('./src/index.html', './dist/index.html', {recursive: true, force: true}); | ||
|
||
Logger.info('Start bundling dist...'); | ||
let distBuild = await Bun.build({ | ||
entrypoints: ['./src/index.ts', './src/argon2id_worker.ts'], | ||
outdir: './dist', | ||
target: 'browser', | ||
format: 'esm', | ||
minify: true, | ||
sourcemap: 'none', // Bun still generates incorrect sourcemaps | ||
plugins: [], | ||
}); | ||
|
||
await Bun.write(Bun.file('./dist/argon2id_wasm_bg.wasm'), Bun.file('./src/argon2id_wasm_bg.wasm')); | ||
await Bun.write(Bun.file('./dist/index.html'), Bun.file('./src/index.html')); | ||
|
||
if(distBuild.success){ | ||
Logger.info('Bundling dist complete'); | ||
}else{ | ||
Logger.error('Bundling dist failed'); | ||
Logger.error(distBuild.logs); | ||
} |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Argon2id-WASM</title> | ||
</head> | ||
<body> | ||
<h1><a href="https://github.com/Rabbit-Company/Argon2id-WASM" target="_blank">Argon2id-WASM</a></h1> | ||
<form id="hashForm"> | ||
<textarea id="message" rows="5" cols="50"></textarea></br></br> | ||
<label>Salt: </label><input id="salt" type="text" placeholder="Salt" required><br/> | ||
<label>Parallelism Factor: </label><input id="p" type="number" min="1" max="224" value="4" placeholder="p" required><br/> | ||
<label>Memory Cost: </label><input id="m" type="number" min="2" max="1048576" value="16" placeholder="m" required><br/> | ||
<label>Iterations: </label><input id="t" type="number" min="1" max="100" value="3" placeholder="t" required><br/> | ||
<label>Hash Length: </label><input id="l" type="number" min="4" max="65536" value="32" placeholder="l" required><br/><br/> | ||
<button type="submit">Hash</button> | ||
</form> | ||
<p id="hash"></p> | ||
|
||
<h1>Validator</h1> | ||
<form id="verifyForm"> | ||
<textarea id="message2" rows="5" cols="50"></textarea></br></br> | ||
<label>Hash Encoded: </label><input id="hashEncoded" type="text" placeholder="$argon2id$v=19$m=65536,t=3,p=4$OVg1TXI3eTlzcnc2SjIxNw$LtPyv2bn74MJPui2JBPXWx5jXMd1uUv3515emrYSlhM" required><br/></br> | ||
<button type="submit">Validate</button> | ||
</form> | ||
<p id="validate"></p> | ||
|
||
<h1>Performance</h1> | ||
<p id="perf"></p> | ||
|
||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.