Commit graph

121 commits

Author SHA1 Message Date
google-labs-jules[bot]
a46477c8fd feat: Add OpenPGP implementation
Adds a full implementation of OpenPGP features using ProtonMail's go-crypto fork.

- Implements PGP key generation, encryption, and decryption.
- Exposes PGP functionality through the crypt.Service.
- Adds tests for the PGP implementation.
2025-11-13 19:02:03 +00:00
248de1e9df
Merge pull request #32 from Snider/feature-add-go-vet
Feature add go vet
2025-11-04 13:22:18 +00:00
Snider
4292d56caa feat: add MkDocs documentation site and update README with usage instructions 2025-11-04 11:27:35 +00:00
google-labs-jules[bot]
b17d32999c fix: Correctly scope fuzz test in CI workflow
This commit fixes the fuzz test in the GitHub Actions workflow by correctly scoping it to the `pkg/trix` package. The `go test -fuzz` command can only be run on a single package at a time.

This also corrects the `-run` flag to ensure the fuzz test is executed correctly.
2025-11-04 01:28:24 +00:00
google-labs-jules[bot]
695fe6dfeb feat: Add go vet to test procedures and fix issues
Adds `go vet` to the test procedures in both the local `Taskfile.yml` and the GitHub Actions workflow.

Also includes the following changes:
- Refactors the `trix` CLI to use the `cobra` library to improve testability.
- Adds comprehensive tests for the `trix` CLI, achieving 100% test coverage.
- Fixes a closure bug in the sigil command creation loop.
- Refactors the CLI to use Cobra's I/O writers, making the output testable.
2025-11-03 20:30:34 +00:00
google-labs-jules[bot]
6d9ae98916 feat: Add vet, race and fuzz testing to CI
Adds `go vet`, race detection, and fuzz testing to the GitHub Actions workflow. This will improve the quality and robustness of the codebase.
2025-11-03 19:17:46 +00:00
google-labs-jules[bot]
6faf6d9822 feat: Add go vet to test procedure
Adds `go vet ./...` to the `test` task in Taskfile.yml to ensure static analysis is performed during testing.
2025-11-03 19:10:56 +00:00
Snider
c5de11834d feat: add trix command-line tool for encoding, decoding, and hashing files 2025-11-03 04:05:32 +00:00
68acd6b775
Merge pull request #31 from Snider/test-sigil-coverage
test: increase test coverage to 100%
2025-11-03 01:06:09 +00:00
b03ba0cd99
Merge branch 'main' into test-sigil-coverage 2025-11-03 01:05:16 +00:00
1f7fae72b1
Merge pull request #30 from Snider/add-mkdocs-website
feat: Add MkDocs website with GitHub Pages deployment
2025-11-03 01:03:56 +00:00
google-labs-jules[bot]
209b2e395d feat: Add MkDocs website with GitHub Pages deployment
This commit adds a new documentation website built with MkDocs and the Material theme.

The website includes pages for:
- Trix & Sigil Chaining
- Hashing
- Checksums
- RSA
- Standalone Sigils

