Commit 9be640c
committed
Use crypto random bytes instead of a UUID for auth tokens
Both should be equally secure, but UUID formatting is needlessly long
and weird, it's an unnecessary dependency, and inefficient (it's 128
bits in theory, but 4 bites are constant so really just 122, and then
we're including dashes for formatting as well, and hex is not efficient
either).
Moving to crypto+base64url lets us boost the key size (122 to 160 bit)
and simultaneously shorten the token length. This also makes it clearer
that we're using cryptographically secure random values (really it
should been the same underlying source, but here we avoid hiding that
away & trusting the uuid dep).1 parent 5dfd6f0 commit 9be640c
3 files changed
+2
-38
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
| |||
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
145 | 143 | | |
146 | 144 | | |
147 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments