Skip to content

Commit 96b401a

Browse files
committed
Add configuration class to hold encryption keys.
1 parent 336fdfd commit 96b401a

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

src/Config/Keys.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Pdsinterop\Solid\Auth\Config;
4+
5+
use Defuse\Crypto\Key as CryptoKey;
6+
use League\OAuth2\Server\CryptKey;
7+
8+
class Keys
9+
{
10+
////////////////////////////// CLASS PROPERTIES \\\\\\\\\\\\\\\\\\\\\\\\\\\\
11+
12+
/** @var string|CryptoKey */
13+
private $encryptionKey;
14+
/** @var CryptKey*/
15+
private $privateKey;
16+
17+
//////////////////////////// GETTERS AND SETTERS \\\\\\\\\\\\\\\\\\\\\\\\\\\
18+
19+
/** @return CryptoKey|string */
20+
final public function getEncryptionKey()
21+
{
22+
return $this->encryptionKey;
23+
}
24+
25+
/** @return CryptKey */
26+
final public function getPrivateKey() : CryptKey
27+
{
28+
return $this->privateKey;
29+
}
30+
31+
//////////////////////////////// PUBLIC API \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
32+
33+
/**
34+
* Keys constructor.
35+
*
36+
* @param CryptKey $privateKey
37+
* @param string|CryptoKey $encryptionKey
38+
*/
39+
final public function __construct(CryptKey $privateKey, $encryptionKey)
40+
{
41+
// @FIXME: Add type-check for $encryptionKey (or an extending class with different parameter type?)
42+
$this->encryptionKey = $encryptionKey;
43+
$this->privateKey = $privateKey;
44+
}
45+
}

0 commit comments

Comments
 (0)