Skip to content

Commit 471a739

Browse files
committed
feat: updated README
1 parent 6cbeb1d commit 471a739

File tree

1 file changed

+44
-43
lines changed

1 file changed

+44
-43
lines changed

README.md

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,55 @@
1-
# Phase Secrets Management SDK
1+
# Phase Secrets Management SDK for Go
22

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.
3+
The Phase Secrets SDK provides a Go package for managing secrets in your application environments using the Phase service. This SDK allows you to create, retrieve, update, and delete secrets with end-to-end encryption using just a few lines of code.
44

5-
## Features:
5+
## Features
66

7-
- End-to-end encrypting secret CRUD
8-
- Cross and local env secret referencing
9-
- Built in handling of rate limiting
7+
- End-to-end encrypted secret CRUD operations
8+
- Cross-environment and local environment secret referencing
9+
- Bulk secret operations
1010

11-
### Secret referencing syntax:
11+
### Secret Referencing Syntax
1212

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. |
13+
| Reference Syntax | Environment | Path | Secret Key | Description |
14+
|-----------------------------------|------------------|-----------------------------------|------------------------|-------------------------------------------------------------|
15+
| `${KEY}` | Same environment | `/` | KEY | Local reference in the same environment and root path (/). |
16+
| `${staging.DEBUG}` | `staging` | `/` (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. |
1919

2020
## Installation
2121

2222
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.
2323

24-
### macOS
24+
This SDK uses the `sodium` package for cryptographic operations. On most systems, you'll need to install the `libsodium` library as a system dependency.
2525

26+
#### macOS
2627
```sh
2728
brew install libsodium
2829
```
2930

30-
## Fedora
31-
31+
#### Fedora
3232
```sh
3333
sudo dnf install libsodium-devel
3434
```
3535

36-
### Ubuntu and Debian
37-
36+
#### Ubuntu and Debian
3837
```sh
3938
sudo apt-get update && sudo apt-get install libsodium-dev
4039
```
4140

42-
### Arch Linux
43-
41+
#### Arch Linux
4442
```sh
4543
sudo pacman -Syu libsodium
4644
```
4745

48-
### Alpine Linux
49-
46+
#### Alpine Linux
5047
```sh
5148
sudo apk add libsodium-dev
5249
```
5350

54-
### Windows
51+
#### Windows
52+
For Windows, download pre-built binaries from the [libsodium GitHub releases page](https://github.com/jedisct1/libsodium/releases). Choose the appropriate version for your system architecture and follow the included instructions.
5553

5654
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.
5755

@@ -66,23 +64,23 @@ If you're using a package manager like `vcpkg` or `chocolatey`, you can also fin
6664
choco install libsodium
6765
```
6866

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.
67+
### Installing the SDK
7068

71-
Next, start using the Phase SDK in your Go project, install it using `go get`:
69+
To start using the Phase SDK in your Go project, install it using `go get`:
7270

7371
```bash
7472
go get github.com/phasehq/golang-sdk/phase
7573
```
7674

77-
Make sure to import the SDK in your Go files:
75+
Import the SDK in your Go files:
7876

7977
```go
8078
import "github.com/phasehq/golang-sdk/phase"
8179
```
8280

8381
## Configuration
8482

85-
Before you can interact with the Phase service, you need to initialize the SDK with your service token and the host information.
83+
Initialize the SDK with your service token and host information:
8684

8785
```go
8886
package main
@@ -94,8 +92,8 @@ import (
9492

9593
func main() {
9694
serviceToken := "pss_service:v1:....."
97-
host := "https://console.phase.dev" // Change this for a self hosted instance of Phase
98-
debug := false
95+
host := "https://console.phase.dev" // Change this for a self-hosted instance of Phase
96+
debug := false // For logging verbosity, disable in production
9997

10098
phaseClient := phase.Init(serviceToken, host, debug)
10199
if phaseClient == nil {
@@ -104,17 +102,19 @@ func main() {
104102
}
105103
```
106104

107-
## Creating a Secret
105+
## Usage
106+
107+
### Creating a Secret
108108

109-
To create new secrets, define key-value pairs, specify the environment and application name, and optionally set paths for each key.
109+
Define key-value pairs, specify the environment and application (using either name or ID), and optionally set paths for each key:
110110

111111
```go
112112
opts := phase.CreateSecretsOptions{
113113
KeyValuePairs: []map[string]string{
114114
{"API_KEY": "api_secret"},
115115
},
116116
EnvName: "Production",
117-
AppName: "MyApp",
117+
AppName: "MyApp", // Or use AppID: "app-id-here"
118118
SecretPath: map[string]string{"API_KEY": "/api/keys"}, // Optional, default path: /
119119
}
120120

@@ -124,14 +124,14 @@ if err != nil {
124124
}
125125
```
126126

127-
## Retrieving a Secret
127+
### Retrieving a Secret
128128

129-
To retrieve a secret, provide the environment name, application name, key to find, and optionally a tag and path.
129+
Provide the environment name, application (name or ID), key to find, and optionally a tag and path:
130130

131131
```go
132132
getOpts := phase.GetSecretOptions{
133133
EnvName: "Production",
134-
AppName: "MyApp",
134+
AppName: "MyApp", // Or use AppID: "app-id-here"
135135
KeyToFind: "API_KEY",
136136
}
137137

@@ -143,14 +143,14 @@ if err != nil {
143143
}
144144
```
145145

146-
## Updating a Secret
146+
### Updating a Secret
147147

148-
To update an existing secret, provide the new value along with the environment name, application name, key, and optionally the path.
148+
Provide the new value along with the environment name, application (name or ID), key, and optionally the path:
149149

150150
```go
151151
updateOpts := phase.SecretUpdateOptions{
152152
EnvName: "Production",
153-
AppName: "MyApp",
153+
AppName: "MyApp", // Or use AppID: "app-id-here"
154154
Key: "API_KEY",
155155
Value: "my_updated_api_secret",
156156
SecretPath: "/api/keys", // Optional, default path: /
@@ -162,14 +162,14 @@ if err != nil {
162162
}
163163
```
164164

165-
## Deleting a Secret
165+
### Deleting a Secret
166166

167-
To delete a secret, specify the environment name, application name, key to delete, and optionally the path.
167+
Specify the environment name, application (name or ID), key to delete, and optionally the path:
168168

169169
```go
170170
deleteOpts := phase.DeleteSecretOptions{
171171
EnvName: "Production",
172-
AppName: "MyApp",
172+
AppName: "MyApp", // Or use AppID: "app-id-here"
173173
KeyToDelete: "API_KEY",
174174
SecretPath: "/api/keys", // Optional, default path: /
175175
}
@@ -180,6 +180,7 @@ if err != nil {
180180
}
181181
```
182182

183-
For more information and advanced usage, refer to the [Phase Docs](https://docs.phase.dev/sdks/go).
183+
For more information on advanced usage, including detailed API references and best practices, please refer to the [Phase Docs](https://docs.phase.dev/sdks/go).
184+
184185

185-
---
186+
If you encounter any issues or have questions, please file an issue on the [GitHub repository](https://github.com/phasehq/golang-sdk) or contact our support team over [Slack](https://slack.phase.dev).

0 commit comments

Comments
 (0)