-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript2.js
20 lines (17 loc) · 804 Bytes
/
script2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.addEventListener('DOMContentLoaded', () => {
const credentialInfoElement = document.getElementById('credential-info');
const deleteButton = document.getElementById('delete-credential');
// Retrieve the stored credential from localStorage
const storedCredential = JSON.parse(localStorage.getItem('webauthn-credential'));
if (storedCredential) {
const publicKey = JSON.stringify(storedCredential.rawId);
credentialInfoElement.textContent = `Public Key: ${publicKey}`;
} else {
credentialInfoElement.textContent = 'No credential stored.';
}
deleteButton.addEventListener('click', () => {
localStorage.removeItem('webauthn-credential');
alert('Credential deleted.');
window.location.href = 'index.html';
});
});