=== VeriSelf — AI Age Verification for WordPress ===
Contributors: robinsec
Tags: age verification, age gate, ai, webcam, identity verification, liveness, gdpr, woocommerce
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 4.3.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI age verification for WordPress. Webcam capture, AI vision analysis, free 100 lifetime verifications. No subscription, no per-check fees.

== Description ==

VeriSelf adds a self-hosted, AI-powered age gate to any WordPress site. Visitors take a quick webcam selfie; an AI vision model analyses the photo for age; the gate opens on success. No third-party SaaS, no per-verification fees, no data sharing.

The free VeriSelf plugin ships with **100 lifetime cloud verifications** included. Run your own AI provider (Ollama, OpenAI-compatible, Claude Vision) for unlimited verifications at your own AI cost.

**Key features:**

* **Webcam capture** — front-facing camera with a guided head outline (single or couple mode).
* **AI age estimation** — any OpenAI-compatible vision model (Ollama with llava / bakllava / moondream / qwen-vl, OpenAI GPT-4o, Claude Vision, etc.).
* **Free cloud verifications** — 100 lifetime verifications included during early access. No credit card required.
* **Self-hosted AI** — point VeriSelf at your own Ollama server for unlimited verifications.
* **Content Gate** — gate posts, pages, categories, blocks, and shortcodes behind verification. Reveal modes: blur, solid overlay, or replace.
* **WooCommerce** — gate the cart, checkout, or specific products. Verified badge on the My Account page.
* **WPForms + Ultimate Member** — gate form submissions and member areas.
* **GPS verification (optional)** — country/region detection via OpenStreetMap Nominatim. Used to apply country-specific age rules.
* **Fraud signals** — IP-vs-GPS mismatch, VPN detection, AI authenticity scores, configurable risk thresholds.
* **Shortcode and Gutenberg block** — `[veriself_verify]` or the VeriSelf block. Legacy `[agv_verify]` kept as alias.
* **Re-verification rules** — never, always, or scheduled re-check.
* **Translation ready** — English (en_GB / en_US), German, Spanish, French, Dutch included.
* **SEO safe** — search-engine crawlers (Googlebot, Bingbot, etc.) bypass the gate by User-Agent so age-restricted content stays indexable. Existing `noindex` tags from SEO plugins are never modified.

**Privacy:**

* Photos are only stored when **Debug Mode** is on (Settings → Maintenance). When off, photos stream directly to the AI provider and are not saved to your site.
* Default storage backend is your own WordPress database. No third-party tracking.
* Disconnect at any time via Settings → Provider.

== Why VeriSelf is different ==

Most age-verification SaaS charge **$0.10–$1.00 per check**, with monthly minimums. VeriSelf inverts the model:

* **Free tier**: 100 lifetime verifications, no card required.
* **Self-hosted**: your own Ollama server, your own API key, your own cost ceiling.
* **Privacy-first**: photo, IP, and GPS data stay on your server. No third party sees your visitor list.
* **GDPR-ready**: data export and account-deletion flows built in.

VeriSelf is in **early-access / free phase**. The plugin's full feature set is available during early access at no charge. We are not selling subscriptions, premium tiers, or pay-per-check credits on this plugin at this time.

== Installation ==

1. Upload the `veriselfverification` folder to `/wp-content/plugins/`, **or** install the .zip via Plugins → Add New → Upload Plugin.
2. Activate the plugin through the Plugins menu in WordPress.
3. Go to Settings → VeriSelf to choose a provider:
   * **Cloud (free)** — uses VeriSelf Cloud AI. 100 lifetime verifications included. No account setup needed.
   * **Self-hosted AI** — point at your own Ollama server (or any OpenAI-compatible vision API). Unlimited verifications at your AI cost.
4. Add the `[veriself_verify]` shortcode to any page, or insert the **VeriSelf Verify** block in the Gutenberg editor.
5. To gate specific content, use the **VeriSelf Content Gate** block or the Content Gate post-type option.

== Frequently Asked Questions ==

= Does the plugin work without an Ollama server? =

Yes. The default provider is VeriSelf Cloud AI, which gives you 100 lifetime verifications during early access. No Ollama install required.

= Which AI models are supported? =

Self-hosted: any OpenAI-compatible vision model (Ollama with llava, bakllava, moondream, qwen-vl; OpenAI GPT-4o; Claude Vision via OpenAI-compatible gateway; etc.). Cloud: managed by the VeriSelf cloud provider.

= Is a webcam required? =

Yes. The plugin uses the front-facing camera to capture a still photo for AI analysis. HTTPS is required for browser camera access.

= Does the plugin store photos? =

Only in Debug Mode (Settings → Maintenance). When Debug Mode is off, photos are sent directly to the AI provider and are not stored on your server. When Debug Mode is on, photos are auto-deleted after the configured retention period.

= Do users need to be logged in? =

Yes. Verification is linked to each user's WordPress account and stored as user meta. Logged-in users see the gate once, then stay verified per your re-verification rule.

= Can I customize the colors and text? =

Yes. All UI colors, button labels, headline text, and consent copy are configurable under Settings → Appearance. Live preview is included.

= Is GPS required? =

No. GPS can be enabled or disabled and set as optional or required in Settings → GPS. When disabled, only the country code from the visitor's IP is used for country-specific age rules.

= What do error codes like "(E007)" mean? =

Each verification failure includes a stable error code (E001–E024). See Settings → Maintenance → Error Codes for the full reference. Enable Debug Mode to log the full diagnostic payload (photo, raw AI response, risk score).

