change key protocols.
@@ -3,11 +3,12 @@ use std::str::FromStr;
use serde::{Deserialize, Serialize};
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
pub enum PublicKeyTypes {
UnknownKey,
- Ed25519Key,
- RSAKey,
- Ed25519VerificationKey,
+ Ed25519VerificationKey2018,
+ RsaVerificationKey2018,
+ EcdsaSecp256k1VerificationKey2018,
}
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize)]
@@ -48,15 +49,15 @@ impl FromStr for KeyEncodingType {
fn from_str(s: &str) -> crate::Result<KeyEncodingType> {
match s {
- "unknown" => Ok(KeyEncodingType::Unknown),
- "pem" => Ok(KeyEncodingType::Pem),
- "jwk" => Ok(KeyEncodingType::Jwk),
- "hex" => Ok(KeyEncodingType::Hex),
- "base64" => Ok(KeyEncodingType::Base64),
- "base58" => Ok(KeyEncodingType::Base58),
- "multibase" => Ok(KeyEncodingType::Multibase),
- "iota" => Ok(KeyEncodingType::IotaAddress),
- "ethereum" => Ok(KeyEncodingType::EthereumAddress),
+ "publicKeyUnknown" => Ok(KeyEncodingType::Unknown),
+ "publicKeyPem" => Ok(KeyEncodingType::Pem),
+ "publicKeyJwk" => Ok(KeyEncodingType::Jwk),
+ "publicKeyHex" => Ok(KeyEncodingType::Hex),
+ "publicKeyBase64" => Ok(KeyEncodingType::Base64),
+ "publicKeyBase58" => Ok(KeyEncodingType::Base58),
+ "publicKeyMultibase" => Ok(KeyEncodingType::Multibase),
+ "iotaAdress" => Ok(KeyEncodingType::IotaAddress),
+ "ethereumAdress" => Ok(KeyEncodingType::EthereumAddress),
_ => Err(crate::Error::KeyFormatError),
}
}
