Multibase to Bytes
Decodes self-describing Multibase string with automatic prefix detection
Overview
Decodes a self-describing Multibase string into a raw byte array (Uint8Array) by inspecting its leading prefix character (z for Base58BTC, f/F for Base16 hex, m for Base64, or u for Base64URL) and applying the corresponding decoder automatically.
When to Use
- Decoding DID key identifiers, IPFS/multiformats strings, or self-describing tokens back into raw
Byteswithout hardcoding the encoding base.
Parameter Configuration
This node has no configurable static parameters in the property inspector; its runtime behavior is determined entirely by its algorithm specification and connected ports.
Port I/O Specification
See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.
Input Ports
Port Nature: Fixed Input Ports (1 total).
| Port Name | Port ID | Data Type | Required | Visibility Condition | Description |
|---|---|---|---|---|---|
Multibase In |
string |
String |
Required | Always visible | Multibase-encoded string starting with a valid single-character prefix (z, f, F, m, or u). |
Output Ports
Port Nature: Fixed Output Ports (1 total).
| Port Name | Port ID | Data Type | Visibility Condition | Description |
|---|---|---|---|---|
Bytes Out |
bytes |
Bytes |
Always visible | Decoded raw byte array (Uint8Array). |
Error Cases
When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute.
| Error Code | Default Engine Message | Trigger Condition |
|---|---|---|
INVALID_MULTIBASE_STRING |
Multibase string is too short | Raised when the input string is shorter than 2 characters, starts with an unsupported prefix character, or contains invalid characters for the detected encoding. |
UNSUPPORTED_MULTIBASE_PREFIX |
Unrecognized Multibase prefix | Raised when the leading character of the Multibase string is not a supported prefix (z, f, F, m, or u). |
INVALID_HEX_LENGTH |
Hex string length is not even | Raised when the hexadecimal string (excluding whitespace and 0x prefix) has an odd number of digits. |
INVALID_HEX_CHAR |
Hex string contains an invalid character | Raised when the hexadecimal string contains characters outside 0-9, a-f, and A-F. |
INVALID_BASE58_CHAR |
Base58 string contains an invalid character | Raised when the input string contains characters not present in the selected Base58 alphabet. |
INVALID_BASE64_INPUT |
Invalid Base64 string | Raised when the input string contains invalid Base64/Base64URL characters or has an invalid remainder length (len % 4 === 1). |
Examples
Auto-Decoding Any Multibase Token
Decode a z-prefixed or u-prefixed Multibase string into raw bytes.
- Connect the Multibase string to
Multibase String; the node inspects the first character and emits the decodedBytes.