Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Felix Foertsch
Luca Web
Commits
49b70877
Commit
49b70877
authored
Apr 15, 2021
by
Philipp Berger
Browse files
fix: use correct base32 decoding
parent
7950093a
Changes
1
Hide whitespace changes
Inline
Side-by-side
services/locations/src/components/RegisterBadge/RegisterForm/SerialCode/SerialCode.helper.js
View file @
49b70877
import
argon2
from
'
argon2-browser
'
;
import
{
base32CrockfordToHex
,
base32ToHex
,
hexToBytes
,
hexToUuid4
,
...
...
@@ -29,7 +30,7 @@ const isV4 = serialNumber => {
};
const
calculateSecretsV3
=
async
serialNumber
=>
{
const
entropy
=
base32ToHex
(
serialNumber
);
const
entropy
=
base32
Crockford
ToHex
(
serialNumber
);
const
cryptoSeed
=
KDF_SHA256
(
entropy
,
'
01
'
);
const
tracingSeed
=
KDF_SHA256
(
entropy
,
'
02
'
).
slice
(
0
,
32
);
...
...
@@ -59,7 +60,7 @@ const calculateSecretsV4 = async serialNumber => {
.
toLowerCase
()
.
replace
(
/h$/
,
'
g
'
)
.
replace
(
/2$/
,
'
0
'
);
const
entropy
=
base32ToHex
(
realSerialNumber
);
const
entropy
=
base32
Crockford
ToHex
(
realSerialNumber
);
const
argon2hash
=
await
argon2
.
hash
({
pass
:
bytesToUint8Array
(
hexToBytes
(
entropy
)),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment