Skip to main content

Crate sevola_encrypt

Crate sevola_encrypt 

Source
Expand description

Rust SDK for Sevola Encrypt — encryption and tokenization as a service by PT Ifabula Digital Kreasi.

The SDK wraps the data-plane API (x-api-key auth) and offers two paths:

PathCipherUse
at restFF1 format-preserving (radix 10 / 62)field-level encryption that keeps the value’s shape
in transitAES-256-CBC, key stretched with PBKDF2opaque payloads, optionally with a per-message key
use sevola_encrypt::{EncryptClient, EncryptRequest, Template};

let client = EncryptClient::new("your-api-key")?;

// Format-preserving: a 16-digit card stays 16 digits.
let results = client
    .encrypt_data(&[EncryptRequest {
        template: Template::Numeric,
        data: "4111111111111111".into(),
    }])
    .await?;
println!("{:?}", results[0].value());

// Transit: opaque base64.
let sealed = client.encrypt_transit("nomor rekening: 1234567890").await?;
let opened = client.decrypt_transit(&sealed).await?;

§Compatibility

Ciphertext must round-trip with the Java, JS, PHP, .NET and Go SDKs, so the algorithm details in crypto, markers and pipeline are wire format, not implementation choices. They are pinned by golden vectors generated from the Go SDK — see testdata/gen and tests/golden.rs.

§Feature flags

  • client (default) — the async HTTP client, EncryptClient. Turn it off for a dependency-light crate with only the crypto and marker layer, which is what an FFI core or a wasm build wants.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use types::ClientOptions;
pub use types::DecryptRequest;
pub use types::EncryptRequest;
pub use types::ItemResult;
pub use types::KeyType;
pub use types::Operation;
pub use types::Template;
pub use types::TemplateProfile;
pub use types::DEFAULT_ALPHABET;
pub use types::DEFAULT_BASE_URL;
pub use types::NUMERIC_ALPHABET;
pub use types::TWEAK_B64;
pub use client::EncryptClient;

Modules§

client
The data-plane HTTP client.
crypto
Crypto primitives, independent of any transport.
error
Error type for the Sevola Encrypt SDK.
markers
Escape/wrap markers and non-alphabet handling.
pipeline
The at-rest (FF1) pipeline, with the key passed in.
types
Configuration, enums and wire types.

Functions§

tweak
The fixed tweak, decoded. FF1 needs a tweak; Sevola uses one constant value across all SDKs so ciphertext is portable between them.