From c69723b4795afbd4c8f83fb96ab2f76492b2a4ff Mon Sep 17 00:00:00 2001 From: Andres Uribe Gonzalez Date: Tue, 5 Dec 2023 11:28:35 -0500 Subject: [PATCH] Clarify documentation of `KeyType` --- crates/crypto/src/key/key.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/crypto/src/key/key.rs b/crates/crypto/src/key/key.rs index 66ada448..ec3d84d0 100644 --- a/crates/crypto/src/key/key.rs +++ b/crates/crypto/src/key/key.rs @@ -2,6 +2,13 @@ use ssi_jwk::JWK; use ssi_jws::Error as JWSError; /// Enum defining all supported cryptographic key types. +/// +/// Note that KeyType is NOT to be interpreted as the "kty" header defined in https://www.rfc-editor.org/rfc/rfc7517#section-4.1. +/// Instead, "kty" (the JOSE header) should be thought of as the type for a Json Web Key (JWK) +/// object. This enum should be thought of as the type of a cryptographic key. +/// KeyType maps to a JWK type, but not the other way around. For example, the KeyType of "Ed25519" +/// maps to the JWK type (i.e. the "kty" header) of "EC". The converse is not true. "EC" maps to +/// many KeyType enums. pub enum KeyType { Secp256k1, Secp256r1,