Secrets Manager Installation
Before you begin
You'll need:
- A ByteHide account and project token
- Java 8 or higher installed
- Maven or Gradle build tool
Installation Options
Add the ByteHide Secrets SDK to your project using one of these methods:
Maven
Add to your pom.xml:
XML
<dependency>
<groupId>com.bytehide</groupId>
<artifactId>bytehide-secrets</artifactId>
<version>1.0.0</version>
</dependency><dependency>
<groupId>com.bytehide</groupId>
<artifactId>bytehide-secrets</artifactId>
<version>1.0.0</version>
</dependency>Gradle
Add to your build.gradle:
GRADLE
implementation 'com.bytehide:bytehide-secrets:1.0.0'implementation 'com.bytehide:bytehide-secrets:1.0.0'Manual Installation
Download the JAR from the releases page and add it to your classpath.
Initialize the SDK
Once installed, you need to initialize the SDK with your project token.
Using Environment Variables (Recommended)
Set up environment variables and the SDK will auto-initialize:
Java
import com.bytehide.secrets.SecretsManager;
// Environment variables:
// BYTEHIDE_SECRETS_TOKEN=f8118003-c24d-4f6f-9057-1a0d0b89ef55
// BYTEHIDE_SECRETS_ENVIRONMENT=production
// The SDK will read from environment variables automatically
String apiKey = SecretsManager.get("API_KEY");import com.bytehide.secrets.SecretsManager;
// Environment variables:
// BYTEHIDE_SECRETS_TOKEN=f8118003-c24d-4f6f-9057-1a0d0b89ef55
// BYTEHIDE_SECRETS_ENVIRONMENT=production
// The SDK will read from environment variables automatically
String apiKey = SecretsManager.get("API_KEY");Direct Initialization
For testing or development scenarios, you can initialize directly with a token:
Java
import com.bytehide.secrets.SecretsManager;
// Not recommended for production - use environment variables instead
SecretsManager.unsecureInitialize("f8118003-c24d-4f6f-9057-1a0d0b89ef55", "production");import com.bytehide.secrets.SecretsManager;
// Not recommended for production - use environment variables instead
SecretsManager.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
Bash
# Linux/macOS
export BYTEHIDE_SECRETS_TOKEN=your-token-here
export BYTEHIDE_SECRETS_ENVIRONMENT=development
# Windows (Command Prompt)
set BYTEHIDE_SECRETS_TOKEN=your-token-here
set BYTEHIDE_SECRETS_ENVIRONMENT=development
# 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
# Windows (Command Prompt)
set BYTEHIDE_SECRETS_TOKEN=your-token-here
set BYTEHIDE_SECRETS_ENVIRONMENT=development
# Windows (PowerShell)
$env:BYTEHIDE_SECRETS_TOKEN = "your-token-here"
$env:BYTEHIDE_SECRETS_ENVIRONMENT = "development"Production Environment
In production, set these variables through your hosting platform:
- AWS Elastic Beanstalk: Environment Properties
- Docker: Environment flags
- Kubernetes: ConfigMaps or Secrets
- Spring Boot:
application.propertiesorapplication.yml
Verify Installation
After initializing the SDK, you can verify it's working by accessing a test secret:
Java
import com.bytehide.secrets.SecretsManager;
public class VerifySetup {
public static void main(String[] args) {
try {
// Attempt to get a secret
String secret = SecretsManager.get("test");
System.out.println("Secret retrieved successfully!");
} catch (Exception ex) {
System.out.println("Error: " + ex.getMessage());
}
}
}import com.bytehide.secrets.SecretsManager;
public class VerifySetup {
public static void main(String[] args) {
try {
// Attempt to get a secret
String secret = SecretsManager.get("test");
System.out.println("Secret retrieved successfully!");
} catch (Exception ex) {
System.out.println("Error: " + ex.getMessage());
}
}
}