{"id":16948865,"url":"https://github.com/jackc/ruby-extid","last_synced_at":"2025-03-21T09:47:16.507Z","repository":{"id":62124902,"uuid":"558047825","full_name":"jackc/ruby-extid","owner":"jackc","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-26T20:08:44.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T00:40:24.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/jackc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-26T19:53:35.000Z","updated_at":"2022-10-26T19:55:09.000Z","dependencies_parsed_at":"2022-10-26T22:19:40.684Z","dependency_job_id":null,"html_url":"https://github.com/jackc/ruby-extid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fruby-extid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fruby-extid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fruby-extid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackc%2Fruby-extid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackc","download_url":"https://codeload.github.com/jackc/ruby-extid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776273,"owners_count":20508503,"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","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":[],"created_at":"2024-10-13T21:52:34.325Z","updated_at":"2025-03-21T09:47:16.492Z","avatar_url":"https://github.com/jackc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExtID\n\nIt can be valuable to internally use a serial integer as an ID without revealing that ID to the outside world. extid\nuses AES-128 to convert to and from an external ID that cannot feasibly be decoded without the secret key.\n\nThis prevents outsiders from quantifying the usage of your application by observing the rate of increase of IDs as well\nas provides protection against brute force crawling of all resources.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```\n$ bundle add extid\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```\n$ gem install extid\n```\n\n## Usage\n\n```ruby\nrequire 'extid'\n\nprefix = \"user\"\nkey = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15].pack('C*')\ntype = ExtID::Type.new prefix, key\ntype.encode(1) # =\u003e \"user_13189a6ae4ab07ae70a3aabd30be99de\"\ntype.decode(\"user_13189a6ae4ab07ae70a3aabd30be99de\") # =\u003e 1\n```\n\n## Other Implementations\n\n* [Go](https://github.com/jackc/go-extid)\n* [PostgreSQL](https://github.com/jackc/pg-extid)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackc%2Fruby-extid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackc%2Fruby-extid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackc%2Fruby-extid/lists"}