{"id":17681210,"url":"https://github.com/z64/steam_id","last_synced_at":"2025-10-10T03:34:20.559Z","repository":{"id":80745995,"uuid":"140216038","full_name":"z64/steam_id","owner":"z64","description":"A Crystal wrapper for Steam IDs","archived":false,"fork":false,"pushed_at":"2019-01-29T14:03:30.000Z","size":56,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T19:09:04.558Z","etag":null,"topics":["api","crystal","steam"],"latest_commit_sha":null,"homepage":"https://z64.github.io/steam_id/","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/z64.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-09T01:25:40.000Z","updated_at":"2020-05-07T17:43:40.000Z","dependencies_parsed_at":"2023-03-12T12:05:52.589Z","dependency_job_id":null,"html_url":"https://github.com/z64/steam_id","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/z64/steam_id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fsteam_id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fsteam_id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fsteam_id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fsteam_id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z64","download_url":"https://codeload.github.com/z64/steam_id/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z64%2Fsteam_id/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002621,"owners_count":26083425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","crystal","steam"],"created_at":"2024-10-24T09:10:31.397Z","updated_at":"2025-10-10T03:34:20.522Z","avatar_url":"https://github.com/z64.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# steam_id\n\nA library for parsing and serializing Steam IDs.\n\n- [Library docs](https://z64.github.io/steam_id/)\n- [SteamID official documentation](https://developer.valvesoftware.com/wiki/SteamID)\n\n## Background\n\nI wrote this library because:\n\n- Understanding Steam IDs can be confusing\n- A lot of libraries implement Steam IDs wrong\n- IDs encountered \"in the wild\" may be missing information, or \"wrong\"\n\nThe important detail to understand is that any observed Steam ID is *not* a\nunique identifier in the traditional sense. For an application that observes\nSteam IDs from *multiple* sources, it would be unwise to use a Steam ID as a\nprimary key, for instance.\n\n**A Steam ID is an integer that contains encoded account metadata. Depending\non how and where you observe a Steam ID, some of this metadata may be\nwrong or missing, but still refer to the same account.**\n\n## ID Formats\n\nAn ID can be represented in three main ways.\n\n1. As a 64 bit integer (`Steam::ID::Format::Community64`). ex: `76561197960287930`\n\n  This is a *lossless* format that contains *all* metadata. This is the format of\n  ID that is used when interacting with the Steam API.\n\n2. As a string (`Steam::ID::Format::Default`). ex: `STEAM_1:0:11101`\n\n  This is the standard \"textual\" format as described by the SteamID docs.\n\n  This is a *lossy* format that is missing account type and account instance.\n\n3. As a string (`Steam::ID::Format::Community32`). ex: `[U:1:22202]`\n\n  This is a special format for forming \"short\" URLs to Steam community\n  pages.\n\n  This is a *lossy* format that is missing account universe and account instance.\n\nIt's important to consider what your application needs, and whether the format\nyou are handling Steam IDs in contains that information. Each format encodes\nand *account ID* and is most likely what you want to use to uniquely identify\nusers, presumably within the same universe.\n\nI've included a fair amount of documentation on `Steam::ID::Format`, as well as\n`Steam::ID::Mask`, a low level set of structs for decoding/encoding Steam IDs,\nthat may help improve your understanding of the format.\n\n## Examples of manipulating IDs\n\nSometimes you may encounter \"wrongly\" encoded IDs that are somehow not encoded\nin a way that can be used with the Steam API. Here are a few \"real world\" examples of\nmanipulating IDs into a usable format.\n\n### Old Source games\n\nGames such as Garry's mod (and other GoldSrc, Orange Box games)  may always encode\n a universe of `STEAM_0`. Attempting to parse this ID, and then to call the API\n with the resulting 64 bit ID, will usually result in an error. You can see why\nin the example below.\n\nYou can use `Steam::ID#universe=` to re-encode the ID with the updated metadata:\n\n```crystal\nid = Steam::ID.new(\"STEAM_0:0:37170282\")\nid.universe # =\u003e Individual\nid.to_u64   # =\u003e 74340564_u64 (Can't be sent to the API..)\nid.universe = :public\nid.to_u64   # =\u003e 72057594112268500_u64 (OK!)\nid.to_s(Steam::ID::Format::Default) # =\u003e STEAM_1:0:37170282\n```\n\n### Discord API\n\nDiscord's OAuth2 API may return a Steam ID with the instance bit as `0`.\nWhile this is still a valid ID that will work in Steam's HTTP API, it will\nnot match Steam IDs you may have received from other sources.\n\nSimilarly, we can re-encode a corrected ID:\n\n```crystal\nid = Steam::ID.new(76561193739638996)\nid.instance # =\u003e 0\nid.instance = 1\nid.instace  #=\u003e 1\nid.to_u64   # =\u003e 76561198034606292_u64\n```\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  steam_id:\n    github: z64/steam_id\n```\n\n## Usage\n\n```crystal\nrequire \"steam_id\"\n\n# Create an ID from a UInt64\nid = Steam::ID.new(76561198092541763)\nid.account_id   # =\u003e 66138017\nid.account_type # =\u003e Steam::ID::AcountType::Individual\nid.universe     # =\u003e Steam::ID::Universe::Public\nid.to_u64       # =\u003e 76561197960287930\n\n# For enum attributes, you can use interrogation style methods:\nid.universe.public? # =\u003e true\n\n# Parse an ID from an unknown format\nSteam::ID.new(\"STEAM_1:0:11101\") # =\u003e Steam::ID\nSteam::ID.new(\"foo\")             # =\u003e raises Steam::ID::Error\n\n# Parse an ID from a known format (better performance)\nSteam::ID.new(\"STEAM_1:0:11101\", Steam::ID::Format::Default)\n  # =\u003e Steam::ID\nSteam::ID.new(\"76561197960287930\", Steam::ID::Format::Default)\n  # =\u003e raises Steam::ID::Error\n```\n\n## Contributors\n\n- [Zac Nowicki](https://github.com/z64) - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz64%2Fsteam_id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz64%2Fsteam_id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz64%2Fsteam_id/lists"}