212 lines
13 KiB
HTML
212 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Blockchain KYC</title>
|
|
<link rel="stylesheet" href="css/main.min.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
|
|
<script src="https://unpkg.com/uhtml@3.0.1/es.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="loading">
|
|
<sm-spinner></sm-spinner>
|
|
<h4>Loading RanchiMall KYC blockchain verification</h4>
|
|
</div>
|
|
<article>
|
|
<header class="flex gap-1 align-center">
|
|
<h1 class="flex align-items-center" style="font-size: 1rem;">
|
|
<svg class="icon" style="margin-right:0.3rem" viewBox="0 0 96 108" xml:space="preserve">
|
|
<path d="M90.2,102.5c-2.4-8.2-9.9-14.5-27.4-23.1c-7.1-3.5-11.8-6.2-14-8.3c-1.7-1.6-3.5-4-4.2-5.5c-0.7-1.7-0.7-5.5,0-7.5
|
|
c1.3-3.6,2.6-5.2,12.9-15.1c6.2-5.9,9.3-10.3,11.1-15.5c0.7-2.1,0.8-7.6,0.2-9.4C66.5,12,61.7,6.7,53.7,1.6c-3-1.9-4.3-2.1-4.3-0.8
|
|
c0,0.3-0.5,1.4-1,2.4l-1,1.8l-2.8-1.9c-1.5-1.1-3.4-2.2-4.1-2.6c-1.3-0.7-2.4-0.6-2.4,0.2c0,0.3-1.4,3.4-2,4.4
|
|
c0,0.1-0.4-0.1-0.9-0.4c-6.1-4.4-8.7-5.5-8.7-3.9c0,0.7-1.8,4.2-4,7.9C16,19.5,9.4,24.9,2.6,24.9c-3,0-2.9-0.1-2,3.4
|
|
c0.7,2.8,1.1,3.1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age.html" class="button button--colored margin-left-auto">For officials</a>
|
|
<theme-toggle></theme-toggle>
|
|
</header>
|
|
<section id="verification_section" class="grid gap-1-5">
|
|
<div class="grid gap-0-5 text-center justify-items-center">
|
|
<h2>KYC verification</h2>
|
|
<P>
|
|
Enter the address you want to verify
|
|
</P>
|
|
</div>
|
|
<sm-form>
|
|
<div class="flex gap-0-5 align-items-start">
|
|
<sm-input placeholder="Bitcoin/FLO address" id="address_verify" class="flex-1"
|
|
error-text="Invalid address" required></sm-input>
|
|
<button id="verify" class="button button--primary cta" type="submit">Verify</button>
|
|
</div>
|
|
</sm-form>
|
|
<output id="verification_result"></output>
|
|
</section>
|
|
</article>
|
|
<script src="scripts/floGlobals.js"></script>
|
|
<script src="scripts/components.min.js"></script>
|
|
<script src="scripts/lib.js"></script>
|
|
<script src="scripts/floCrypto.js"></script>
|
|
<script src="scripts/floBlockchainAPI.js"></script>
|
|
<script src="scripts/btcOperator.js"></script>
|
|
<script src="scripts/chainkyc.js"></script>
|
|
<script>
|
|
const { html, render: renderElem } = uhtml;
|
|
</script>
|
|
<script>
|
|
router.addRoute('', async state => {
|
|
verify()
|
|
})
|
|
router.addRoute('verify', async state => {
|
|
verify(state.params.address)
|
|
})
|
|
function verify(address) {
|
|
if (address) {
|
|
if (getRef('address_verify').value.trim() !== address)
|
|
getRef('address_verify').value = address;
|
|
} else {
|
|
address = getRef('address_verify').value.trim();
|
|
}
|
|
getRef('verification_result').classList.add('hidden');
|
|
if (address === '')
|
|
return renderElem(getRef('verification_result'), html``);
|
|
if (!floCrypto.validateAddr(address)) {
|
|
getRef('address_verify').isValid
|
|
return renderElem(getRef('verification_result'), html``);
|
|
}
|
|
if (floCrypto.validateFloID(address))
|
|
address = btcOperator.convert.legacy2bech(address)
|
|
if (address === '') return renderElem(getRef('verification_result'), html`Please enter an address`);
|
|
getRef('verification_result').classList.remove('hidden');
|
|
if (floGlobals.approvedKyc[address]) {
|
|
const { validFrom, validTo, issuedBy, revokedBy } = floGlobals.approvedKyc[address];
|
|
const validFromFormatted = getFormattedTime(validFrom, 'date-only');
|
|
const validToFormatted = getFormattedTime(validTo, 'date-only');
|
|
const floID = floCrypto.toFloID(address)
|
|
const btcID = btcOperator.convert.legacy2bech(floID)
|
|
if (validFrom <= Date.now() && Date.now() <= validTo) {
|
|
getRef('verification_result').dataset.status = 'valid';
|
|
renderElem(getRef('verification_result'), html`
|
|
<div class="grid justify-items-center text-center gap-0-5" style="margin: 2rem">
|
|
<svg class='icon' xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M23,12l-2.44-2.79l0.34-3.69l-3.61-0.82L15.4,1.5L12,2.96L8.6,1.5L6.71,4.69L3.1,5.5L3.44,9.2L1,12l2.44,2.79l-0.34,3.7 l3.61,0.82L8.6,22.5l3.4-1.47l3.4,1.46l1.89-3.19l3.61-0.82l-0.34-3.69L23,12z M10.09,16.72l-3.8-3.81l1.48-1.48l2.32,2.33 l5.85-5.87l1.48,1.48L10.09,16.72z"/></g></svg>
|
|
<h4>KYC successfully verified</h4>
|
|
</div>
|
|
<div class="info flex gap-0-5 flex-wrap">
|
|
<span>Address</span>
|
|
<div class="grid gap-0-5">
|
|
<span>
|
|
BTC:
|
|
<sm-copy value=${btcID} clip-text></sm-copy>
|
|
</span>
|
|
<span>
|
|
FLO:
|
|
<sm-copy value=${floID} clip-text></sm-copy>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="info flex gap-0-5 flex-wrap">
|
|
<span>Issued by</span>
|
|
<div class="grid">
|
|
<h4>${floGlobals.approvedKycAggregators[issuedBy]}</h4>
|
|
<sm-copy value=${issuedBy} clip-text></sm-copy>
|
|
</div>
|
|
</div>
|
|
<div class="info flex align-center gap-0-5 flex-wrap">
|
|
<span>Issued on</span>
|
|
<span>${validFromFormatted}</span>
|
|
</div>
|
|
<div class="info flex align-center gap-0-5 flex-wrap">
|
|
<span>Verified on</span>
|
|
<span>${getFormattedTime(Date.now(), 'date-only')}</span>
|
|
</div>
|
|
`);
|
|
} else {
|
|
renderElem(getRef('verification_result'), html`
|
|
<div class="grid justify-items-center text-center gap-0-5" style="margin: 2rem">
|
|
<svg class="icon" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><path d="M12,2L4,5v6.09c0,5.05,3.41,9.76,8,10.91c4.59-1.15,8-5.86,8-10.91V5L12,2z M15.5,14.09l-1.41,1.41L12,13.42L9.91,15.5 L8.5,14.09L10.59,12L8.5,9.91L9.91,8.5L12,10.59l2.09-2.09l1.41,1.41L13.42,12L15.5,14.09z"/></g></svg>
|
|
<h4>KYC verification expired</h4>
|
|
</div>
|
|
<div class="info flex gap-0-5 flex-wrap">
|
|
<span>Issued by</span>
|
|
<div class="grid">
|
|
<h4>${floGlobals.approvedKycAggregators[issuedBy]}</h4>
|
|
<sm-copy value=${issuedBy} clip-text></sm-copy>
|
|
</div>
|
|
</div>
|
|
<div class="info flex align-center gap-0-5 flex-wrap">
|
|
<span>Issued on</span>
|
|
<span>${validFromFormatted}</span>
|
|
</div>
|
|
<div class="info flex align-center gap-0-5 flex-wrap">
|
|
<span>Expired on</span>
|
|
<span>${validToFormatted}</span>
|
|
</div>
|
|
<div class="info flex gap-0-5 flex-wrap">
|
|
<span>Revoked by</span>
|
|
<div class="grid">
|
|
<h4>${floGlobals.approvedKycAggregators[revokedBy]}</h4>
|
|
<sm-copy value=${revokedBy} clip-text></sm-copy>
|
|
</div>
|
|
</div>
|
|
`);
|
|
getRef('verification_result').dataset.status = 'invalid';
|
|
}
|
|
} else {
|
|
renderElem(getRef('verification_result'), html`
|
|
<div class="grid justify-items-center text-center gap-0-5" style="margin: 2rem">
|
|
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/></svg>
|
|
<h4>KYC data not found</h4>
|
|
</div>
|
|
`);
|
|
getRef('verification_result').dataset.status = 'invalid';
|
|
}
|
|
|
|
}
|
|
getRef('address_verify').addEventListener('input', e => {
|
|
if (e.target.isValid) {
|
|
|
|
} else {
|
|
location.hash = `/verify?address=${e.target.value.trim()}`
|
|
}
|
|
})
|
|
window.onload = async () => {
|
|
try {
|
|
getRef('address_verify').customValidation = floCrypto.validateAddr
|
|
await getApprovedAggregators();
|
|
await getApprovedKycs();
|
|
router.routeTo(window.location.hash)
|
|
getRef('verify').addEventListener('click', e => {
|
|
location.hash = `/verify?address=${getRef('address_verify').value.trim()}`
|
|
});
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |