{"id":27171389,"url":"https://github.com/tankerhq/identity-ruby","last_synced_at":"2025-08-09T03:52:21.497Z","repository":{"id":36959259,"uuid":"180400187","full_name":"TankerHQ/identity-ruby","owner":"TankerHQ","description":"Identity management in Ruby for the Tanker SDK","archived":false,"fork":false,"pushed_at":"2025-06-04T09:21:44.000Z","size":247,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-09T03:52:21.388Z","etag":null,"topics":["cryptography","encryption","privacy","ruby","sdk","security","tanker"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TankerHQ.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,"zenodo":null}},"created_at":"2019-04-09T15:44:09.000Z","updated_at":"2025-06-04T09:21:48.000Z","dependencies_parsed_at":"2024-01-10T11:51:20.957Z","dependency_job_id":"f658bcce-107f-4dfd-9713-4f46beadc735","html_url":"https://github.com/TankerHQ/identity-ruby","commit_stats":{"total_commits":76,"total_committers":10,"mean_commits":7.6,"dds":0.6578947368421053,"last_synced_commit":"e6064e637ae0f2da986028513a407f42c1c30c21"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/TankerHQ/identity-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankerHQ%2Fidentity-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankerHQ%2Fidentity-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankerHQ%2Fidentity-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankerHQ%2Fidentity-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TankerHQ","download_url":"https://codeload.github.com/TankerHQ/identity-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TankerHQ%2Fidentity-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269527575,"owners_count":24432442,"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-08-09T02:00:10.424Z","response_time":111,"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":["cryptography","encryption","privacy","ruby","sdk","security","tanker"],"created_at":"2025-04-09T08:33:57.379Z","updated_at":"2025-08-09T03:52:21.466Z","avatar_url":"https://github.com/TankerHQ.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"#readme\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/TankerHQ/spec/master/img/tanker-logotype-blue-nomargin-350.png\" alt=\"Tanker logo\" width=\"175\" /\u003e\u003c/a\u003e\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Actions Status](https://github.com/TankerHQ/identity-ruby/workflows/Tests/badge.svg)](https://github.com/TankerHQ/identity-ruby/actions)\n[![codecov](https://codecov.io/gh/TankerHQ/identity-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/TankerHQ/identity-ruby)\n\n# Identity SDK\n\nIdentity generation in Ruby for the [Tanker SDK](https://docs.tanker.io/latest/).\n\n## Requirements\n\nThis gem requires Ruby v2.7 or greater. Older Ruby versions are not supported.\n\n## Installation\n\nThis project depends on the [rbnacl](https://github.com/crypto-rb/rbnacl) gem, which requires the [libsodium](https://download.libsodium.org/doc/) cryptographic library.\n\nBefore going further, please follow [instructions to install libsodium](https://github.com/crypto-rb/rbnacl/wiki/Installing-libsodium).\n\nThen, add this line to your application's Gemfile:\n\n```ruby\ngem 'tanker-identity', 'X.Y.Z'\n```\n\nFinally, run:\n\n```shell\nbundle\n```\n\n## API\n\n```ruby\nTanker::Identity.create_identity(app_id, app_secret, user_id)\n```\nCreate a new Tanker identity. This identity is secret and must only be given to a user who has been authenticated by your application. This identity is used by the Tanker client SDK to open a Tanker session.\n\n**app_id**\u003cbr\u003e\nThe app ID, must match the one used in the constructor of the Core SDK.\n\n**app_secret**\u003cbr\u003e\nThe app secret, secret that you have saved right after the creation of your app.\n\n**user_id**\u003cbr\u003e\nThe unique ID of a user in your application.\n\u003cbr\u003e\u003cbr\u003e\n\n```ruby\nTanker::Identity.create_provisional_identity(app_id, 'email', email)\n```\nCreate a Tanker provisional identity. It allows you to share a resource with a user who does not have an account in your application yet.\n\n**app_id**\u003cbr\u003e\nThe app ID, must match the one used in the constructor of the Core SDK.\n\n**email**\u003cbr\u003e\nThe email of the potential recipient of the resource.\n\u003cbr\u003e\u003cbr\u003e\n\n```ruby\nTanker::Identity.get_public_identity(identity)\n```\nReturn the public identity from an identity. This public identity can be used by the Tanker client SDK to share encrypted resource.\n\n**identity**\u003cbr\u003e\nA secret identity.\n\u003cbr\u003e\u003cbr\u003e\n\n## Usage example\n\nThe server-side pseudo-code below demonstrates a typical flow to safely deliver identities to your users:\n\n```ruby\nrequire 'tanker-identity'\n\n# 1. store these configurations in a safe place\napp_id = '\u003capp-id\u003e'\napp_secret = '\u003capp-secret\u003e'\n\n# 2. you will typically have methods to check user authentication\ndef authenticated? # check user is authenticated on the server\ndef current_user   # current authenticated user\n\n# 3. you will need to add internal methods to store / load identities\ndef db_store_identity(user_id, identity)\ndef db_load_identity(user_id)\n\n# 4. finally, add user facing functionality\ndef tanker_secret_identity(user_id)\n  raise 'Not authenticated' unless authenticated?\n  raise 'Not authorized' unless current_user.id == user_id\n\n  identity = db_load_identity(user_id)\n\n  if identity.nil?\n    identity = Tanker::Identity.create_identity(app_id, app_secret, user_id)\n    db_store_identity(user_id, identity)\n  end\n\n  identity\nend\n\ndef tanker_public_identity(user_id)\n  raise 'Not authenticated' unless authenticated?\n\n  identity = db_load_identity(user_id)\n\n  raise 'User does not exist or has no identity yet' unless identity\n\n  Tanker::Identity.get_public_identity(identity)\nend\n```\n\nRead more about identities in the [Tanker documentation](https://docs.tanker.io/latest/).\n\nCheck the [examples](https://github.com/TankerHQ/identity-ruby/tree/master/examples/) folder for usage examples.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\nTo audit the Gemfile.lock against the [advisory database](https://rubysec.com/), run `bundle exec bundle-audit check --update`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/TankerHQ/identity-ruby.\n\n[build-badge]: https://travis-ci.org/TankerHQ/identity-ruby.svg?branch=master\n[build]: https://travis-ci.org/TankerHQ/identity-ruby\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftankerhq%2Fidentity-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftankerhq%2Fidentity-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftankerhq%2Fidentity-ruby/lists"}