Обновить example.html
This commit is contained in:
14
example.html
14
example.html
@@ -19,21 +19,21 @@
|
||||
<p id="result"></p>
|
||||
|
||||
<script type="module">
|
||||
import init, { get_secret_value } from './hublib.js';
|
||||
import init, { get_secret_value } from './hublib.js'; // импортируем функции для wasm
|
||||
|
||||
async function runWasm() {
|
||||
await init();
|
||||
await init();
|
||||
|
||||
|
||||
document.getElementById('getSecretValue').addEventListener('click', async () => {
|
||||
const userAgent = document.getElementById('userAgent').value || navigator.userAgent; // Используем введенный user agent или стандартный
|
||||
const url = document.getElementById('url').value || window.location.href; // Используем введенный URL или текущий
|
||||
const userAgent = document.getElementById('userAgent').value || navigator.userAgent; // тупо поле для user agent
|
||||
const url = document.getElementById('url').value || window.location.href; // тупо поле для url
|
||||
|
||||
const serverTs = await fetchServerTimestamp()
|
||||
const secretValue = await get_secret_value(BigInt(serverTs.timestamp), userAgent, url);
|
||||
const serverTs = await fetchServerTimestamp(); // получаем timestamp из эндпоинта (код ниже)
|
||||
const secretValue = await get_secret_value(BigInt(serverTs.timestamp), userAgent, url); // вставляем всё в функцию генерации подписи
|
||||
// const asd = await fetch_timestamp();
|
||||
|
||||
document.getElementById('result').innerText = secretValue;
|
||||
document.getElementById('result').innerText = secretValue; // подпись выводится на экран. если там вывелась какая-то ошибка, то кринж
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user