reallyme-crypto-dispatch 0.1.6

Algorithm dispatch, codec binding, and structural validation for cryptographic primitives.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-FileCopyrightText: Copyright © 2026 ReallyMe LLC. All rights reserved
//
// SPDX-License-Identifier: Apache-2.0

use crypto_core::{Algorithm, CryptoError, SignatureFailureKind, SignatureOperation};

use crate::AlgorithmError;

pub(crate) fn map_verify_error(algorithm: Algorithm, error: CryptoError) -> AlgorithmError {
    match error {
        CryptoError::Signature {
            operation: SignatureOperation::Verify,
            kind: SignatureFailureKind::InvalidSignature,
            ..
        } => AlgorithmError::SignatureInvalid(algorithm),
        other => AlgorithmError::from(other),
    }
}