Infisical.Sdk 3.0.1

dotnet add package Infisical.Sdk --version 3.0.1
                    
NuGet\Install-Package Infisical.Sdk -Version 3.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Infisical.Sdk" Version="3.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Infisical.Sdk" Version="3.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Infisical.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Infisical.Sdk --version 3.0.1
                    
#r "nuget: Infisical.Sdk, 3.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Infisical.Sdk@3.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Infisical.Sdk&version=3.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Infisical.Sdk&version=3.0.1
                    
Install as a Cake Tool

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:

  1. Auth(): Handles authentication methods.
  2. 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 create
  • SecretValue (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 to false.

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 to Shared.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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