diff --git a/src/PubNub/PubNub.php b/src/PubNub/PubNub.php index f1237d52..5aedea86 100644 --- a/src/PubNub/PubNub.php +++ b/src/PubNub/PubNub.php @@ -79,6 +79,8 @@ class PubNub implements LoggerAwareInterface /** @var int $nextSequence */ protected $nextSequence = 0; + protected ?CryptoModule $cryptoModule = null; + /** * PNConfiguration constructor. * @@ -557,4 +559,18 @@ public function setToken($token) { return $this->tokenManager->setToken($token); } + + public function getCrypto(): CryptoModule + { + if ($this->cryptoModule) { + return $this->cryptoModule; + } else { + return $this->configuration->getCrypto(); + } + } + + public function setCrypto(CryptoModule $cryptoModule) + { + $this->cryptoModule = $cryptoModule; + } }