#[non_exhaustive]pub enum KeyError {
InvalidPrivateKey,
InvalidPublicKey,
NotDidKey,
NotBase58Btc,
Multikey(CryptoError),
WrongCurve {
codec: KeyCodec,
},
NotCompressed {
got: usize,
},
InvalidSignature,
VerificationFailed,
}Expand description
Anything that can go wrong handling a key or a signature.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidPrivateKey
The 32 bytes are not a valid secp256k1 scalar: zero, or at or above the curve order.
InvalidPublicKey
The point bytes are not on the curve, or are otherwise malformed.
NotDidKey
The string did not start with did:key:.
NotBase58Btc
The multibase string was not base58btc, which atproto requires. Other multibase alphabets decode fine but are not interoperable here.
Multikey(CryptoError)
The multibase or multicodec framing did not decode.
WrongCurve
The key decoded, but it is for a curve this crate does not sign with. See the module docs for why there is only one.
Fields
codec: KeyCodecThe codec that was actually present.
NotCompressed
A secp256k1 key in the 65-byte uncompressed form, or some other length.
InvalidSignature
The 64 bytes are not a well-formed r || s pair.
VerificationFailed
The signature is well-formed but does not match this key and message.
A high-S signature lands here too: k256 rejects those on verify.
Trait Implementations§
Source§impl Error for KeyError
impl Error for KeyError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()