Initial commit: breakpilot-compliance - Compliance SDK Platform
Services: Admin-Compliance, Backend-Compliance, AI-Compliance-SDK, Consent-SDK, Developer-Portal, PCA-Platform, DSMS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
444
pca-platform/demo/index.html
Normal file
444
pca-platform/demo/index.html
Normal file
@@ -0,0 +1,444 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PCA Platform Demo - Human vs Bot Detection</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 200vh; /* Long page for scroll testing */
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
}
|
||||
header {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
||||
}
|
||||
h1 {
|
||||
color: #667eea;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.subtitle {
|
||||
color: #666;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.score-panel {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
||||
position: sticky;
|
||||
top: 1rem;
|
||||
z-index: 100;
|
||||
}
|
||||
.score-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2rem;
|
||||
}
|
||||
.score-circle {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.score-circle.low {
|
||||
background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
|
||||
color: white;
|
||||
}
|
||||
.score-circle.medium {
|
||||
background: linear-gradient(135deg, #feca57, #ff9f43);
|
||||
color: white;
|
||||
}
|
||||
.score-circle.high {
|
||||
background: linear-gradient(135deg, #1dd1a1, #10ac84);
|
||||
color: white;
|
||||
}
|
||||
.score-value {
|
||||
font-size: 2rem;
|
||||
}
|
||||
.score-label {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.score-details {
|
||||
flex: 1;
|
||||
}
|
||||
.score-details h3 {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.status-badge {
|
||||
display: inline-block;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.status-badge.allow {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
.status-badge.challenge {
|
||||
background: #fff3cd;
|
||||
color: #856404;
|
||||
}
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.metric {
|
||||
text-align: center;
|
||||
padding: 0.5rem;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.metric-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #667eea;
|
||||
}
|
||||
.metric-label {
|
||||
font-size: 0.75rem;
|
||||
color: #666;
|
||||
}
|
||||
.content-section {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
||||
}
|
||||
.content-section h2 {
|
||||
color: #333;
|
||||
margin-bottom: 1rem;
|
||||
padding-bottom: 0.5rem;
|
||||
border-bottom: 2px solid #667eea;
|
||||
}
|
||||
.content-section p {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.demo-buttons {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
button {
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
}
|
||||
.btn-primary {
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: white;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.btn-warning {
|
||||
background: linear-gradient(135deg, #feca57, #ff9f43);
|
||||
color: white;
|
||||
}
|
||||
.protected-content {
|
||||
background: #f8f9fa;
|
||||
border: 2px dashed #ddd;
|
||||
border-radius: 8px;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.protected-content.unlocked {
|
||||
border-color: #1dd1a1;
|
||||
background: #d4edda;
|
||||
}
|
||||
.log-panel {
|
||||
background: #1a1a2e;
|
||||
color: #eee;
|
||||
border-radius: 12px;
|
||||
padding: 1rem;
|
||||
font-family: 'Monaco', 'Menlo', monospace;
|
||||
font-size: 0.85rem;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.log-entry {
|
||||
padding: 0.25rem 0;
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
.log-entry:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.log-time {
|
||||
color: #667eea;
|
||||
}
|
||||
.log-score {
|
||||
color: #1dd1a1;
|
||||
}
|
||||
footer {
|
||||
text-align: center;
|
||||
color: white;
|
||||
padding: 2rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>PCA Platform Demo</h1>
|
||||
<p class="subtitle">Person - Corporate - Agent | Human vs Bot Detection</p>
|
||||
</header>
|
||||
|
||||
<div class="score-panel">
|
||||
<div class="score-display">
|
||||
<div class="score-circle low" id="scoreCircle">
|
||||
<span class="score-value" id="scoreValue">0.00</span>
|
||||
<span class="score-label">Human Score</span>
|
||||
</div>
|
||||
<div class="score-details">
|
||||
<h3>Status: <span class="status-badge challenge" id="statusBadge">Initializing...</span></h3>
|
||||
<p id="statusMessage">Collecting behavioral data...</p>
|
||||
<div class="metrics-grid">
|
||||
<div class="metric">
|
||||
<div class="metric-value" id="metricDwell">0%</div>
|
||||
<div class="metric-label">Dwell Time</div>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-value" id="metricScroll">0%</div>
|
||||
<div class="metric-label">Scroll Depth</div>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-value" id="metricClicks">0</div>
|
||||
<div class="metric-label">Clicks</div>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-value" id="metricMouse">0</div>
|
||||
<div class="metric-label">Mouse Moves</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="content-section">
|
||||
<h2>How It Works</h2>
|
||||
<p>
|
||||
The PCA SDK analyzes your browsing behavior to distinguish humans from bots.
|
||||
It tracks metrics like scroll depth, mouse movements, click patterns, and dwell time
|
||||
- all without collecting personal information.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Scroll down</strong>, <strong>move your mouse</strong>, and <strong>click around</strong>
|
||||
to increase your human score. Once you reach a score of 0.7+, you'll be recognized as human.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<h2>Test the SDK</h2>
|
||||
<div class="demo-buttons">
|
||||
<button class="btn-primary" onclick="testEvaluate()">Evaluate Now</button>
|
||||
<button class="btn-secondary" onclick="testTick()">Send Tick</button>
|
||||
<button class="btn-warning" onclick="testStepUp()">Trigger Step-Up</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<h2>Protected Content</h2>
|
||||
<p>This content is protected and requires a human score of 0.7 or higher to access:</p>
|
||||
<div class="protected-content" id="protectedContent">
|
||||
<p>Content locked. Increase your score to unlock.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<h2>More Content (Scroll Test)</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
||||
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
||||
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
||||
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<h2>Event Log</h2>
|
||||
<div class="log-panel" id="logPanel">
|
||||
<div class="log-entry"><span class="log-time">[--:--:--]</span> SDK initializing...</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>PCA Platform v0.1.0 | GDPR Compliant | No PII Collected</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<!-- PCA SDK -->
|
||||
<script src="/sdk/pca-sdk.js"></script>
|
||||
<script>
|
||||
const logPanel = document.getElementById('logPanel');
|
||||
const scoreCircle = document.getElementById('scoreCircle');
|
||||
const scoreValue = document.getElementById('scoreValue');
|
||||
const statusBadge = document.getElementById('statusBadge');
|
||||
const statusMessage = document.getElementById('statusMessage');
|
||||
const protectedContent = document.getElementById('protectedContent');
|
||||
|
||||
function log(message) {
|
||||
const time = new Date().toLocaleTimeString();
|
||||
const entry = document.createElement('div');
|
||||
entry.className = 'log-entry';
|
||||
entry.innerHTML = `<span class="log-time">[${time}]</span> ${message}`;
|
||||
logPanel.appendChild(entry);
|
||||
logPanel.scrollTop = logPanel.scrollHeight;
|
||||
}
|
||||
|
||||
function updateUI(score, action, data) {
|
||||
// Update score display
|
||||
scoreValue.textContent = score.toFixed(2);
|
||||
|
||||
// Update score circle color
|
||||
scoreCircle.className = 'score-circle';
|
||||
if (score >= 0.7) {
|
||||
scoreCircle.classList.add('high');
|
||||
} else if (score >= 0.4) {
|
||||
scoreCircle.classList.add('medium');
|
||||
} else {
|
||||
scoreCircle.classList.add('low');
|
||||
}
|
||||
|
||||
// Update status badge
|
||||
statusBadge.textContent = action === 'allow' ? 'Human Detected' : 'Verification Needed';
|
||||
statusBadge.className = 'status-badge ' + action;
|
||||
|
||||
// Update status message
|
||||
if (score >= 0.7) {
|
||||
statusMessage.textContent = 'Congratulations! You are recognized as a human visitor.';
|
||||
} else if (score >= 0.4) {
|
||||
statusMessage.textContent = 'Almost there! Keep interacting with the page.';
|
||||
} else {
|
||||
statusMessage.textContent = 'Scroll, click, and move your mouse to prove you are human.';
|
||||
}
|
||||
|
||||
// Update metrics
|
||||
if (data && data.metrics) {
|
||||
document.getElementById('metricDwell').textContent = Math.round(data.metrics.dwell_ratio * 100) + '%';
|
||||
document.getElementById('metricScroll').textContent = Math.round(data.metrics.scroll_depth * 100) + '%';
|
||||
document.getElementById('metricClicks').textContent = data.metrics.clicks;
|
||||
document.getElementById('metricMouse').textContent = data.metrics.mouse_moves;
|
||||
}
|
||||
|
||||
// Update protected content
|
||||
if (score >= 0.7) {
|
||||
protectedContent.className = 'protected-content unlocked';
|
||||
protectedContent.innerHTML = `
|
||||
<h3>Content Unlocked!</h3>
|
||||
<p>This is the secret content that only humans can see.</p>
|
||||
<p>Your session ID: ${PCA.getSessionId()}</p>
|
||||
`;
|
||||
}
|
||||
|
||||
log(`Score updated: <span class="log-score">${score.toFixed(3)}</span> | Action: ${action}`);
|
||||
}
|
||||
|
||||
// Initialize SDK with custom config
|
||||
const customConfig = {
|
||||
thresholds: {
|
||||
score_pass: 0.7,
|
||||
score_challenge: 0.4
|
||||
},
|
||||
weights: {
|
||||
dwell_ratio: 0.30,
|
||||
scroll_score: 0.25,
|
||||
pointer_variance: 0.20,
|
||||
click_rate: 0.25
|
||||
},
|
||||
tick: {
|
||||
endpoint: 'http://localhost:8085/pca/v1/tick',
|
||||
interval_ms: 3000
|
||||
},
|
||||
step_up: {
|
||||
methods: ['webauthn', 'pow'],
|
||||
primary: 'pow',
|
||||
webauthn: {
|
||||
enabled: true,
|
||||
challenge_endpoint: 'http://localhost:8085/pca/v1/webauthn-challenge'
|
||||
},
|
||||
pow: {
|
||||
enabled: true,
|
||||
difficulty: 4,
|
||||
max_duration_ms: 5000
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Wait for SDK to load
|
||||
if (typeof PCA !== 'undefined') {
|
||||
PCA.init(customConfig);
|
||||
log('SDK initialized with custom config');
|
||||
|
||||
// Subscribe to score updates
|
||||
PCA.onScoreUpdate((score, action, data) => {
|
||||
updateUI(score, action, PCA.evaluate());
|
||||
});
|
||||
|
||||
// Update metrics every second
|
||||
setInterval(() => {
|
||||
const data = PCA.evaluate();
|
||||
updateUI(data.score, data.score >= 0.7 ? 'allow' : 'challenge', data);
|
||||
}, 1000);
|
||||
} else {
|
||||
log('Error: PCA SDK not loaded');
|
||||
}
|
||||
|
||||
// Test functions
|
||||
function testEvaluate() {
|
||||
const result = PCA.evaluate();
|
||||
log(`Manual evaluation: ${JSON.stringify(result)}`);
|
||||
updateUI(result.score, result.score >= 0.7 ? 'allow' : 'challenge', result);
|
||||
}
|
||||
|
||||
function testTick() {
|
||||
PCA.tick();
|
||||
log('Tick sent to server');
|
||||
}
|
||||
|
||||
async function testStepUp() {
|
||||
log('Starting step-up verification (PoW)...');
|
||||
const success = await PCA.triggerStepUp();
|
||||
if (success) {
|
||||
log('Step-up verification successful!');
|
||||
} else {
|
||||
log('Step-up verification failed or cancelled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user