|
| 1 | +Welcome! Thanks for looking into contributing to our project! |
| 2 | + |
| 3 | +# Table of Contents |
| 4 | + |
| 5 | +- [Ways to Contribute](#ways-to-contribute) |
| 6 | +- [Looking for Help?](#looking-for-help) |
| 7 | + - [Documentation](#documentation) |
| 8 | +- [Reporting Issues](#reporting-issues) |
| 9 | +- [Submitting Code](#submitting-code) |
| 10 | + - [Building](#building) |
| 11 | + - [Coding Style](#coding-style) |
| 12 | + - [Submitting PRs](#submitting-prs) |
| 13 | + - [Where do I start?](#where-do-i-start) |
| 14 | +- [Testing](#testing) |
| 15 | + |
| 16 | +# Ways to Contribute |
| 17 | + |
| 18 | +We are looking This document below primarily focuses on writing code for this |
| 19 | +project, but there are many ways you can help out: |
| 20 | + |
| 21 | +- **Testing**: We only have access to a limited set of hardware and accounts. |
| 22 | + Installing the project and using it yourself is a great way to get us more |
| 23 | + feedback to improve the project. |
| 24 | + |
| 25 | +- **Writing UI implementations**: The UI included in this document is for reference |
| 26 | + purposes. We need developers who are familiar with (or willing to learn about) |
| 27 | + the specifics of integrating with particular desktop environments, like GNOME, |
| 28 | + KDE, etc. |
| 29 | + |
| 30 | +- **Writing documentation**: Documentation is always hard. If you notice |
| 31 | + something missing or incorrect, then feel free to ask a question about it or |
| 32 | + send a pull request to address it. |
| 33 | + |
| 34 | +- **Sponsorship**: We haven't set up any sort of platform to receive monetary |
| 35 | + donations, but if you are interested, you can reach out by filing an issue, |
| 36 | + and we can see what we can do. Individual sponsorships are not the only way to |
| 37 | + support the project: getting us in touch with companies or foundations |
| 38 | + offering grants for open source or hardware for testing is also helpful. |
| 39 | + |
| 40 | +- **Spread the word**: We believe that this project is important to get in the hands |
| 41 | + of users. Whether you can help or not, telling others about the project and |
| 42 | + asking them to get involved is another way you can help! |
| 43 | + |
| 44 | +And then there is, of course, writing code! |
| 45 | + |
| 46 | +# Looking for Help? |
| 47 | + |
| 48 | +Here is a list of helpful resources you can consult: |
| 49 | + |
| 50 | +## Documentation |
| 51 | + |
| 52 | +Before getting started, it may help you to read the documentation. Take a look at these: |
| 53 | + |
| 54 | +- [credentialsd API Specification](/doc/api.md) |
| 55 | +- [ARCHITECTURE.md](/ARCHITECTURE.md), our architecture guide. |
| 56 | +- [BUILDING.md](/BUILDING.md) |
| 57 | + |
| 58 | +You may also need to consult various specifications while developing. |
| 59 | + |
| 60 | +- [WebAuthn (Level 3) Specification](https://www.w3.org/TR/webauthn-3/) |
| 61 | +- [CTAP 2.2 Specification](https://fidoalliance.org/specs/fido-v2.2-ps-20250714/fido-client-to-authenticator-protocol-v2.2-ps-20250714.html) |
| 62 | + |
| 63 | +# Reporting Issues |
| 64 | + |
| 65 | +If you find any bugs, inconsistencies or other problems, feel free to submit |
| 66 | +a GitHub [issue](https://github.com/linux-credentials/credentialsd/issues/new). |
| 67 | + |
| 68 | +Also, if you have trouble getting on board, let us know so we can help future |
| 69 | +contributors to the project overcome that hurdle too. |
| 70 | + |
| 71 | +## Security Issues |
| 72 | + |
| 73 | +If you are reporting a security issue, please review |
| 74 | +[`SECURITY.md`](/SECURITY.md) for the prodedure to follow. |
| 75 | + |
| 76 | +# Submitting Code |
| 77 | + |
| 78 | +Ready to write some code? Great! Here are some guidelines to follow to |
| 79 | +help you on your way: |
| 80 | + |
| 81 | +## Building |
| 82 | + |
| 83 | +When you first start making changes, make sure you can build the code and run |
| 84 | +the tests. |
| 85 | + |
| 86 | +To build the project, follow the build instructions in [`BUILDING.md`](/BUILDING.md). |
| 87 | + |
| 88 | +To run tests, follow the [test instructions](/BUILDING.md#running-tests) in the |
| 89 | +same file. |
| 90 | + |
| 91 | +## Coding Style |
| 92 | + |
| 93 | +In general, try to replicate the coding style that is already present. Specifically: |
| 94 | + |
| 95 | +### Naming |
| 96 | + |
| 97 | +For internal consistency, credentialsd uses `snake_case` for D-Bus field names |
| 98 | +and `SCREAMING_SNAKE_CASE` for enum values. This is consistent with D-Bus |
| 99 | +conventions, but it is distinct from Web Credential Management/WebAuthn |
| 100 | +conventions, which this API is based on. Values specified within JSON string |
| 101 | +payloads should stick to the naming conventions as specified in the WebAuthn. |
| 102 | + |
| 103 | +### Code Formatting and Linting |
| 104 | + |
| 105 | +For Rust code, we use [rustfmt][] to ensure consistent formatting code and |
| 106 | +[clippy][] to catch common mistakes not caught by the compiler. |
| 107 | + |
| 108 | +```sh |
| 109 | +# if you don't have them installed, install or update the stable toolchain |
| 110 | +rustup install stable |
| 111 | +# … and install prebuilt rustfmt and clippy executables (available for most platforms) |
| 112 | +rustup component add rustfmt clippy |
| 113 | +``` |
| 114 | + |
| 115 | +Before committing your changes, run `cargo fmt` to format the code (if your |
| 116 | +editor / IDE isn't set up to run it automatically) and `cargo clippy` to run |
| 117 | +lints. You'll need to run this from each Cargo project (`credentialsd/`, |
| 118 | +`credentialsd-ui/`, `credentialsd-common/`). |
| 119 | + |
| 120 | +For Python code, we use [ruff][]. |
| 121 | + |
| 122 | +[rustfmt]: https://github.com/rust-lang/rustfmt#readme |
| 123 | +[clippy]: https://github.com/rust-lang/rust-clippy#readme |
| 124 | +[ruff]: https://docs.astral.sh/ruff/installation/ |
| 125 | + |
| 126 | +### Import Formatting |
| 127 | + |
| 128 | +Organize your imports into three groups separated by blank lines: |
| 129 | + |
| 130 | +1. `std` imports |
| 131 | +1. External imports (from other crates) |
| 132 | +1. Local imports (`crate::`, `super::`, `self::` and things like `LocalEnum::*`) |
| 133 | + |
| 134 | +For example, |
| 135 | + |
| 136 | +```rust |
| 137 | +use std::collections::HashMap; |
| 138 | + |
| 139 | +use credentialsd_common::model::Operation; |
| 140 | + |
| 141 | +use super::MyType; |
| 142 | +``` |
| 143 | + |
| 144 | +### Commit Messages |
| 145 | + |
| 146 | +The commit message should start with the _area_ that is affected by the change, which is usually the name of the folder withouth the `credentialsd-` prefix. The exception is `credentialsd/` itself, which should use `daemon`. |
| 147 | + |
| 148 | +Write commit messages using the imperative mood, as if completing the sentence: |
| 149 | +"If applied, this commit will \_\_\_." For example, use "Fix some bug" instead |
| 150 | +of "Fixed some bug" or "Add a feature" instead of "Added a feature". |
| 151 | + |
| 152 | +(Take a look at this [blog post][commit-messages-guide] for more information on |
| 153 | +writing good commit messages.) |
| 154 | + |
| 155 | +[commit-messages-guide]: https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/ |
| 156 | + |
| 157 | +### Tracking Changes |
| 158 | + |
| 159 | +For bug fixes, breaking changes and improvements add an entry about them to the |
| 160 | +[changelog](/CHANGELOG.md). |
| 161 | + |
| 162 | +If your changes affect the the public D-Bus API (Gateway, Flow Control or UI |
| 163 | +Control APIs), also make sure to document the change in [doc/api.md](/doc/api.md) and |
| 164 | +add a note to the [revision history](/doc/api.md#revision-history) in that file. |
| 165 | + |
| 166 | +## Submitting PRs |
| 167 | + |
| 168 | +Once you're ready to submit your code, create a pull request, and one of our |
| 169 | +maintainers will review it. Once your PR has passed review, a maintainer will |
| 170 | +merge the request and you're done! 🎉 |
| 171 | + |
| 172 | +## Where do I start? |
| 173 | + |
| 174 | +If this is your first contribution to the project, we recommend taking a look |
| 175 | +at one of the [open issues][] we've marked for new contributors. |
| 176 | + |
| 177 | +[open issues]: https://github.com/linux-credentials/credentialsd/issues?q=is%3Aissue+is%3Aopen+label%3A"help+wanted" |
| 178 | + |
| 179 | +# Testing |
| 180 | + |
| 181 | +Before committing, run `meson test --interactive` from the `build/` directory to |
| 182 | +make sure that your changes can build and pass all tests, as well as running the |
| 183 | +formatting and linting tools [mentioned above](#code-formatting-and-linting). |
| 184 | + |
| 185 | +You should also follow the install instructions in [`BUILDING.md`](/BUILDING.md) |
| 186 | +and execute authentication flows in a browser the to ensure that everything |
| 187 | +still works as it should. |
0 commit comments