glm_vault/vault

Types

A vault is an opaque datatype that contains the secrets.

pub opaque type Vault

Vault Errors

pub type VaultError {
  UnableToSerializeUnsupportdType(tom.Toml)
  UnableToGetFromVault(tom.GetError)
  UnableToDecryptFile(openssl.OpenSslError, String, String)
  UnableToParseDecryptedToml(tom.ParseError, String, String)
  UnableToEncryptFile(simplifile.FileError)
  UnableToGetFromDict(String)
}

Constructors

Values

pub fn decrypt(
  encrypted_file: String,
  password_file: String,
) -> Result(Vault, VaultError)

Decrypt an encrypted file and return a vault instance.

pub fn encrypt(
  vault: Vault,
  encrypted_file: String,
  password_file: String,
) -> Result(Nil, VaultError)

Serialize a vault instance to a temporary file, then encrypt that file and delete the temporary file. Upon success, an encrypted file is created that contains the serialized contents of the vault.

pub fn get_bool(
  v: Vault,
  key: String,
) -> Result(Bool, VaultError)
pub fn get_float(
  v: Vault,
  key: String,
) -> Result(Float, VaultError)
pub fn get_int(v: Vault, key: String) -> Result(Int, VaultError)
pub fn get_string(
  v: Vault,
  key: String,
) -> Result(String, VaultError)
pub fn new_vault(secrets: dict.Dict(String, tom.Toml)) -> Vault

Create a new vault.

pub fn set_bool(v: Vault, key: String, value: Bool) -> Vault
pub fn set_float(v: Vault, key: String, value: Float) -> Vault
pub fn set_int(v: Vault, key: String, value: Int) -> Vault
pub fn set_string(v: Vault, key: String, value: String) -> Vault
Search Document