for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace yrc\api\actions;
use yrc\rest\Action as RestAction;
use yrc\api\models\TokenKeyPair;
use Sodium;
use Yii;
class OneTimeKeyAction extends RestAction
{
/**
* Generates a one time key pair to authenticate further authentication sessions
* @return array
*/
public function get($params)
$params
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
// Generate a one time key pair
$model = TokenKeyPair::generate(TokenKeyPair::OTK_TYPE);
// Return the public keys, and a signature of the public key
return [
'public' => \base64_encode($model->getBoxPublicKey()),
'signing' => \base64_encode($model->getSignPublicKey()),
'signature' => \base64_encode(\Sodium\crypto_sign(
$model->getBoxPublicKey(),
\base64_decode($model->secret_sign_kp)
)),
'hash' => $model->hash,
'expires_at' => $model->expires_at
];
}
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.