Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Fix account creation failure #1651

Merged
merged 6 commits into from
Feb 23, 2024
Merged

Fix account creation failure #1651

merged 6 commits into from
Feb 23, 2024

Conversation

mnvr
Copy link
Member

@mnvr mnvr commented Feb 23, 2024

This was happening because yesterday I'd updated a bunch of dependencies by recreating the yarn.lock, and our caret dependency on libsodium caused it to also get updated. The newer libsodium version removed an API that we were using.

Full details are in the documentation notes I've added in the PR changes itself.

Tested by

I verified the problem using this (it'd print undefined):

 export async function generateSaltToDeriveKey() {
     await sodium.ready;
+    console.log({ crypto_pwhash_SALTBYTES: sodium.crypto_pwhash_SALTBYTES });
     return await toB64(sodium.randombytes_buf(sodium.crypto_pwhash_SALTBYTES));
 }

After the changes in this PR, it correctly prints 16 and account creation proceeds.

mnvr added 6 commits February 23, 2024 11:11
The latest one is causing password generation issues (e.g. when creating an account):

 TypeError: length cannot be null or undefined
    at f (webpack-internal:///../../node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:18896)
    at m (webpack-internal:///../../node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:18940)
    at Object.Lt [as randombytes_buf] (webpack-internal:///../../node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js:1:93208)
    at Module.generateSaltToDeriveKey (webpack-internal:///../../packages/shared/crypto/internal/libsodium.ts:261:82)

We can investigate them and fix them in a subsequent PR, for now it is more
prudent to stick with the version that we've been using and upgrade more
carefully.
We're getting `sodium.crypto_pwhash_SALTBYTES` as undefined.

jedisct1/libsodium.js#326
The @types package uses a caret import which is bringing a newer libsodium with
it, so add an explicit override to pin it to the version that we want.
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 69652de
Status: ✅  Deploy successful!
Preview URL: https://de0a6d38.bada-frame.pages.dev
Branch Preview URL: https://account-creation.bada-frame.pages.dev

View logs

@mnvr mnvr merged commit 9859d4e into main Feb 23, 2024
5 checks passed
@mnvr mnvr deleted the account-creation branch February 23, 2024 06:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant