{"id":22271152,"url":"https://github.com/cryptolens/cryptolens-golang","last_synced_at":"2025-07-28T13:32:33.586Z","repository":{"id":47392102,"uuid":"176941991","full_name":"Cryptolens/cryptolens-golang","owner":"Cryptolens","description":"Client API to access the functionality of Cryptolens Software Licensing API","archived":false,"fork":false,"pushed_at":"2023-01-02T16:19:06.000Z","size":18,"stargazers_count":34,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-21T03:08:13.333Z","etag":null,"topics":["golang","licensing","licensing-as-a-service","licensing-library"],"latest_commit_sha":null,"homepage":"https://cryptolens.io/","language":"Go","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/Cryptolens.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}},"created_at":"2019-03-21T12:40:18.000Z","updated_at":"2023-08-27T22:26:54.000Z","dependencies_parsed_at":"2023-02-01T03:30:59.558Z","dependency_job_id":null,"html_url":"https://github.com/Cryptolens/cryptolens-golang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cryptolens","download_url":"https://codeload.github.com/Cryptolens/cryptolens-golang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227914220,"owners_count":17839245,"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":["golang","licensing","licensing-as-a-service","licensing-library"],"created_at":"2024-12-03T12:10:49.461Z","updated_at":"2024-12-03T12:10:50.104Z","avatar_url":"https://github.com/Cryptolens.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptolens Licensing for Golang\n\nThis library serves to simplify communication with Cryptolens Web API (https://app.cryptolens.io/docs/api).\n\n\u003e **Note**: an updated version of the library (with support for offline activation) can be found in the [go_mod branch](https://github.com/cryptolens/cryptolens-golang/tree/go_mod).\n\nIn order to get started with the library, start by\n\n```\ngo get github.com/Cryptolens/cryptolens-golang/cryptolens\n```\n\nNow we can use the library in our code. A working example of the following can be found\nin the `examples/example_activate` directory.\n\nWe start by importing the library with:\n\n```golang\nimport \"github.com/Cryptolens/cryptolens-golang/cryptolens\"\n```\n\nNow we can activate a license key as follows:\n\n```golang\ntoken := \"WyI0NjUiLCJBWTBGTlQwZm9WV0FyVnZzMEV1Mm9LOHJmRDZ1SjF0Vk52WTU0VzB2Il0=\"\npublicKey := \"\u003cRSAKeyValue\u003e\u003cModulus\u003ekhbyu3/vAEBHi339fTuo2nUaQgSTBj0jvpt5xnLTTF35FLkGI+5Z3wiKfnvQiCLf+5s4r8JB/Uic/i6/iNjPMILlFeE0N6XZ+2pkgwRkfMOcx6eoewypTPUoPpzuAINJxJRpHym3V6ZJZ1UfYvzRcQBD/lBeAYrvhpCwukQMkGushKsOS6U+d+2C9ZNeP+U+uwuv/xu8YBCBAgGb8YdNojcGzM4SbCtwvJ0fuOfmCWZvUoiumfE4x7rAhp1pa9OEbUe0a5HL+1v7+JLBgkNZ7Z2biiHaM6za7GjHCXU8rojatEQER+MpgDuQV3ZPx8RKRdiJgPnz9ApBHFYDHLDzDw==\u003c/Modulus\u003e\u003cExponent\u003eAQAB\u003c/Exponent\u003e\u003c/RSAKeyValue\u003e\"\n\nlicenseKey, err := cryptolens.KeyActivate(token, cryptolens.KeyActivateArguments{\n\tProductId:   3646,\n\tKey:         \"MPDWY-PQAOW-FKSCH-SGAAU\",\n\tMachineCode: \"289jf2afs3\",\n})\nif err != nil || !licenseKey.HasValidSignature(publicKey) {\n\tfmt.Println(\"License key activation failed!\")\n\treturn\n}\n```\n\nIn order to use the code above with your account on cryptolens.io you need to change the\nconstants as follows:\n\n 1. The `token` need to be changed to a valid access token for your account. Access tokens can be created at\n    https://app.cryptolens.io/User/AccessToken/. In order to be able to use the `KeyActivate()` function\n    the token needs to have the `Activate` scope.\n 2. The correct value for `publicKey` for your account can be found when logged in on Cryptolens.io from\n    the menu in the top-right corner (\"Hello \u003cusername\u003e!\") and then *Security Settings*. Copy paste the\n    value from the *Public key* field.\n 3. The `ProductId` can be found at the page for the corresponding product at https://app.cryptolens.io/Product.\n 4. The `Key` is the license key string, and would in most cases be entered by the user of the application\n    in some application dependent manner.\n 5. The `MachineCode` is an optional argument allowing you to provide an identifier for which\n    device the application is running on, or something with a similar purpuse. You can read more about the ways it can be computed in [this article](https://help.cryptolens.io/faq/index#machine-code-generation).\n\nFinally, additional properties of the license key can be checked if desired:\n\n```golang\nfmt.Printf(\"License key for product with id: %d\\n\", licenseKey.ProductId)\n\nif time.Now().After(licenseKey.Expires) {\n\tfmt.Println(\"License key has expired\")\n\treturn\n}\n\nif licenseKey.F1 {\n\tfmt.Println(\"Welcome! Pro version enabled!\")\n} else {\n\tfmt.Println(\"Welcome!\")\n}\n```\n\n## Examples\n\n* [Key verification example](https://github.com/Cryptolens/cryptolens-golang/blob/master/examples/example_activate/main.go)\n* [Offline verification example](https://github.com/Cryptolens/cryptolens-golang/blob/master/examples/example_offline/main.go)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptolens%2Fcryptolens-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptolens%2Fcryptolens-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptolens%2Fcryptolens-golang/lists"}