cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

Create digest-stream.md

Open simonhaenisch opened this issue 3 years ago • 3 comments

After dropping this as a comment here: https://github.com/w3c/webcrypto/issues/73#issuecomment-1165517709, I thought might be worth turning it into an example for the docs as well?

Feel free to update this (i've allowed edits by maintainers to the branch in my fork).

simonhaenisch avatar Jun 24 '22 12:06 simonhaenisch

BTW crypto.DigestStream got announced here in December (found a link to that post via the Github issue), but there's nothing in the docs yet (neither mentioned in Using Streams nor Streams API Reference), so this is the working result of my trial-and-error 😅

simonhaenisch avatar Jun 28 '22 12:06 simonhaenisch

I would recommend using sha512 in the example with a comment that it's faster than sha1 (it is). It's also faster than sha256 for longer messages but slightly slower/the same for shorter ones.

processBody should have an implementation I think so that the example is copyable without doing anything.

I believe all our docs are currently JS unfortunately so we should probably remain consistent until we get UI elements to dynamically switch between languages.

Might not be a bad idea to return the ETag in the response header (don't forget to put quotes around it - etags in HTTP have double quotes).

vlovich avatar Jul 07 '22 13:07 vlovich

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
- Generic High Entropy Secret 7d3d958ba7e1005d201a7e62289737fd5d716394 config.toml View secret
- Generic High Entropy Secret 58b6333afd7670da52bd237bec6b2c0cb708ae5e products/ddos-protection/docs-config.js View secret
- Generic High Entropy Secret f5ad72dcb5f9b6b4072be76c18ee663e52f30f72 products/ddos-protection/docs-config.js View secret
3543783 Generic High Entropy Secret 51cbbada456648d933bd539e901cb20bb22d0adb products/ruleset-engine/docs-config.js View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

gitguardian[bot] avatar Jul 16 '22 22:07 gitguardian[bot]

Hi @simonhaenisch , is this ready for merge? Could you please look through and accept or resolve James' suggestions?

deadlypants1973 avatar Nov 09 '22 15:11 deadlypants1973

Hey sorry haven't gotten around to it, so no not yet (let me convert it to draft PR). I'll try to get to it asap.

simonhaenisch avatar Nov 09 '22 17:11 simonhaenisch

Hi @simonhaenisch , would you still like to work on this? Let me know, and thank you

deadlypants1973 avatar Jun 01 '23 16:06 deadlypants1973

Hey sorry don't really have to time to finish it currently... can close it for now, and it would still be here as reference i guess.

simonhaenisch avatar Jun 01 '23 18:06 simonhaenisch

Closing per the last comment - can reopen at a later date.

KimJ15 avatar Jun 21 '23 19:06 KimJ15