public function KeyClient::set in Lockr 7.2
Same name and namespace in other branches
- 7 src/Lockr/KeyClient.php \Lockr\KeyClient::set()
Sets a key in Lockr.
Parameters
string $name The key name.:
string $value The key value.:
string $label The key label.:
Return value
string Returns the decrypt data or true.
File
- vendor/
lockr/ lockr-client/ src/ KeyClient.php, line 82
Class
Namespace
LockrCode
public function set($name, $value, $label, $encoded = null) {
if ($this->encoded) {
if ($encoded === NULL) {
$ret = MultiKeyWrapper::encrypt($value);
}
else {
$ret = MultiKeyWrapper::reencrypt($value, $encoded);
}
$value = $ret['ciphertext'];
}
$data = array(
'key_value' => $value,
'key_label' => $label,
);
$this->client
->patch($this
->uri($name), $data);
if ($this->encoded) {
return $ret['encoded'];
}
return true;
}