Str Key
StrKey is a helper class for encoding and decoding Stellar keys to/from strings. Stellar uses a base32 encoding with checksums called "strkey" for human-readable keys.
The decode contract
Every decodeX runs the same checks in the same order and reports the first one the string fails as an IllegalArgumentException:
the character count is one the requested type has;
every character is inside the ASCII range;
the character count leaves no partially filled trailing character;
every character is one of the 32 in BASE32_ALPHABET;
the unused trailing bits of the last character are zero;
the version byte names a strkey type;
the decoded payload has a size that type admits;
the framing that type defines inside its payload holds;
the version byte names the type the caller asked for;
the checksum matches the payload it covers.
Checks 2 and 4 answer one question - whether the string is written in the characters a strkey is written in - and report it in the same words. Check 5 has nothing to read for a type whose character count fills its last character, and check 8 nothing to read for a type whose payload is an opaque key of a fixed size.
Each decodeX documents only what its own type fixes: the character count it has, the version byte it is written under and the framing it defines. Each isValidX reports whether the matching decodeX accepts the string, so it is false wherever that decode throws.
Functions
Decodes strkey claimable balance ID (B...) to raw bytes
Decodes strkey contract address (C...) to raw bytes
Decodes strkey ed25519 public key (G...) to raw bytes
Decodes strkey ed25519 secret seed (S...) to raw bytes
Decodes strkey liquidity pool ID (L...) to raw bytes
Decodes strkey muxed ed25519 public key (M...) to raw bytes
Decodes strkey pre-authorized transaction hash (T...) to raw bytes
Decodes strkey SHA-256 hash (X...) to raw bytes
Decodes strkey signed payload (P...) to raw bytes
Encodes raw bytes to strkey claimable balance ID (B...)
Encodes raw bytes to strkey contract address (C...)
Encodes raw bytes to strkey ed25519 public key (G...)
Encodes raw bytes to strkey ed25519 secret seed (S...)
Encodes raw bytes to strkey liquidity pool ID (L...)
Encodes raw bytes to strkey muxed ed25519 public key (M...)
Encodes raw bytes to strkey pre-authorized transaction hash (T...)
Encodes raw bytes to strkey SHA-256 hash (X...)
Encodes raw bytes to strkey signed payload (P...)
Checks validity of claimable balance ID (B...)
Checks validity of contract address (C...)
Checks validity of Stellar account ID (G...)
Checks validity of seed (S...)
Checks validity of liquidity pool ID (L...)
Checks validity of muxed ed25519 public key (M...)
Checks validity of pre-authorized transaction hash (T...)
Checks validity of SHA-256 hash (X...)
Checks validity of signed payload (P...)