|
2 | 2 |
|
3 | 3 | The Phase Secrets SDK provides a Go package for managing secrets in your application environments using the Phase service. This SDK let's you create, retrieve, update, and delete secrets, with end-to-end encryption with just a few lines of code. |
4 | 4 |
|
| 5 | +## Features: |
| 6 | + |
| 7 | +- End-to-end encrypting secret CRUD |
| 8 | +- Cross and local env secret referencing |
| 9 | +- Built in handling of rate limiting |
| 10 | + |
| 11 | +### Secret referencing syntax: |
| 12 | + |
| 13 | +| Reference syntax | Environment | Path | Secret Key Being Referenced | Description | |
| 14 | +| --------------------------------- | ---------------- | --------------------------------- | --------------------------- | ------------------------------------------------------------------ | |
| 15 | +| `${KEY}` | same environment | `/ | KEY | Local reference in the same environment and path root (/). | |
| 16 | +| `${staging.DEBUG}` | `dev` | `/` (root of staging environment) | DEBUG | Cross-environment reference to a secret at the root (/). | |
| 17 | +| `${prod./frontend/SECRET_KEY}` | `prod` | `/frontend/` | SECRET_KEY | Cross-environment reference to a secret in a specific path. | |
| 18 | +| `${/backend/payments/STRIPE_KEY}` | same environment | `/backend/payments/` | STRIPE_KEY | Local reference with a specified path within the same environment. | |
| 19 | + |
5 | 20 | ## Installation |
6 | 21 |
|
7 | | -To start using the Phase SDK in your Go project, install it using `go get`: |
| 22 | +This SDK uses the `sodium` package to perform cryptographic operations, on most system you will need to install the `libsodium` library as a system dependency. Here's how you can install `libsodium` or its development packages on different platforms, including macOS, Ubuntu, Debian, Arch Linux, Alpine Linux, and Windows. |
| 23 | + |
| 24 | +### macOS |
| 25 | + |
| 26 | +```sh |
| 27 | +brew install libsodium |
| 28 | +``` |
| 29 | + |
| 30 | +## Fedora |
| 31 | + |
| 32 | +```sh |
| 33 | +sudo dnf install libsodium-devel |
| 34 | +``` |
| 35 | + |
| 36 | +### Ubuntu and Debian |
| 37 | + |
| 38 | +```sh |
| 39 | +sudo apt-get update && sudo apt-get install libsodium-dev |
| 40 | +``` |
| 41 | + |
| 42 | +### Arch Linux |
| 43 | + |
| 44 | +```sh |
| 45 | +sudo pacman -Syu libsodium |
| 46 | +``` |
| 47 | + |
| 48 | +### Alpine Linux |
| 49 | + |
| 50 | +```sh |
| 51 | +sudo apk add libsodium-dev |
| 52 | +``` |
| 53 | + |
| 54 | +### Windows |
| 55 | + |
| 56 | +On Windows, the process is a bit different due to the variety of development environments. However, you can download pre-built binaries from the official [libsodium GitHub releases page](https://github.com/jedisct1/libsodium/releases). Choose the appropriate version for your system architecture (e.g., Win32 or Win64), download it, and follow the instructions included to integrate `libsodium` with your development environment. For development with Visual Studio, you'll typically include the header files and link against the `libsodium.lib` or `libsodium.dll` file. |
| 57 | + |
| 58 | +If you're using a package manager like `vcpkg` or `chocolatey`, you can also find `libsodium` packages available for installation: |
| 59 | + |
| 60 | +- Using `vcpkg`: |
| 61 | + ```sh |
| 62 | + vcpkg install libsodium |
| 63 | + ``` |
| 64 | +- Using `chocolatey`: |
| 65 | + ```sh |
| 66 | + choco install libsodium |
| 67 | + ``` |
| 68 | + |
| 69 | +Remember, after installing the library, you might need to configure your project or environment variables to locate the `libsodium` libraries correctly, especially on Windows. |
| 70 | + |
| 71 | +Next, start using the Phase SDK in your Go project, install it using `go get`: |
8 | 72 |
|
9 | 73 | ```bash |
10 | 74 | go get github.com/phasehq/golang-sdk/phase |
@@ -116,6 +180,6 @@ if err != nil { |
116 | 180 | } |
117 | 181 | ``` |
118 | 182 |
|
119 | | -For more information and advanced usage, refer to the official Phase documentation. |
| 183 | +For more information and advanced usage, refer to the [Phase Docs](https://docs.phase.dev/sdks/go). |
120 | 184 |
|
121 | 185 | --- |
0 commit comments