PHP 8.2.31
Preview: 2fainitializationdata.php Size: 1.26 KB
/home/nshryvcy/blissfulnepal.com/wp-content/plugins/wordfence/modules/login-security/classes/model/2fainitializationdata.php

<?php

namespace WordfenceLS;

class Model_2faInitializationData {

	private $user;
	private $raw_secret;
	private $base32_secret;
	private $otp_url;
	private $recovery_codes;

	public function __construct($user) {
		$this->user = $user;
		$this->raw_secret = Model_Crypto::random_bytes(20);
	}

	public function get_user() {
		return $this->user;
	}

	public function get_raw_secret() {
		return $this->raw_secret;
	}

	public function get_base32_secret() {
		if ($this->base32_secret === null)
			$this->base32_secret = Utility_BaseConversion::base32_encode($this->raw_secret);
		return $this->base32_secret;
	}

	private function generate_otp_url() {
		return "otpauth://totp/" . rawurlencode(preg_replace('~^https?://(?:www\.)?~i', '', home_url()) . ':' . $this->user->user_login) . '?secret=' . $this->get_base32_secret() . '&algorithm=SHA1&digits=6&period=30&issuer=' . rawurlencode(preg_replace('~^https?://(?:www\.)?~i', '', home_url()));
	}

	public function get_otp_url() {
		if ($this->otp_url === null)
			$this->otp_url = $this->generate_otp_url();
		return $this->otp_url;
	}

	public function get_recovery_codes() {
		if ($this->recovery_codes === null)
			$this->recovery_codes = Controller_Users::shared()->regenerate_recovery_codes();
		return $this->recovery_codes;
	}

}

Directory Contents

Dirs: 4 × Files: 12

Name Size Perms Modified Actions
crypto DIR
- drwxr-xr-x 2026-06-03 14:57:34
Edit Download
settings DIR
- drwxr-xr-x 2026-06-03 14:57:34
Edit Download
text DIR
- drwxr-xr-x 2026-06-03 14:57:34
Edit Download
view DIR
- drwxr-xr-x 2026-06-03 14:57:34
Edit Download
1.26 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
2.48 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
248 B lrw-r--r-- 2026-06-03 14:57:34
Edit Download
8.11 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
5.06 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
1.51 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
5.77 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
2.60 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
698 B lrw-r--r-- 2026-06-03 14:57:34
Edit Download
1.89 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
5.83 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download
2.19 KB lrw-r--r-- 2026-06-03 14:57:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).