위젯 설치
단 두 줄의 코드로 웹사이트에 SilentShield를 추가할 수 있습니다. 위젯은 자동으로 폼을 감지하고 보호를 시작합니다.
기본 연동
웹사이트의 닫는 </body> 태그 앞에 다음 코드 스니펫을 추가합니다:
<script src="https://api.silentshield.io/client.js?key=YOUR_API_KEY" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
SilentShield.init({ apiKey: 'YOUR_API_KEY' });
});
</script>자동으로 수행되는 작업
- 위젯이 페이지의 모든 폼을 감지합니다
- 행동 분석이 백그라운드에서 시작됩니다 (사용자에게 보이지 않음)
- 의심스러운 행동이 감지된 경우에만 CAPTCHA가 표시됩니다
- 폼 제출 전에 검증 Nonce가 폼에 삽입됩니다
서버 측 검증 (권장)
폼이 제출된 후 서버에서 Nonce를 검증하여 사람이 제출한 것인지 확인합니다.
POST https://api.silentshield.io/api/v1/captcha/verify-nonce
X-Api-Key: YOUR_API_KEY
PHPphp
<?php
$nonce = $_POST['ss_nonce'] ?? '';
$ch = curl_init('https://api.silentshield.io/api/v1/captcha/verify-nonce');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Api-Key: ' . $apiKey,
],
CURLOPT_POSTFIELDS => json_encode(['nonce' => $nonce]),
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($result['verdict'] === 'bot') {
http_response_code(403);
die('Bot detected');
}Node.jsjavascript
const response = await fetch('https://api.silentshield.io/api/v1/captcha/verify-nonce', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': process.env.SILENTSHIELD_API_KEY,
},
body: JSON.stringify({ nonce: req.body.ss_nonce }),
});
const data = await response.json();
if (data.verdict === 'bot') {
return res.status(403).json({ error: 'Bot detected' });
}테스트
URL에 ?silentshield-debug를 추가하면 디버그 오버레이가 활성화됩니다. 현재 행동 점수, 판정 결과 및 활성 기능이 실시간으로 표시됩니다.