yabase/core/error
Types
Result of decoding a Base58Check string.
pub type Base58CheckDecoded {
Base58CheckDecoded(version: Int, payload: BitArray)
}
Constructors
-
Base58CheckDecoded(version: Int, payload: BitArray)
Result of decoding a Bech32/Bech32m string.
pub type Bech32Decoded {
Bech32Decoded(
hrp: String,
data: BitArray,
variant: Bech32Variant,
)
}
Constructors
-
Bech32Decoded( hrp: String, data: BitArray, variant: Bech32Variant, )
Bech32 encoding variant.
pub type Bech32Variant {
Bech32
Bech32m
}
Constructors
-
Bech32BIP 173 original Bech32
-
Bech32mBIP 350 improved Bech32m
Error and result types shared across yabase’s per-base modules.
These types are split out of core/encoding so the per-base modules
(yabase/base32/rfc4648, yabase/z85, …) can depend on them
without forming an import cycle: core/encoding aggregates the
per-base modules to provide the Encoding dispatcher, so the
per-base modules cannot in turn import core/encoding.
Errors that can occur during encoding or decoding.
pub type CodecError {
InvalidCharacter(character: String, position: Int)
InvalidLength(length: Int)
Overflow
UnsupportedPrefix(prefix: String)
UnsupportedMultibaseEncoding(encoding_name: String)
InvalidChecksum
InvalidHrp(reason: String)
NonCanonical
}
Constructors
-
InvalidCharacter(character: String, position: Int)Input contains a character not in the encoding’s alphabet.
-
InvalidLength(length: Int)Input length is not valid for the encoding.
-
OverflowDecoded value overflows the expected range.
-
UnsupportedPrefix(prefix: String)An unknown multibase prefix was encountered during decode.
-
UnsupportedMultibaseEncoding(encoding_name: String)An encoding has no assigned multibase prefix (e.g. Base64 DQ).
-
InvalidChecksumChecksum verification failed (Base58Check, Bech32).
-
InvalidHrp(reason: String)Invalid human-readable part in Bech32/Bech32m.
-
NonCanonicalThe decoded bytes are valid but the wire encoding is not the canonical form. Per RFC 4648 §3.5, the pad bits in base32 / base64 must be zero on the encoder side; decoders MAY reject non-canonical input. The strict-variant decoders surface this rejection so callers that need wire-form uniqueness (signature verification, content-addressable storage, audit comparisons) can opt into it.