Pumpkin-MC/Pumpkin · error · TelemetryVerificationError
Invalid signature bytes
Error message
Invalid signature bytes: {0} What it means
TelemetryVerificationError::InvalidSignature(String), produced when the hex-decoded signature bytes cannot be converted into an Ed25519 Signature (typically wrong length — Ed25519 signatures are 64 bytes). Hex decoding succeeded but the byte content is unusable.
Solutions
- Verify the decoded signature is exactly 64 bytes before calling verify
- Ensure the client signs with Ed25519 over the same payload the server verifies
- Log the decoded byte length on failure to spot truncation in the transport layer
Example fix
// before let sig_bytes = &sha256(payload); // 32 bytes // after let sig_bytes = signing_key.sign(payload.as_bytes()).to_bytes(); // 64 bytes
Defensive patterns
Strategy: validation
Validate before calling
let bytes = hex::decode(sig)?;
if bytes.len() != 64 { return Err(format!("signature must be 64 bytes, got {}", bytes.len())); } Type guard
fn valid_signature_bytes(sig_hex: &str) -> bool {
hex::decode(sig_hex).map(|b| b.len() == 64).unwrap_or(false)
} Try / catch
match telemetry::verify(&key, &sig, &msg, now) {
Err(TelemetryVerificationError::InvalidSignature(m)) => log::error!("bad signature (len check failed): {m}"),
Ok(()) => { /* proceed */ }
Err(e) => return Err(e.into()),
} Prevention
- Use the Ed25519 crate's Signature::to_bytes() output directly (always 64 bytes)
- Reject signatures with wrong decoded length at the HTTP layer with a clear 400 message
- Log decoded byte lengths on failure to detect truncating middleware
When it happens
Trigger: Calling telemetry::verify with a hex string decoding to a length other than 64 bytes — e.g. a truncated signature, a SHA-256 digest, or concatenated key+signature material.
Common situations: Signing implementation truncates or extends output; client signs with a different algorithm (e.g. ECDSA) than expected; middleware strips/reformats the signature.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Invalid public key hex encoding
- Invalid public key bytes
- Invalid signature hex encoding
- Signature verification failed
- Token not signed by trusted Mojang key
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/451351bdd9627b39.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin/src/telemetry.rs:133
(pubkey_hex, sig_hex)
}
/// Errors that can occur during telemetry request signature verification.
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum TelemetryVerificationError {
#[error("Invalid timestamp string format")]
InvalidTimestamp,
#[error(
"Timestamp drift exceeded: drift was {drift}s (max allowed is {MAX_CLOCK_DRIFT_SECS}s)"
)]
ClockDriftExceeded { drift: u64 },
#[error("Invalid public key hex encoding")]
InvalidPublicKeyHex,
#[error("Invalid public key bytes: {0}")]
InvalidPublicKey(String),
#[error("Invalid signature hex encoding")]
InvalidSignatureHex,
#[error("Invalid signature bytes: {0}")]
InvalidSignature(String),
#[error("Signature verification failed: {0}")]
VerificationFailed(String),
}
/// Verifies a signed telemetry request against an Ed25519 public key and timestamp.
///
/// Ensures clock drift between `current_time_secs` and `timestamp_str` does not exceed `±300` seconds.
pub fn verify_telemetry_request(
pubkey_hex: &str,
sig_hex: &str,
timestamp_str: &str,
body_bytes: &[u8],
current_time_secs: u64,
) -> Result<(), TelemetryVerificationError> {
let ts: u64 = timestamp_str
.parse()
.map_err(|_| TelemetryVerificationError::InvalidTimestamp)?;View on GitHub (pinned to 8d4639e25a)