browserified js

This commit is contained in:
mbhandary
2020-02-19 18:22:29 -05:00
parent 112fc90f7d
commit 3ce03b08b9
5 changed files with 47442 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,16 @@
const codec = require('ripple-binary-codec');
const addressCodec = require('ripple-address-codec');
const keyCodec = require('ripple-keypairs')
const keyCodec = require('ripple-keypairs');
const TOML_PATH = "/.well-known/xrp-ledger.toml";
//Get the domain and public key from the manifest
function parseManifest(manhex){
function parseManifest(){
const manhex = $('#manifest').val()
//TODO: throw errors when manifest is malformed or keys are not present
let man = codec.decode(manhex);
let buff = new Buffer(man['PublicKey'], 'hex').toJSON().data
@@ -17,7 +19,7 @@ function parseManifest(manhex){
let publicKey = addressCodec.encodeNodePublic(buff);
let publicKeyHex = man['PublicKey'];
let message = "[domain-attestation-blob:mayurbhandary.com:"+publicKey+"]";
let message = "[domain-attestation-blob:"+domain+":"+publicKey+"]";
let attestation = "A59AB577E14A7BEC053752FBFE78C3DED6DCEC81A7C41DF1931BC61742BB4FAEAA0D4F1C1EAE5BC74F6D68A3B26C8A223EA2492A5BD18D51F8AC7F4A97DFBE0C";
var verify = keyCodec.verify(ascii_to_hexa(message),attestation,publicKeyHex)
@@ -30,17 +32,17 @@ function parseManifest(manhex){
}
function hex_to_ascii(str1)
{
{
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
str += String.fromCharCode(parseInt(hex.substr(n, 2), 16));
}
return str;
}
}
function ascii_to_hexa(str)
{
{
var arr1 = [];
for (var n = 0, l = str.length; n < l; n ++)
{
@@ -48,7 +50,7 @@ function hex_to_ascii(str1)
arr1.push(hex);
}
return arr1.join('');
}
}
//message: [domain-attestation-blob:mayurbhandary.com]
@@ -57,5 +59,20 @@ function hex_to_ascii(str1)
//attestation="A59AB577E14A7BEC053752FBFE78C3DED6DCEC81A7C41DF1931BC61742BB4FAEAA0D4F1C1EAE5BC74F6D68A3B26C8A223EA2492A5BD18D51F8AC7F4A97DFBE0C"
//manifest: 24000000017121EDFCADB465692E663A6081B8AE60A5CAA7FC9519B6140B9C9FFDE313A7044CEDC3732103A951D1D042B128BC3253E261719277CBEE7966207C55299DDF9DE08ACCF81C67764730450221009AB0D13B5F333BFA75098F5E8C81638E133D9585973E56E22C9202D4F13E12FE02207B48B2C49B734D78E23AD0C51C98E21F78813D711E465C88A4FBEA37263552A477116D617975726268616E646172792E636F6D7012401EB58B0BACE2E8BBE07D9A2A0FA82BAB21B236DE23FB81F44816921730300038598F4144B85A72206065F1F05563A84997F15A345058CCB07B3D63702F2D760C'
parseManifest('24000000017121EDFCADB465692E663A6081B8AE60A5CAA7FC9519B6140B9C9FFDE313A7044CEDC3732103A951D1D042B128BC3253E261719277CBEE7966207C55299DDF9DE08ACCF81C67764730450221009AB0D13B5F333BFA75098F5E8C81638E133D9585973E56E22C9202D4F13E12FE02207B48B2C49B734D78E23AD0C51C98E21F78813D711E465C88A4FBEA37263552A477116D617975726268616E646172792E636F6D7012401EB58B0BACE2E8BBE07D9A2A0FA82BAB21B236DE23FB81F44816921730300038598F4144B85A72206065F1F05563A84997F15A345058CCB07B3D63702F2D760C');
//parseManifest('24000000017121EDFCADB465692E663A6081B8AE60A5CAA7FC9519B6140B9C9FFDE313A7044CEDC3732103A951D1D042B128BC3253E261719277CBEE7966207C55299DDF9DE08ACCF81C67764730450221009AB0D13B5F333BFA75098F5E8C81638E133D9585973E56E22C9202D4F13E12FE02207B48B2C49B734D78E23AD0C51C98E21F78813D711E465C88A4FBEA37263552A477116D617975726268616E646172792E636F6D7012401EB58B0BACE2E8BBE07D9A2A0FA82BAB21B236DE23FB81F44816921730300038598F4144B85A72206065F1F05563A84997F15A345058CCB07B3D63702F2D760C');
function handle_submit(event) {
event.preventDefault();
$('.result-title').show()
$('#result').show()
$('#log').empty()
parseManifest();
}
$(document).ready(() => {
$('#manifest-entry').submit(handle_submit)
})

View File

@@ -18,6 +18,10 @@ Ripple provides a set of developer tools to help you test, explore, and validate
Use this tool to verify that your [xrp-ledger.toml file](xrp-ledger-toml.html) is set up properly.
* **[Domain Verification Checker](validator-domain-verifier.html)**
Use this tool to check that your validator's domain can be verified.
* **[XRP Faucets](xrp-testnet-faucet.html)**
Get credentials and test-XRP for XRP Ledger Testnet or Devnet, and connect to servers in these parallel networks to test building software on the XRP Ledger without using real funds.

View File

@@ -5927,6 +5927,14 @@ pages:
- ja
template: template-xrp-ledger-toml-checker.html
- name: Domain Verification Checker
funnel: Dev Tools
html: validator-domain-verifier.html
targets:
- en
- ja
template: template-validator-domain-verifier.html
- name: XRP Faucets
html: xrp-testnet-faucet.html
funnel: Dev Tools

View File

@@ -0,0 +1,35 @@
{% extends "template-base.html" %}
{% block main %}
<section class="container-fluid p-3">
<h1>xrp-ledger.toml Checker</h1>
<p>Domain Verification <a href="https://developers.ripple.com/xrp-ledger-toml.html"><code>xrp-ledger.toml</code> file</a>.</p>
<p>This tool allows you to verify that domain verification is properly set up on your validator. </p><br/>
<form id="manifest-entry">
<div class="input-group">
<input id="manifest" type="text" class="form-control" required
placeholder="Your Manifest Here"
pattern="[0-9A-F]+"><br>
<button class="btn btn-primary form-control">Check Domain Verification</button>
</div><!--/.input-group-->
</form>
<div id="result">
<h5 class='result-title'>Result</h5>
<ul id="log">
</ul>
</div>
</section>
{% endblock %}
{% block endbody %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
<script type="application/javascript" src="assets/js/ripple-lib-1.4.1-min.js"></script>
<script type='text/javascript' src='assets/vendor/iarna-toml-parse.js'></script>
<script type='text/javascript' src='assets/js/domain-verifier-bundle.js'></script>
<script type="application/javascript">
gtag('set', {'content_group1': 'API Tools'});
</script>
{% endblock %}