/

Secrets Manager Installation

Before you begin

You'll need:

  • A ByteHide account and project token
  • .NET SDK installed - Bytehide.ToolBox (supports .NET Core 2+, .NET Framework 4.6.1+, .NET 5+, Unity 2018.1+, Xamarin, .NET MAUI)

Installation Options

Add the ByteHide Secrets SDK to your project using one of these methods:

NuGet Package Manager

Install-Package Bytehide.ToolBox

.NET CLI

dotnet add package Bytehide.ToolBox --version 2.0.0.7

PackageReference

<PackageReference Include="Bytehide.ToolBox" Version="2.0.0.7" />

Initialize the SDK

Once installed, you need to initialize the SDK with your project token.

Set up environment variables and use the simplified initialization:

using Bytehide.ToolBox;
using Bytehide.ToolBox.Secrets;

// Environment variables:
// BYTEHIDE_SECRETS_TOKEN=f8118003-c24d-4f6f-9057-1a0d0b89ef55
// BYTEHIDE_SECRETS_ENVIRONMENT=production

// The SDK will read from environment variables automatically
ManagerSecrets.Initialize();

Direct Initialization

For testing or development scenarios, you can initialize directly with a token:

using Bytehide.ToolBox;
using Bytehide.ToolBox.Secrets;

// Not recommended for production - use environment variables instead
ManagerSecrets.UnsecureInitialize("f8118003-c24d-4f6f-9057-1a0d0b89ef55", "production");

Security Notice

Never hardcode your token in source code. For production environments, always use environment variables or a secure vault.

Environment Variables Setup

Development Environment

# Windows (PowerShell)
$env:BYTEHIDE_SECRETS_TOKEN = "your-token-here"
$env:BYTEHIDE_SECRETS_ENVIRONMENT = "development"

# Linux/MacOS
export BYTEHIDE_SECRETS_TOKEN=your-token-here
export BYTEHIDE_SECRETS_ENVIRONMENT=development

Production Environment

In production, set these variables through your hosting platform:

  • Azure App Service: Application Settings
  • AWS Lambda: Environment Variables
  • Docker: Environment flags
  • Kubernetes: ConfigMaps or Secrets

Verify Installation

After initializing the SDK, you can verify it's working by accessing a test secret:

using Bytehide.ToolBox;
using Bytehide.ToolBox.Secrets;

// Initialize the SDK
ManagerSecrets.Initialize();

try {
    // Attempt to get a secret
    var secret = Products.Secrets.Get("test");
    Console.WriteLine("Secret retrieved successfully!");
} catch (Exception ex) {
    Console.WriteLine($"Error: {ex.Message}");
}

Next Steps

Previous
CI/CD Integration