Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/twofactor_totp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-03-12 16:04:08 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-03-12 16:04:08 +0300
commit8dc7bbab04108a61c8ae218a99f093d0843a7f06 (patch)
treea64b28d941c7116817f9dcdb2f44496209696226 /lib/Service
parent2b8058a660e8a432f842eb195f885eeb65ee3087 (diff)
Make app strict
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/ITotp.php8
-rw-r--r--lib/Service/Totp.php8
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Service/ITotp.php b/lib/Service/ITotp.php
index cb5c66b..1864ec2 100644
--- a/lib/Service/ITotp.php
+++ b/lib/Service/ITotp.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types = 1);
+
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
@@ -45,7 +47,7 @@ interface ITotp {
* @return string the newly created secret
* @throws TotpSecretAlreadySet
*/
- public function createSecret(IUser $user);
+ public function createSecret(IUser $user): string;
/**
* Enable OTP for the given user. The secret has to be generated
@@ -56,7 +58,7 @@ interface ITotp {
* @return bool whether the key is valid and the secret has been enabled
* @throws DoesNotExistException
*/
- public function enable(IUser $user, $key);
+ public function enable(IUser $user, $key): bool;
/**
* @param IUser $user
@@ -67,5 +69,5 @@ interface ITotp {
* @param IUser $user
* @param string $key
*/
- public function validateSecret(IUser $user, $key);
+ public function validateSecret(IUser $user, $key): bool;
}
diff --git a/lib/Service/Totp.php b/lib/Service/Totp.php
index aaa38d8..47ec8cc 100644
--- a/lib/Service/Totp.php
+++ b/lib/Service/Totp.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types = 1);
+
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -62,7 +64,7 @@ class Totp implements ITotp {
/**
* @param IUser $user
*/
- public function createSecret(IUser $user) {
+ public function createSecret(IUser $user): string {
try {
// Delet existing one
$oldSecret = $this->secretMapper->getSecret($user);
@@ -99,7 +101,7 @@ class Totp implements ITotp {
$this->activityManager->publish($activity);
}
- public function enable(IUser $user, $key) {
+ public function enable(IUser $user, $key): bool {
if (!$this->validateSecret($user, $key)) {
return false;
}
@@ -121,7 +123,7 @@ class Totp implements ITotp {
$this->publishEvent($user, 'totp_disabled');
}
- public function validateSecret(IUser $user, $key) {
+ public function validateSecret(IUser $user, $key): bool {
try {
$dbSecret = $this->secretMapper->getSecret($user);
} catch (DoesNotExistException $ex) {