aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Security/IHasher.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Security/IHasher.php')
-rw-r--r--lib/public/Security/IHasher.php35
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/public/Security/IHasher.php b/lib/public/Security/IHasher.php
index 7c4d743002c..d0d6e4e9028 100644
--- a/lib/public/Security/IHasher.php
+++ b/lib/public/Security/IHasher.php
@@ -1,28 +1,10 @@
<?php
declare(strict_types=1);
-
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCP\Security;
@@ -37,10 +19,10 @@ namespace OCP\Security;
*
* Usage:
* // Hashing a message
- * $hash = \OC::$server->getHasher()->hash('MessageToHash');
+ * $hash = \OCP\Server::get(\OCP\Security\IHasher::class)->hash('MessageToHash');
* // Verifying a message - $newHash will contain the newly calculated hash
* $newHash = null;
- * var_dump(\OC::$server->getHasher()->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
+ * var_dump(\OCP\Server::get(\OCP\Security\IHasher::class)->verify('a', '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', $newHash));
* var_dump($newHash);
*
* @since 8.0.0
@@ -65,4 +47,11 @@ interface IHasher {
* @since 8.0.0
*/
public function verify(string $message, string $hash, &$newHash = null): bool ;
+
+ /**
+ * Check if the prefixed hash is valid
+ *
+ * @since 30.0.0
+ */
+ public function validate(string $prefixedHash): bool;
}