Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
Apparently, `RepoId::from_urn` also accepts strings without the `rad:` prefix.
Open did:key:z6MkgFq6...nBGz opened 6 months ago crate=radicle type=refactor
pub fn from_urn(s: &str) -> Result<Self, IdError> {
    let s = s.strip_prefix(RAD_PREFIX).unwrap_or(s);
    let id = Self::from_canonical(s)?;

    Ok(id)
}

This is unexpected, since the constructor name mentions from_urn, which implies that it is in fact a URN, not just a bare string of characters.

This can be generally fine, since Self::from_canonical does the parsing of the multibase encoding, and the rad: prefix is not always needed. However, that string becomes ambiguous if something uses the same multibase encoding, whether in Radicle or from some other application.

It is hard to reverse this decision since this is used to parse RIDs, via FromStr, and we cannot know for sure how downstream crates are parsing, i.e. whether prefixed or not.

Changing this behaviour would be a non-backwards-compatible change. So, we should keep this in mind, and review at a later date.