oas-crypto · error
Declared module signatures, types, configuration, and source documentation.
Source: oas/oas/oas-crypto/src/error.rs. SHA-256: cebc0111a9abeddb65aa444ff3796175d34fc2b8263529c8b1f59ba8f44c1a59.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
error::CryptoError
Errors arising from OAS cryptographic operations.
Every variant includes enough context to diagnose the issue without requiring a stack trace or access to private key material.
Examples
use oas_crypto::CryptoError;
let err = CryptoError::InvalidSignature {
context: "lineage proof verification".to_string(),
};
assert!(err.to_string().contains("lineage proof verification"));#[derive(Debug, Error)]
pub enum CryptoError {
/// Ed25519 signature verification failed.
#[error("signature verification failed during {context}")]
InvalidSignature {
/// What operation was being performed when verification failed.
context: String,
},
/// The provided key bytes have an invalid length.
#[error("invalid key length: expected {expected} bytes, got {actual} bytes")]
InvalidKeyLength {
/// Expected number of bytes.
expected: usize,
/// Actual number of bytes provided.
actual: usize,
},
/// HKDF key derivation failed.
#[error("HKDF key derivation failed for path '{derivation_path}': {reason}")]
DerivationFailed {
/// The derivation path that was being used.
derivation_path: String,
/// Why the derivation failed.
reason: String,
},
/// Multibase decoding failed.
#[error("multibase decoding failed: {reason}")]
MultibaseDecodeFailed {
/// Why the decoding failed.
reason: String,
},
/// Base64url decoding failed.
#[error("base64url decoding failed: {reason}")]
Base64DecodeFailed {
/// Why the decoding failed.
reason: String,
},
/// JSON canonicalization (JCS) failed.
#[error("JCS canonicalization failed: {reason}")]
CanonicalizationFailed {
/// Why canonicalization failed.
reason: String,
},
/// The proof payload structure is invalid.
#[error("invalid proof payload: {reason}")]
InvalidProofPayload {
/// Why the payload is invalid.
reason: String,
},
/// A legacy lineage proof omits bindings required for authorization.
#[error(
"legacy lineage proof is non-authorizing: {reason}; parse for migration only and issue a fully bound proof"
)]
LegacyInsecureProof {
/// The missing or insecure legacy property.
reason: String,
},
/// Standalone verification was attempted without an external trust decision.
#[error(
"lineage proof verification requires a trusted parent key from a validated DID document or explicit verifier policy"
)]
VerifierTrustRequired,
/// The lineage proof type is not supported.
#[error("unsupported lineage proof type '{found}'; expected '{expected}'")]
UnsupportedProofType {
/// Proof type received from the input.
found: String,
/// Proof type supported by this implementation.
expected: &'static str,
},
/// The lineage proof algorithm is not supported.
#[error("unsupported lineage proof algorithm '{found}'; expected '{expected}'")]
UnsupportedProofAlgorithm {
/// Algorithm received from the input.
found: String,
/// Algorithm supported by this implementation.
expected: &'static str,
},
/// The lineage proof canonicalization profile is not supported.
#[error("unsupported lineage proof canonicalization '{found}'; expected '{expected}'")]
UnsupportedCanonicalization {
/// Canonicalization identifier received from the input.
found: String,
/// Canonicalization identifier supported by this implementation.
expected: &'static str,
},
/// The lineage proof purpose is not authorized for lineage delegation.
#[error("unsupported lineage proof purpose '{found}'; expected '{expected}'")]
UnsupportedProofPurpose {
/// Proof purpose received from the input.
found: String,
/// Proof purpose required by this implementation.
expected: &'static str,
},
/// The proof's embedded parent key disagrees with the trusted verifier key.
#[error("embedded parent key does not match the externally trusted verification key")]
EmbeddedKeyMismatch,
/// Ed25519 key construction failed.
#[error("failed to construct Ed25519 key: {reason}")]
KeyConstructionFailed {
/// Why key construction failed.
reason: String,
},
/// FROST threshold key generation failed.
///
/// Returned when the trusted dealer key generation process fails,
/// typically due to invalid threshold parameters.
#[error("FROST key generation failed for {min_signers}-of-{max_signers} threshold: {reason}")]
FrostKeyGenFailed {
/// The requested minimum number of signers.
min_signers: u16,
/// The requested total number of participants.
max_signers: u16,
/// Why key generation failed.
reason: String,
},
/// FROST signing round failed.
///
/// Returned when a participant fails to produce their signature share
/// during round 2 of the FROST protocol.
#[error("FROST signing failed: {reason}")]
FrostSigningFailed {
/// Why the signing round failed.
reason: String,
},
/// FROST signature aggregation failed.
///
/// Returned when the coordinator fails to combine individual signature
/// shares into a valid group signature.
#[error("FROST signature aggregation failed: {reason}")]
FrostAggregationFailed {
/// Why aggregation failed.
reason: String,
},
/// FROST group signature verification failed.
///
/// Returned when a threshold signature does not verify against
/// the group public key.
#[error("FROST group signature verification failed: {reason}")]
FrostVerificationFailed {
/// Why verification failed.
reason: String,
},
/// Invalid participant selection for FROST signing.
///
/// Returned when the provided participant indices are invalid —
/// wrong count, out of range, or contain duplicates.
#[error("invalid FROST participant selection: {reason}")]
FrostInvalidParticipants {
/// Why the participant selection is invalid.
reason: String,
},
/// FROST signature serialization failed.
///
/// Returned when a FROST signature or key cannot be serialized to bytes.
#[error("FROST serialization failed: {reason}")]
FrostSerializationFailed {
/// Why serialization failed.
reason: String,
},
}Source line: 25.