CSharpRU/vault-php

Support Vault KV2

njoerd114 opened this issue · 2 comments

Vault KV2 expects the JSON Body to be formed as documented here:
https://www.vaultproject.io/api/secret/kv/kv-v2.html#data

We should consider providing an optional parameter that defines the kv version used.

I'm gonna provide a PR.

Update:
I probpably won't provide a PR :)

Did a workaround in the AbstractionClass, i.e.:

     * @param string $path
     * @param array $secrets
     * @return bool
     */
    public function put(string $path, array $secrets): bool
    {
        try {
            $secrets = ['data' => $secrets];
            $result = $this->client->write($path, $secrets);
...

Hello there, sorry for the long answer.

I can guess that you're trying to create/update secret (https://www.vaultproject.io/api/secret/kv/kv-v2.html#createupdate-secret), right?

Did you try to use https://github.com/CSharpRU/vault-php/blob/master/src/Client.php#L89 with ['data' => $secrets]?

this can be closed