fix: qr code size validation

This commit is contained in:
trafficlunar 2025-04-05 16:56:05 +01:00
parent ed33993a42
commit 75e2444541
3 changed files with 10 additions and 4 deletions

View file

@ -72,7 +72,14 @@ export default function SubmitForm() {
const decode = async () => {
setError("");
// Decrypt the QR code
// Validate QR code size
if (qrBytesRaw.length !== 372) {
setError("QR code size is not a valid Tomodachi Life QR code");
return;
}
// Decrypt the Mii part of the QR code
// (Credits to kazuki-4ys)
const nonce = qrBytes.subarray(0, 8);
const content = qrBytes.subarray(8, 0x70);