-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
73 lines (72 loc) · 3.29 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="public/css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>erc1271 sig splitter</title>
</head>
<body>
<div class="container">
<fieldset class='fieldset'>
<form action="javascript:page_split()" class="form">
<input name="input_sig" type="text" class="ghost-input" id="sig" placeholder="Enter signature (0x...)" pattern="0[xX][0-9-a-fA-F]{130}" required>
<button class="button_copy" formaction="javascript:copy_element('sig')"></button>
<input type="submit" class="ghost-button" value="split">
</form>
</fieldset>
<fieldset class='fieldset'>
<form class="form">
<input name="input_v" type="text" id="v" class="ghost-input" placeholder="Component - v" pattern="0[xX][0-9-a-fA-F]{64}" required>
<button class="button_copy" formaction="javascript:copy_element('v')"></button>
<input name="input_r" type="text" id="r" class="ghost-input" placeholder="Component - r" pattern="0[xX][0-9-a-fA-F]{64}" required>
<button class="button_copy" formaction="javascript:copy_element('r')"></button>
<input name="input_s" type="text" id="s" class="ghost-input" placeholder="Component - s" pattern="(0[xX])?[0-9-a-fA-F]{2}" required>
<button class="button_copy" formaction="javascript:copy_element('s')"></button>
<input type="submit" class="ghost-button" formaction="javascript:page_combine()"value= "combine">
</form>
</fieldset>
</div>
<script>
function page_combine()
{
document.getElementById("sig").value = module.combine(document.getElementById("v").value, document.getElementById("r").value, document.getElementById("s").value);
}
function page_split()
{
console.log(document.getElementById("sig").value);
let input_components = module.split(document.getElementById("sig").value);
document.getElementById("v").value = input_components.v;
document.getElementById("r").value = input_components.r;
document.getElementById("s").value = input_components.s;
}
const module = {};
</script>
<script>
function copy_element(element)
{
if (navigator && navigator.clipboard && navigator.clipboard.writeText)
{
navigator.clipboard.writeText(document.getElementById(element).value);
}
else
{
return Promise.reject('The Clipboard API is not available.');
}
}
</script>
<script type="module">
import { split, combine } from "https://sourabhmarathe.github.io/sig-splitter-js/index.js";
module.split = split;
module.combine = combine;
</script>
<footer>
<a href="https://eips.ethereum.org/EIPS/eip-1271">ERC1271</a>
<a href="https://github.com/sourabhmarathe/sig-splitter">source</a>
</footer>
</body>
<!--The copy icon is used with permission from ARISO from here: https://thenounproject.com/icon/copy-4623897/-->
</html>