3 * @copyright Copyright (C) 2010-2021, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Security\TwoFactor\Model;
24 use Friendica\BaseEntity;
25 use Friendica\Util\DateTimeFormat;
28 * Class TrustedBrowser
31 * @property-read $cookie_hash
33 * @property-read $user_agent
34 * @property-read $created
35 * @property-read $last_used
36 * @package Friendica\Model\TwoFactor
38 class TrustedBrowser extends BaseEntity
40 protected $cookie_hash;
42 protected $user_agent;
47 * Please do not use this constructor directly, instead use one of the method of the TrustedBroser factory.
49 * @see \Friendica\Security\TwoFactor\Factory\TrustedBrowser
51 * @param string $cookie_hash
53 * @param string $user_agent
54 * @param string $created
55 * @param string|null $last_used
57 public function __construct(string $cookie_hash, int $uid, string $user_agent, string $created, string $last_used = null)
59 $this->cookie_hash = $cookie_hash;
61 $this->user_agent = $user_agent;
62 $this->created = $created;
63 $this->last_used = $last_used;
66 public function recordUse()
68 $this->last_used = DateTimeFormat::utcNow();