diff --git a/creator/index.html b/creator/index.html index e4c4023..d332208 100644 --- a/creator/index.html +++ b/creator/index.html @@ -61,12 +61,19 @@ setMessage("⏳ Importing key...") - // Whatever array of bytes is in the password field - let password = new TextEncoder().encode(document.getElementById("password").value) + const passwordEl = document.getElementById("password") + const passwordConfirmEl = document.getElementById("password-confirm") + + // Whatever arrays of bytes are in the password fields + const password = new TextEncoder().encode(passwordEl.value) + const passwordConfirm = new TextEncoder().encode(passwordConfirmEl.value) if (password.length == 0) { throw new Error(`Empty password`) } + else if (passwordEl.value !== passwordConfirmEl.value) { + throw new Error(`Passwords must match`) + } // Import password into a Key suitable for use with Cryptography APIs let passwordKey = await window.crypto.subtle.importKey( @@ -319,10 +326,17 @@