diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2833057 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# How to Contribute + +Our [Contributing Guidelines](https://contributing.bitwarden.com/contributing/) are located in our [Contributing Documentation](https://contributing.bitwarden.com/). The documentation also includes recommended tooling, code style tips, and lots of other great information to get you started. diff --git a/README.md b/README.md index e6924c0..318a99f 100644 --- a/README.md +++ b/README.md @@ -218,41 +218,6 @@ keyConnectorSettings__certificate__vaultSecretDataKey={SecretDataKey} keyConnectorSettings__certificate__vaultSecretFilePassword={SecretFilePassword} ``` -## Build/Run +## Developer Documentation -### Requirements - -- [.NET Core 5.0 SDK](https://www.microsoft.com/net/download/core) - -*These dependencies are free to use.* - -### Format - -We use dotnet-format to apply our code style. - -```powershell -dotnet tool restore -dotnet tool run dotnet-format -``` - -### MacOS - -MacOS requires updated SSL libraries, otherwise you will receive the error "No usable version of libssl was found". - -1. Install [Homebrew](https://brew.sh/) -2. Install the OpenSSL package: - ```bash - brew install openssl - ``` -3. Set the required environment variables to point to the OpenSSL libraries: - ```bash - echo 'DYLD_LIBRARY_PATH="/usr/local/opt/openssl@1.1/lib"' >> ~/.zshrc - ``` -4. If you are running the Key Connector from a terminal, restart your terminal to make sure the updated `.zshrc` settings are applied - -### Recommended Development Tooling - -- [Visual Studio](https://www.visualstudio.com/vs/) (Windows and macOS) -- [Visual Studio Code](https://code.visualstudio.com/) (other) - -*These tools are free to use.* +Please refer to the [Key Connector section](https://contributing.bitwarden.com/enterprise/key-connector/) of the [Contributing Documentation](https://contributing.bitwarden.com/) for build instructions, recommended tooling, code style tips, and lots of other great information to get you started. diff --git a/dev/.gitignore b/dev/.gitignore new file mode 100644 index 0000000..e2d699a --- /dev/null +++ b/dev/.gitignore @@ -0,0 +1,7 @@ +secrets.json +database.json + +# Development keys +*.key +*.crt +*.pfx diff --git a/dev/secrets.json.example b/dev/secrets.json.example new file mode 100644 index 0000000..0a68bea --- /dev/null +++ b/dev/secrets.json.example @@ -0,0 +1,16 @@ +{ + "keyConnectorSettings": { + "database": { + "provider": "json", + "jsonFilePath": "{pathToThisRepository}/dev/database.json" + }, + "rsaKey": { + "provider": "certificate" + }, + "certificate": { + "provider": "filesystem", + "filesystemPath": "{pathToThisRepository}/dev/bwkc.pfx", + "filesystemPassword": "{Password}" + } + } +} diff --git a/dev/setup_secrets.ps1 b/dev/setup_secrets.ps1 new file mode 100644 index 0000000..13789bf --- /dev/null +++ b/dev/setup_secrets.ps1 @@ -0,0 +1,29 @@ +#!/usr/bin/env pwsh +# Helper script for applying the same user secrets to each project +# Duplicated from the server repo +param ( + [bool]$clear, + [Parameter(ValueFromRemainingArguments = $true, Position=1)] + $cmdArgs +) + +if (!(Test-Path "secrets.json")) { + Write-Warning "No secrets.json file found, please copy and modify the provided example"; + exit; +} + +if ($clear -eq $true) { + Write-Output "Deleting all existing user secrets" +} + +$projects = @{ + KeyConnector = "../src/KeyConnector" +} + +foreach ($key in $projects.keys) { + if ($clear -eq $true) { + dotnet user-secrets clear -p $projects[$key] + } + $output = Get-Content secrets.json | & dotnet user-secrets set -p $projects[$key] + Write-Output "$output - $key" +}