Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Failing after 1s
Podman Rootless Demo / deploy-prod (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Has been skipped
46 lines
No EOL
1.7 KiB
HTML
46 lines
No EOL
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>SPF File Debug</title>
|
|
</head>
|
|
<body>
|
|
<h1>SPF File Debug</h1>
|
|
<input type="file" id="spfFile" accept=".spf">
|
|
<div id="output"></div>
|
|
|
|
<script type="module">
|
|
import init, { parse_spf_file } from './wasm/pkg/sharenet_passport_wasm.js';
|
|
|
|
await init();
|
|
|
|
document.getElementById('spfFile').addEventListener('change', async (event) => {
|
|
const file = event.target.files[0];
|
|
if (!file) return;
|
|
|
|
const output = document.getElementById('output');
|
|
output.innerHTML = `<p>Loading file: ${file.name} (${file.size} bytes)</p>`;
|
|
|
|
try {
|
|
const arrayBuffer = await file.arrayBuffer();
|
|
const data = new Uint8Array(arrayBuffer);
|
|
|
|
output.innerHTML += `<p>File loaded: ${data.length} bytes</p>`;
|
|
output.innerHTML += `<p>First 16 bytes: ${Array.from(data.slice(0, 16)).map(b => b.toString(16).padStart(2, '0')).join(' ')}</p>`;
|
|
|
|
// Try to parse with password "test"
|
|
const password = prompt('Enter password:');
|
|
if (!password) return;
|
|
|
|
output.innerHTML += `<p>Attempting to parse with password...</p>`;
|
|
|
|
const result = await parse_spf_file(data, password);
|
|
output.innerHTML += `<p style="color: green;">Success! Parsed SPF file</p>`;
|
|
output.innerHTML += `<pre>${JSON.stringify(result, null, 2)}</pre>`;
|
|
} catch (error) {
|
|
output.innerHTML += `<p style="color: red;">Error: ${error.message}</p>`;
|
|
console.error('SPF parsing error:', error);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |