gothic-0.1.1: A Haskell Vault KVv2 secret engine client

Safe HaskellNone




See for HashiCorp Vault KVv2 API details



Connect & configure Vault KVv2 Engine

vaultConnect Source #


:: Maybe String

Use Just this string as Vault address or get it from variable environment VAULT_ADDR

-> String

KV engine path

-> Maybe VaultToken

Use Just this VaultToken or get it from $HOME/.vaut-token

-> Bool

Disable certificate validation

-> IO (Either String VaultConnection) 

Get a VaultConnection, or an error message.

λ: vaultConnect (Just "https://vault.local.lan:8200/") "/secret" Nothing False

kvEngineConfig Source #


:: VaultConnection 
-> Int

Max versions

-> Bool

CAS required

-> IO (Either String Value) 

Set default secret settings for the KVv2 engine.

secretConfig Source #


:: VaultConnection 
-> SecretPath 
-> Int

Max versions

-> Bool

CAS required

-> IO (Either String Value) 

Override default secret settings for the given secret.

Basic operations

putSecret Source #

Put SecretData into Vault at the given location.

getSecret :: VaultConnection -> SecretPath -> Maybe SecretVersion -> IO (Either String SecretData) Source #

Get a secret from Vault. Give Just the SecretVersion to retrieve or Nothing to get the current one.

λ>getSecret conn (SecretPath "MySecret") Nothing
Right (SecretData (fromList [("my","password")]))

Soft secret deletion

Permanent secret deletion

destroySecret :: VaultConnection -> SecretPath -> IO (Maybe Error) Source #

Permanently delete a secret, i.e. all its versions and metadata.

Get informations

currentSecretVersion :: VaultConnection -> SecretPath -> IO (Either String SecretVersion) Source #

Get version number of the current given secret.

readSecretMetadata :: VaultConnection -> SecretPath -> IO (Either String SecretMetadata) Source #

Retrieve versions history of the given secret.

λ: readSecretMetadata conn (SecretPath "MySecret") 
Right (SecretMetadata (fromList [(SecretVersion 1,Metadata {destroyed = True, deletion_time = "", created_time = "2019-05-30T13:22:58.416399224Z"}),(SecretVersion 2,Metadata {destroyed = True, deletion_time = "2019-06-29T15:28:46.145302138Z"})]))

secretsList :: VaultConnection -> SecretPath -> IO (Either String [VaultKey]) Source #

Get list of secrets and folders at the given location.