{"id":25598203,"url":"https://github.com/code0-tech/code0-license","last_synced_at":"2026-06-23T22:01:23.612Z","repository":{"id":237547069,"uuid":"794249634","full_name":"code0-tech/code0-license","owner":"code0-tech","description":"Library for creating and validating our software licenses.","archived":false,"fork":false,"pushed_at":"2024-05-28T20:14:42.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-29T11:16:40.910Z","etag":null,"topics":["license","license-management","licenses","ruby"],"latest_commit_sha":null,"homepage":"","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/code0-tech.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-30T18:40:32.000Z","updated_at":"2024-05-28T20:14:45.000Z","dependencies_parsed_at":"2024-05-09T22:29:54.080Z","dependency_job_id":"01c92dbc-84a5-44e8-81e1-1a3d289777c3","html_url":"https://github.com/code0-tech/code0-license","commit_stats":null,"previous_names":["code0-tech/code0-license"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code0-tech%2Fcode0-license","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code0-tech%2Fcode0-license/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code0-tech%2Fcode0-license/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code0-tech%2Fcode0-license/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code0-tech","download_url":"https://codeload.github.com/code0-tech/code0-license/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240022833,"owners_count":19735558,"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":["license","license-management","licenses","ruby"],"created_at":"2025-02-21T13:30:51.083Z","updated_at":"2026-04-20T04:30:22.301Z","avatar_url":"https://github.com/code0-tech.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code0::License\n\n`Code0::License` can create and validate software licenses.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add code0-license\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install code0-license\n\n## Usage\n\nTo start using the gem, you need to have a public and private RSA key.\nIf you don't have a key pair, you can generate one by running `bin/create_key`\n\nTo generate a license, use the private key as encryption key:\n\n```ruby\nrequire \"code0/license\"\n\n# read private key from file\nprivate_key_file = File.read('license_key.key')\nprivate_key = OpenSSL::PKey::RSA.new(private_key_file)\n\n# set private key as encryption key\nCode0::License.encryption_key = private_key\n\n# create a license\nlicense = Code0::License.new(\n  {\n    licensee: { company: 'Code0' }, # content of licensee can be as you want, it just can't be empty\n    start_date: '2024-05-01', # when is the first date where this license is valid?\n    end_date: '2025-05-01', # until when is the license valid?\n    restrictions: {}, # content can be as you wish, can be used to semantically store some restrictions that are evaluated by your application\n    options: {}, # content can be as you wish, can be used to semantically provide some options of this license\n  }\n)\n\n# export the license\nFile.write('license.txt', Code0::License.export(license, 'CODE0'))\n```\n\nTo verify the license in your application, use the public key\n\n```ruby\nrequire \"code0/license\"\n\n# read public key from file\npublic_key_file = File.read('license_key.pub')\npublic_key = OpenSSL::PKey::RSA.new(public_key_file)\n\n# set public key as encryption key\nCode0::License.encryption_key = public_key\n\n# load the license\nlicense = Code0::License.load(File.read('license.txt'))\n\n# exit if license is not valid or outside of the valid time\nexit unless license.valid?\nexit unless license.in_active_time?\n\n# for example, exit if users exceed licensed amount\nexit if license.restricted?(:user_count) \u0026\u0026 User.count \u003e license.restrictions[:user_count]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode0-tech%2Fcode0-license","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode0-tech%2Fcode0-license","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode0-tech%2Fcode0-license/lists"}