-
Notifications
You must be signed in to change notification settings - Fork 9
/
digiid.html
39 lines (32 loc) · 1.01 KB
/
digiid.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
<style>
input {
width: 100%;
}
</style>
<h1>DigiID Path Finder</h1>
Scan the QR code provided by the DigiID web site with a bar code reading app and type value it says below:<br>
<input type="text" id="url" width="100"><br>
<br>
Sites Path:<br>
<input type="text" id="path" width="100" disabled>
<script src="libraries.min.js"></script>
<script>
var domURL=document.getElementById('url');
domURL.addEventListener('keyup',function() {
var text=domURL.value.trim();
var a=text.indexOf(':');
var b=text.indexOf('?');
if ((a>=0)&&(b>=0)) {
text=String.fromCharCode(0)+String.fromCharCode(0)+String.fromCharCode(0)+String.fromCharCode(0)+'https'+text.substr(a,b-a);
//text=text.substr(0,b);
console.log(text);
var hash=bitcoinjs.bitcoin.crypto.sha256(text.trim());
console.log(hash);
var path="m/13'";
for (var i=0;i<16;i+=4) {
path+="/"+((hash[i+3]&0x7f)<<24|hash[i+2]<<16|hash[i+1]<<8|hash[i])+"'";
}
document.getElementById('path').value=path;
}
});
</script>