{"id":15823437,"url":"https://github.com/ianacaburian/generate-key-file","last_synced_at":"2025-03-15T01:31:47.954Z","repository":{"id":257800480,"uuid":"863030599","full_name":"ianacaburian/generate-key-file","owner":"ianacaburian","description":"Ports juce_KeyGeneration::generateKeyFile() to node.","archived":false,"fork":false,"pushed_at":"2024-10-11T07:16:19.000Z","size":16014,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-10-11T07:56:09.681Z","etag":null,"topics":["auth","cmake","cpp20","cryptography","juce","keyfile","nodejs","npm","rsa","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ianacaburian.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":"2024-09-25T15:40:55.000Z","updated_at":"2024-10-11T07:10:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"062541dd-66f7-4722-9eec-469de03a93df","html_url":"https://github.com/ianacaburian/generate-key-file","commit_stats":null,"previous_names":["ianacaburian/generate-key-file"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianacaburian%2Fgenerate-key-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianacaburian%2Fgenerate-key-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianacaburian%2Fgenerate-key-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianacaburian%2Fgenerate-key-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ianacaburian","download_url":"https://codeload.github.com/ianacaburian/generate-key-file/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243671213,"owners_count":20328583,"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":["auth","cmake","cpp20","cryptography","juce","keyfile","nodejs","npm","rsa","typescript"],"created_at":"2024-10-05T08:10:26.675Z","updated_at":"2025-03-15T01:31:47.948Z","avatar_url":"https://github.com/ianacaburian.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generate-key-file\n\nPorts juce_KeyGeneration::generateKeyFile() to node.\n\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ianacaburian/generate-key-file/build.yml)](https://github.com/ianacaburian/generate-key-file/actions)\n[![NPM Version](https://img.shields.io/npm/v/%40ianacaburian%2Fgenerate-key-file)](https://www.npmjs.com/package/@ianacaburian/generate-key-file)\n[![X (formerly Twitter) URL](https://img.shields.io/twitter/url?url=https%3A%2F%2Ftwitter.com%2Fintent%2Fpost%3Ftext%3DNeed%2520to%2520auth%2520a%2520JUCE%2520app%2520in%2520nodejs%2520%253F%2520Check%2520out%2520generate-key-file%2520by%2520%2540ianacaburian%2520%2520%26url%3Dhttps%253A%252F%252Fgithub.com%252Fianacaburian%252Fgenerate-key-file)](https://twitter.com/intent/tweet?text=Need%20to%20auth%20a%20JUCE%20app%20in%20nodejs%20%3F%20Check%20out%20generate-key-file%20by%20%40ianacaburian%20%20\u0026url=https%3A%2F%2Fgithub.com%2Fianacaburian%2Fgenerate-key-file)\n\n## Installation\n\n```\nnpm i @ianacaburian/generate-key-file\n```\n\n## Usage\n\n### `generateKeyFile`\n\n-   Signature:\n\n```\ngenerateKeyFile(params: GenerateKeyFileParams, date: Date = new Date()) =\u003e string\n```\n\n-   Example:\n\n```\nimport { generateKeyFile } from '@ianacaburian/generate-key-file'\n\nconst keyFileContent = generateKeyFile({\n    userName: 'Ian',\n    userEmail: 'ian@email.com',\n    machineNumbers: '123',\n    appName: 'app-name-or-product-id',\n    privateKey: 'comma-sep-private-key'\n})\n```\n\n-   Returns the \u003ckey\u003e string value to be used in the XML response for decryption\n    by the client.\n-   Throws ZodError for invalid params -- see\n    [zod](https://github.com/colinhacks/zod).\n-   From juce_KeyFileGeneration.h:\n\n```\n    /**\n        Generates the content of a key-file which can be sent to a user's machine to\n        unlock a product.\n\n        The returned value is a block of text containing an RSA-encoded block, followed\n        by some human-readable details. If you pass this block of text to\n        OnlineUnlockStatus::applyKeyFile(), it will decrypt it, and if the\n        key matches and the machine numbers match, it will unlock that machine.\n\n        Typically the way you'd use this on a server would be to build a small executable\n        that simply calls this method and prints the result, so that the webserver can\n        use this as a reply to the product's auto-registration mechanism. The\n        keyGenerationAppMain() function is an example of how to build such a function.\n\n        @see OnlineUnlockStatus\n    */\n```\n\n### `generateExpiringKeyFile`\n\n-   Signature:\n\n```\ngenerateExpiringKeyFile(params: GenerateExpiringKeyFileParams, date: Date = new Date()) =\u003e string\n```\n\n-   Example:\n\n```\nimport { generateExpiringKeyFile } from '@ianacaburian/generate-key-file'\n\nconst oneDayFromNow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000)\nconst expiringKeyFileContent = generateExpiringKeyFile({\n    userName: 'Ian',\n    userEmail: 'ian@email.com',\n    machineNumbers: '123',\n    appName: 'app-name-or-product-id',\n    privateKey: 'comma-sep-private-key'\n    expiryTime: oneDayFromNow\n})\n```\n\n-   Returns the \u003ckey\u003e string value to be used in the XML response for decryption\n    by the client.\n-   Throws ZodError for invalid params -- see\n    [zod](https://github.com/colinhacks/zod).\n-   From juce_KeyFileGeneration.h:\n\n```\n    /** Similar to the above key file generation method but with an expiry time.\n        You must supply a Time after which this key file should no longer be considered as active.\n\n        N.B. when an app is unlocked with an expiring key file, OnlineUnlockStatus::isUnlocked will\n        still return false. You must then check OnlineUnlockStatus::getExpiryTime to see if this\n        expiring key file is still in date and act accordingly.\n\n        @see OnlineUnlockStatus\n    */\n```\n\n## Development\n\n```\nnpm run clean                   # Clean dist and test builds (inc test bins).\nnpm run lint                    # Lint the src dir.\nnpm run build                   # Lint, install tests, and build package.\n```\n\n### Testing\n\n```\nnpm run test                    # Start vitest to run all tests.\nnpm run test -- -t \"divideBy\"   # Start vitest to run one test.\nnpm run cm:clean                # Clean test build.\nnpm run cm:open                 # Open test/console project in Xcode.\nnpm run cm:install              # Build and install the test/console bins.\n```\n\n-   Optional: Set \"FC_NUM_RUMS\" (default=1) to specify how many times to run\n    each (randomly generated) propery-based test -- see\n    [fast-check](https://github.com/dubzzz/fast-check).\n\n```\nFC_NUM_RUNS=1000 npm run test   # Run each fc test 1000 times.\n```\n\n-   Optional: Set \"FC_SEED\" (default=1) to specify the seed for each fc test.\n\n```\nFC_SEED=2 npm run test   # Run each fc test with seed=2.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianacaburian%2Fgenerate-key-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fianacaburian%2Fgenerate-key-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianacaburian%2Fgenerate-key-file/lists"}