use thiserror::Error;
use key::POINT_LEN;
pub(crate) mod armor;
pub mod entity;
pub mod key;
pub(crate) mod packet;
pub(crate) mod signature;
#[derive(Debug, Error)]
pub enum OpenPgpError {
#[error("expected a hex encoded public key")]
NotHex(#[from] hex::FromHexError),
#[error("expected a {POINT_LEN} byte public key, got {actual} bytes")]
PointLength {
actual: usize,
},
#[error("expected an uncompressed public key point (0x04 prefix)")]
CompressedPoint,
#[error("expected a 40 character hex fingerprint")]
NotFingerprint,
#[error("OpenPGP identity has no user ID")]
EmptyUserId,
#[error("OpenPGP user ID must not contain a NUL, a carriage return, or a line feed")]
UserIdControlByte,
#[error("invalid armored OpenPGP signature")]
InvalidSignatureArmor,
#[error("OpenPGP signature scalar must be nonzero and below the P-256 curve order")]
SignatureScalarOutOfRange,
}