= What happens to verification data on uninstall? =

Optional cleanup. Check **"Cleanup on Uninstall"** in Settings → Maintenance before removing the plugin. When enabled, all VeriSelf options, user meta, and log entries are removed on uninstall.

= Does the old [agv_verify] shortcode still work? =

Yes. `[agv_verify]` is kept as a backward-compatible alias. New sites should use `[veriself_verify]`.

= Is the age gate SEO-safe? =

Yes. VeriSelf detects search-engine crawlers (Googlebot, Bingbot, DuckDuckBot, etc.) by User-Agent and serves them the full page content. Age-restricted pages stay indexable. Existing `noindex` tags from SEO plugins (Yoast, Rank Math, AIOSEO) are never modified.

= Can I use my home / dynamic-DNS Ollama server? =

Yes. If your Ollama hostname resolves to a private IP (e.g. home network or Tailscale), enable **Allow Private-Resolved Hosts** in Settings → Provider. This is off by default to protect against DNS-rebinding / SSRF attacks.

= Why is OpenSSL required for the Self-hosted AI provider? =

The Self-hosted AI provider stores your API key on the WordPress server. OpenSSL encrypts that key (PBKDF2 + AES-256-GCM). The free Cloud provider does not store any key, so it works without OpenSSL.

= Why does the Content Gate use admin-ajax instead of the REST API? =

The public REST endpoint could be called by anyone who knew a gated post ID, and relied on a cookie that could be forged. The nonce-protected AJAX endpoint is reachable only through WordPress and prevents unauthenticated bypass.

= Is VeriSelf GDPR-compliant? =

VeriSelf stores the minimum data needed (verification status, optional photo in Debug Mode). Visitors can request data export and account deletion. The plugin integrates with CookieYes, Cookiebot, Complianz, and Cookie Notice for consent detection.

= Where is data processed? =

Free Cloud verifications: processed by the VeriSelf cloud. Self-hosted verifications: processed on your own server / your own AI provider. Photos are not sent to any third party.

== Screenshots ==

1. The age gate as visitors see it — guided head outline, consent checkbox, age verification prompt.
2. VeriSelf Verify block in the Gutenberg editor — drop-in shortcode alternative.
3. Settings → Provider — choose Free Cloud or Self-hosted AI.
4. Settings → Content Gate — gate posts, pages, blocks, or shortcodes.
5. Admin Logbook — full verification history with photo thumbnails (Debug Mode).

== Changelog ==

= 4.3.6 =
* Body-scroll-lock refactor: gate open/close paths now use refcounted `vrsLockBodyScroll()` / `vrsUnlockBodyScroll()` helpers to prevent permanent lockout.
* Tested up to WordPress 7.0.

= 4.3.5 =
* E005 "Session expired" errors auto-retry once with a fresh liveness token.

= 4.3.4 =
* Re-verification lockout with human-readable wait time.

= 4.3.3 =
* Defensive AJAX error handling with try/catch on all verification paths.

= 4.3.2 =
* Country DOB format expanded to 60+ countries; default `dd/mm/yyyy`.

= 4.3.1 =
* AI now returns per-face authenticity scores (real-human, spoof, deepfake, risk score, risk factors).
* New Risk Engine signals: low AI confidence, not-real-human, suspicious media — each with configurable thresholds.

= 4.3.0 =
* AI confidence threshold (0.1–1.0, default 0.7). New error code E023.
* Fraud scoring per capture with GeoFraud (IP vs GPS mismatch, VPN detection). New error code E024.

= 4.2.4 =
* Age Gate v2 redesign: card-based popup, DOB fields, AI verification toggle, inline errors, consent + remember-me.
* Admin redesign: sidebar layout (Setup / Gate / Content / System tabs).
* WooCommerce gating: cart, checkout, product-level.
* WPForms + Ultimate Member integration settings now have their own section.

= 4.2.3 =
* Content Gate full card and compact CTA no longer overlap; verified state hides all gate chrome.
* In-content-only gates auto-reveal when a valid verified cookie exists, even without a global age-gate popup.

= 4.2.2 =
* Webcam capture now crops the grayscale frame to the transparent face hole(s) in the SVG overlay before sending to the AI provider.
* Liveness thumbnails cropped to the same face region.

= 4.2.1 =
* CryptoService now uses PBKDF2 (100k iterations) over the WordPress auth salt with a per-ciphertext random salt. BYOAI API keys encrypted with AES-256-GCM.
* DOB and Yes/No verification state now lives in a server-side transient keyed by an opaque httponly `veriself_session` cookie. No more cookie forgery.

= 4.2.0 =
* Self-hosted AI provider (Ollama, OpenAI-compatible) is now a first-class option alongside the cloud provider.
* GPS / country rule engine for country-specific age thresholds.
* Re-verification scheduling.

= 4.1.0 =
* Initial public release as **VeriSelf Verification** (rebranded from Age Gender Verify).
* Age gate, AI age estimation, WooCommerce gating, content gating, admin logbook.

= 4.0.0 =
* Initial release as **Age Gender Verify**.

== Upgrade Notice ==

= 4.3.6 =
Body-scroll-lock refactor and WordPress 7.0 compatibility. Recommended update for all sites.

= 4.2.4 =
Plugin install folder is now `veriselfverification`. Manual upgrade required; all settings and verification data are preserved.

= 4.2.0 =
Major upgrade: self-hosted AI provider is now a first-class option. New GPS / country rule engine.

= 4.1.0 =
Initial public release as VeriSelf Verification.
