-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJWEDecrypterFactory.php
36 lines (30 loc) · 1.25 KB
/
JWEDecrypterFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Jose\Bundle\JoseFramework\Services;
use Jose\Component\Core\AlgorithmManagerFactory;
use Jose\Component\Encryption\Compression\CompressionMethodManagerFactory;
use Psr\EventDispatcher\EventDispatcherInterface;
final class JWEDecrypterFactory
{
public function __construct(
private readonly AlgorithmManagerFactory $algorithmManagerFactory,
private readonly CompressionMethodManagerFactory $compressionMethodManagerFactory,
private readonly EventDispatcherInterface $eventDispatcher
) {
}
public function create(
array $keyEncryptionAlgorithms,
array $contentEncryptionAlgorithms,
array $compressionMethods
): JWEDecrypter {
$keyEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($keyEncryptionAlgorithms);
$contentEncryptionAlgorithmManager = $this->algorithmManagerFactory->create($contentEncryptionAlgorithms);
$compressionMethodManager = $this->compressionMethodManagerFactory->create($compressionMethods);
return new JWEDecrypter(
$keyEncryptionAlgorithmManager,
$contentEncryptionAlgorithmManager,
$compressionMethodManager,
$this->eventDispatcher
);
}
}