reallyme-codec-multibase 0.3.0

Multibase encoding and decoding support for ReallyMe Codec.
Documentation
// SPDX-FileCopyrightText: 2026 ReallyMe LLC
//
// SPDX-License-Identifier: MIT OR Apache-2.0

use thiserror::Error;

use crate::base58btc::Base58Error;

/// Error returned when decoding a multibase string fails.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum MultibaseError {
    /// Encoded multibase text exceeded the supported resource limit.
    #[error("multibase input too large")]
    InputTooLarge,
    /// The input is too short to contain a multibase prefix and payload.
    #[error("invalid multibase string: too short")]
    TooShort,

    // Deliberately carries no payload: the rejected prefix comes from
    // untrusted input, and error variants must not echo it back.
    /// The leading multibase prefix denotes an unsupported base encoding.
    #[error("unsupported multibase prefix")]
    UnsupportedPrefix,

    /// The base58btc payload failed to decode.
    #[error(transparent)]
    Base58(#[from] Base58Error),

    /// The base64url payload failed to decode.
    #[error("invalid base64url")]
    Base64Url,

    /// The encoded output length would exceed the supported allocation domain.
    #[error("multibase encoded length overflow")]
    LengthOverflow,
}