click to copy privkey and pubkey
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
const currentUrl = window.location.href;
|
||||
import { ab2str, exportedKeyToPem, pemToKey, genKey } from "./ecc.js";
|
||||
import { add_div_register_text } from "./registertext.js";
|
||||
|
||||
export async function registerConfirm() {
|
||||
const apiUrl = `${currentUrl}account/register`;
|
||||
@ -9,7 +10,8 @@ export async function registerConfirm() {
|
||||
if (!inputFieldPublicKey.value) {
|
||||
const { privateKey, publicKey } = await genKey();
|
||||
pubkey = exportedKeyToPem(publicKey, "public");
|
||||
document.getElementById("registerPopupText").innerText = exportedKeyToPem(privateKey, "private");
|
||||
let privkey = exportedKeyToPem(privateKey, "private");
|
||||
add_div_register_text(privkey);
|
||||
} else {
|
||||
pubkey = inputFieldPublicKey.value;
|
||||
}
|
||||
@ -36,7 +38,9 @@ export async function registerConfirm() {
|
||||
if (response.ok) {
|
||||
console.log(response);
|
||||
} else {
|
||||
document.getElementById("registerPopupText").innerText = "Registration failed. Please try again.";
|
||||
registerPopupText = document.getElementById("registerPopupText")
|
||||
registerPopupText.innerHTML = '';
|
||||
registerPopupText.innerText = "Registration failed. Please try again.";
|
||||
console.error('Error in server response.', response);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user