{"id":22271153,"url":"https://github.com/cryptolens/cryptolens-nodejs","last_synced_at":"2025-04-22T15:21:31.724Z","repository":{"id":39637920,"uuid":"178161655","full_name":"Cryptolens/cryptolens-nodejs","owner":"Cryptolens","description":"Client API to access the functionality of Cryptolens Software Licensing API","archived":false,"fork":false,"pushed_at":"2024-07-22T18:18:18.000Z","size":79,"stargazers_count":18,"open_issues_count":10,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T17:18:50.898Z","etag":null,"topics":["licensing","licensing-as-a-service","licensing-library","nodejs"],"latest_commit_sha":null,"homepage":"https://cryptolens.io/","language":"JavaScript","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-28T08:40:53.000Z","updated_at":"2024-12-24T03:20:41.000Z","dependencies_parsed_at":"2024-06-19T00:13:37.140Z","dependency_job_id":"5ab725b0-54eb-4ffd-bf74-611c1de03717","html_url":"https://github.com/Cryptolens/cryptolens-nodejs","commit_stats":{"total_commits":58,"total_committers":6,"mean_commits":9.666666666666666,"dds":0.3448275862068966,"last_synced_commit":"9a532770a5be3d477d179a8a9282afc2c73584b7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cryptolens%2Fcryptolens-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cryptolens","download_url":"https://codeload.github.com/Cryptolens/cryptolens-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250264931,"owners_count":21402005,"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":["licensing","licensing-as-a-service","licensing-library","nodejs"],"created_at":"2024-12-03T12:10:49.823Z","updated_at":"2025-04-22T15:21:31.602Z","avatar_url":"https://github.com/Cryptolens.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptolens Client API for NodeJS\n\nThis library contains helper methods to verify licenses in NodeJS.\n\n## Installation\n\n```bash \nnpm add cryptolens\n```\n\n## Example\n\n### Key Verification\nTo verify a license key, you can use the code below. The RSAPublicKey, token and the product id can be found on [this page](https://help.cryptolens.io/examples/key-verification).\n\n```js\nconst key = require('cryptolens').Key;\nconst Helpers = require('cryptolens').Helpers;\n\nvar RSAPubKey = \"Your RSA Public key, which can be found here: https://app.cryptolens.io/User/Security\";\nvar result = key.Activate(token=\"Access token with with Activate permission\", RSAPubKey, ProductId=3349, Key=\"GEBNC-WZZJD-VJIHG-GCMVD\", MachineCode=Helpers.GetMachineCode());\n\nresult.then(function(license) {\n\n    // success\n    \n    // Please see https://app.cryptolens.io/docs/api/v3/model/LicenseKey for a complete list of parameters.\n    console.log(license.Created);\n\n}).catch(function(error) {\n    // in case of an error, an Error object is returned.\n    console.log(error.message);\n});\n```\n\n### Offline activation (saving/loading licenses)\nAssuming the license key verification was successful, we can save the result in a file so that we can use it instead of contacting Cryptolens.\n\nFirst, we need to add the reference to the helper methods:\n\n```js\nconst Helpers = require('cryptolens').Helpers;\n```\n\nWe can now proceed and save it as a string.\n\n```js\nvar licenseString = Helpers.SaveAsString(license);\n```\n\nWhen loading it back, we can use the code below:\n```js\nvar license = Helpers.LoadFromString(RSAPubKey, licenseString);\n```\n\nIf you want to make sure that the license file is not too old, you can specify the maximum number of days as shown below (after 30 days, this method will return null).\n```js\nvar license = Helpers.LoadFromString(RSAPubKey, licenseString, 30);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptolens%2Fcryptolens-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptolens%2Fcryptolens-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptolens%2Fcryptolens-nodejs/lists"}