Skip to content

Test/core crypto primitives#16

Open
The-FOOL-00 wants to merge 4 commits into
Gitlawb:mainfrom
The-FOOL-00:test/core-crypto-primitives
Open

Test/core crypto primitives#16
The-FOOL-00 wants to merge 4 commits into
Gitlawb:mainfrom
The-FOOL-00:test/core-crypto-primitives

Conversation

@The-FOOL-00
Copy link
Copy Markdown

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
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.

1 participant