Implement progress bar in CAPTCHA widget. #8
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
renovate-bot
renovate-security
security
wontfix
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mCaptcha/2023-NLnet#8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement PoW progress notification: the method that generates PoW returns early after a configurable number of hash computations. This can be used to roughly indicate progress while waiting for a PoW to complete.
mCaptcha/pow_sha256#4
Publish 0.5.0: https://crates.io/crates/mcaptcha_pow_sha256/0.5.0
Uses
mcaptcha_pow_sha256
to build an opinionated WASM interface. This change implements the PoW progress notification implemented inmcaptcha_pow_sha256@v0.5.0
.pow_wasm
is run in a service worker by mCaptcha/mCaptcha. To show progress, WASM must notify service worker, which in turn must notify the parent page to update DOM to reflect progress. The current implementation accepts a JavaScript callback function, which can be defined in the service worker. The callback function can pass message to parent page to update DOM.PR: https://github.com/mCaptcha/pow_wasm/pull/2
Published: https://www.npmjs.com/package/@mcaptcha/pow-wasm/v/0.1.0-rc2
Same as the WASM implementation, runs in service worker and has to update DOM to inform progress. Also implements progress notification through callback function.
PR: https://github.com/mCaptcha/pow_sha256-polyfill/pull/16
Published: https://www.npmjs.com/package/@mcaptcha/pow_sha256-polyfill/v/0.1.0-rc2
Progress bar is tricky, because Proof-of-Work of the same difficulty level sometimes requires more number of hashes (
nonce
= number of hashes in mCaptcha). So tracking/predicting progress is difficult.This PR introduces changes to track maximum
nonce
encountered for every captcha configuration. This data is included in the PoW config fetch, and is used by the progress bar generation bit to compute progress by:which is the best I could come up with 😓
PR: https://github.com/mCaptcha/mCaptcha/pull/118