File: src/CryptographyKey.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  sapient  >  src/CryptographyKey.php  >  Download  
File: src/CryptographyKey.php
Role: Class source
Content type: text/plain
Description: Class source
Class: sapient
Add a security layer to server to server requests
Author: By
Last change:
Date: 3 years ago
Size: 674 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\Sapient;

use
ParagonIE\ConstantTime\Base64UrlSafe;

/**
 * Class CryptographyKey
 * @package ParagonIE\Sapient
 */
class CryptographyKey
{
   
/**
     * @var string
     */
   
protected $key = '';

    public function
__debugInfo()
    {
        return [
           
'key' => '****',
           
'hint' => 'Use $key->getString(), do not just var_dump($key)'
       
];
    }

   
/**
     * @param bool $raw
     * @return string
     */
   
public function getString(bool $raw = false): string
   
{
        if (
$raw) {
            return
$this->key;
        }
        return
Base64UrlSafe::encode($this->key);
    }
}


For more information send a message to info at phpclasses dot org.