Skip to main content

Crate ubiq_rust

Crate ubiq_rust 

Source
Expand description

§ubiq_rust

Rust client library for the Ubiq Security platform. Provides both unstructured (AES-based) and structured (format-preserving) encryption.

§Quick start

Use the builder::Builder to construct encryption/decryption objects. Credentials are loaded from ~/.ubiq/credentials by default, or can be configured via environment variables or explicit paths.

§Structured (format-preserving) encryption

use ubiq_rust::builder::{Builder, Structured};

let mut enc = Builder::<Structured>::new().build()?;

let ciphertext = enc.encrypt("SSN", "123-45-6789", None).await?;
let plaintext  = enc.decrypt("SSN", &ciphertext, None).await?;

assert_eq!(plaintext, "123-45-6789");

§Unstructured encryption

use ubiq_rust::builder::{Builder, Unstructured};

let mut enc = Builder::<Unstructured>::new()
    .build_encryption()
    .await?;
let ciphertext = enc.encrypt(b"hello, world!")?;

let mut dec = Builder::<Unstructured>::new()
    .build_decryption()?;
let plaintext = dec.decrypt(&ciphertext).await?;

assert_eq!(plaintext, b"hello, world!");

See the individual module docs and the README for more details.

Modules§

builder
config
credentials
error
structured
unstructured

Structs§

UbiqClient
Wrapper for the http client.

Type Aliases§

Result
Convenience alias for results returned by this crate.