-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
32 lines (29 loc) · 1.06 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"use strict";
let pass_gen;
wasm_bindgen("./pkg/wasm_bg.wasm")
.then(() => {
const {gen} = wasm_bindgen;
pass_gen=gen;
});
window.addEventListener('load', () => {
const master = document.getElementById("master");
const master_confirm = document.getElementById("master-confirm");
const domain = document.getElementById("domain");
const button = document.getElementById("generate");
const output = document.getElementById("password");
button.addEventListener('click', () => {
if (pass_gen) {
if (master.value===master_confirm.value) {
const start = performance.now();
output.innerText=pass_gen(master.value, domain.value);
const finish = performance.now();
console.log("Generated password in "+(finish-start)+"ms");
}else{
console.log("Password mismatch");
alert("Passwords don't match");
}
} else {
console.log("Pazzfraze WASM module not loaded yet");
}
});
});