Skip to content

refactor(webapp): inject app lock crypto dependency [WPB-22420] (#20743)#20746

Merged
thisisamir98 merged 1 commit intomasterfrom
release/2026-03-23
Mar 18, 2026
Merged

refactor(webapp): inject app lock crypto dependency [WPB-22420] (#20743)#20746
thisisamir98 merged 1 commit intomasterfrom
release/2026-03-23

Conversation

@thisisamir98
Copy link
Collaborator

@thisisamir98 thisisamir98 commented Mar 18, 2026

TaskWPB-22420 [Web] General maintenance ticket for PR merges

  • refactor(webapp): inject app lock crypto dependency

Refactor AppLockRepository to receive its password-hashing dependency through constructor injection instead of reading libsodium directly at module scope.

This keeps production behavior unchanged through a default libsodium-backed adapter, while making tests simpler and more reliable. App-lock tests now pass plain fake crypto implementations rather than using jest.mock for libsodium.

Also preserve the runtime guard and upstream issue reference for the crypto_pwhash_str type mismatch, where the installed package returns a string despite the published TypeScript definitions declaring Uint8Array.

  • fix lint issue

* refactor(webapp): inject app lock crypto dependency

Refactor AppLockRepository to receive its password-hashing dependency through
constructor injection instead of reading libsodium directly at module scope.

This keeps production behavior unchanged through a default libsodium-backed
adapter, while making tests simpler and more reliable. App-lock tests now pass
plain fake crypto implementations rather than using jest.mock for libsodium.

Also preserve the runtime guard and upstream issue reference for the
crypto_pwhash_str type mismatch, where the installed package returns a string
despite the published TypeScript definitions declaring Uint8Array.

* fix lint issue
@thisisamir98 thisisamir98 merged commit 8718a4f into master Mar 18, 2026
10 checks passed
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants