Skip to main content

did_short

Function did_short 

Source
pub fn did_short(hex: &str) -> String
Expand description

Shorten a did:nostr public key for display: did:nostr: plus the first eight characters and an ellipsis. The hex stays canonical in every path and identifier; this is for rendering only (JSS didShort).

§Examples

use solid_pod_rs_forge::gitmark::did_short;

let hex = format!("4a578b54{}", "ab".repeat(28));
assert_eq!(did_short(&hex), "did:nostr:4a578b54…");
// shorter input is shown whole, never padded
assert_eq!(did_short("abc"), "did:nostr:abc…");