Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, codes, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies to all project spaces and events, including issue trackers, pull requests, mailing lists, chat channels, video calls, in-person events, and any other project-related communications.

## Reporting

To report an incident, contact the project conduct team at [[email protected]](mailto:[email protected]) or reach out to any maintainer. If you prefer, you may submit an anonymous report via a form or third-party service (link/placeholders should be added). Please include as much detail as possible, including links, timestamps, and any relevant context.

## Confidentiality and Anonymity

Reports will be handled confidentially. Reporters may request anonymity; the conduct team will make reasonable efforts to protect identities and sensitive information when requested.

## Consequences

Consequences for violations may include private warnings, required remediation (for example, apologies or training), temporary suspension of repository or event access, removal of privileges, or permanent bans. The chosen action will be proportional to the severity and frequency of the behavior.

## Anti-Retaliation

Retaliation against anyone who reports misconduct or participates in an investigation is strictly prohibited and will itself be treated as a serious violation of this Code of Conduct.

## Conflict of Interest & Recusal

If a conduct team member has a conflict of interest in a case, they will recuse themselves and another impartial member will handle the investigation.

## Contact & Upkeep

For questions about this policy or to update contact details, contact [[email protected]](mailto:[email protected]).

This policy was last updated: 2026-03-28
13 changes: 7 additions & 6 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ RngCore / CryptoRng ← standard rand_core traits
|------|------|------|
| `RandomBlockSource` | `src/traits.rs` | Trait every entropy backend must implement |
| `Ctrng` | `src/ctrng/mod.rs` | Public enum dispatching to concrete backends |
| `IpfsCtrng` | `src/ctrng/ipfs.rs` | IPFS beacon client (internal, behind `Ctrng`) |
| `IpfsConfig` | `src/ctrng/ipfs.rs` | Gateway list, `use_defaults`, timeout |
| `IpfsGateway` | `src/ctrng/ipfs.rs` | Newtype for gateway URL; builds `/ipfs/` and `/ipns/` paths |
| `IpfsBeacon` | `src/ctrng/ipfs_beacon.rs` | IPFS beacon client (internal, behind `Ctrng`) |
| `IpfsConfig` | `src/ctrng/ipfs_beacon.rs` | Gateway list, `use_defaults`, timeout |
| `IpfsGateway` | `src/ctrng/ipfs_beacon.rs` | Newtype for gateway URL; builds `/ipfs/` and `/ipns/` paths |
| `CtrngBlock` | `src/ctrng/types.rs` | Block with sequence number, timestamp, 32-byte data |
| `MixedCtrng<R>` | `src/mixed.rs` | XOR of remote + local OS entropy |
| `ReseedingRng` | `src/reseed.rs` | ChaCha20 DRBG with configurable reseed intervals |
Expand All @@ -58,19 +58,20 @@ src/
├── error.rs SourceError
├── ctrng/
│ ├── mod.rs Ctrng enum + RandomBlockSource impl
│ ├── ipfs.rs IpfsCtrng, IpfsGateway, IpfsConfig, DEFAULT_GATEWAYS
│ ├── ipfs_beacon.rs IpfsCtrng, IpfsGateway, IpfsConfig, DEFAULT_GATEWAYS
│ └── types.rs BeaconResponse, CtrngBlock
├── mixed.rs MixedCtrng (XOR mixer)
├── reseed.rs ReseedingRng, ReseedConfig
├── rng.rs BlockRng (RngCore adapter)
└── local.rs LocalRng (OS entropy)