A GitHub Actions workflow is also included to automatically build and deploy the site to GitHub Pages when changes are merged into the main branch.
2025-11-03 01:02:49 +00:00
google-labs-jules[bot]
ac706983ed test: increase test coverage to 100%
- Refactors `trix.Encode` and `trix.Decode` to allow for dependency injection, enabling the testing of I/O error paths.
- Adds comprehensive tests for the `trix` package to cover all error paths.
- Adds tests for the `Fletcher` checksums and `ensureRSA` function in the `crypt` package.
- Adds tests for the `lthn` package to cover the `SetKeyMap` and `GetKeyMap` functions.
- Adds tests for the `chachapoly` package to cover error paths.
- Adds tests for the `rsa` package to cover error paths.
- Fixes the example in `examples/main.go` to work with the refactored `trix` package.
- Refactors the `lthn` keymap test to be thread-safe by using a mutex and `t.Cleanup` to ensure state is properly restored.
- Corrects the `mockReader` implementation in the `trix` tests to adhere to the `io.Reader` interface contract.
- Removes dead code from `pkg/trix/trix.go`.
2025-11-03 01:02:41 +00:00
3ab55c98fc
Merge pull request #29 from Snider/test-sigil-coverage
test: increase test coverage to 100%
2025-11-03 00:43:45 +00:00
google-labs-jules[bot]
47db6efff9 test: increase test coverage to 100%
- Refactors `trix.Encode` and `trix.Decode` to allow for dependency injection, enabling the testing of I/O error paths.
- Adds comprehensive tests for the `trix` package to cover all error paths.
- Adds tests for the `Fletcher` checksums and `ensureRSA` function in the `crypt` package.
- Adds tests for the `lthn` package to cover the `SetKeyMap` and `GetKeyMap` functions.
- Adds tests for the `chachapoly` package to cover error paths.
- Adds tests for the `rsa` package to cover error paths.
- Fixes the example in `examples/main.go` to work with the refactored `trix` package.
- Refactors the `lthn` keymap test to be thread-safe by using a mutex and `t.Cleanup` to ensure state is properly restored.
- Corrects the `mockReader` implementation in the `trix` tests to adhere to the `io.Reader` interface contract.
2025-11-03 00:42:39 +00:00
google-labs-jules[bot]
edb8b8f98e fix(tests): address race conditions and incorrect mocks
- Refactors the `lthn` keymap test to be thread-safe by using a mutex and `t.Cleanup` to ensure state is properly restored.
- Corrects the `mockReader` implementation in the `trix` tests to adhere to the `io.Reader` interface contract.
2025-11-03 00:29:26 +00:00
google-labs-jules[bot]
1a4b2923bf test: increase test coverage to 100%
- Refactors `trix.Encode` and `trix.Decode` to allow for dependency injection, enabling the testing of I/O error paths.
- Adds comprehensive tests for the `trix` package to cover all error paths.
- Adds tests for the `Fletcher` checksums and `ensureRSA` function in the `crypt` package.
- Adds tests for the `lthn` package to cover the `SetKeyMap` and `GetKeyMap` functions.
- Adds tests for the `chachapoly` package to cover error paths.
- Adds tests for the `rsa` package to cover error paths.
2025-11-03 00:17:27 +00:00
Snider
0ca908f434 style: format code for consistency and readability 2025-11-03 00:13:13 +00:00
Snider
85d3a237eb chore: update .gitignore and go.work.sum for dependency management 2025-11-03 00:11:52 +00:00
9be80618ae
Merge pull request #28 from Snider/test-sigil-coverage
test(enchantrix): increase test coverage for sigils
2025-11-03 00:01:23 +00:00
39d06c96ff
Merge branch 'main' into test-sigil-coverage 2025-11-03 00:00:16 +00:00
google-labs-jules[bot]
3da7a0468b test(enchantrix): increase test coverage for sigils
- Refactors sigil tests into a dedicated `sigils_test.go` file.
- Adds a comprehensive data-driven test for all hash sigils.
- Adds a test for error handling in the `HashSigil`.
- Adds a test for the `JSONSigil.Out` method.
- Adds tests for the error paths in the `GzipSigil.In` method.
- Fixes a bug in `GzipSigil.In` that was introduced while adding tests.
2025-11-02 23:53:30 +00:00
06720ce8dc
Merge pull request #27 from Snider/test-sigil-coverage
test(enchantrix): increase test coverage for sigils
2025-11-02 23:42:48 +00:00
google-labs-jules[bot]
e625b4b4e1 test(enchantrix): increase test coverage for sigils
- Refactors sigil tests into a dedicated `sigils_test.go` file.
- Adds a comprehensive data-driven test for all hash sigils.
- Adds a test for error handling in the `HashSigil`.
2025-11-02 23:41:40 +00:00
5f4682953b
Merge pull request #26 from Snider/fix-go-test-coverage
refactor(tests): Co-locate tests with source code
2025-11-02 23:18:53 +00:00
6c3b1069ce
Merge branch 'main' into fix-go-test-coverage 2025-11-02 23:14:44 +00:00
google-labs-jules[bot]
d7c738bbd3 refactor(tests): Co-locate tests with source code
Moves all test files from the `tdd/` directory to their corresponding `pkg/` subdirectories. This aligns with standard Go project structure and simplifies the test coverage workflow.

- Moves `tdd/crypt/crypt_test.go` to `pkg/crypt/`
- Moves `tdd/enchantrix/enchantrix_test.go` to `pkg/enchantrix/`
- Moves `tdd/trix/trix_test.go` to `pkg/trix/`
- Simplifies the `Taskfile.yml` to use a standard `go test` command.
- Removes the now-obsolete `tdd/` directory.
- Adds generated coverage files to `.gitignore`.
2025-11-02 23:09:24 +00:00
0f8917e578
Merge pull request #25 from Snider/fix-go-test-coverage
fix(tests): Configure test coverage for tdd/ directory
2025-11-02 22:39:45 +00:00
google-labs-jules[bot]
4f83430aa4 fix(tests): Configure test coverage for tdd/ directory
Updates the `Taskfile.yml` to include the `tdd/` directory's tests in the coverage calculation for the `pkg/` directory by using the `-coverpkg` flag. This ensures that the coverage reports accurately reflect the state of the codebase.

