Thank you for your interest in contributing! We welcome bug reports, feature requests, and pull requests to make this library even better.
To maintain the high quality and security of this library, please adhere to the following standards:
- Java Version: Code must match Java 21 baseline.
- Null Safety: Use jSpecify annotations.
- Packages are
@NullMarkedby default. - Explicitly annotate nullable parameters/returns with
@Nullable.
- Packages are
- Immutability: Prefer immutable objects and
finalfields/variables where possible. - Dependencies: Zero runtime dependencies policy (except for optional extensions like QR generation).
- Memory Safety: Use
SecureBytesfor handling raw secret key material. - Timing Attacks: Use
TOTPEngine.constantTimeEquals()for sensitive comparisons. - Input Validation: strictly validate all public API inputs.
- Indentation: 4 spaces.
- Formatting: No empty lines at the beginning or end of methods.
- Javadoc: Required for all public classes and methods.
- Tests: New features must include unit tests.
Follow Conventional Commits format for clear, consistent, and reviewable messages:
<type>(<scope>): <short summary>
<body>
<footer>
Only the first line is mandatory.
| Type | Meaning | Example |
|---|---|---|
| feat | New feature | feat(TOTP) |
| fix | Bug fix | fix(ReplayGuard) |
| docs | Documentation only | docs(readme) |
| style | Formatting, no logic change | style(lint) |
| refactor | Code refactor | refactor(engine) |
| perf | Performance improvement | perf(cache) |
| test | Adding or fixing tests | test(security) |
| build | Build system changes | build(maven) |
| ci | CI/CD changes | ci(github) |
| chore | Maintenance / tooling | chore(deps) |
✅ Good:
feat(ReplayGuard): add distributed cache support
Add RedisReplayGuard implementation for distributed systems.
Maintains same API as InMemoryReplayGuard.
Fixes #123
❌ Bad:
fixed stuff
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes with proper commit messages
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Tests pass (
mvn clean test) - Code coverage is maintained or improved
- Javadoc added/updated
- CHANGELOG.md updated (if applicable)
- Coding standards followed
- Commit messages follow the standard
Please include:
- Library version
- Java version
- Minimal reproduction code
- Expected vs actual behavior