The standard `did:key` identifier for this Ed25519 key. Multicodec `ed25519-pub` (varint `0xed01`) + the 32 key bytes, base58btc multibase — always rendered `did:key:z6Mk...` for Ed25519. Unlike `did:atomic` (a blake3 fingerprint), the public key is *recoverable from this form, so a verifier holding only the DID can check a signature. Delegation certificates carry both.
(&self)
| 61 | /// from this form, so a verifier holding only the DID can check a |
| 62 | /// signature. Delegation certificates carry both. |
| 63 | pub fn to_did_key(&self) -> String { |
| 64 | let mut bytes = Vec::with_capacity(2 + Self::SIZE); |
| 65 | bytes.extend_from_slice(&MULTICODEC_ED25519_PUB); |
| 66 | bytes.extend_from_slice(self.as_bytes()); |
| 67 | format!("{}z{}", DID_KEY_PREFIX, bs58::encode(bytes).into_string()) |
| 68 | } |
| 69 | |
| 70 | /// Recover a public key from its `did:key` form. |
| 71 | pub fn from_did_key(did: &str) -> Result<Self, IdentityError> { |
no test coverage detected