PluginProbe
404 Solution / trunk
404 Solution vtrunk
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / gsc / GscConfig.php

GscConfig.php in 404 Solution trunk, at includes/gsc/GscConfig.php

52 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 /**
8 * Shared Google Search Console integration configuration.
9 *
10 * Keeps storage keys, external endpoint URLs, TTLs, and pure key derivation
11 * out of the facade so OAuth and Search Analytics collaborators do not
12 * depend back on ABJ_404_Solution_GoogleSearchConsole.
13 */
14 class ABJ_404_Solution_GscConfig {
15
16 const OPTION_KEY = 'abj404_gsc_settings';
17 const TOKEN_OPTION_KEY = 'abj404_gsc_token';
18 const ERROR_OPTION_KEY = 'abj404_gsc_last_error';
19 const TRANSIENT_KEY = 'abj404_gsc_data';
20 const TRANSIENT_TTL = 90000;
21
22 const CRON_HOOK = 'abj404_gsc_fetch_cron';
23 const BACKGROUND_REFRESH_HOOK = 'abj404_gsc_background_refresh';
24 const LOCK_TRANSIENT_KEY = 'abj404_gsc_fetch_lock';
25 const LOCK_TTL = 900;
26 const ATOMIC_LOCK_READY_OPTION = 'abj404_gsc_atomic_lock_ready_at';
27 const ATOMIC_LOCK_MIGRATION_DELAY = 86400;
28 const LAST_FETCH_OPTION_KEY = 'abj404_gsc_last_fetch_time';
29 const STALE_THRESHOLD = 72000;
30
31 const OAUTH_AUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth';
32 const OAUTH_TOKEN_URL = 'https://oauth2.googleapis.com/token';
33 const API_BASE_URL = 'https://www.googleapis.com/webmasters/v3';
34 const SCOPE = 'https://www.googleapis.com/auth/webmasters.readonly';
35
36 /** Base URL of the centralized OAuth proxy Worker. */
37 const CENTRALIZED_AUTH_URL = 'https://404-solution-auth.forethought-studio.com';
38
39 const CENTRALIZED_CALLBACK_SECRET_TRANSIENT_PREFIX = 'abj404_gsc_oauth_cb_secret_';
40 const CENTRALIZED_CALLBACK_SECRET_TTL = 900;
41
42 /**
43 * Build the transient key that stores the one-time Worker callback signing secret.
44 *
45 * @param string $nonce WordPress OAuth callback nonce.
46 * @return string
47 */
48 public static function centralizedCallbackSecretTransientKey(string $nonce): string {
49 return self::CENTRALIZED_CALLBACK_SECRET_TRANSIENT_PREFIX . hash('sha256', $nonce);
50 }
51 }
52