Completed
Push — master ( 8ea8de...59eb2e )
by Charles
01:52
created

OneTimeKeyAction::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace yrc\actions;
4
5
use yrc\rest\Action as RestAction;
6
use yrc\models\EncryptionKey;
7
use Sodium;
8
use Yii;
9
10
class OneTimeKeyAction extends RestAction
11
{
12
    /**
13
     * Generates a one time key pair to authenticate further authentication sessions
14
     * @return array
15
     */
16
    public function get($params)
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
17
    {
18
        // Generate a one time key pair
19
        $model = EncryptionKey::generate();
20
21
        // Return the public keys, and a signature of the public key
22
        return [
23
            'public'        => \base64_encode($model->getBoxPublicKey()),
24
            'hash'          => $model->hash,
25
        ];
26
    }
27
}