Repository navigation
fix(crypto): 🔒 Use raw Media bytes for cryptographic operations - #10
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 322c0d49fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Note on the Codecov warning: the app installation is repository setup rather than a code change in this PR. The uploaded Codecov report says all modified and coverable lines are covered. |
Motivation
MediaconvertedBufferinput to UTF-8 strings and later reconstructed bytes withBuffer.from(this.value), causing distinct binary sequences to collide during hash/sign operations.Mediais provided.Description
Mediapayloads as raw bytes by usingMedia.getBuffer()instead ofvalueOf()when building message buffers for signing, verification, and encryption inPrivateKeyandPublicKey. (src/value-objects/crypto/PrivateKey.ts,src/value-objects/crypto/PublicKey.ts).Media.getBuffer()when aMediainstance is passed toMD5Hash.from,SHA256Hash.from, andSHA512Hash.fromso digests reflect original bytes. (src/value-objects/hashes/MD5Hash.ts,src/value-objects/hashes/SHA256Hash.ts,src/value-objects/hashes/SHA512Hash.ts).string,StringValueObject, andBufferpayloads; change affects onlyMediainputs.Testing
npm test -- --runInBand, which completed successfully and reported all test suites passing.Supersedes #5.
Codex Task