|
| 1 | +# Copilot Instructions for Yubico.NET.SDK |
| 2 | + |
| 3 | +This document provides instructions for the Copilot coding agent to work efficiently with the Yubico.NET.SDK repository. |
| 4 | + |
| 5 | +## High-Level Details |
| 6 | + |
| 7 | +- **Repository Summary**: The Yubico.NET.SDK is an enterprise-grade, cross-platform SDK for integrating YubiKey functionality into .NET applications. It provides APIs for device communication, cryptography, and management of YubiKey features. The protocols used include FIDO2, CTAPP, OATH, PIV, SCP3, SCP11 and OTP. |
| 8 | +- **Project Type**: This is a .NET library project, consisting of multiple sub-projects. |
| 9 | +- **Languages**: The primary language is C#. |
| 10 | +- **Frameworks and Runtimes**: |
| 11 | + - .NET Framework 4.7 |
| 12 | + - .NET Standard 2.1 |
| 13 | + - .NET 6 and later |
| 14 | +- **Key Dependencies**: The solution has a dependency on the `Yubico.NativeShims` project, which provides a stable ABI for P/Invoke operations. |
| 15 | +- The project makes use of an .editorconfig file to maintain consistent coding styles across the codebase. |
| 16 | + |
| 17 | +## Build Instructions |
| 18 | + |
| 19 | +To build, test, and validate changes, follow these steps. |
| 20 | + |
| 21 | +### Building the Solution |
| 22 | + |
| 23 | +You can build the entire solution from the root of the repository using the following command: |
| 24 | + |
| 25 | +```bash |
| 26 | +dotnet build Yubico.NET.SDK.sln |
| 27 | +``` |
| 28 | + |
| 29 | +Alternatively, you can use the pre-configured build tasks in Visual Studio Code: |
| 30 | + |
| 31 | +- `build project: Yubico.Yubikey`: Builds the `Yubico.YubiKey` project. |
| 32 | +- `dotnet: build`: A general-purpose build task. |
| 33 | + |
| 34 | +### Running Tests |
| 35 | + |
| 36 | +The repository contains both unit and integration tests. |
| 37 | + |
| 38 | +- **Unit Tests**: |
| 39 | + - `run unit tests: Yubico.YubiKey`: Runs unit tests for the `Yubico.YubiKey` project. |
| 40 | + - `run unit tests: Yubico.Core`: Runs unit tests for the `Yubico.Core` project. |
| 41 | + |
| 42 | +- **Integration Tests**: |
| 43 | + - Integration tests require a YubiKey plugged in and are categorized. You can run them using the provided tasks: |
| 44 | + - `run tests: integration (Simple)` |
| 45 | + - `run tests: integration (RequiresTouch)` |
| 46 | + - `run tests: integration (Elevated)` |
| 47 | + - `run tests: integration (RequiresBio)` |
| 48 | + - `run tests: integration (RequiresSetup)` |
| 49 | + - `run tests: integration (RequiresStepDebug)` |
| 50 | + - `run tests: integration (RequiresFips)` |
| 51 | + |
| 52 | +## Project Layout |
| 53 | + |
| 54 | +- **`Yubico.Core/`**: Contains the platform abstraction layer (PAL) for OS-specific functionality, device enumeration, and utility classes. It connects to devices such as HID and Smart Cards. |
| 55 | +- **`Yubico.YubiKey/`**: The primary assembly with all the classes and types for YubiKey interaction. |
| 56 | +- **`Yubico.NativeShims/`**: An internal project that provides a stable ABI for P/Invoke operations. It is not intended for public use. This is a C project that wraps native code for easier use in .NET. |
| 57 | +- **`contributordocs/`**: Contains detailed documentation for contributors, including coding guidelines, testing procedures, and code flow information. |
| 58 | +- **`.github/workflows/`**: Contains GitHub Actions workflows for continuous integration, including builds, tests, and code analysis. |
| 59 | + |
| 60 | +## Validation and CI |
| 61 | + |
| 62 | +The repository uses GitHub Actions for continuous integration. The following workflows are run on pull requests: |
| 63 | + |
| 64 | +- `build.yml`: Builds the solution. |
| 65 | +- `build-nativeshims.yml`: Builds the native shims C project. |
| 66 | +- `test.yml`: Runs tests on macOS, Windows, and Ubuntu. |
| 67 | +- `codeql-analysis.yml`: Performs static code analysis using CodeQL. |
| 68 | + |
| 69 | +Before submitting a pull request, ensure that your changes build successfully and that all relevant tests pass. Adhering to the coding style is also crucial. |
| 70 | + |
| 71 | +## Documentation |
| 72 | + |
| 73 | +The repository includes XML documentation comments for public APIs. To generate the documentation, use the following command: |
| 74 | + |
| 75 | +```bash |
| 76 | +dotnet docfx docfx.json |
| 77 | +``` |
| 78 | + |
| 79 | +This will create a `docs` folder with the generated documentation. |
| 80 | +The published documentation can be found at `https://docs.yubico.com/yesdk/`. You may search this website for specific topics or API references. |
| 81 | + |
| 82 | +## Exceptions |
| 83 | +The exceptions strings are stored in the ./Yubico.Core/src/Resources/ExceptionMessages.resx and ./Yubico.YubiKey/src/Resources/ExceptionMessages.cs files. |
0 commit comments