Infisical.Sdk
3.0.1
dotnet add package Infisical.Sdk --version 3.0.1
NuGet\Install-Package Infisical.Sdk -Version 3.0.1
<PackageReference Include="Infisical.Sdk" Version="3.0.1" />
<PackageVersion Include="Infisical.Sdk" Version="3.0.1" />
<PackageReference Include="Infisical.Sdk" />
paket add Infisical.Sdk --version 3.0.1
#r "nuget: Infisical.Sdk, 3.0.1"
#:package Infisical.Sdk@3.0.1
#addin nuget:?package=Infisical.Sdk&version=3.0.1
#tool nuget:?package=Infisical.Sdk&version=3.0.1
Infisical .NET SDK
The Infisical .NET SDK provides a convenient way to interact with the Infisical API.
Installation
dotnet add package Infisical.Sdk
Getting Started
namespace Example;
using Infisical.Sdk;
using Infisical.Sdk.Model;
public class Program {
public static void Main(string[] args) {
var settings = new InfisicalSdkSettingsBuilder()
.WithHostUri("http://localhost:8080") // Optional. Will default to https://app.infisical.com
.Build();
var infisicalClient = new InfisicalClient(settings);
var _ = client.Auth().UniversalAuth().LoginAsync("<machine-identity-universal-auth-client-id>", "<machine-identity-universal-auth-client-secret>").Result;
var options = new ListSecretsOptions
{
SetSecretsAsEnvironmentVariables = true,
EnvironmentSlug = "<your-env-slug>",
SecretPath = "/",
ProjectId = "<your-project-id>",
};
var secrets = client.Secrets().ListAsync(options).Result;
if (secrets == null)
{
throw new Exception("Failed to fetch secrets, returned null response");
}
foreach (var secret in secrets)
{
Console.WriteLine($"{secret.SecretKey}: {secret.SecretValue}");
}
}
}
Core Methods
The SDK methods are organized into the following high-level categories:
Auth()
: Handles authentication methods.Secrets()
: Manages CRUD operations for secrets.
Auth
The Auth
component provides methods for authentication:
Universal Auth
Authenticating
var _ = await sdk.Auth().UniversalAuth().LoginAsync(
"CLIENT_ID",
"CLIENT_SECRET"
);
Parameters:
clientId
(string): The client ID of your Machine Identity.clientSecret
(string): The client secret of your Machine Identity.
Secrets
This sub-class handles operations related to secrets:
List Secrets
Task<Secret[]> ListAsync(ListSecretsOptions options);
throws InfisicalException
var options = new ListSecretsOptions
{
SetSecretsAsEnvironmentVariables = true,
EnvironmentSlug = "dev",
SecretPath = "/test",
Recursive = true,
ExpandSecretReferences = true,
ProjectId = projectId,
ViewSecretValue = true,
};
Secret[] secrets = await sdk.Secrets().ListAsync(options);
ListSecretsOptions:
ProjectId
(string): The ID of your project.EnvironmentSlug
(string): The environment in which to list secrets (e.g., "dev").SecretPath
(string): The path to the secrets.ExpandSecretReferences
(boolean): Whether to expand secret references.Recursive
(boolean): Whether to list secrets recursively.SetSecretsAsEnvironmentVariables
(boolean): Set the retrieved secrets as environment variables.
Returns:
Task<Secret[]>
: The response containing the list of secrets.
Create Secret
public Task<Secret> CreateAsync(CreateSecretOptions options);
throws InfisicalException
var options = new CreateSecretOptions
{
SecretName = "SECRET_NAME",
SecretValue = "SECRET_VALUE",
EnvironmentSlug = "<environment-slug>",
SecretPath = "/",
ProjectId = "<your-project-id>",
Metadata = new SecretMetadata[] {
new SecretMetadata {
Key = "metadata-key",
Value = "metadata-value"
}
}
};
Task<Secret> newSecret = await sdk.Secrets().CreateAsync(options);
Parameters:
SecretName
(string): The name of the secret to createSecretValue
(string): The value of the secret.ProjectId
(string): The ID of your project.EnvironmentSlug
(string): The environment in which to create the secret.SecretPath
(string, optional): The path to the secret.Metadata
(object, optional): Attach metadata to the secret.SecretComment
(string, optional): Attach a secret comment to the secret.SecretReminderNote
(string, optional): Attach a secret reminder note to the secret.SecretReminderRepeatDays
(int, optional): Set the reminder repeat days on the secret.SkipMultilineEncoding
(bool, optional): Weather or not to skip multiline encoding for the secret's value. Defaults tofalse
.
Returns:
Task<Secret>
: The created secret.
Update Secret
public Task<Secret> UpdateAsync(UpdateSecretOptions options);
throws InfisicalException
var updateSecretOptions = new UpdateSecretOptions
{
SecretName = "EXISTING_SECRET_NAME",
EnvironmentSlug = "<environment-slug>",
SecretPath = "/",
NewSecretName = "NEW_SECRET_NAME",
NewSecretValue = "new-secret-value",
ProjectId = "<project-id>",
};
Task<Secret> updatedSecret = await sdk.Secrets().UpdateAsync(options);
Parameters:
SecretName
(string): The name of the secret to update.`ProjectId
(string): The ID of your project.EnvironmentSlug
(string): The environment in which to update the secret.SecretPath
(string): The path to the secret.NewSecretValue
(string, optional): The new value of the secret.NewSecretName
(string, optional): A new name for the secret.NewMetadata
(object, optional): New metadata to attach to the secret.
Returns:
Task<Secret>
: The updated secret.
Get Secret by Name
public Secret GetAsync(GetSecretOptions options);
throws InfisicalException
var getSecretOptions = new GetSecretOptions
{
SecretName = "SECRET_NAME",
EnvironmentSlug = "<environment-slug>",
SecretPath = "/",
ProjectId = "<project-id>",
};
Secret secret = await sdk.Secrets().GetAsync(options);
Parameters:
SecretName
(string): The name of the secret to get`ProjectId
(string): The ID of your project.EnvironmentSlug
(string): The environment in which to retrieve the secret.SecretPath
(string): The path to the secret.ExpandSecretReferences
(boolean, optional): Whether to expand secret references.Type
(SecretType, optional): The type of secret to fetch. Defaults toShared
.
Returns:
Task<Secret>
: The fetched secret.
Delete Secret by Name
public Secret DeleteAsync(DeleteSecretOptions options);
throws InfisicalException
var options = new DeleteSecretOptions
{
SecretName = "SECRET_TO_DELETE",
EnvironmentSlug = "<environment-slug>",
SecretPath = "/",
ProjectId = "<project-id>",
};
Secret deletedSecret = await sdk.Secrets().DeleteAsync(options);
Parameters:
SecretName
(string): The name of the secret to delete.ProjectId
(string): The ID of your project.EnvironmentSlug
(string): The environment in which to delete the secret.SecretPath
(string, optional): The path to the secret.
Returns:
Task<Secret>
: The deleted secret.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Polly.Extensions.Http (>= 3.0.0)
- System.Text.Json (>= 8.0.5)
-
.NETStandard 2.1
- Polly.Extensions.Http (>= 3.0.0)
- System.Text.Json (>= 8.0.5)
-
net6.0
- Polly.Extensions.Http (>= 3.0.0)
- System.Text.Json (>= 8.0.5)
-
net7.0
- Polly.Extensions.Http (>= 3.0.0)
- System.Text.Json (>= 8.0.5)
-
net8.0
- Polly.Extensions.Http (>= 3.0.0)
- System.Text.Json (>= 8.0.5)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Infisical.Sdk:
Package | Downloads |
---|---|
DotNetBrightener.InfisicalVaultClient
A library that provides the abilities to retrieve secrets from Infisical vault and apply to Configuration |
|
OLT.Extensions.Configuration.Infisical
Configuration provider for the .NET Core that allows developers to use Infisical as a configuration source in their applications |
|
TRENZ.Extensions.Infisical
Adds extensions for adding Infisical to .NET applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.0.1 | 518 | 6/17/2025 |
3.0.0 | 141 | 6/17/2025 |
2.3.9 | 3,781 | 4/17/2025 |
2.3.7 | 25,183 | 9/2/2024 |
2.3.6 | 214 | 8/31/2024 |
2.3.5 | 1,556 | 8/19/2024 |
2.3.1 | 1,113 | 7/31/2024 |
2.3.0 | 110 | 7/30/2024 |
2.2.5 | 3,443 | 7/17/2024 |
2.2.4 | 163 | 7/16/2024 |
2.2.3 | 6,740 | 5/27/2024 |
2.2.2 | 190 | 5/27/2024 |
2.2.1 | 183 | 5/27/2024 |
2.2.0 | 192 | 5/25/2024 |
2.1.9 | 1,318 | 4/15/2024 |
2.1.8 | 2,038 | 2/1/2024 |
2.1.3 | 145 | 1/26/2024 |
2.1.2 | 148 | 1/24/2024 |
2.1.0 | 139 | 1/24/2024 |
2.0.7 | 193 | 1/22/2024 |
2.0.6 | 160 | 1/17/2024 |
2.0.5 | 158 | 1/15/2024 |
2.0.3 | 167 | 1/13/2024 |
1.2.2 | 167 | 1/10/2024 |
1.2.1 | 163 | 1/10/2024 |
1.2.0 | 199 | 1/10/2024 |