Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 1... Línea 1...
1
<?php
1
<?php
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea -...
3
declare(strict_types=1);
-
 
4
 
-
 
5
/*
-
 
6
 * The MIT License (MIT)
-
 
7
 *
-
 
8
 * Copyright (c) 2014-2018 Spomky-Labs
-
 
9
 *
-
 
10
 * This software may be modified and distributed under the terms
-
 
11
 * of the MIT license.  See the LICENSE file for details.
-
 
12
 */
3
declare(strict_types=1);
Línea 13... Línea 4...
13
 
4
 
14
namespace OTPHP;
5
namespace OTPHP;
-
 
6
 
-
 
7
interface TOTPInterface extends OTPInterface
-
 
8
{
-
 
9
    public const DEFAULT_PERIOD = 30;
-
 
10
 
-
 
11
    public const DEFAULT_EPOCH = 0;
-
 
12
 
-
 
13
    /**
-
 
14
     * Create a new TOTP object.
-
 
15
     *
-
 
16
     * If the secret is null, a random 64 bytes secret will be generated.
-
 
17
     *
-
 
18
     * @param null|non-empty-string $secret
-
 
19
     * @param positive-int $period
-
 
20
     * @param non-empty-string $digest
-
 
21
     * @param positive-int $digits
-
 
22
     *
-
 
23
     * @deprecated Deprecated since v11.1, use ::createFromSecret or ::generate instead
-
 
24
     */
-
 
25
    public static function create(
-
 
26
        null|string $secret = null,
-
 
27
        int $period = self::DEFAULT_PERIOD,
-
 
28
        string $digest = self::DEFAULT_DIGEST,
-
 
29
        int $digits = self::DEFAULT_DIGITS
-
 
30
    ): self;
-
 
31
 
-
 
32
    public function setPeriod(int $period): void;
15
 
33
 
16
interface TOTPInterface extends OTPInterface
34
    public function setEpoch(int $epoch): void;
-
 
35
 
-
 
36
    /**
17
{
37
     * Return the TOTP at the current time.
18
    /**
38
     *
Línea 19... Línea 39...
19
     * @return string Return the TOTP at the current time
39
     * @return non-empty-string
20
     */
40
     */
21
    public function now(): string;
41
    public function now(): string;
22
 
42
 
-
 
43
    /**
-
 
44
     * Get the period of time for OTP generation (a non-null positive integer, in second).
-
 
45
     */
-
 
46
    public function getPeriod(): int;
23
    /**
47