extractKeyId

Extract the key ID string from a verification method ID.

Returns the key ID fragment without the '#' prefix (e.g., "key-1"). This is the type-safe alternative to using substringAfter("#") on the string value.

Example:

val vmId = VerificationMethodId(did, KeyId("#key-1"))
val keyId = vmId.extractKeyId() // Returns "key-1"

Return

The key ID string without the fragment prefix


Extract the key ID string from a verification method.

Returns the key ID fragment without the '#' prefix (e.g., "key-1"). This is a convenience extension that extracts the key ID from the verification method's ID.

Example:

val verificationMethod = document.verificationMethod.firstOrNull()
val keyId = verificationMethod?.extractKeyId() // Returns "key-1" or null

Return

The key ID string without the fragment prefix, or null if the method is null