Thank you for your interest in contributing to the Auki Authentication library! This document provides guidelines and instructions for contributing.
- Getting Started
- Development Setup
- Project Structure
- Building the Project
- Running Tests
- Coding Standards
- Making Changes
- Submitting a Pull Request
- Release Process
This library is experimental and under active development. We welcome contributions, but please be aware that the API is subject to rapid changes, including breaking changes.
Before contributing:
- Check existing issues to see if your idea or bug is already being discussed
- For major changes, open an issue first to discuss your approach
- For minor fixes or improvements, feel free to submit a PR directly
Required:
- Rust 1.70 or higher
- Node.js 18 or higher (for JavaScript/TypeScript bindings)
- Python 3.8 or higher (for Python bindings)
For Cross-Platform Builds:
- Docker Desktop (for cross-compilation)
- Build tools will be auto-installed via
make install-tools
-
Clone the repository:
git clone https://github.com/aukilabs/experimental-modules.git cd authentication-rust -
Install build tools:
make install-tools
-
Set up environment variables:
cp .env.example .env # Edit .env with your test credentials -
Build the project:
# Build Rust library cargo build # Build JavaScript bindings make javascript # Build Python bindings make python
authentication/
├── src/ # Rust core library (sans-I/O)
│ ├── lib.rs # Main library entry point
│ ├── client.rs # Core authentication client
│ ├── state.rs # State management
│ ├── actions.rs # Action types (HTTP requests, etc.)
│ ├── events.rs # Event types (responses, errors)
│ └── platforms/ # Platform-specific bindings
│ ├── web.rs # WASM bindings for JavaScript
│ └── uniffi.udl # UniFFI interface for Python
├── pkg/ # Language bindings
│ ├── javascript/ # JavaScript/TypeScript package
│ │ ├── src/ # High-level wrapper
│ │ ├── examples/ # Usage examples
│ │ └── README.md
│ ├── python/ # Python package
│ │ ├── src/ # High-level wrapper
│ │ ├── examples/ # Usage examples
│ │ └── README.md
│ └── expo/ # React Native/Expo package
│ ├── ios/ # iOS bindings
│ ├── android/ # Android bindings
│ └── example/ # Example app
├── tests/ # Rust integration tests
├── examples/ # Rust examples
├── Makefile # Build automation
├── README.md # Main documentation
├── ARCHITECTURE.md # Architecture details
└── CONTRIBUTING.md # This file
# Development build
cargo build
# Release build
cargo build --release
# Run tests
cargo test
# Run clippy (linting)
cargo clippy
# Format code
cargo fmt# Build WASM and JavaScript bindings
make javascript
# Run tests
cd pkg/javascript
npm test
# Run examples
npm run example:basic
npm run example:auto-auth# Build bindings for all platforms
make python
# Install for development
cd pkg/python
pip install -e .
# Run tests
python examples/basic.py
python examples/test_auto_auth.py# Clean everything
make clean
# Clean specific bindings
make clean-javascript
make clean-python# Run all tests
cargo test
# Run specific test
cargo test test_name
# Run with output
cargo test -- --nocapturecd pkg/javascript
npm test
npm run test:auto-auth
npm run test:refreshcd pkg/python
python examples/test_auto_auth.py
python examples/test_multi_domain.py
python examples/test_refresh.pyIntegration tests require valid credentials in .env:
# Run Rust example with real API
cargo run --example basic
# Run JavaScript example
cd pkg/javascript
npm run example:basic
# Run Python example
cd pkg/python
python examples/basic.py- Follow Rust API Guidelines
- Run
cargo fmtbefore committing - Run
cargo clippyand address all warnings - Add tests for new functionality
- Document public APIs with doc comments (
///)
Example:
/// Authenticates to the Auki network.
///
/// # Returns
///
/// A vector of actions to execute (typically HTTP requests).
///
/// # Example
///
/// ```
/// let actions = client.authenticate();
/// ```
pub fn authenticate(&mut self) -> Vec<Action> {
// Implementation
}- Follow the existing code style
- Use TypeScript for type safety
- Add JSDoc comments for public APIs
- Run examples after making changes
- Keep the high-level wrapper simple and intuitive
Example:
/**
* Authenticates to the Auki network.
* @returns Promise resolving to a Token
* @throws {AuthenticationError} If authentication fails
*/
async authenticate(): Promise<Token> {
// Implementation
}- Follow PEP 8
- Add type hints for all public APIs
- Add docstrings for classes and methods
- Keep examples updated with API changes
Example:
async def authenticate(self) -> Token:
"""
Authenticates to the Auki network.
Returns:
Token: The network authentication token
Raises:
AuthenticationError: If authentication fails
"""
# ImplementationAll examples should:
- Load configuration from
.envusingdotenv - Use
os.getenv()with sensible defaults - Follow the pattern in
examples/basic.py(Python) orexamples/basic.js(JavaScript)
Example:
from dotenv import load_dotenv
load_dotenv(dotenv_path="../../.env")
config = Config(
api_url=os.getenv("API_URL", "https://api.aukiverse.com"),
refresh_url=os.getenv("REFRESH_URL", "https://api.aukiverse.com/user/refresh"),
dds_url=os.getenv("DDS_URL", "https://dds.posemesh.org"),
client_id=os.getenv("CLIENT_ID", "my-app"),
refresh_threshold_ms=int(os.getenv("REFRESH_THRESHOLD_MS", "300000"))
)-
Create a feature branch from
main:git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix -
Make your changes following the coding standards
-
Test your changes thoroughly:
# Rust cargo test cargo clippy cargo fmt --check # JavaScript cd pkg/javascript npm test npm run example:basic # Python cd pkg/python python examples/basic.py
-
Commit your changes:
git add . git commit -m "feat: add new authentication method" # or git commit -m "fix: resolve token refresh issue"
We use conventional commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringtest:- Test additions or changeschore:- Build process or tooling changesbreaking:- Breaking changes (major version bump)
Examples:
feat: add support for OAuth authentication
fix: resolve race condition in token refresh
docs: update Python README with new API
refactor: simplify state management
test: add integration tests for multi-domain
chore: update dependencies
breaking: change Client constructor signature
When making changes to the Rust core that affect the API:
-
Update the core library (
src/) -
Update platform bindings:
- WASM bindings:
src/platforms/web.rs - Python bindings:
src/platforms/uniffi.udl
- WASM bindings:
-
Update high-level wrappers:
- JavaScript:
pkg/javascript/src/index.ts - Python:
pkg/python/src/client.py
- JavaScript:
-
Update examples in all languages
-
Update READMEs to reflect API changes
-
Rebuild bindings:
make javascript make python
-
Test all bindings:
# Test JavaScript cd pkg/javascript && npm run example:basic # Test Python cd pkg/python && python examples/basic.py
When changing the API, ensure you update:
- Rust core library (
src/) - Rust examples (
examples/) - WASM bindings (
src/platforms/web.rs) - Python bindings (
src/platforms/uniffi.udl) - JavaScript wrapper (
pkg/javascript/src/index.ts) - JavaScript examples (
pkg/javascript/examples/) - JavaScript README (
pkg/javascript/README.md) - Python wrapper (
pkg/python/src/client.py) - Python examples (
pkg/python/examples/) - Python README (
pkg/python/README.md) - Main README (
README.md) - Architecture docs (if applicable)
-
Push your branch:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub with:
- Clear title describing the change
- Description explaining what changed and why
- Reference to any related issues
- Screenshots/examples if applicable
-
PR Template:
## Description Brief description of the changes ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Testing - [ ] Rust tests pass (`cargo test`) - [ ] JavaScript examples work - [ ] Python examples work - [ ] All linting passes ## Related Issues Closes #123
-
Address review feedback:
- Respond to all comments
- Make requested changes
- Push updates to the same branch
-
Merge requirements:
- All tests must pass
- Code review approval required
- No merge conflicts with
main
Note: This section is for maintainers
-
Update version numbers:
Cargo.toml(Rust)pkg/javascript/package.jsonpkg/python/setup.pypkg/python/pyproject.toml
-
Update CHANGELOG.md with release notes
-
Create a release commit:
git commit -am "chore: release v0.2.0" git tag v0.2.0 git push origin main --tags
JavaScript/NPM:
cd pkg/javascript
npm publishPython/PyPI:
cd pkg/python
python -m build
python -m twine upload dist/*- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Architecture: See ARCHITECTURE.md
We are committed to providing a welcoming and inclusive environment. Please:
- Be respectful and professional
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards other community members
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).
Thank you for contributing to Auki Authentication! 🎉