vaultPHP
vaultPHP copied to clipboard
Support K/V Secret Engine
I am trying to fetch kv secrets with EndpointResponse like this
$response = $client->sendApiRequest(
'GET',
'/v1/secret/data/creds',
EndpointResponse::class);
However, In the EndpointResponse class the data is never being set in the properties as this condition below never meets to find the key in the class. there is a declaration for $metaData, but we get metadata in $key below. Also, since there is no $data property it fails on this condition again.
if (property_exists(static::class, (string) $key)) {
So, adding these missing properties gives me data in the response.
protected $metadata;
protected $data;
Now, I am new to Vault so I may be doing things wrong way. Looking forward for your feedback.
Thanks !!
Hey! Currently vaultPHP only supports the transit
secret engine - so the K/V secret engine is not implemented. Feel free to adapt the current implementation from SecretEngines/Transit
to support K/V and open a pull request. Every file in that folder is the abstraction between api calls and mapping to a data object that gets parsed and finally served as a response dto.