toCoseKey

fun CryptoPublicKey.toCoseKey(algorithm: CoseAlgorithm? = null, keyId: ByteArray? = this.coseKid): KmmResult<CoseKey>(source)

Converts CryptoPublicKey into a KmmResult wrapped CoseKey If algorithm is not set then key can be used for any algorithm with same kty (RFC 8152), returns IllegalArgumentException for invalid kty/algorithm pairs