tests/
├── ipfs_live.rs live IPFS gateway tests (#[ignore])
├── e2e_ipfs.rs live IPFS gateway tests
├── e2e_mixed.rs live MixedCtrng end-to-end tests
├── mixed_tests.rs MixedCtrng tests (some #[ignore])
├── reseed_tests.rs ReseedingRng offline tests
├── rng_tests.rs BlockRng error propagation
└── statistical_tests.rs TestU01 / PractRand (behind features)
└── testu01_tests.rs TestU01 / PractRand (behind features)
```

## Conventions
Expand Down
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing to crypto-ctrng

We welcome contributions to crypto-ctrng! Whether it's fixing a bug, adding a new feature, improving documentation, or suggesting new ideas, your contributions are highly appreciated.

## How to Contribute

1. **Fork the Repository**: Start by forking the crypto-ctrng repository to your GitHub account.
2. **Create a Branch**: Create a new branch for your contribution. Use a descriptive name for the branch, such as `fix-issue-123` or `add-new-feature`. Only lowercase letters, numbers, and hyphens are allowed in branch names.
3. **Make Your Changes**: Make the necessary changes in your branch. Ensure that your code follows the project's coding standards and includes appropriate tests if applicable.
4. **Commit Your Changes**: Commit your changes with a clear and concise commit message that describes the purpose of the change.
5. **Push to GitHub**: Push your branch to your forked repository on GitHub.
6. **Create a Pull Request**: Go to the original crypto-ctrng repository and create a pull request from your branch. Provide a detailed description of your changes and why they are necessary.
7. **Review Process**: The maintainers will review your pull request and may request changes or provide feedback. Be responsive to any comments and make the necessary adjustments.
8. **Merge**: Once your pull request is approved, it will be merged into the main branch.

## Code of Conduct

Please note that we have a [Code of Conduct](CODE_OF_CONDUCT.md) in place to ensure a welcoming and inclusive environment for all contributors. By participating in this project, you agree to abide by its terms.

## Reporting Issues

If you encounter any issues or have suggestions for improvements, please feel free to open an issue in the GitHub repository. Provide as much detail as possible to help us understand and address the problem effectively.

---

Thank you for your interest in contributing to crypto-ctrng! We look forward to your contributions and working together to make crypto-ctrng even better.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
name = "crypto-ctrng"
version = "0.1.0"
edition = "2024"
rust-version = "1.85"
description = "Secure abstraction layer over a cosmic True Random Number Generator (cTRNG) backend, exposing RngCore/CryptoRng traits"
license = "MIT"
repository = "https://github.com/spacecomputer-io/crypto-ctrng"
homepage = "https://docs.spacecomputer.io"
keywords = ["cryptography", "random", "trng", "entropy", "rng"]
categories = ["cryptography"]

[dependencies]
rand_core = { version = "0.6", features = ["std"] }
Expand All @@ -21,4 +28,4 @@ testu01 = []
practrand = []

[dev-dependencies]
rng-statistical-tests = { git = "https://github.com/spacecomputer-io/statistical-verification.git" }
statistical-verification = { git = "https://github.com/spacecomputer-io/statistical-verification.git" }
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 SpaceComputer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 1 addition & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,29 +144,9 @@ cargo test --test e2e_ipfs
cargo test --test e2e_mixed
```

You can also run the dedicated e2e integration targets individually:

```bash
cargo test --test e2e_ipfs
cargo test --test e2e_mixed
```

To run the IPFS-backed end-to-end tests :

```bash
cargo test test_e2e
```

You can also run the dedicated e2e integration targets individually:

```bash
cargo test --test e2e_ipfs
cargo test --test e2e_mixed
```

### Statistical verification

Statistical testing is provided by the separate [`rng-statistical-tests`](https://github.com/spacecomputer-io/statistical-verification) library, which supports both **TestU01** and **PractRand**.
Statistical testing is provided by the separate [`statistical-verification`](https://github.com/spacecomputer-io/statistical-verification) library, which supports both **TestU01** and **PractRand**.

TestU01 and PractRand are automatically downloaded and built during compilation - no manual setup required.

Expand All @@ -176,12 +156,3 @@ To run statistical tests:
cargo test --features testu01 # TestU01 SmallCrush
cargo test --features practrand # PractRand (1 MiB)
```


## License

This project is licensed under the terms of the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

We welcome contributions to this project! If you have suggestions for improvements or new features, please open an issue or submit a pull request.
Loading
Loading