Skip to content

Why isn't an account id guaranteed to be a number? #28454

Closed Answered by Gargron
YOCKOW asked this question in Q&A
Discussion options

You must be logged in to vote

The reason it's encoded as a string is to avoid integer overflow in JavaScript. In Mastodon it's pretty much always going to be a number. However there are third-party platforms that emulate the Mastodon API to let people use familiar Mastodon apps with them (e.g. Pleroma, Akkoma, GoToSocial) that have different internal data structures. At the end of the day, you don't need to do any number things like addition or multiplication with the id, so just treating it as an opaque string works.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@YOCKOW
Comment options

Answer selected by trwnh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants