Skip to content

Test/core crypto primitives#16

Merged
kevincodex1 merged 6 commits into
Gitlawb:mainfrom
The-FOOL-00:test/core-crypto-primitives
May 29, 2026
Merged

Test/core crypto primitives#16
kevincodex1 merged 6 commits into
Gitlawb:mainfrom
The-FOOL-00:test/core-crypto-primitives

Conversation

@The-FOOL-00
Copy link
Copy Markdown
Contributor

Summary

This PR expands unit test coverage across gitlawb-core crypto primitives and DID utilities. It focuses on validating failure paths and invariants around certificate structure, content addressing, DID parsing/validation, and identity signing.

Certificates (cert)

  • Adds validation tests for wrong cert type, invalid to hash, and empty signatures
  • Verifies tampered signatures fail verify_all
  • Confirms threshold behavior for non-maintainer signers and threshold=0

Content IDs (cid)

  • Ensures from_sha256_bytes matches from_git_object_bytes
  • Adds CID parsing success/failure tests
  • Validates distinct inputs produce distinct CIDs
  • Adds SHA-256 hex conversion error cases and known empty-hash constant

DIDs (did)

  • Confirms did:web and did:gitlawb cannot resolve to verifying keys locally
  • Adds parsing validation for missing DID prefix and unsupported methods
  • Validates supported method set and predicate helpers
  • Verifies method_id extraction

Identity (identity)

  • Adds seed round-trip coverage
  • Verifies sign_b64 outputs valid base64url signatures
  • Ensures wrong-key verification fails
  • Adds signed payload round-trip and failure cases
  • Adds invalid PEM error-path test

Testing

  • cargo test --workspace --exclude gl
  • cargo test -p gitlawb-core --doc

Notes

  • Full workspace cargo test failed only for the gl test binary due to Windows Application Control (os error 4551). All other tests passed.

Copilot AI review requested due to automatic review settings May 28, 2026 18:29
@The-FOOL-00
Copy link
Copy Markdown
Contributor Author

Hey @kevincodex1 , could you approve the workflow run so CI can execute?
It's blocked on fork workflow approval. All checks pass locally
(fmt, clippy, 317 tests). Thanks!

@kevincodex1
Copy link
Copy Markdown
Contributor

yeah running now. will merge once its good bro

@kevincodex1 kevincodex1 merged commit 491978a into Gitlawb:main May 29, 2026
1 check passed
@The-FOOL-00
Copy link
Copy Markdown
Contributor Author

Hey @kevincodex1 - I noticed the red X on the merged commit.
Is that related to my changes or something else on main?
Happy to help investigate if needed.

@The-FOOL-00
Copy link
Copy Markdown
Contributor Author

Also,
could you use "Create a merge commit" instead of squash merge?
I'd like to preserve the individual commits. Thanks!

@kevincodex1
Copy link
Copy Markdown
Contributor

hello @The-FOOL-00 thank you so much for your contribution, I like better squash merge so its cleaner. you are still the author attributed to it right?

@The-FOOL-00
Copy link
Copy Markdown
Contributor Author

makes sense, thanks for merging!

@The-FOOL-00
Copy link
Copy Markdown
Contributor Author

also any idea what caused the red X on the merged commit? was that related to my changes or something else on main?

@kevincodex1
Copy link
Copy Markdown
Contributor

its fine bro, its our release process havent configured yet the binary release flow. we are using release-please

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants