Skip to main content

urma_runtime/
container.rs

1use rand::rngs::OsRng;
2pub use urma_core::container::{
3    PrivateChunk, PrivateObject, PrivateRecordHeader, RecordMatch, inspect_header, open,
4    open_record, pack, unpack,
5};
6use urma_core::{container, error::Error, format::ContentType};
7use zeroize::Zeroizing;
8
9pub fn random_secret() -> Result<Zeroizing<[u8; 32]>, Error> {
10    container::random_secret(&mut OsRng)
11}
12pub fn seal(
13    root: &[u8; 32],
14    plaintext: &[u8],
15    content_type: ContentType,
16) -> Result<Vec<Vec<u8>>, Error> {
17    container::seal(root, plaintext, content_type, &mut OsRng)
18}