From b52bc3bed7f8c8c6425794577608395927917e51 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Thu, 11 Jan 2024 01:12:05 +0400
Subject: [PATCH 1/5] Added CSharp docs
---
docs/sdks/languages/csharp.mdx | 391 +++++++++++++++++++++++++++++++++
1 file changed, 391 insertions(+)
create mode 100644 docs/sdks/languages/csharp.mdx
diff --git a/docs/sdks/languages/csharp.mdx b/docs/sdks/languages/csharp.mdx
new file mode 100644
index 000000000..70c583a86
--- /dev/null
+++ b/docs/sdks/languages/csharp.mdx
@@ -0,0 +1,391 @@
+---
+title: "C#"
+icon: "C#"
+---
+
+If you're working with C#, the official [Infisical C# SDK](https://github.com/Infisical/sdk/tree/main/languages/csharp) package is the easiest way to fetch and work with secrets for your application.
+
+## Basic Usage
+
+```cs
+using Infisical.Sdk;
+
+namespace Example
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+
+ var settings = new ClientSettings
+ {
+ ClientId = "CLIENT_ID",
+ ClientSecret = "CLIENT_SECRET",
+ // SiteUrl = "http://localhost:8080", <-- This line can be omitted if you're using Infisical Cloud.
+ };
+ var infisical = new InfisicalClient(settings);
+
+ var options = new GetSecretOptions
+ {
+ SecretName = "TEST",
+ ProjectId = "PROJECT_ID",
+ Environment = "dev",
+ };
+ var secret = infisical.GetSecret(options);
+
+
+ Console.WriteLine($"The value of secret '{secret.SecretKey}', is: {secret.SecretValue}");
+ }
+ }
+}
+```
+
+This example demonstrates how to use the Infisical C# SDK in a C# application. The application retrieves a secret named `TEST` from the `dev` environment of the `PROJECT_ID` project.
+
+
+ We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting it as an environment variable would be best.
+
+
+# Installation
+
+Run `npm` to add `@infisical/sdk` to your project.
+
+```console
+$ dotnet add package Infisical.Sdk
+```
+# Configuration
+
+Import the SDK and create a client instance with your [Machine Identity](/platform/identities/universal-auth).
+
+```cs
+using Infisical.Sdk;
+
+namespace Example
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+
+ var settings = new ClientSettings
+ {
+ ClientId = "CLIENT_ID",
+ ClientSecret = "CLIENT_SECRET",
+ };
+
+ var infisical = new InfisicalClient(settings); // <-- Your SDK instance!
+ }
+ }
+}
+```
+
+### ClientSettings methods
+
+
+
+
+ Your machine identity client ID.
+
+
+ Your machine identity client secret.
+
+
+
+ An access token obtained from the machine identity login endpoint.
+
+
+
+ Time-to-live (in seconds) for refreshing cached secrets.
+ If manually set to 0, caching will be disabled, this is not recommended.
+
+
+
+ Your self-hosted absolute site URL including the protocol (e.g. `https://app.infisical.com`)
+
+
+
+
+
+### Caching
+
+To reduce the number of API requests, the SDK temporarily stores secrets it retrieves. By default, a secret remains cached for 5 minutes after it's first fetched. Each time it's fetched again, this 5-minute timer resets. You can adjust this caching duration by setting the "cacheTTL" option when creating the client.
+
+## Working with Secrets
+
+### client.ListSecrets(options)
+
+```cs
+var options = new ListSecretsOptions
+{
+ ProjectId = "PROJECT_ID",
+ Environment = "dev",
+ Path = "/foo/bar",
+ AttachToProcessEnv = false,
+};
+
+var secrets = infisical.ListSecrets(options);
+```
+
+Retrieve all secrets within the Infisical project and environment that client is connected to
+
+#### Parameters
+
+
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+
+ The project ID where the secret lives in.
+
+
+
+ The path from where secrets should be fetched from.
+
+
+
+ Whether or not to set the fetched secrets to the process environment. If true, you can access the secrets like so `System.getenv("SECRET_NAME")`.
+
+
+
+ Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)
+
+
+
+
+
+### client.GetSecret(options)
+
+```cs
+var options = new GetSecretOptions
+ {
+ SecretName = "AAAA",
+ ProjectId = "659c781eb2d4fe3e307b77bd",
+ Environment = "dev",
+ };
+var secret = infisical.GetSecret(options);
+```
+
+Retrieve a secret from Infisical.
+
+By default, `GetSecret()` fetches and returns a shared secret.
+
+#### Parameters
+
+
+
+
+ The key of the secret to retrieve.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be fetched from.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.CreateSecret(options)
+
+```cs
+var options = new CreateSecretOptions {
+ Environment = "dev",
+ ProjectId = "PROJECT_ID",
+
+ SecretName = "NEW_SECRET",
+ SecretValue = "NEW_SECRET_VALUE",
+ SecretComment = "This is a new secret",
+};
+
+var newSecret = infisical.CreateSecret(options);
+```
+
+Create a new secret in Infisical.
+
+#### Parameters
+
+
+
+
+ The key of the secret to create.
+
+
+ The value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be created.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.UpdateSecret(options)
+
+```cs
+var options = new UpdateSecretOptions {
+ Environment = "dev",
+ ProjectId = "PROJECT_ID",
+
+ SecretName = "SECRET_TO_UPDATE",
+ SecretValue = "NEW VALUE"
+};
+
+var updatedSecret = infisical.UpdateSecret(options);
+```
+
+Update an existing secret in Infisical.
+
+#### Parameters
+
+
+
+
+ The key of the secret to update.
+
+
+ The new value of the secret.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be updated.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+### client.DeleteSecret(options)
+
+```cs
+var options = new DeleteSecretOptions
+{
+ Environment = "dev",
+ ProjectId = "PROJECT_ID",
+ SecretName = "NEW_SECRET",
+};
+
+var deletedSecret = infisical.DeleteSecret(options);
+```
+
+Delete a secret in Infisical.
+
+#### Parameters
+
+
+
+
+ The key of the secret to update.
+
+
+ The project ID where the secret lives in.
+
+
+ The slug name (dev, prod, etc) of the environment from where secrets should be fetched from.
+
+
+ The path from where secret should be deleted.
+
+
+ The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "shared".
+
+
+
+
+## Cryptography
+
+### Create a symmetric key
+
+Create a base64-encoded, 256-bit symmetric key to be used for encryption/decryption.
+
+```cs
+var key = infisical.CreateSymmetricKey();
+```
+
+#### Returns (string)
+`key` (string): A base64-encoded, 256-bit symmetric key, that can be used for encryption/decryption purposes.
+
+### Encrypt symmetric
+```cs
+var options = new EncryptSymmetricOptions
+{
+ Plaintext = "Infisical is awesome!",
+ Key = key,
+};
+
+var encryptedData = infisical.EncryptSymmetric(options);
+```
+
+#### Parameters
+
+
+
+
+ The plaintext you want to encrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+
+
+#### Returns (object)
+`Tag` (string): A base64-encoded, 128-bit authentication tag.
+`Iv` (string): A base64-encoded, 96-bit initialization vector.
+`CipherText` (string): A base64-encoded, encrypted ciphertext.
+
+### Decrypt symmetric
+```cs
+var decryptOptions = new DecryptSymmetricOptions
+{
+ Key = key,
+ Ciphertext = encryptedData.Ciphertext,
+ Iv = encryptedData.Iv,
+ Tag = encryptedData.Tag,
+};
+
+var decryptedPlaintext = infisical.DecryptSymmetric(decryptOptions);
+```
+
+#### Parameters
+
+
+
+ The ciphertext you want to decrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+ The initialization vector to use for decryption.
+
+
+ The authentication tag to use for decryption.
+
+
+
+
+#### Returns (string)
+`Plaintext` (string): The decrypted plaintext.
+
From 5a2516e0a7947c463641d12e7134e54b90aa74e5 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Thu, 11 Jan 2024 01:12:17 +0400
Subject: [PATCH 2/5] Removed unsupported languages to remove clutter
---
docs/sdks/languages/go.mdx | 8 --------
docs/sdks/languages/php.mdx | 8 --------
docs/sdks/languages/ruby.mdx | 8 --------
docs/sdks/languages/rust.mdx | 8 --------
4 files changed, 32 deletions(-)
delete mode 100644 docs/sdks/languages/go.mdx
delete mode 100644 docs/sdks/languages/php.mdx
delete mode 100644 docs/sdks/languages/ruby.mdx
delete mode 100644 docs/sdks/languages/rust.mdx
diff --git a/docs/sdks/languages/go.mdx b/docs/sdks/languages/go.mdx
deleted file mode 100644
index 3baca3b0f..000000000
--- a/docs/sdks/languages/go.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: "Go"
-icon: "golang"
----
-
-Coming soon.
-
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/php.mdx b/docs/sdks/languages/php.mdx
deleted file mode 100644
index bf861acb4..000000000
--- a/docs/sdks/languages/php.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: "PHP"
-icon: "php"
----
-
-Coming soon.
-
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/ruby.mdx b/docs/sdks/languages/ruby.mdx
deleted file mode 100644
index 2836f7043..000000000
--- a/docs/sdks/languages/ruby.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: "Ruby"
-icon: "gem"
----
-
-Coming soon.
-
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
diff --git a/docs/sdks/languages/rust.mdx b/docs/sdks/languages/rust.mdx
deleted file mode 100644
index d535ad527..000000000
--- a/docs/sdks/languages/rust.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: "Rust"
-icon: "rust"
----
-
-Coming soon.
-
-Star our GitHub repository to stay updated [cross-language SDK](https://github.com/Infisical/sdk) GitHub repository to stay updated.
From 2069ac1554b90a9fa3b0379af4493f4bab827643 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Thu, 11 Jan 2024 01:12:26 +0400
Subject: [PATCH 3/5] Added CSharp and removed unfinished SDK's
---
docs/sdks/overview.mdx | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdx
index aca673c49..28631a77d 100644
--- a/docs/sdks/overview.mdx
+++ b/docs/sdks/overview.mdx
@@ -18,17 +18,8 @@ From local development to production, Infisical SDKs provide the easiest way for
Manage secrets for your Java application on demand
-
- Manage secrets for your Ruby application on demand
-
-
- Manage secrets for your Go application on demand
-
-
- Manage secrets for your Rust application on demand
-
-
- Manage secrets for your PHP application on demand
+
+ Manage secrets for your C#/.NET application on demand
From 74644fd8bb5b5084ba098937ca92fb1b93c01121 Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Thu, 11 Jan 2024 01:12:38 +0400
Subject: [PATCH 4/5] Added cryptography docs and fixed formatting
---
docs/sdks/languages/java.mdx | 83 +++++++++++++++++++++++--
docs/sdks/languages/node.mdx | 80 ++++++++++++++++++++++--
docs/sdks/languages/python.mdx | 110 +++++++++++++++++++++++++++++++--
3 files changed, 257 insertions(+), 16 deletions(-)
diff --git a/docs/sdks/languages/java.mdx b/docs/sdks/languages/java.mdx
index 7c3ec5599..36c339c9b 100644
--- a/docs/sdks/languages/java.mdx
+++ b/docs/sdks/languages/java.mdx
@@ -121,7 +121,7 @@ SecretElement[] secrets = client.listSecrets(options);
Retrieve all secrets within the Infisical project and environment that client is connected to
-### Methods
+#### Methods
@@ -165,7 +165,7 @@ Retrieve a secret from Infisical.
By default, `getSecret()` fetches and returns a shared secret.
-### Methods
+#### Methods
@@ -203,7 +203,7 @@ CreateSecretResponseSecret newSecret = client.createSecret(createOptions);
Create a new secret in Infisical.
-### Methods
+#### Methods
@@ -245,7 +245,7 @@ UpdateSecretResponseSecret updatedSecret = client.updateSecret(options);
Update an existing secret in Infisical.
-### Methods
+#### Methods
@@ -286,7 +286,7 @@ DeleteSecretResponseSecret deletedSecret = client.deleteSecret(options);
Delete a secret in Infisical.
-### Methods
+#### Methods
@@ -307,3 +307,76 @@ Delete a secret in Infisical.
+
+## Cryptography
+
+### Create a symmetric key
+
+Create a base64-encoded, 256-bit symmetric key to be used for encryption/decryption.
+
+```java
+String key = client.createSymmetricKey();
+```
+
+#### Returns (string)
+`key` (string): A base64-encoded, 256-bit symmetric key, that can be used for encryption/decryption purposes.
+
+### Encrypt symmetric
+```java
+EncryptSymmetricOptions options = new EncryptSymmetricOptions();
+options.setKey(key);
+options.setPlaintext("Infisical is awesome!");
+
+EncryptSymmetricResponse encryptedData = client.encryptSymmetric(options);
+```
+
+#### Methods
+
+
+
+
+ The plaintext you want to encrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+
+
+#### Returns (object)
+`tag (getTag())` (string): A base64-encoded, 128-bit authentication tag.
+`iv (getIv())` (string): A base64-encoded, 96-bit initialization vector.
+`ciphertext (getCipherText())` (string): A base64-encoded, encrypted ciphertext.
+
+
+### Decrypt symmetric
+```java
+DecryptSymmetricOptions decryptOptions = new DecryptSymmetricOptions();
+decryptOptions.setKey(key);
+decryptOptions.setCiphertext(encryptedData.getCiphertext());
+decryptOptions.setIv(encryptedData.getIv());
+decryptOptions.setTag(encryptedData.getTag());
+
+String decryptedString = client.decryptSymmetric(decryptOptions);
+```
+
+#### Methods
+
+
+
+ The ciphertext you want to decrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+ The initialization vector to use for decryption.
+
+
+ The authentication tag to use for decryption.
+
+
+
+
+#### Returns (string)
+`Plaintext` (string): The decrypted plaintext.
\ No newline at end of file
diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx
index 9179e2f9d..3e6b0cae9 100644
--- a/docs/sdks/languages/node.mdx
+++ b/docs/sdks/languages/node.mdx
@@ -84,12 +84,12 @@ Import the SDK and create a client instance with your [Machine Identity](/docume
clientSecret: "YOUR_CLIENT_SECRET",
logLevel: LogLevel.Error
});
- ````
+ ```
-### Parameters
+#### Parameters
@@ -138,7 +138,7 @@ const secrets = await client.listSecrets({
Retrieve all secrets within the Infisical project and environment that client is connected to
-### Parameters
+#### Parameters
@@ -180,7 +180,7 @@ Retrieve a secret from Infisical.
By default, `getSecret()` fetches and returns a shared secret.
-### Parameters
+#### Parameters
@@ -255,7 +255,7 @@ const updatedApiKey = await client.updateSecret({
Update an existing secret in Infisical.
-### Parameters
+#### Parameters
@@ -315,3 +315,73 @@ Delete a secret in Infisical.
+
+## Cryptography
+
+### Create a symmetric key
+
+Create a base64-encoded, 256-bit symmetric key to be used for encryption/decryption.
+
+```js
+const key = client.createSymmetricKey();
+```
+
+#### Returns (string)
+`key` (string): A base64-encoded, 256-bit symmetric key, that can be used for encryption/decryption purposes.
+
+### Encrypt symmetric
+```js
+const { iv, tag, ciphertext } = await client.encryptSymmetric({
+ key: key,
+ plaintext: "Infisical is awesome!",
+})
+```
+
+#### Parameters
+
+
+
+
+ The plaintext you want to encrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+
+
+#### Returns (object)
+`tag` (string): A base64-encoded, 128-bit authentication tag.
+`iv` (string): A base64-encoded, 96-bit initialization vector.
+`ciphertext` (string): A base64-encoded, encrypted ciphertext.
+
+### Decrypt symmetric
+```js
+const decryptedString = await client.decryptSymmetric({
+ key: key,
+ iv: iv,
+ tag: tag,
+ ciphertext: ciphertext,
+});
+```
+
+#### Parameters
+
+
+
+ The ciphertext you want to decrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+ The initialization vector to use for decryption.
+
+
+ The authentication tag to use for decryption.
+
+
+
+
+#### Returns (string)
+`plaintext` (string): The decrypted plaintext.
diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx
index 8420e6e77..320dcb49c 100644
--- a/docs/sdks/languages/python.mdx
+++ b/docs/sdks/languages/python.mdx
@@ -60,7 +60,7 @@ client = InfisicalClient(ClientSettings(
))
```
-### Parameters
+#### Parameters
@@ -110,7 +110,7 @@ client.listSecrets(options=ListSecretsOptions(
Retrieve all secrets within the Infisical project and environment that client is connected to
-### Parameters
+#### Parameters
@@ -149,7 +149,7 @@ value = secret.secret_value # get its value
By default, `getSecret()` fetches and returns a shared secret. If not found, it returns a personal secret.
-### Parameters
+#### Parameters
@@ -187,7 +187,7 @@ api_key = client.createSecret(options=CreateSecretOptions(
Create a new secret in Infisical.
-### Parameters
+#### Parameters
@@ -225,7 +225,7 @@ client.updateSecret(options=UpdateSecretOptions(
Update an existing secret in Infisical.
-### Parameters
+#### Parameters
@@ -262,7 +262,7 @@ client.deleteSecret(options=DeleteSecretOptions(
Delete a secret in Infisical.
-### Parameters
+#### Parameters
@@ -283,3 +283,101 @@ Delete a secret in Infisical.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Cryptography
+
+### Create a symmetric key
+
+Create a base64-encoded, 256-bit symmetric key to be used for encryption/decryption.
+
+```py
+key = client.createSymmetricKey()
+```
+
+#### Returns (string)
+`key` (string): A base64-encoded, 256-bit symmetric key, that can be used for encryption/decryption purposes.
+
+### Encrypt symmetric
+```py
+encryptOptions = EncryptSymmetricOptions(
+ key=key,
+ plaintext="Infisical is awesome!"
+)
+
+encryptedData = client.encryptSymmetric(encryptOptions)
+```
+
+#### Parameters
+
+
+
+
+ The plaintext you want to encrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+
+
+#### Returns (object)
+`tag` (string): A base64-encoded, 128-bit authentication tag.
+`iv` (string): A base64-encoded, 96-bit initialization vector.
+`ciphertext` (string): A base64-encoded, encrypted ciphertext.
+
+### Decrypt symmetric
+```py
+decryptOptions = DecryptSymmetricOptions(
+ ciphertext=encryptedData.ciphertext,
+ iv=encryptedData.iv,
+ tag=encryptedData.tag,
+ key=key
+)
+
+decryptedString = client.decryptSymmetric(decryptOptions)
+
+
+```
+
+#### Parameters
+
+
+
+ The ciphertext you want to decrypt.
+
+
+ The symmetric key to use for encryption.
+
+
+ The initialization vector to use for decryption.
+
+
+ The authentication tag to use for decryption.
+
+
+
+
+#### Returns (string)
+`plaintext` (string): The decrypted plaintext.
From e88b0ad3c40691994db04ebd50a34b6a873aae1a Mon Sep 17 00:00:00 2001
From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com>
Date: Thu, 11 Jan 2024 01:25:10 +0400
Subject: [PATCH 5/5] Update python.mdx
---
docs/sdks/languages/python.mdx | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx
index 320dcb49c..68cabaee9 100644
--- a/docs/sdks/languages/python.mdx
+++ b/docs/sdks/languages/python.mdx
@@ -284,28 +284,6 @@ Delete a secret in Infisical.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
## Cryptography
### Create a symmetric key