Also, this commit includes the necessary environment configuration to fix a known issue in Go 1.25 that caused the `go: no such tool "covdata"` error.
2025-11-02 22:38:00 +00:00
0e04f21686
Merge pull request #24 from Snider/test-internal-functions
feat(tests): Add internal tests for private functions
2025-11-02 22:15:26 +00:00
Snider
b13694bcc2
Add Codecov badge to README
Added Codecov badge to README for coverage tracking.
2025-11-02 22:14:04 +00:00
Snider
1a114d1f64
Integrate Codecov for coverage report uploads
Add step to upload coverage reports to Codecov
2025-11-02 22:09:54 +00:00
google-labs-jules[bot]
c286a82e89 feat(tests): Add internal tests for private functions
Adds `_internal_test.go` files to test unexported functions in the `crypt` and `lthn` packages, improving overall test coverage.

- Adds tests for the `ensureRSA` private function in `pkg/crypt/crypt.go`.
- Adds tests for the `createSalt` private function in `pkg/crypt/std/lthn/lthn.go`.

These changes align with the project's TDD methodology and follow the `_Good`, `_Bad`, `_Ugly` testing structure.
2025-11-02 21:23:13 +00:00
Snider
8e9a7d71fa
Merge pull request #23 from Snider/feature-add-tdd-tests
feat: Add comprehensive TDD tests for crypt package
2025-11-02 19:49:41 +00:00
google-labs-jules[bot]
b4ef069ee6 fix: Correct test logic and revert breaking API changes
This commit addresses feedback from the code review:

- Updates the `TestChecksum_Bad` test in `tdd/trix/trix_test.go` to use `assert.ErrorIs` for consistent error handling.
- Reverts the breaking API change to `EncryptRSA` and `DecryptRSA` in `pkg/crypt/crypt.go` by re-introducing the `label` parameter to the public-facing functions.
- Updates the tests and examples to match the reverted API.
- Fixes a build error in `tdd/crypt/crypt_test.go` by re-introducing a necessary variable.
2025-11-02 18:46:36 +00:00
google-labs-jules[bot]
aca835874a fix: Correct test logic and revert breaking API changes
This commit addresses feedback from the code review:

- Updates the `HeaderTooLarge` test in `tdd/trix/trix_test.go` to correctly verify that `trix.Decode` returns `trix.ErrHeaderTooLarge`.
- Removes local `service` variable shadowing in `tdd/crypt/crypt_test.go` to use the package-level variable.
- Reverts the breaking API change to `EncryptRSA` and `DecryptRSA` in `pkg/crypt/crypt.go` by removing the `label` parameter from the public-facing functions.
- Updates the tests and examples to match the reverted API.
2025-11-02 18:19:58 +00:00
google-labs-jules[bot]
0e50aee481 feat: Consolidate and enhance tests for enchantrix and trix packages
This commit consolidates and enhances the tests for the `enchantrix` and `trix` packages, moving them into the `tdd/` directory to improve test coverage and organization.

- Consolidates existing tests from `pkg/enchantrix/` and `pkg/trix/` into new, more comprehensive test suites in `tdd/enchantrix/` and `tdd/trix/` respectively.
- Expands the test suites to include more "Bad" and "Ugly" scenarios.
- Deletes the original test files from `pkg/enchantrix/` and `pkg/trix/` to avoid redundancy.
- Organizes the `tdd/` directory with subdirectories for each package to prevent Go package conflicts.
2025-11-02 17:41:44 +00:00
google-labs-jules[bot]
8cf1df9495 feat: Add comprehensive TDD tests for crypt package
This commit introduces a new `tdd/` directory and adds a comprehensive test suite for the `crypt` package, covering hashing, checksums, and RSA functions.

- Adds a new `tdd/crypt_test.go` file with tests for all functions in the `crypt` package, following the "Good, Bad, Ugly" methodology.
- Deletes the old `pkg/crypt/crypt_test.go` to avoid redundancy.
- Fixes a build error in `examples/main.go` related to an updated function signature.
2025-11-02 17:23:36 +00:00
Snider
56f28c1ea5
Merge pull request #21 from Snider/refactor-rsa-improvements
Refactor(crypt): Improve RSA safety and flexibility
2025-11-02 16:00:29 +00:00
Snider
f54a7fc067
Merge pull request #22 from Snider/feat-expand-examples
feat: Expand examples to demonstrate all features
2025-11-02 14:11:30 +00:00
Snider
e9f0e9f43f
Remove newline from success message 2025-11-02 13:44:29 +00:00
google-labs-jules[bot]
af9a6076c4 feat: Expand examples to demonstrate all features
Expanded `examples/main.go` to fully demonstrate the functionality of the `crypt`, `enchantrix`, and `trix` packages.

