Skip to main content

compute_next_commitment

Function compute_next_commitment 

Source
pub fn compute_next_commitment(key: &KeriPublicKey) -> Said
Expand description

Compute the next-key commitment digest for pre-rotation.

The commitment is the Blake3-256 digest of the next verkey, CESR-encoded with the E derivation code. It goes in the current event’s n field and must be satisfied by the next rotation’s k.

The key is typed (KeriPublicKey) so its curve travels with it — the curve is required to encode the verkey, and a typed key makes a “key without a curve” unrepresentable at the call site.

Args:

  • key - The next public key (Ed25519 or P-256), carrying its curve.

Usage:

use auths_keri::{compute_next_commitment, KeriPublicKey};
let commitment = compute_next_commitment(&KeriPublicKey::Ed25519([0u8; 32]));
assert_eq!(commitment.as_str().len(), 44);
assert!(commitment.as_str().starts_with('E'));