steam-friend-code
Steam friend code utilities — encoding and decoding both CS:GO/CS2 in-game friend codes and short Steam quick-invite codes.
Installation
[]
= "0.1"
Two Code Formats
CSGO Friend Code
Base32/MD5-encoded codes used in the CS:GO and CS2 in-game friend system, displayed as ABCDE-FGHJK-LMNPQ.
use CsgoFriendCode;
// Encode a SteamID64 into a CS:GO friend code
let code = encode?;
println!; // e.g. "ABCDE-FGHJK-LMNPQ"
// Decode a code back to SteamID64
let steam_id = decode?;
SteamFriendCode is a backward-compatible type alias for CsgoFriendCode.
Short Steam Friend Code
Hex-mapped codes used in Steam quick-invite links (https://s.team/p/{code}/{token}).
use ;
// Create a short code from a SteamID64
let code = create_short_steam_friend_code;
// Parse a short code back to SteamID64
let steam_id = parse_short_steam_friend_code?;
// Extract SteamID64 from a full s.team/p/... URL
let steam_id = parse_quick_invite_link?;
SHORT_STEAM_FRIEND_CODE_CHARS is the character alphabet used by the short code encoding.
API
| Symbol | Description |
|---|---|
CsgoFriendCode |
Encode/decode CS:GO friend codes |
SteamFriendCode |
Alias for CsgoFriendCode |
create_short_steam_friend_code |
Encode SteamID64 → short invite code |
parse_short_steam_friend_code |
Decode short invite code → SteamID64 |
parse_quick_invite_link |
Extract SteamID64 from an s.team/p/… URL |
SHORT_STEAM_FRIEND_CODE_CHARS |
Character alphabet for short codes |