You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!\function_exists('sodium_crypto_box_seal')) {
34
-
thrownew \LogicException('The "sodium" PHP extension is required to deal with secrets. Alternatively, try running "composer require paragonie/sodium_compat" if you cannot enable the extension."');
thrownew \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, %s given.', \gettype($decryptionKey)));
39
35
}
@@ -107,16 +103,22 @@ public function reveal(string $name): ?string
107
103
returnnull;
108
104
}
109
105
106
+
if (!\function_exists('sodium_crypto_box_seal')) {
107
+
$this->lastMessage = sprintf('Secret "%s" cannot be revealed as the "sodium" PHP extension missing. Try running "composer require paragonie/sodium_compat" if you cannot enable the extension."', $name);
108
+
109
+
returnnull;
110
+
}
111
+
110
112
$this->loadKeys();
111
113
112
114
if ('' === $this->decryptionKey) {
113
-
$this->lastMessage = sprintf('Secrets cannot be revealed as no decryption key was found in "%s".', $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
115
+
$this->lastMessage = sprintf('Secret "%s" cannot be revealed as no decryption key was found in "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
114
116
115
117
returnnull;
116
118
}
117
119
118
120
if (false === $value = sodium_crypto_box_seal_open(include$file, $this->decryptionKey)) {
119
-
$this->lastMessage = sprintf('Secrets cannot be revealed as the wrong decryption key was provided for "%s".', $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
121
+
$this->lastMessage = sprintf('Secret "%s" cannot be revealed as the wrong decryption key was provided for "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
120
122
121
123
returnnull;
122
124
}
@@ -167,6 +169,10 @@ public function list(bool $reveal = false): array
167
169
168
170
privatefunctionloadKeys(): void
169
171
{
172
+
if (!\function_exists('sodium_crypto_box_seal')) {
173
+
thrownew \LogicException('The "sodium" PHP extension is required to deal with secrets. Alternatively, try running "composer require paragonie/sodium_compat" if you cannot enable the extension."');
0 commit comments