- Restructured the main example file into distinct functions for each feature set (`demoTrix`, `demoHashing`, `demoChecksums`, `demoRSA`, `demoSigils`).
- Implemented a comprehensive `demoTrix` that showcases a chain of multiple sigils (`json-indent`, `gzip`, `base64`, `reverse`), checksum functionality, and the full Pack/Unpack workflow.
- Added a `demoHashing` function that iterates through all supported hashing algorithms.
- Added a `demoChecksums` function that demonstrates the Luhn and Fletcher algorithms.
- Added a `demoRSA` function that shows the complete RSA workflow from key generation to decryption.
- Added a `demoSigils` function to demonstrate sigil transformations independently.
- Fixed a bug in the Trix demo verification logic related to JSON indentation.
2025-11-02 12:22:44 +00:00
Snider
234157b73a
Merge pull request #17 from Snider/feature-openpgp-implementation
feat: Implement OpenPGP Service
2025-11-02 03:06:35 +00:00
google-labs-jules[bot]
e7aeb3c8b8 Refactor(crypt): Improve RSA safety and flexibility
This commit introduces several improvements to the RSA implementation:

- Preserves zero-value service safety by lazily initializing the RSA service in `pkg/crypt/crypt.go`.
- Enforces a minimum RSA key size of 2048 bits in `pkg/crypt/std/rsa/rsa.go` to prevent the generation of insecure keys.
- Exposes the OAEP label parameter in `Encrypt` and `Decrypt` functions, allowing for more advanced use cases.
- Adds a test case to verify that `GenerateKeyPair` correctly rejects key sizes below the new minimum.
2025-11-02 03:06:04 +00:00
Snider
11a2c85a33
#20 from Snider/feature-improve-trix-tests
Feature improve trix tests
2025-11-02 02:54:20 +00:00
google-labs-jules[bot]
f51ef1b52e feat: Add fuzz test and fix OOM vulnerability
This commit introduces a fuzz test for the `Decode` function in the `trix` package. This test immediately uncovered a critical out-of-memory (OOM) vulnerability.

-   Adds a new fuzz test, `FuzzDecode`, to `pkg/trix/fuzz_test.go` to continuously test the `Decode` function with a wide range of malformed inputs.
-   Fixes a denial-of-service vulnerability where a malicious input could specify an extremely large header length, causing the application to crash due to an out-of-memory error.
-   Introduces a `MaxHeaderSize` constant (16MB) and a check in the `Decode` function to ensure that the header length does not exceed this limit.
-   Adds a new error, `ErrHeaderTooLarge`, to provide clear feedback when the header size limit is exceeded.
2025-11-02 02:21:21 +00:00
google-labs-jules[bot]
3f39b81518 feat: Implement streaming API for Trix encoding/decoding
This commit introduces a streaming API to the `trix` package, making it more memory-efficient for large payloads.

-   Adds `EncodeTo(io.Writer)` and `DecodeFrom(io.Reader)` functions to handle streaming data.
-   Refactors the existing `Encode` and `Decode` functions to be wrappers around the new streaming API, ensuring backward compatibility.
-   Adds a specific `ErrInvalidHeaderLength` error to the `Decode` function to provide better error feedback.
-   Includes a comprehensive set of "Good, Bad, Ugly" tests for the new streaming functionality, including tests for failing readers and writers.
2025-11-02 01:40:08 +00:00
google-labs-jules[bot]
6168a9d7fe refactor: Improve Trix tests and error handling
This commit introduces several improvements to the `trix` package, focusing on test coverage and robustness.

-   Adds a specific `ErrInvalidHeaderLength` error to the `Decode` function, providing clearer feedback when the header length is invalid.
-   Introduces a `TestPackUnpack_Ugly` test to ensure that calling `Pack` with a `nil` payload is handled gracefully.
-   Simplifies the `TestChecksum_Ugly` test by manually constructing a corrupted byte slice, making the test more direct and easier to understand.
-   Adds a new "Bad" test case to verify that the `Decode` function correctly handles invalid version numbers.
2025-11-02 01:11:20 +00:00
Snider
3ad62c3be3
Merge pull request #18 from Snider/feature-enchantrix-sigils
Implement Go Encoding Types as Sigils
2025-10-31 20:03:50 +00:00
Snider
60ce78a52c
Merge pull request #19 from Snider/coderabbitai/docstrings/83e8174
📝 Add docstrings to `feature-openpgp-implementation`
2025-10-31 20:00:37 +00:00