Cihaz kanıtı
Telefonda donanım anahtarı (Secure Enclave / Android Keystore) varsa her onay approvalProof taşır: telefonun, istek kimliği, işlem, sayı eşleme kodu ve ekranda gösterdiği detaylar üzerine attığı ECDSA P-256 imzası. Sunucunuzda doğrulayın — Touchque'ya güvenmeniz gerekmez.
Cihazı sabitleyin: kullanıcının ilk doğrulanan onayındaki
proof.publicKey değerini saklayıp beklenen anahtar olarak verin. Sabitleme yoksa, sabitlenmemiş anahtara açıkça izin vermediğiniz sürece kontrol false döner (yalnız ilk kullanımda güven).Python için isteğe bağlı ek gerekir: touchque-authenticator[proof] (cryptography paketi). PHP ext-openssl ister; Node, Go, .NET, Java ve Ruby standart kütüphanelerini kullanır.
Webhook'unuzda / durum sorgusundan sonra
const { verifyApprovalProof } = require('@touchque/node');
const ok = verifyApprovalProof(event.approvalProof, {
requestId, type: 'WITHDRAW', details, challengeCode,
expectedPublicKey: user.touchqueDeviceKey, // ilk doğrulanan onaydan saklanan anahtar
});
if (!ok) throw new Error('approval proof does not match');# pip install "touchque-authenticator[proof]"
from touchque import verify_approval_proof
ok = verify_approval_proof(
event['approvalProof'], request_id=request_id, type='WITHDRAW',
details=details, challenge_code=challenge_code,
expected_public_key=user.touchque_device_key,
)use Touchque\ApprovalProof;
$ok = ApprovalProof::verify($event['approvalProof'] ?? null, [
'requestId' => $requestId, 'type' => 'WITHDRAW', 'details' => $details,
'challengeCode' => $challengeCode,
'expectedPublicKey' => $user->touchque_device_key,
]);ok := touchque.VerifyApprovalProof(event["approvalProof"], touchque.VerifyApprovalProofOptions{
RequestID: requestID, Type: "WITHDRAW", Details: details, ChallengeCode: challengeCode,
ExpectedPublicKey: user.TouchqueDeviceKey,
})var ok = ApprovalProof.Verify(e["approvalProof"] as JsonObject, new ApprovalProofOptions
{
RequestId = requestId, Type = "WITHDRAW", Details = details, ChallengeCode = challengeCode,
ExpectedPublicKey = user.TouchqueDeviceKey, // ilk doğrulanan onaydan saklanan anahtar
});boolean ok = ApprovalProof.verify(event.get("approvalProof"), new ApprovalProof.Options(requestId, "WITHDRAW")
.details(details).challengeCode(challengeCode)
.expectedPublicKey(user.getTouchqueDeviceKey())); // ilk doğrulanan onaydan saklanan anahtarok = Touchque::ApprovalProof.verify(
event["approvalProof"], request_id: request_id, type: "WITHDRAW",
details: details, challenge_code: challenge_code,
expected_public_key: user.touchque_device_key
)