Exemplo n.º 1
0
 private function generateSecureKey()
 {
     $fs = new Filesystem();
     $dir = $this->getKeyDir();
     if (!$fs->exists($dir)) {
         $fs->mkdir($dir, 0700);
     }
     $file = $dir . DS . $this->getApiKey() . ".key";
     $fs->touch($file);
     file_put_contents($file, Password::generateHexaRandom(45));
     $fs->chmod($file, 0600);
 }
Exemplo n.º 2
0
 public function testGenerateHexaRandom()
 {
     $length = 8;
     $password = Password::generateHexaRandom($length);
     $this->assertEquals($length, strlen($password));
 }