'auth_key', 'AUTH_SALT' => 'auth_salt'] as $constant => $option) { $value = defined($constant) ? (string) constant($constant) : ''; if ($value === '' || stripos($value, 'put your unique phrase') !== false) { $value = (string) get_site_option($option, ''); if ($value === '' && function_exists('wp_salt')) { wp_salt('auth'); // makes WordPress generate and store its salts $value = (string) get_site_option($option, ''); } } $parts[] = $value; } if ($parts[0] === '' && $parts[1] === '') { throw new RelayError('keys.no_salt', esc_html__('This site has no authentication salts, so SiteRelay cannot store secrets safely.', 'siterelay'), esc_html__('Add AUTH_KEY and AUTH_SALT to wp-config.php.', 'siterelay')); } return hash('sha256', implode('|', $parts) . '|relay-keys', true); } private static function unreadable(): RelayError { return new RelayError('keys.unreadable', esc_html__('A stored SiteRelay secret can no longer be read (the site\'s security salts changed).', 'siterelay'), esc_html__('Create a new access key or connection.', 'siterelay')); } }