Infisical.Sdk
3.0.2
See the version list below for details.
dotnet add package Infisical.Sdk --version 3.0.2
NuGet\Install-Package Infisical.Sdk -Version 3.0.2
<PackageReference Include="Infisical.Sdk" Version="3.0.2" />
<PackageVersion Include="Infisical.Sdk" Version="3.0.2" />
<PackageReference Include="Infisical.Sdk" />
paket add Infisical.Sdk --version 3.0.2
#r "nuget: Infisical.Sdk, 3.0.2"
#:package Infisical.Sdk@3.0.2
#addin nuget:?package=Infisical.Sdk&version=3.0.2
#tool nuget:?package=Infisical.Sdk&version=3.0.2
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 (.NET)
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 _ = infisicalClient.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 = infisicalClient.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}");
}
}
}
Getting Started (Visual Basic)
Imports Infisical.Sdk
Imports Infisical.Sdk.Model
Module Program
Sub Main(args As String())
Dim settings = New InfisicalSdkSettingsBuilder() _
.WithHostUri("https://app.infisical.com") _
.Build()
Dim infisicalClient As New InfisicalClient(settings)
Dim authResult = infisicalClient.Auth().UniversalAuth() _
.LoginAsync("<machine-identity-universal-auth-client-id>", "machine-identity-universal-auth-client-secret").Result
Dim options As New ListSecretsOptions With {
.SetSecretsAsEnvironmentVariables = True,
.EnvironmentSlug = "<your-env-slug>",
.SecretPath = "/",
.ProjectId = "<your-project-id>"
}
Dim secrets = infisicalClient.Secrets().ListAsync(options).Result
For Each secret In secrets
Console.WriteLine(secret.SecretKey)
if Environment.GetEnvironmentVariable(secret.SecretKey) IsNot Nothing Then
Console.WriteLine("{0} found on environment variables", secret.SecretKey)
End If
Next
End Sub
End Module
Core Methods
The SDK methods are organized into the following high-level categories:
Auth(): Handles authentication methods.Secrets(): Manages CRUD operations for secrets.Pki(): Programmatically interact with the Infisical PKI.Subscribers(): Manage PKI Subscribers.
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()
The Secrets() sub-class handles operations related to the Infisical secrets management product.
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.
Pki().Subscribers()
The Pki().Subscribers() sub-class is used to programmatically interact with the Infisical PKI product line. Currently only issuing new certificates and retrieving the latest certificate bundle from a subscriber is supported. More widespread support for the PKI product is coming to the .NET SDK in the near future.
Issue a new certificate
public async Task<SubscriberIssuedCertificate> IssueCertificateAsync(RetrieveLatestCertificateBundleOptions options);
throws InfisicalException
var options = new IssueCertificateOptions
{
SubscriberName = "<subscriber-name>"
ProjectId = "<your-project-id>",
};
SubscriberIssuedCertificate newCertificate = await sdk.Pki().Subscribers().IssueCertificateAsync(options);
Parameters:
SubscriberName(string): The name of the subscriber to create a certificate for.ProjectId(string): The ID of PKI project.
Returns:
Task<SubscriberIssuedCertificate>: The newly issued certificate along with it's credentials for the specified subscriber.
Retrieve latest certificate bundle
public async Task<CertificateBundle> RetrieveLatestCertificateBundleAsync(RetrieveLatestCertificateBundleOptions options)
throws InfisicalException
var options = new RetrieveLatestCertificateBundleOptions
{
SubscriberName = "<subscriber-name>",
ProjectId = "<your-project-id>",
};
CertificateBundle latestCertificate = await sdk.Pki().Subscribers().RetrieveLatestCertificateBundleAsync(options);
Parameters:
SubscriberName(string): The name of the subscriber to retrieve the latest certificate bundle forProjectId(string): The ID of PKI project.
Returns:
Task<CertificateBundle>: The latest certificate bundle for the specified subscriber.
| 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 (4)
Showing the top 4 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. |
|
|
BTW.SecretsProvider
Extensiones para cargar configuraciones locales de docker secrets e integrar Infisical en proyectos .NET. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.4 | 13,359 | 11/19/2025 |
| 3.0.3 | 10,203 | 9/12/2025 |
| 3.0.2 | 1,787 | 8/13/2025 |
| 3.0.1 | 4,752 | 6/17/2025 |
| 3.0.0 | 219 | 6/17/2025 |
| 2.3.9 | 12,820 | 4/17/2025 |
| 2.3.7 | 35,036 | 9/2/2024 |
| 2.3.6 | 307 | 8/31/2024 |
| 2.3.5 | 1,708 | 8/19/2024 |
| 2.3.1 | 1,220 | 7/31/2024 |
| 2.3.0 | 175 | 7/30/2024 |
| 2.2.5 | 3,520 | 7/17/2024 |
| 2.2.4 | 243 | 7/16/2024 |
| 2.2.3 | 7,067 | 5/27/2024 |
| 2.2.2 | 268 | 5/27/2024 |
| 2.2.1 | 272 | 5/27/2024 |
| 2.2.0 | 285 | 5/25/2024 |
| 2.1.9 | 1,398 | 4/15/2024 |
| 2.1.8 | 2,158 | 2/1/2024 |
| 2.1.3 | 208 | 1/26/2024 |