opaque_id 1.4.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +206 -0
- data/README.md +93 -79
- data/docs/_config.yml +2 -0
- data/docs/algorithms.md +4 -4
- data/docs/api-reference.md +6 -6
- data/docs/benchmarks.md +385 -0
- data/docs/configuration.md +32 -18
- data/docs/index.md +21 -3
- data/docs/performance.md +3 -3
- data/docs/usage.md +22 -18
- data/lib/generators/opaque_id/install_generator.rb +13 -0
- data/lib/generators/opaque_id/templates/migration.rb.tt +3 -3
- data/lib/opaque_id/model.rb +2 -2
- data/lib/opaque_id/version.rb +1 -1
- data/lib/opaque_id.rb +4 -1
- data/release-please-config.json +2 -1
- metadata +2 -9
- data/tasks/0001-prd-opaque-id-gem.md +0 -202
- data/tasks/0002-prd-publishing-release-automation.md +0 -206
- data/tasks/0003-prd-documentation-site.md +0 -191
- data/tasks/references/opaque_gem_requirements.md +0 -482
- data/tasks/references/original_identifiable_concern_and_nanoid.md +0 -110
- data/tasks/tasks-0001-prd-opaque-id-gem.md +0 -109
- data/tasks/tasks-0002-prd-publishing-release-automation.md +0 -177
- data/tasks/tasks-0003-prd-documentation-site.md +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f3a94f08b1d9f3e21a513fe3f7ae6422c7288c2ccef38c78394209e835d264d
|
4
|
+
data.tar.gz: 114701a6d202fa5d41ac77da871f86ffc88182d54ffb58ea8ab2324bda177fee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66f5027ec5599b164599a7c5f4d6bc6c7396787671ea7a2238bc95385482150bfb5b4e1341173264fc870af0b851d45c4faad6c9396519f96e11c00b5ff5978c
|
7
|
+
data.tar.gz: 50b3da266692f3b004d2c00f9a485d5bdfe0af51465dd4f87f5189d109cbfd3849c29a741ce4c3a4fb8565970594696e48467bf2e1fc8312b7356c7f1a87bd80
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,212 @@ All notable changes to the OpaqueId gem will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.7.0](https://github.com/nyaggah/opaque_id/compare/opaque_id-v1.6.0...opaque_id/v1.7.0) (2025-10-04)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* add external links to sidebar using JavaScript ([cd77079](https://github.com/nyaggah/opaque_id/commit/cd770795936ca76633a18f80cba8482ec09db8e2))
|
14
|
+
* add SLUG_LIKE_ALPHABET as default for URL-safe IDs ([1e52b17](https://github.com/nyaggah/opaque_id/commit/1e52b174d70ca72b74badf399401605b307e3604))
|
15
|
+
* add Table of Contents to all documentation pages ([9472175](https://github.com/nyaggah/opaque_id/commit/94721752270211d5b7db460da61d79a8a81218b2))
|
16
|
+
* complete Table of Contents implementation ([5b037e4](https://github.com/nyaggah/opaque_id/commit/5b037e42692803204bc4d8991b6d2e0c9639a05c))
|
17
|
+
* implement dynamic copyright year ([b86cea6](https://github.com/nyaggah/opaque_id/commit/b86cea66e60939377c6b0a67c1d385c9bf4bece3))
|
18
|
+
* improve documentation site theme and navigation ([304f845](https://github.com/nyaggah/opaque_id/commit/304f845a47397ea2a15f12d2c635144b39be431b))
|
19
|
+
* improve generator API and add custom column configuration ([5c1a570](https://github.com/nyaggah/opaque_id/commit/5c1a5703dee269f6985d26096942c086787296f3))
|
20
|
+
* initial release of OpaqueId gem v0.1.0 ([3a90274](https://github.com/nyaggah/opaque_id/commit/3a9027403552f8160e3aaf413d1e99ce8c63bbe4))
|
21
|
+
* update defaults to slug-like alphabet and 18-char length ([ec76440](https://github.com/nyaggah/opaque_id/commit/ec764400b0f40a93784c70c7c99ec15a9e386d36))
|
22
|
+
* update defaults to slug-like alphabet and length 18 ([87c978f](https://github.com/nyaggah/opaque_id/commit/87c978f3601270e990bc976344fd2113ba0573b3))
|
23
|
+
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* add frozen string literal comment to docs/Gemfile ([2d653a7](https://github.com/nyaggah/opaque_id/commit/2d653a7bbc071e67e94e63ebc1602768b8d04456))
|
28
|
+
* add Release Please manifest and update workflow configuration ([f33ce6c](https://github.com/nyaggah/opaque_id/commit/f33ce6c96805b6c670cd1eedf5ebed2a46e8ffa6))
|
29
|
+
* add required permissions for Release Please job ([cdf8d2b](https://github.com/nyaggah/opaque_id/commit/cdf8d2bfc5dbea9a9ec40411a988191ba91913fa))
|
30
|
+
* configure just-the-docs theme for GitHub Pages compatibility ([c2fb96c](https://github.com/nyaggah/opaque_id/commit/c2fb96c46e99fd5287520e01c3bc2dd7bd5d4817))
|
31
|
+
* correct aux_links configuration format ([61b3fb9](https://github.com/nyaggah/opaque_id/commit/61b3fb9441ce3cfc3cf30637c277d19135f89dab))
|
32
|
+
* correct release-please tag format ([b4c31e5](https://github.com/nyaggah/opaque_id/commit/b4c31e5d0f4878878dd728e82fe9f5eb09ce5b82))
|
33
|
+
* improve publish workflow trigger reliability ([9c6e240](https://github.com/nyaggah/opaque_id/commit/9c6e2402474d8ecf8a3f754a9f2ca149a63bf1d1))
|
34
|
+
* improve statistical test reliability for CI ([c9b0d52](https://github.com/nyaggah/opaque_id/commit/c9b0d52fb4e9559aad489fcf58bdff1917d613a6))
|
35
|
+
* remove unsupported Release Please configuration parameters ([e3b0d2a](https://github.com/nyaggah/opaque_id/commit/e3b0d2ac96b905316a78992004fae83423991632))
|
36
|
+
* resolve CSS linting warnings ([d01e8c0](https://github.com/nyaggah/opaque_id/commit/d01e8c05628b7f2bd8b39a13325112168cf4e689))
|
37
|
+
* resolve dependency version conflicts and improve test robustness ([af43e13](https://github.com/nyaggah/opaque_id/commit/af43e13393a452f11ce32bafb26a267d1460736c))
|
38
|
+
* resolve TOC rendering and improve workflow configuration ([244d532](https://github.com/nyaggah/opaque_id/commit/244d5321e5b18091d8599bd772a28f5a30239c80))
|
39
|
+
* update deprecated platform specifications in docs/Gemfile ([cf96134](https://github.com/nyaggah/opaque_id/commit/cf9613499150dd7152bff38aa8f8fe7ab9923eb5))
|
40
|
+
* use correct aux_links format ([d4a4bc0](https://github.com/nyaggah/opaque_id/commit/d4a4bc0c11bc66b661034915b471ed762611d821))
|
41
|
+
|
42
|
+
|
43
|
+
### Documentation
|
44
|
+
|
45
|
+
* final cleanup of over-inflated claims ([795b5b0](https://github.com/nyaggah/opaque_id/commit/795b5b0071a098f718a40e84e81ceba4525b8d3b))
|
46
|
+
* implement comprehensive documentation site with dark theme ([19cc9e3](https://github.com/nyaggah/opaque_id/commit/19cc9e30c584658559c5404a4518e871039cc223))
|
47
|
+
* implement comprehensive documentation site with dark theme ([a249c6a](https://github.com/nyaggah/opaque_id/commit/a249c6ad2253439f0d070620a914ff87597cf7cb))
|
48
|
+
* tone down over-inflated claims and remove unsubstantiated benchmarks ([6536b87](https://github.com/nyaggah/opaque_id/commit/6536b87f9a9c2049497328319641ff21368c6032))
|
49
|
+
* tone down pretentious language in algorithms intro ([58c0caf](https://github.com/nyaggah/opaque_id/commit/58c0caf116228401b6218ec589a35b350d068b49))
|
50
|
+
|
51
|
+
|
52
|
+
### Styles
|
53
|
+
|
54
|
+
* improve code formatting in generator ([ce52021](https://github.com/nyaggah/opaque_id/commit/ce52021cd60e3594dc1ee34e5b96d48568008b5a))
|
55
|
+
|
56
|
+
|
57
|
+
### Miscellaneous Chores
|
58
|
+
|
59
|
+
* configure just-the-docs theme ([3dfcac8](https://github.com/nyaggah/opaque_id/commit/3dfcac88099e65e61931e558e9242050bdbf0bc9))
|
60
|
+
* **main:** release 1.0.0 ([43282c5](https://github.com/nyaggah/opaque_id/commit/43282c5865aae3f136c9eaa49f013066a2359826))
|
61
|
+
* **main:** release 1.0.0 ([b8271ad](https://github.com/nyaggah/opaque_id/commit/b8271ad43cf6fab4687276258f0105c06a87bff7))
|
62
|
+
* **main:** release 1.0.1 ([4ee2e2c](https://github.com/nyaggah/opaque_id/commit/4ee2e2c69905e71d6c5048617af09b65cbb9e12a))
|
63
|
+
* **main:** release 1.0.1 ([e6cd2f8](https://github.com/nyaggah/opaque_id/commit/e6cd2f8f8ff545ad3010598488f71956e36a88c5))
|
64
|
+
* **main:** release 1.0.2 ([d5c7423](https://github.com/nyaggah/opaque_id/commit/d5c7423cf06ae7638d95cdd29b2631049efed727))
|
65
|
+
* **main:** release 1.0.2 ([365dff8](https://github.com/nyaggah/opaque_id/commit/365dff87a044aa967906866d6ace8d1ccad08c78))
|
66
|
+
* **main:** release opaque_id 1.1.0 ([df65c79](https://github.com/nyaggah/opaque_id/commit/df65c79d0efaee1dcd89b8af2f1b1c712c3cc2cd))
|
67
|
+
* **main:** release opaque_id 1.1.0 ([e2a4ee0](https://github.com/nyaggah/opaque_id/commit/e2a4ee0fd2d31132bc5bc0de6b6115f3ceae8afb))
|
68
|
+
* **main:** release opaque_id 1.2.0 ([1987b07](https://github.com/nyaggah/opaque_id/commit/1987b07b3db92216f3fbbe807c3ad66ca105866e))
|
69
|
+
* **main:** release opaque_id 1.2.0 ([aacd20a](https://github.com/nyaggah/opaque_id/commit/aacd20aa5eaa1fe2fa76d89cc6bdab26214b744d))
|
70
|
+
* **main:** release opaque_id 1.3.0 ([964b1b4](https://github.com/nyaggah/opaque_id/commit/964b1b421b1fac3fe43b15549e0e6b216b600357))
|
71
|
+
* **main:** release opaque_id 1.3.0 ([76453ad](https://github.com/nyaggah/opaque_id/commit/76453ad18b2d2b81548e49dafb5dde6fb52abcca))
|
72
|
+
* **main:** release opaque_id 1.4.0 ([6c3ccd1](https://github.com/nyaggah/opaque_id/commit/6c3ccd108b3eea0bbf0ac71fda4ccc0e47e97b95))
|
73
|
+
* **main:** release opaque_id 1.4.0 ([3d9d818](https://github.com/nyaggah/opaque_id/commit/3d9d818b34771ad1ca729f3f9b443784a6965568))
|
74
|
+
* **main:** release opaque_id 1.5.0 ([113af74](https://github.com/nyaggah/opaque_id/commit/113af74dda07330bf7108977147362385dc806ae))
|
75
|
+
* **main:** release opaque_id 1.5.0 ([ff14fe9](https://github.com/nyaggah/opaque_id/commit/ff14fe92d94cf4ecbe5aaeb31ad6cd044bfa89d0))
|
76
|
+
* **main:** release opaque_id 1.6.0 ([9c95d04](https://github.com/nyaggah/opaque_id/commit/9c95d0461bcca6e8eeccc4f985f7e993ba651bb3))
|
77
|
+
* **main:** release opaque_id 1.6.0 ([74f09bd](https://github.com/nyaggah/opaque_id/commit/74f09bd860fc6f097140e1cc4efb4164407be30d))
|
78
|
+
* remove tasks/ directory from source control ([e007ead](https://github.com/nyaggah/opaque_id/commit/e007ead90fa3fbb62ab17e334563e69899afb259))
|
79
|
+
* sync version to 1.0.2 ([2f870c8](https://github.com/nyaggah/opaque_id/commit/2f870c89d486f0a5cda8ef37e5544c29c8fa2919))
|
80
|
+
* update author name and GitHub URLs ([e911548](https://github.com/nyaggah/opaque_id/commit/e911548e89e1e60ac3281157059f7c7b812750bd))
|
81
|
+
* update bundle and add Linux platform support ([661842f](https://github.com/nyaggah/opaque_id/commit/661842f0ba66ce36962bb11f75a1b0e35eb5a3e7))
|
82
|
+
* update Gemfile.lock after dependency check ([058281f](https://github.com/nyaggah/opaque_id/commit/058281f6e07f3c9a1057c6fbeb0200bccf221558))
|
83
|
+
|
84
|
+
|
85
|
+
### Code Refactoring
|
86
|
+
|
87
|
+
* improve generator code quality and resolve RuboCop issues ([b658bbc](https://github.com/nyaggah/opaque_id/commit/b658bbcb29f6c0134f2bf256b24c5b3c2bccb265))
|
88
|
+
* integrate Release Please into main CI workflow ([8a0b189](https://github.com/nyaggah/opaque_id/commit/8a0b189a8bfbfcc07275c9bdda3397ff367b2054))
|
89
|
+
* simplify external links implementation ([5cb84c1](https://github.com/nyaggah/opaque_id/commit/5cb84c1e8952a0fd1aa4b9089b9ff11829dc397c))
|
90
|
+
|
91
|
+
|
92
|
+
### Tests
|
93
|
+
|
94
|
+
* add test for lowercase model names ([8ef4675](https://github.com/nyaggah/opaque_id/commit/8ef4675a0698d2cda054084360c9e80d956ddb14))
|
95
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d7296c7](https://github.com/nyaggah/opaque_id/commit/d7296c77b1b7a995e7a42b3ba546fdeb8e41c297))
|
96
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d1f8f26](https://github.com/nyaggah/opaque_id/commit/d1f8f26e7be80f6cbefc98563c0ffa45033372dc))
|
97
|
+
|
98
|
+
## [1.6.0](https://github.com/nyaggah/opaque_id/compare/opaque_id-v1.5.0...opaque_id/v1.6.0) (2025-10-03)
|
99
|
+
|
100
|
+
|
101
|
+
### Features
|
102
|
+
|
103
|
+
* add external links to sidebar using JavaScript ([cd77079](https://github.com/nyaggah/opaque_id/commit/cd770795936ca76633a18f80cba8482ec09db8e2))
|
104
|
+
* add SLUG_LIKE_ALPHABET as default for URL-safe IDs ([1e52b17](https://github.com/nyaggah/opaque_id/commit/1e52b174d70ca72b74badf399401605b307e3604))
|
105
|
+
* add Table of Contents to all documentation pages ([9472175](https://github.com/nyaggah/opaque_id/commit/94721752270211d5b7db460da61d79a8a81218b2))
|
106
|
+
* complete Table of Contents implementation ([5b037e4](https://github.com/nyaggah/opaque_id/commit/5b037e42692803204bc4d8991b6d2e0c9639a05c))
|
107
|
+
* implement dynamic copyright year ([b86cea6](https://github.com/nyaggah/opaque_id/commit/b86cea66e60939377c6b0a67c1d385c9bf4bece3))
|
108
|
+
* improve documentation site theme and navigation ([304f845](https://github.com/nyaggah/opaque_id/commit/304f845a47397ea2a15f12d2c635144b39be431b))
|
109
|
+
* improve generator API and add custom column configuration ([5c1a570](https://github.com/nyaggah/opaque_id/commit/5c1a5703dee269f6985d26096942c086787296f3))
|
110
|
+
* initial release of OpaqueId gem v0.1.0 ([3a90274](https://github.com/nyaggah/opaque_id/commit/3a9027403552f8160e3aaf413d1e99ce8c63bbe4))
|
111
|
+
|
112
|
+
|
113
|
+
### Bug Fixes
|
114
|
+
|
115
|
+
* add frozen string literal comment to docs/Gemfile ([2d653a7](https://github.com/nyaggah/opaque_id/commit/2d653a7bbc071e67e94e63ebc1602768b8d04456))
|
116
|
+
* add Release Please manifest and update workflow configuration ([f33ce6c](https://github.com/nyaggah/opaque_id/commit/f33ce6c96805b6c670cd1eedf5ebed2a46e8ffa6))
|
117
|
+
* add required permissions for Release Please job ([cdf8d2b](https://github.com/nyaggah/opaque_id/commit/cdf8d2bfc5dbea9a9ec40411a988191ba91913fa))
|
118
|
+
* configure just-the-docs theme for GitHub Pages compatibility ([c2fb96c](https://github.com/nyaggah/opaque_id/commit/c2fb96c46e99fd5287520e01c3bc2dd7bd5d4817))
|
119
|
+
* correct aux_links configuration format ([61b3fb9](https://github.com/nyaggah/opaque_id/commit/61b3fb9441ce3cfc3cf30637c277d19135f89dab))
|
120
|
+
* correct release-please tag format ([b4c31e5](https://github.com/nyaggah/opaque_id/commit/b4c31e5d0f4878878dd728e82fe9f5eb09ce5b82))
|
121
|
+
* improve publish workflow trigger reliability ([9c6e240](https://github.com/nyaggah/opaque_id/commit/9c6e2402474d8ecf8a3f754a9f2ca149a63bf1d1))
|
122
|
+
* improve statistical test reliability for CI ([c9b0d52](https://github.com/nyaggah/opaque_id/commit/c9b0d52fb4e9559aad489fcf58bdff1917d613a6))
|
123
|
+
* remove unsupported Release Please configuration parameters ([e3b0d2a](https://github.com/nyaggah/opaque_id/commit/e3b0d2ac96b905316a78992004fae83423991632))
|
124
|
+
* resolve CSS linting warnings ([d01e8c0](https://github.com/nyaggah/opaque_id/commit/d01e8c05628b7f2bd8b39a13325112168cf4e689))
|
125
|
+
* resolve dependency version conflicts and improve test robustness ([af43e13](https://github.com/nyaggah/opaque_id/commit/af43e13393a452f11ce32bafb26a267d1460736c))
|
126
|
+
* resolve TOC rendering and improve workflow configuration ([244d532](https://github.com/nyaggah/opaque_id/commit/244d5321e5b18091d8599bd772a28f5a30239c80))
|
127
|
+
* update deprecated platform specifications in docs/Gemfile ([cf96134](https://github.com/nyaggah/opaque_id/commit/cf9613499150dd7152bff38aa8f8fe7ab9923eb5))
|
128
|
+
* use correct aux_links format ([d4a4bc0](https://github.com/nyaggah/opaque_id/commit/d4a4bc0c11bc66b661034915b471ed762611d821))
|
129
|
+
|
130
|
+
|
131
|
+
### Documentation
|
132
|
+
|
133
|
+
* final cleanup of over-inflated claims ([795b5b0](https://github.com/nyaggah/opaque_id/commit/795b5b0071a098f718a40e84e81ceba4525b8d3b))
|
134
|
+
* implement comprehensive documentation site with dark theme ([19cc9e3](https://github.com/nyaggah/opaque_id/commit/19cc9e30c584658559c5404a4518e871039cc223))
|
135
|
+
* implement comprehensive documentation site with dark theme ([a249c6a](https://github.com/nyaggah/opaque_id/commit/a249c6ad2253439f0d070620a914ff87597cf7cb))
|
136
|
+
* tone down over-inflated claims and remove unsubstantiated benchmarks ([6536b87](https://github.com/nyaggah/opaque_id/commit/6536b87f9a9c2049497328319641ff21368c6032))
|
137
|
+
* tone down pretentious language in algorithms intro ([58c0caf](https://github.com/nyaggah/opaque_id/commit/58c0caf116228401b6218ec589a35b350d068b49))
|
138
|
+
|
139
|
+
|
140
|
+
### Styles
|
141
|
+
|
142
|
+
* improve code formatting in generator ([ce52021](https://github.com/nyaggah/opaque_id/commit/ce52021cd60e3594dc1ee34e5b96d48568008b5a))
|
143
|
+
|
144
|
+
|
145
|
+
### Miscellaneous Chores
|
146
|
+
|
147
|
+
* configure just-the-docs theme ([3dfcac8](https://github.com/nyaggah/opaque_id/commit/3dfcac88099e65e61931e558e9242050bdbf0bc9))
|
148
|
+
* **main:** release 1.0.0 ([43282c5](https://github.com/nyaggah/opaque_id/commit/43282c5865aae3f136c9eaa49f013066a2359826))
|
149
|
+
* **main:** release 1.0.0 ([b8271ad](https://github.com/nyaggah/opaque_id/commit/b8271ad43cf6fab4687276258f0105c06a87bff7))
|
150
|
+
* **main:** release 1.0.1 ([4ee2e2c](https://github.com/nyaggah/opaque_id/commit/4ee2e2c69905e71d6c5048617af09b65cbb9e12a))
|
151
|
+
* **main:** release 1.0.1 ([e6cd2f8](https://github.com/nyaggah/opaque_id/commit/e6cd2f8f8ff545ad3010598488f71956e36a88c5))
|
152
|
+
* **main:** release 1.0.2 ([d5c7423](https://github.com/nyaggah/opaque_id/commit/d5c7423cf06ae7638d95cdd29b2631049efed727))
|
153
|
+
* **main:** release 1.0.2 ([365dff8](https://github.com/nyaggah/opaque_id/commit/365dff87a044aa967906866d6ace8d1ccad08c78))
|
154
|
+
* **main:** release opaque_id 1.1.0 ([df65c79](https://github.com/nyaggah/opaque_id/commit/df65c79d0efaee1dcd89b8af2f1b1c712c3cc2cd))
|
155
|
+
* **main:** release opaque_id 1.1.0 ([e2a4ee0](https://github.com/nyaggah/opaque_id/commit/e2a4ee0fd2d31132bc5bc0de6b6115f3ceae8afb))
|
156
|
+
* **main:** release opaque_id 1.2.0 ([1987b07](https://github.com/nyaggah/opaque_id/commit/1987b07b3db92216f3fbbe807c3ad66ca105866e))
|
157
|
+
* **main:** release opaque_id 1.2.0 ([aacd20a](https://github.com/nyaggah/opaque_id/commit/aacd20aa5eaa1fe2fa76d89cc6bdab26214b744d))
|
158
|
+
* **main:** release opaque_id 1.3.0 ([964b1b4](https://github.com/nyaggah/opaque_id/commit/964b1b421b1fac3fe43b15549e0e6b216b600357))
|
159
|
+
* **main:** release opaque_id 1.3.0 ([76453ad](https://github.com/nyaggah/opaque_id/commit/76453ad18b2d2b81548e49dafb5dde6fb52abcca))
|
160
|
+
* **main:** release opaque_id 1.4.0 ([6c3ccd1](https://github.com/nyaggah/opaque_id/commit/6c3ccd108b3eea0bbf0ac71fda4ccc0e47e97b95))
|
161
|
+
* **main:** release opaque_id 1.4.0 ([3d9d818](https://github.com/nyaggah/opaque_id/commit/3d9d818b34771ad1ca729f3f9b443784a6965568))
|
162
|
+
* **main:** release opaque_id 1.5.0 ([113af74](https://github.com/nyaggah/opaque_id/commit/113af74dda07330bf7108977147362385dc806ae))
|
163
|
+
* **main:** release opaque_id 1.5.0 ([ff14fe9](https://github.com/nyaggah/opaque_id/commit/ff14fe92d94cf4ecbe5aaeb31ad6cd044bfa89d0))
|
164
|
+
* remove tasks/ directory from source control ([e007ead](https://github.com/nyaggah/opaque_id/commit/e007ead90fa3fbb62ab17e334563e69899afb259))
|
165
|
+
* sync version to 1.0.2 ([2f870c8](https://github.com/nyaggah/opaque_id/commit/2f870c89d486f0a5cda8ef37e5544c29c8fa2919))
|
166
|
+
* update author name and GitHub URLs ([e911548](https://github.com/nyaggah/opaque_id/commit/e911548e89e1e60ac3281157059f7c7b812750bd))
|
167
|
+
* update bundle and add Linux platform support ([661842f](https://github.com/nyaggah/opaque_id/commit/661842f0ba66ce36962bb11f75a1b0e35eb5a3e7))
|
168
|
+
* update Gemfile.lock after dependency check ([058281f](https://github.com/nyaggah/opaque_id/commit/058281f6e07f3c9a1057c6fbeb0200bccf221558))
|
169
|
+
|
170
|
+
|
171
|
+
### Code Refactoring
|
172
|
+
|
173
|
+
* improve generator code quality and resolve RuboCop issues ([b658bbc](https://github.com/nyaggah/opaque_id/commit/b658bbcb29f6c0134f2bf256b24c5b3c2bccb265))
|
174
|
+
* integrate Release Please into main CI workflow ([8a0b189](https://github.com/nyaggah/opaque_id/commit/8a0b189a8bfbfcc07275c9bdda3397ff367b2054))
|
175
|
+
* simplify external links implementation ([5cb84c1](https://github.com/nyaggah/opaque_id/commit/5cb84c1e8952a0fd1aa4b9089b9ff11829dc397c))
|
176
|
+
|
177
|
+
|
178
|
+
### Tests
|
179
|
+
|
180
|
+
* add test for lowercase model names ([8ef4675](https://github.com/nyaggah/opaque_id/commit/8ef4675a0698d2cda054084360c9e80d956ddb14))
|
181
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d7296c7](https://github.com/nyaggah/opaque_id/commit/d7296c77b1b7a995e7a42b3ba546fdeb8e41c297))
|
182
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d1f8f26](https://github.com/nyaggah/opaque_id/commit/d1f8f26e7be80f6cbefc98563c0ffa45033372dc))
|
183
|
+
|
184
|
+
## [1.5.0](https://github.com/nyaggah/opaque_id/compare/opaque_id/v1.4.0...opaque_id/v1.5.0) (2025-10-03)
|
185
|
+
|
186
|
+
|
187
|
+
### Features
|
188
|
+
|
189
|
+
* add SLUG_LIKE_ALPHABET as default for URL-safe IDs ([1e52b17](https://github.com/nyaggah/opaque_id/commit/1e52b174d70ca72b74badf399401605b307e3604))
|
190
|
+
|
191
|
+
|
192
|
+
### Bug Fixes
|
193
|
+
|
194
|
+
* resolve TOC rendering and improve workflow configuration ([244d532](https://github.com/nyaggah/opaque_id/commit/244d5321e5b18091d8599bd772a28f5a30239c80))
|
195
|
+
|
196
|
+
|
197
|
+
### Documentation
|
198
|
+
|
199
|
+
* final cleanup of over-inflated claims ([795b5b0](https://github.com/nyaggah/opaque_id/commit/795b5b0071a098f718a40e84e81ceba4525b8d3b))
|
200
|
+
* tone down over-inflated claims and remove unsubstantiated benchmarks ([6536b87](https://github.com/nyaggah/opaque_id/commit/6536b87f9a9c2049497328319641ff21368c6032))
|
201
|
+
* tone down pretentious language in algorithms intro ([58c0caf](https://github.com/nyaggah/opaque_id/commit/58c0caf116228401b6218ec589a35b350d068b49))
|
202
|
+
|
203
|
+
|
204
|
+
### Miscellaneous Chores
|
205
|
+
|
206
|
+
* remove tasks/ directory from source control ([e007ead](https://github.com/nyaggah/opaque_id/commit/e007ead90fa3fbb62ab17e334563e69899afb259))
|
207
|
+
|
208
|
+
|
209
|
+
### Tests
|
210
|
+
|
211
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d7296c7](https://github.com/nyaggah/opaque_id/commit/d7296c77b1b7a995e7a42b3ba546fdeb8e41c297))
|
212
|
+
* update tests for SLUG_LIKE_ALPHABET defaults ([d1f8f26](https://github.com/nyaggah/opaque_id/commit/d1f8f26e7be80f6cbefc98563c0ffa45033372dc))
|
213
|
+
|
8
214
|
## [1.4.0](https://github.com/nyaggah/opaque_id/compare/opaque_id/v1.3.0...opaque_id/v1.4.0) (2025-10-02)
|
9
215
|
|
10
216
|
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](https://github.com/rubocop/rubocop)
|
5
5
|
[](https://rubygems.org/gems/opaque_id)
|
6
6
|
|
7
|
-
A Ruby gem for generating
|
7
|
+
A simple Ruby gem for generating secure, opaque IDs for ActiveRecord models. OpaqueId provides a drop-in replacement for `nanoid.rb` using Ruby's built-in `SecureRandom` methods, with slug-like IDs as the default for optimal URL safety and user experience.
|
8
8
|
|
9
9
|
## Table of Contents
|
10
10
|
|
@@ -27,7 +27,7 @@ A Ruby gem for generating cryptographically secure, collision-free opaque IDs fo
|
|
27
27
|
- [Configuration Options](#configuration-options)
|
28
28
|
- [Configuration Details](#configuration-details)
|
29
29
|
- [Built-in Alphabets](#built-in-alphabets)
|
30
|
-
- [`
|
30
|
+
- [`SLUG_LIKE_ALPHABET` (Default)](#slug_like_alphabet-default)
|
31
31
|
- [`STANDARD_ALPHABET`](#standard_alphabet)
|
32
32
|
- [Alphabet Comparison](#alphabet-comparison)
|
33
33
|
- [Custom Alphabets](#custom-alphabets)
|
@@ -36,6 +36,7 @@ A Ruby gem for generating cryptographically secure, collision-free opaque IDs fo
|
|
36
36
|
- [Fast Path Algorithm (64-character alphabets)](#fast-path-algorithm-64-character-alphabets)
|
37
37
|
- [Unbiased Path Algorithm (other alphabets)](#unbiased-path-algorithm-other-alphabets)
|
38
38
|
- [Algorithm Selection](#algorithm-selection)
|
39
|
+
- [Performance & Benchmarks](#performance--benchmarks)
|
39
40
|
- [Performance Benchmarks](#performance-benchmarks)
|
40
41
|
- [Generation Speed (IDs per second)](#generation-speed-ids-per-second)
|
41
42
|
- [Memory Usage](#memory-usage)
|
@@ -87,12 +88,12 @@ A Ruby gem for generating cryptographically secure, collision-free opaque IDs fo
|
|
87
88
|
## Features
|
88
89
|
|
89
90
|
- **🔐 Cryptographically Secure**: Uses Ruby's `SecureRandom` for secure ID generation
|
90
|
-
- **⚡
|
91
|
-
- **🎯 Collision
|
91
|
+
- **⚡ Performance Optimized**: Efficient algorithms with fast paths for 64-character alphabets
|
92
|
+
- **🎯 Collision Resistant**: Built-in collision detection with configurable retry attempts
|
92
93
|
- **🔧 Highly Configurable**: Customizable alphabet, length, column name, and validation rules
|
93
|
-
- **🚀 Rails Integration**:
|
94
|
+
- **🚀 Rails Integration**: ActiveRecord integration with automatic ID generation
|
94
95
|
- **📦 Rails Generator**: One-command setup with `rails generate opaque_id:install`
|
95
|
-
- **🧪
|
96
|
+
- **🧪 Tested**: Includes test suite with statistical uniformity tests
|
96
97
|
- **📚 Rails 8.0+ Compatible**: Built for modern Rails applications
|
97
98
|
|
98
99
|
## Installation
|
@@ -176,15 +177,34 @@ end
|
|
176
177
|
|
177
178
|
# IDs are automatically generated on creation
|
178
179
|
user = User.create!(name: "John Doe")
|
179
|
-
puts user.opaque_id # => "
|
180
|
+
puts user.opaque_id # => "izkpm55j334u8x9y2a"
|
180
181
|
|
181
182
|
# Find by opaque ID
|
182
|
-
user = User.find_by_opaque_id("
|
183
|
-
user = User.find_by_opaque_id!("
|
183
|
+
user = User.find_by_opaque_id("izkpm55j334u8x9y2a")
|
184
|
+
user = User.find_by_opaque_id!("izkpm55j334u8x9y2a") # raises if not found
|
184
185
|
```
|
185
186
|
|
186
187
|
## Usage
|
187
188
|
|
189
|
+
### URL-Safe, Double-Click Selectable IDs
|
190
|
+
|
191
|
+
OpaqueId defaults to generating **slug-like IDs** that are perfect for URLs and user-facing identifiers:
|
192
|
+
|
193
|
+
- **URL-safe**: No special characters that need encoding
|
194
|
+
- **Double-click selectable**: Users can easily select the entire ID
|
195
|
+
- **Shorter than UUIDs**: 18 characters vs 36 for UUIDs
|
196
|
+
- **Collision resistant**: Built on Ruby's `SecureRandom` for security
|
197
|
+
|
198
|
+
```ruby
|
199
|
+
# Default generation creates slug-like IDs
|
200
|
+
id = OpaqueId.generate
|
201
|
+
# => "izkpm55j334u8x9y2a" # Perfect for URLs and user selection
|
202
|
+
|
203
|
+
# Compare to UUIDs
|
204
|
+
uuid = SecureRandom.uuid
|
205
|
+
# => "7cb776c5-8c12-4b1a-84aa-9941b815d873" # Harder to select, longer
|
206
|
+
```
|
207
|
+
|
188
208
|
### Standalone ID Generation
|
189
209
|
|
190
210
|
OpaqueId can be used independently of ActiveRecord for generating secure IDs in any Ruby application:
|
@@ -192,13 +212,13 @@ OpaqueId can be used independently of ActiveRecord for generating secure IDs in
|
|
192
212
|
#### Basic Usage
|
193
213
|
|
194
214
|
```ruby
|
195
|
-
# Generate with default settings (
|
215
|
+
# Generate with default settings (18 characters, slug-like)
|
196
216
|
id = OpaqueId.generate
|
197
|
-
# => "
|
217
|
+
# => "izkpm55j334u8x9y2a"
|
198
218
|
|
199
219
|
# Custom length
|
200
220
|
id = OpaqueId.generate(size: 10)
|
201
|
-
# => "
|
221
|
+
# => "izkpm55j334u"
|
202
222
|
|
203
223
|
# Custom alphabet
|
204
224
|
id = OpaqueId.generate(alphabet: OpaqueId::STANDARD_ALPHABET)
|
@@ -210,7 +230,7 @@ id = OpaqueId.generate(size: 8, alphabet: "ABCDEFGH")
|
|
210
230
|
|
211
231
|
# Generate multiple IDs
|
212
232
|
ids = 5.times.map { OpaqueId.generate(size: 8) }
|
213
|
-
# => ["
|
233
|
+
# => ["izkpm55j", "334u8x9y", "2abc1234", "def5678g", "hij9klmn"]
|
214
234
|
```
|
215
235
|
|
216
236
|
#### Standalone Use Cases
|
@@ -229,7 +249,7 @@ class BackgroundJob
|
|
229
249
|
end
|
230
250
|
|
231
251
|
job_id = BackgroundJob.enqueue(ProcessDataJob, user_id: 123)
|
232
|
-
# => "
|
252
|
+
# => "izkpm55j334u8x9y2a"
|
233
253
|
```
|
234
254
|
|
235
255
|
##### Temporary File Names
|
@@ -243,7 +263,7 @@ def create_temp_file(content)
|
|
243
263
|
end
|
244
264
|
|
245
265
|
filename = create_temp_file("Hello World")
|
246
|
-
# => "
|
266
|
+
# => "temp_izkpm55j334u8x9y2.txt"
|
247
267
|
```
|
248
268
|
|
249
269
|
##### Cache Keys
|
@@ -264,7 +284,7 @@ user_key = CacheManager.user_cache_key(123)
|
|
264
284
|
# => "user:V1StGX:123"
|
265
285
|
|
266
286
|
session_key = CacheManager.session_cache_key
|
267
|
-
# => "session:
|
287
|
+
# => "session:izkpm55j334u8x9y2"
|
268
288
|
```
|
269
289
|
|
270
290
|
##### Webhook Signatures
|
@@ -281,7 +301,7 @@ class WebhookService
|
|
281
301
|
end
|
282
302
|
|
283
303
|
signature = WebhookService.generate_signature({ user_id: 123 })
|
284
|
-
# => "1703123456:
|
304
|
+
# => "1703123456:izkpm55j334u8x9y2:1234567890"
|
285
305
|
```
|
286
306
|
|
287
307
|
##### Database Migration IDs
|
@@ -309,7 +329,7 @@ class EmailService
|
|
309
329
|
end
|
310
330
|
|
311
331
|
tracking_id = EmailService.tracking_pixel_id
|
312
|
-
# => "
|
332
|
+
# => "izkpm55j334u8x9y2abc"
|
313
333
|
|
314
334
|
# Use in email template
|
315
335
|
# <img src="https://example.com/track/#{tracking_id}" width="1" height="1" />
|
@@ -328,7 +348,7 @@ class ApiLogger
|
|
328
348
|
end
|
329
349
|
|
330
350
|
request_id = ApiLogger.log_request("/api/users", { page: 1 })
|
331
|
-
# => "
|
351
|
+
# => "izkpm55j334u8x9y2a"
|
332
352
|
```
|
333
353
|
|
334
354
|
##### Batch Processing IDs
|
@@ -350,9 +370,9 @@ class BatchProcessor
|
|
350
370
|
end
|
351
371
|
|
352
372
|
batch_id = BatchProcessor.process_batch([1, 2, 3, 4, 5])
|
353
|
-
# => "
|
354
|
-
# => Processing item
|
355
|
-
# => Processing item
|
373
|
+
# => "izkpm55j334u8x9y2a"
|
374
|
+
# => Processing item izkpm55j334u8x9y2_000: 1
|
375
|
+
# => Processing item izkpm55j334u8x9y2_001: 2
|
356
376
|
# => ...
|
357
377
|
```
|
358
378
|
|
@@ -417,7 +437,7 @@ end
|
|
417
437
|
|
418
438
|
# Create a new post - opaque_id is automatically generated
|
419
439
|
post = Post.create!(title: "Hello World", content: "This is my first post")
|
420
|
-
puts post.opaque_id # => "
|
440
|
+
puts post.opaque_id # => "izkpm55j334u8x9y2a"
|
421
441
|
|
422
442
|
# Create multiple posts
|
423
443
|
posts = Post.create!([
|
@@ -427,9 +447,9 @@ posts = Post.create!([
|
|
427
447
|
])
|
428
448
|
|
429
449
|
posts.each { |p| puts "#{p.title}: #{p.opaque_id}" }
|
430
|
-
# => Post 1:
|
431
|
-
# => Post 2:
|
432
|
-
# => Post 3:
|
450
|
+
# => Post 1: izkpm55j334u8x9y2
|
451
|
+
# => Post 2: 334u8x9y2abc1234
|
452
|
+
# => Post 3: abc1234def5678gh
|
433
453
|
```
|
434
454
|
|
435
455
|
#### Custom Configuration
|
@@ -482,7 +502,7 @@ class ApiKey < ApplicationRecord
|
|
482
502
|
self.opaque_id_max_retry = 10
|
483
503
|
end
|
484
504
|
|
485
|
-
# Generated API keys will look like: "
|
505
|
+
# Generated API keys will look like: "izkpm55j334u8x9y2abc1234def5678gh"
|
486
506
|
```
|
487
507
|
|
488
508
|
##### Short URL Configuration
|
@@ -529,7 +549,7 @@ class Upload < ApplicationRecord
|
|
529
549
|
self.opaque_id_purge_chars = ['/', '\\', ':', '*', '?', '"', '<', '>', '|']
|
530
550
|
end
|
531
551
|
|
532
|
-
# Generated filenames will look like: "
|
552
|
+
# Generated filenames will look like: "izkpm55j334u8x9y2a"
|
533
553
|
```
|
534
554
|
|
535
555
|
##### Session Token Configuration
|
@@ -554,7 +574,7 @@ class Session < ApplicationRecord
|
|
554
574
|
self.opaque_id_max_retry = 8
|
555
575
|
end
|
556
576
|
|
557
|
-
# Generated session tokens will look like: "
|
577
|
+
# Generated session tokens will look like: "izkpm55j334u8x9y2abc123"
|
558
578
|
```
|
559
579
|
|
560
580
|
##### Custom Alphabet Examples
|
@@ -592,7 +612,7 @@ end
|
|
592
612
|
|
593
613
|
```ruby
|
594
614
|
# Find by opaque ID (returns nil if not found)
|
595
|
-
user = User.find_by_opaque_id("
|
615
|
+
user = User.find_by_opaque_id("izkpm55j334u8x9y2a")
|
596
616
|
if user
|
597
617
|
puts "Found user: #{user.name}"
|
598
618
|
else
|
@@ -600,14 +620,14 @@ else
|
|
600
620
|
end
|
601
621
|
|
602
622
|
# Find by opaque ID (raises ActiveRecord::RecordNotFound if not found)
|
603
|
-
user = User.find_by_opaque_id!("
|
623
|
+
user = User.find_by_opaque_id!("izkpm55j334u8x9y2a")
|
604
624
|
puts "Found user: #{user.name}"
|
605
625
|
|
606
626
|
# Use in controllers for public-facing URLs
|
607
627
|
class PostsController < ApplicationController
|
608
628
|
def show
|
609
629
|
@post = Post.find_by_opaque_id!(params[:id])
|
610
|
-
# This allows URLs like /posts/
|
630
|
+
# This allows URLs like /posts/izkpm55j334u8x9y2
|
611
631
|
end
|
612
632
|
end
|
613
633
|
|
@@ -648,14 +668,14 @@ rails generate opaque_id:install users --column-name=public_id
|
|
648
668
|
|
649
669
|
OpaqueId provides comprehensive configuration options to customize ID generation behavior:
|
650
670
|
|
651
|
-
| Option | Type | Default
|
652
|
-
| -------------------------------- | --------------- |
|
653
|
-
| `opaque_id_column` | `Symbol` | `:opaque_id`
|
654
|
-
| `opaque_id_length` | `Integer` | `
|
655
|
-
| `opaque_id_alphabet` | `String` | `
|
656
|
-
| `opaque_id_require_letter_start` | `Boolean` | `false`
|
657
|
-
| `opaque_id_purge_chars` | `Array<String>` | `[]`
|
658
|
-
| `opaque_id_max_retry` | `Integer` | `3`
|
671
|
+
| Option | Type | Default | Description | Example Usage |
|
672
|
+
| -------------------------------- | --------------- | -------------------- | ----------------------------------------------- | ------------------------------------------------------- |
|
673
|
+
| `opaque_id_column` | `Symbol` | `:opaque_id` | Column name for storing the opaque ID | `self.opaque_id_column = :public_id` |
|
674
|
+
| `opaque_id_length` | `Integer` | `18` | Length of generated IDs | `self.opaque_id_length = 32` |
|
675
|
+
| `opaque_id_alphabet` | `String` | `SLUG_LIKE_ALPHABET` | Character set for ID generation | `self.opaque_id_alphabet = OpaqueId::STANDARD_ALPHABET` |
|
676
|
+
| `opaque_id_require_letter_start` | `Boolean` | `false` | Require ID to start with a letter | `self.opaque_id_require_letter_start = true` |
|
677
|
+
| `opaque_id_purge_chars` | `Array<String>` | `[]` | Characters to remove from generated IDs | `self.opaque_id_purge_chars = ['0', 'O', 'I', 'l']` |
|
678
|
+
| `opaque_id_max_retry` | `Integer` | `3` | Maximum retry attempts for collision resolution | `self.opaque_id_max_retry = 10` |
|
659
679
|
|
660
680
|
### Configuration Details
|
661
681
|
|
@@ -672,8 +692,8 @@ OpaqueId provides comprehensive configuration options to customize ID generation
|
|
672
692
|
- **Performance**: Longer IDs are more secure but use more storage
|
673
693
|
- **Examples**:
|
674
694
|
- `6` → Short URLs: `"V1StGX"`
|
675
|
-
- `
|
676
|
-
- `32` → API Keys: `"
|
695
|
+
- `18` → Default: `"izkpm55j334u8x9y2a"`
|
696
|
+
- `32` → API Keys: `"izkpm55j334u8x9y2abc1234def5678gh"`
|
677
697
|
|
678
698
|
#### `opaque_id_alphabet`
|
679
699
|
|
@@ -691,7 +711,7 @@ OpaqueId provides comprehensive configuration options to customize ID generation
|
|
691
711
|
- **Purpose**: Ensures IDs start with a letter for better readability
|
692
712
|
- **Use Cases**: When IDs are user-facing or need to be easily readable
|
693
713
|
- **Performance**: Slight overhead due to rejection sampling
|
694
|
-
- **Example**: `true` → `"
|
714
|
+
- **Example**: `true` → `"izkpm55j334u8x9y2a"`, `false` → `"zkpm55j334u8x9y2a"`
|
695
715
|
|
696
716
|
#### `opaque_id_purge_chars`
|
697
717
|
|
@@ -744,7 +764,7 @@ OpaqueId::ALPHANUMERIC_ALPHABET
|
|
744
764
|
|
745
765
|
```ruby
|
746
766
|
OpaqueId.generate(size: 8, alphabet: OpaqueId::ALPHANUMERIC_ALPHABET)
|
747
|
-
# => "
|
767
|
+
# => "izkpm55j"
|
748
768
|
```
|
749
769
|
|
750
770
|
### `STANDARD_ALPHABET`
|
@@ -932,41 +952,14 @@ def generate(size:, alphabet:)
|
|
932
952
|
end
|
933
953
|
```
|
934
954
|
|
935
|
-
## Performance
|
936
|
-
|
937
|
-
### Generation Speed (IDs per second)
|
938
|
-
|
939
|
-
| Alphabet Size | Algorithm | Performance | Relative Speed |
|
940
|
-
| ------------- | --------- | ------------------ | --------------- |
|
941
|
-
| 64 characters | Fast Path | ~2,500,000 IDs/sec | 100% (baseline) |
|
942
|
-
| 62 characters | Unbiased | ~1,200,000 IDs/sec | 48% |
|
943
|
-
| 36 characters | Unbiased | ~1,100,000 IDs/sec | 44% |
|
944
|
-
| 26 characters | Unbiased | ~1,000,000 IDs/sec | 40% |
|
945
|
-
| 10 characters | Unbiased | ~900,000 IDs/sec | 36% |
|
946
|
-
|
947
|
-
_Benchmarks run on Ruby 3.2.0, generating 21-character IDs_
|
955
|
+
## Performance Characteristics
|
948
956
|
|
949
|
-
|
957
|
+
OpaqueId is designed for efficient ID generation with different performance characteristics based on alphabet size:
|
950
958
|
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
_Memory usage is consistent regardless of algorithm choice_
|
957
|
-
|
958
|
-
### Collision Probability
|
959
|
-
|
960
|
-
For 21-character IDs with different alphabets:
|
961
|
-
|
962
|
-
| Alphabet | Characters | Collision Probability (1 in) |
|
963
|
-
| --------------------- | ---------- | ---------------------------- |
|
964
|
-
| STANDARD_ALPHABET | 64 | 2.9 × 10^37 |
|
965
|
-
| ALPHANUMERIC_ALPHABET | 62 | 1.4 × 10^37 |
|
966
|
-
| Numeric (0-9) | 10 | 1.0 × 10^21 |
|
967
|
-
| Binary (0-1) | 2 | 2.1 × 10^6 |
|
968
|
-
|
969
|
-
_Collision probability calculated using birthday paradox formula_
|
959
|
+
- **64-character alphabets**: Use optimized bitwise operations for faster generation
|
960
|
+
- **Other alphabets**: Use rejection sampling for unbiased distribution with slight overhead
|
961
|
+
- **Memory usage**: Scales linearly with ID length
|
962
|
+
- **Collision resistance**: Extremely low probability for typical use cases
|
970
963
|
|
971
964
|
### Performance Characteristics
|
972
965
|
|
@@ -975,7 +968,7 @@ _Collision probability calculated using birthday paradox formula_
|
|
975
968
|
- **Time Complexity**: O(n) where n = ID length
|
976
969
|
- **Space Complexity**: O(n)
|
977
970
|
- **Rejection Rate**: 0% (no rejections)
|
978
|
-
- **Distribution**:
|
971
|
+
- **Distribution**: Uniform distribution
|
979
972
|
- **Best For**: High-performance applications, short URLs
|
980
973
|
|
981
974
|
#### Unbiased Path (other alphabets)
|
@@ -983,7 +976,7 @@ _Collision probability calculated using birthday paradox formula_
|
|
983
976
|
- **Time Complexity**: O(n × (1 + rejection_rate)) where rejection_rate ≈ 0.01
|
984
977
|
- **Space Complexity**: O(n)
|
985
978
|
- **Rejection Rate**: <1% for most alphabet sizes
|
986
|
-
- **Distribution**:
|
979
|
+
- **Distribution**: Uniform distribution using rejection sampling
|
987
980
|
- **Best For**: General-purpose applications, custom alphabets
|
988
981
|
|
989
982
|
### Real-World Performance
|
@@ -1675,6 +1668,27 @@ This software is provided "as is" without warranty of any kind, express or impli
|
|
1675
1668
|
|
1676
1669
|
Everyone interacting in the OpaqueId project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nyaggah/opaque_id/blob/main/CODE_OF_CONDUCT.md).
|
1677
1670
|
|
1671
|
+
## Performance & Benchmarks
|
1672
|
+
|
1673
|
+
You can run benchmarks to test OpaqueId's performance and uniqueness characteristics on your system.
|
1674
|
+
|
1675
|
+
**Quick Test:**
|
1676
|
+
|
1677
|
+
```bash
|
1678
|
+
# Test 10,000 ID generation
|
1679
|
+
ruby -e "require 'opaque_id'; start=Time.now; 10000.times{OpaqueId.generate}; puts \"Generated 10,000 IDs in #{(Time.now-start).round(4)}s\""
|
1680
|
+
|
1681
|
+
# Compare with SecureRandom (as mentioned in nanoid.rb issue #67)
|
1682
|
+
ruby -e "require 'opaque_id'; require 'securerandom'; puts 'OpaqueId: ' + OpaqueId.generate; puts 'SecureRandom: ' + SecureRandom.urlsafe_base64"
|
1683
|
+
```
|
1684
|
+
|
1685
|
+
**Expected Results:**
|
1686
|
+
|
1687
|
+
- **Performance**: 100,000+ IDs per second on modern hardware
|
1688
|
+
- **Uniqueness**: Zero collisions in practice (theoretical probability < 10^-16 for 1M IDs)
|
1689
|
+
|
1690
|
+
For comprehensive benchmarks including collision tests, alphabet distribution analysis, and performance comparisons, see the [Benchmarks Guide](docs/benchmarks.md).
|
1691
|
+
|
1678
1692
|
## Acknowledgements
|
1679
1693
|
|
1680
1694
|
OpaqueId is heavily inspired by [nanoid.rb](https://github.com/radeno/nanoid.rb), which is a Ruby implementation of the original [NanoID](https://github.com/ai/nanoid) project. The core algorithm and approach to secure ID generation draws from the excellent work done by the NanoID team.
|