-
Notifications
You must be signed in to change notification settings - Fork 0
/
recover.html
38 lines (38 loc) · 1.32 KB
/
recover.html
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
33
34
35
36
37
38
<script>
window.addEventListener('load', async () => {
if (typeof window.ethereum !== 'undefined') {
try {
await window.ethereum.enable();
} catch (e) {
document.querySelector('#result').innerText = 'Unlock MetaMask';
}
} else {
document.querySelector('#result').innerText = 'Install MetaMask';
}
});
verify = async () => {
try {
document.querySelector('#result').innerText = '';
const data = document.querySelector('#data').value;
const signature = document.querySelector('#signature').value;
const result = await window.ethereum.request({
method: 'personal_ecRecover',
params: [data, signature],
});
document.querySelector('#result').innerText = (result);
} catch (error) {
document.querySelector('#result').innerText = error.message;
}
};
</script>
<style>
textarea {
width: 100%;
height: 100px;
}
</style>
<h1>Verify Personal Message Ethereum Online</h1>
Message <textarea id="data" placeholder="some text"></textarea><br>
Signature <textarea id="signature" placeholder="0x0"></textarea><br>
<button onclick="verify()">Verify</button>
<pre id="result"></pre>