{"id":40870928,"url":"https://github.com/mderazon/order-id","last_synced_at":"2026-01-22T00:40:05.637Z","repository":{"id":13449007,"uuid":"74465126","full_name":"mderazon/order-id","owner":"mderazon","description":"Unique order id generator","archived":false,"fork":false,"pushed_at":"2025-02-25T14:58:35.000Z","size":48,"stargazers_count":58,"open_issues_count":0,"forks_count":19,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T13:24:37.211Z","etag":null,"topics":["format-preserving-encryption","fpe","random","timestamp","unique-id","unique-identifier"],"latest_commit_sha":null,"homepage":null,"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/mderazon.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":"2016-11-22T11:18:03.000Z","updated_at":"2025-03-14T19:19:25.000Z","dependencies_parsed_at":"2024-06-18T16:29:17.539Z","dependency_job_id":null,"html_url":"https://github.com/mderazon/order-id","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":"0.18181818181818177","last_synced_commit":"1cb56f5fcbf5317cbe3e92f4dd7040330ad48f97"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mderazon/order-id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mderazon%2Forder-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mderazon%2Forder-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mderazon%2Forder-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mderazon%2Forder-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mderazon","download_url":"https://codeload.github.com/mderazon/order-id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mderazon%2Forder-id/sbom","scorecard":{"id":633001,"data":{"date":"2025-08-11","repo":{"name":"github.com/mderazon/order-id","commit":"4a60ca55ba9d0bcd44ef500dcfc7b40a9b7937e0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/mderazon/order-id/node.js.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/mderazon/order-id/node.js.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/mderazon/order-id/npm-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/mderazon/order-id/npm-publish.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/npm-publish.yml:9"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T08:24:45.968Z","repository_id":13449007,"created_at":"2025-08-21T08:24:45.968Z","updated_at":"2025-08-21T08:24:45.968Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28648460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["format-preserving-encryption","fpe","random","timestamp","unique-id","unique-identifier"],"created_at":"2026-01-22T00:40:05.422Z","updated_at":"2026-01-22T00:40:05.626Z","avatar_url":"https://github.com/mderazon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# order-id\n\n[![Build status](https://github.com/mderazon/order-id/actions/workflows/node.js.yml/badge.svg)](https://github.com/mderazon/order-id/actions) [![npm Version](https://badge.fury.io/js/order-id.svg)](https://badge.fury.io/js/order-id) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003e (almost) unique order id generator\n\n- Generates order ids in the format `xxxx-xxxxxx-xxxx`, where `x` is a digit (0-9). Similar to the format Amazon is using for their order numbers.\n- Uses the current unix timestamp (13 digits) plus 1 random digit so it's **unique down to the milisecond**.\n- If your system generates 1,000,000 orders per day (evenly distributed), the probability of collision would be ~1%. The extra padding digit makes it even lower.\n- The timestamp is scrambled using a supplied key so the result doesn't appear as a timestamp and is not sequential.\n- Bonus: Since it's based on timestamp, we can get the time back from the order id (see api calls).\n\n### Usage\n\n```js\nimport orderid from 'order-id';\nconst id = orderid('key').generate();\n// 3016-734428-7759\n\norderid('key').getTime(id);\n// 1479812667797\n```\n\n### API\n\n- `orderid(key)` - Creates an order ID generator instance with the given `key`. The `key` is an optional string used as a seed for the underlying cipher. It is needed to recover the timestamp from an order ID.\n- `generate(date)` - Generates an order ID. The `date` argument is optional and can be any value that the JavaScript [Date](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) constructor can parse. If provided, the generated order ID will be based on the provided date/time. Otherwise, the current date/time will be used.\n- `getTime(id)` - Returns the Unix timestamp (in milliseconds) that the order ID was generated from. You must use the same `key` that was used to generate the order ID.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmderazon%2Forder-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmderazon%2Forder-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmderazon%2Forder-id/lists"}