Skip to main content

libkeri/keri/app/
mod.rs

1pub mod configing;
2pub mod habbing;
3pub mod habery;
4pub mod keeping;
5
6/// Returns a bytes DB key from concatenation with '.' of qualified Base64 prefix
7/// bytes `pre` and int `ri` (rotation index) of key rotation.
8/// Inception has ri == 0
9pub fn ri_key(pre: &[u8], ri: usize) -> Vec<u8> {
10    let mut key = Vec::with_capacity(pre.len() + 1 + 32);
11    key.extend_from_slice(pre);
12    key.push(b'.'); // Add dot separator
13
14    // Format ri as a 32-character zero-padded lowercase hex string
15    let ri_hex = format!("{:032x}", ri);
16    key.extend_from_slice(ri_hex.as_bytes());
17
18    key
19}