public function SecretInfo::getSecretInfo in Lockr 4.x
Same name and namespace in other branches
- 8.4 src/SecretInfo.php \Drupal\lockr\SecretInfo::getSecretInfo()
- 8.3 src/SecretInfo.php \Drupal\lockr\SecretInfo::getSecretInfo()
File
- src/
SecretInfo.php, line 53
Class
- SecretInfo
- SecretInfo implements secret info for Lockr secrets.
Namespace
Drupal\lockrCode
public function getSecretInfo($name) {
/** @var \Drupal\lockr\SecretInterface */
$secret = $this->secretStorage
->load($name);
if (!is_null($secret)) {
return $secret
->getInfo();
}
$config = $this->configFactory
->get('lockr.secret_info');
$info = $config
->get($name);
if (!$info) {
$key = $this->keyRepository
->getKey($name);
if ($key) {
$provider = $key
->getKeyProvider();
$config = $provider
->getConfiguration();
if (isset($config['encoded'])) {
return [
'wrapping_key' => $config['encoded'],
];
}
}
}
return $info ?: [];
}