diff --git a/auth.html b/auth.html new file mode 100644 index 0000000..fdb9ff4 --- /dev/null +++ b/auth.html @@ -0,0 +1,51 @@ + + + + + + Wallet Authentication + + + + + + + diff --git a/verify.php b/verify.php new file mode 100644 index 0000000..0fae7b5 --- /dev/null +++ b/verify.php @@ -0,0 +1,45 @@ +recoverPublicKey($msgHash, $signature); + + // Convert the public key to an Ethereum address + $derivedAddress = $util->publicKeyToAddress($pubKey); + + // Compare the derived address with the given address + return strtolower($address) === strtolower($derivedAddress); +} + +// Fetch and decode the JSON POST request +$data = json_decode(file_get_contents('php://input'), true); +$account = $data['account']; +$signature = $data['signature']; +$message = $data['message']; + +$verified = verifySignature($account, $signature, $message); + +echo json_encode(['verified' => $verified]); +