Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing partial crypto functionality #89

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/PubNub/PubNub.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class PubNub implements LoggerAwareInterface
/** @var int $nextSequence */
protected $nextSequence = 0;

protected ?CryptoModule $cryptoModule = null;

/**
* PNConfiguration constructor.
*
Expand Down Expand Up @@ -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();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line creates a new cryptomodule on missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it has the cipher keyset up in config then will get the module. Else it raises an exception

}
}

public function setCrypto(CryptoModule $cryptoModule)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. In Kotlin/Java it is not possible to setCrypto in PubNub. User can setCrypto only in PNConfiguration.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understood @techwritermat asked for that - maybe he will ask you too ;o

{
$this->cryptoModule = $cryptoModule;
}
}
Loading