fromEd25519

fun fromEd25519(publicKey: ByteArray): String

Generates a did:key from a 32-byte Ed25519 public key.

Format: did:key:z<base58btc(varint(0xed) || ed25519_pubkey)>

Produced DIDs start with the well-known prefix did:key:z6Mk — a direct consequence of the multicodec 0xed01 + the 32-byte key length passing through base58btc. Any consumer comparing DID prefixes to detect Ed25519 (as opposed to legacy P-256 did:key:zDn…) can rely on z6Mk.

Reference: https://w3c-ccg.github.io/did-method-key/#ed25519-x25519

Return

The DID string, e.g. did:key:z6Mk...

Parameters

publicKey

32-byte Ed25519 public key

Throws

if key is not 32 bytes