Managing Secrets
This guide covers all CRUD operations for workspace secrets using the Ductape SDK.
Prerequisites
Before managing secrets, ensure you have:
- Installed the Ductape SDK
- Initialized the SDK with valid credentials
- Access to the workspace where you want to manage secrets
- TypeScript
- Java
- Go
- .NET
import Ductape from '@ductape/sdk';
const ductape = new Ductape({
accessKey: 'your-access-key',
});
await ductape.init();
import app.ductape.sdk.Ductape;
import app.ductape.sdk.core.EnvType;
import app.ductape.sdk.core.RequestContext;
RequestContext auth = new RequestContext(null, null, null, null, 'your-access-key');
Ductape ductape = new Ductape(EnvType.PRODUCTION, auth);
ductape.init();
import (
"context"
"github.com/ductape/ductape/sdk/go/core"
ductapesdk "github.com/ductape/ductape/sdk/go/ductape"
)
auth := core.NewRequestContext("", "", "", "", 'your-access-key')
client, err := ductapesdk.New(core.EnvProduction, auth)
if err != nil {
return err
}
client.init();
using Ductape.Sdk;
using Ductape.Sdk.Core;
var auth = new RequestContext(null, null, null, null, 'your-access-key', null);
var ductape = new Ductape(EnvType.Production, auth);
await ductape.init();
Create a Secret
Create a new encrypted secret in your workspace.
Parameters
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| key | string | Yes | Unique identifier for the secret | STRIPE_API_KEY |
| value | string | Yes | The secret value (will be encrypted) | sk_live_xxx... |
| description | string | No | Human-readable description | Production Stripe key |
| token_type | string | No | Type of token: api or access | api |
| scope | string[] | No | Array of app tags this secret can be used with | ['stripe_app', 'pay_app'] |
| envs | string[] | No | Array of environment slugs | ['prd', 'staging'] |
| expires_at | number | No | Unix timestamp for expiration (null = no expiry) | 1735689600 |
Example
- TypeScript
- Java
- Go
- .NET
const secret = await ductape.secrets.create({
key: 'STRIPE_API_KEY',
value: 'sk_live_51ABC123...',
description: 'Production Stripe API key for payment processing',
token_type: 'api',
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
expires_at: Math.floor(Date.now() / 1000) + (365 * 24 * 60 * 60) // 1 year from now
});
console.log('Secret created:', secret.key);
Map<String, Object> secret = ductape.secretService().create(Map<String, Object>.of(
"key", "STRIPE_API_KEY",
"value", "sk_live_51ABC123...",
"description", "Production Stripe API key for payment processing",
"token_type", "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
expires_at: Math.floor(Date.now() / 1000) + (365 * 24 * 60 * 60) // 1 year from now
));
System.out.println('Secret created:', secret.key);
secret := client.secrets.create({
"key": "STRIPE_API_KEY",
"value": "sk_live_51ABC123...",
"description": "Production Stripe API key for payment processing",
"token_type": "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
expires_at: Math.floor(Date.now() / 1000) + (365 * 24 * 60 * 60) // 1 year from now
});
fmt.Println('Secret created:', secret.key);
var secret = await ductape.secrets.create({
["key"] = "STRIPE_API_KEY",
["value"] = "sk_live_51ABC123...",
["description"] = "Production Stripe API key for payment processing",
["token_type"] = "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
expires_at: Math.floor(Date.now() / 1000) + (365 * 24 * 60 * 60) // 1 year from now
});
Console.WriteLine('Secret created:', secret.key);
Response
- TypeScript
- Java
- Go
- .NET
{
_id: '507f1f77bcf86cd799439011',
workspace_id: 'ws_123',
key: 'STRIPE_API_KEY',
description: 'Production Stripe API key for payment processing',
token_type: 'api',
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
expires_at: 1735689600,
createdAt: '2024-01-15T10:30:00.000Z',
updatedAt: '2024-01-15T10:30:00.000Z'
}
Map.of(
"_id", "507f1f77bcf86cd799439011",
"workspace_id", "ws_123",
"key", "STRIPE_API_KEY",
"description", "Production Stripe API key for payment processing",
"token_type", "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
"expires_at", 1735689600,
"createdAt", "2024-01-"15T10", 30:00.000Z",
"updatedAt", "2024-01-"15T10", 30:00.000Z"
)
{
"_id": "507f1f77bcf86cd799439011",
"workspace_id": "ws_123",
"key": "STRIPE_API_KEY",
"description": "Production Stripe API key for payment processing",
"token_type": "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
"expires_at": 1735689600,
"createdAt": "2024-01-"15T10": 30:00.000Z",
"updatedAt": "2024-01-"15T10": 30:00.000Z"
}
{
["_id"] = "507f1f77bcf86cd799439011",
["workspace_id"] = "ws_123",
["key"] = "STRIPE_API_KEY",
["description"] = "Production Stripe API key for payment processing",
["token_type"] = "api",
scope: ['stripe_payments', 'checkout_service'],
envs: ['prd', 'staging'],
["expires_at"] = 1735689600,
["createdAt"] = "2024-01-["15T10"] = 30:00.000Z",
["updatedAt"] = "2024-01-["15T10"] = 30:00.000Z"
}
List All Secrets
Retrieve all secrets in your workspace. Note: This returns metadata only, not the encrypted values.
Example
- TypeScript
- Java
- Go
- .NET
const secrets = await ductape.secrets.fetchAll();
secrets.forEach(secret => {
console.log(`${secret.key}: ${secret.description || 'No description'}`);
console.log(` Type: ${secret.token_type || 'Not specified'}`);
console.log(` Scope: ${secret.scope?.join(', ') || 'All apps'}`);
console.log(` Environments: ${secret.envs?.join(', ') || 'All environments'}`);
});
Map<String, Object> secrets = ductape.secrets.fetchAll();
secrets.forEach(secret => Map.of(
System.out.println(`$Map.of(secret.key): $Map.of(secret.description || 'No description')`);
System.out.println(` Type: $Map.of(secret.token_type || 'Not specified')`);
System.out.println(` Scope: $Map.of(secret.scope?.join(', ') || 'All apps')`);
System.out.println(` Environments: $Map.of(secret.envs?.join(', ') || 'All environments')`);
));
secrets := client.secrets.fetchAll();
secrets.forEach(secret => {
fmt.Println(`${secret.key}: ${secret.description || 'No description'}`);
fmt.Println(` Type: ${secret.token_type || 'Not specified'}`);
fmt.Println(` Scope: ${secret.scope?.join(', ') || 'All apps'}`);
fmt.Println(` Environments: ${secret.envs?.join(', ') || 'All environments'}`);
});
var secrets = await ductape.secrets.fetchAll();
secrets.forEach(secret => {
Console.WriteLine(`${secret.key}: ${secret.description || 'No description'}`);
Console.WriteLine(` Type: ${secret.token_type || 'Not specified'}`);
Console.WriteLine(` Scope: ${secret.scope?.join(', ') || 'All apps'}`);
Console.WriteLine(` Environments: ${secret.envs?.join(', ') || 'All environments'}`);
});
Response
- TypeScript
- Java
- Go
- .NET
[
{
_id: '507f1f77bcf86cd799439011',
workspace_id: 'ws_123',
key: 'STRIPE_API_KEY',
description: 'Production Stripe API key',
token_type: 'api',
scope: ['stripe_payments'],
envs: ['prd'],
expires_at: 1735689600,
createdAt: '2024-01-15T10:30:00.000Z',
updatedAt: '2024-01-15T10:30:00.000Z'
},
{
_id: '507f1f77bcf86cd799439012',
workspace_id: 'ws_123',
key: 'SENDGRID_KEY',
description: 'SendGrid API key for emails',
token_type: 'api',
scope: ['email_service'],
envs: ['dev', 'staging', 'prd'],
expires_at: null,
createdAt: '2024-01-10T08:00:00.000Z',
updatedAt: '2024-01-10T08:00:00.000Z'
}
]
[
Map.of(
"_id", "507f1f77bcf86cd799439011",
"workspace_id", "ws_123",
"key", "STRIPE_API_KEY",
"description", "Production Stripe API key",
"token_type", "api",
scope: ['stripe_payments'],
envs: ['prd'],
"expires_at", 1735689600,
"createdAt", "2024-01-"15T10", 30:00.000Z",
"updatedAt", "2024-01-"15T10", 30:00.000Z"
),
Map.of(
"_id", "507f1f77bcf86cd799439012",
"workspace_id", "ws_123",
"key", "SENDGRID_KEY",
"description", "SendGrid API key for emails",
"token_type", "api",
scope: ['email_service'],
envs: ['dev', 'staging', 'prd'],
expires_at: null,
"createdAt", "2024-01-"10T08", 00:00.000Z",
"updatedAt", "2024-01-"10T08", 00:00.000Z"
)
]
[
{
"_id": "507f1f77bcf86cd799439011",
"workspace_id": "ws_123",
"key": "STRIPE_API_KEY",
"description": "Production Stripe API key",
"token_type": "api",
scope: ['stripe_payments'],
envs: ['prd'],
"expires_at": 1735689600,
"createdAt": "2024-01-"15T10": 30:00.000Z",
"updatedAt": "2024-01-"15T10": 30:00.000Z"
},
{
"_id": "507f1f77bcf86cd799439012",
"workspace_id": "ws_123",
"key": "SENDGRID_KEY",
"description": "SendGrid API key for emails",
"token_type": "api",
scope: ['email_service'],
envs: ['dev', 'staging', 'prd'],
expires_at: null,
"createdAt": "2024-01-"10T08": 00:00.000Z",
"updatedAt": "2024-01-"10T08": 00:00.000Z"
}
]
[
{
["_id"] = "507f1f77bcf86cd799439011",
["workspace_id"] = "ws_123",
["key"] = "STRIPE_API_KEY",
["description"] = "Production Stripe API key",
["token_type"] = "api",
scope: ['stripe_payments'],
envs: ['prd'],
["expires_at"] = 1735689600,
["createdAt"] = "2024-01-["15T10"] = 30:00.000Z",
["updatedAt"] = "2024-01-["15T10"] = 30:00.000Z"
},
{
["_id"] = "507f1f77bcf86cd799439012",
["workspace_id"] = "ws_123",
["key"] = "SENDGRID_KEY",
["description"] = "SendGrid API key for emails",
["token_type"] = "api",
scope: ['email_service'],
envs: ['dev', 'staging', 'prd'],
expires_at: null,
["createdAt"] = "2024-01-["10T08"] = 00:00.000Z",
["updatedAt"] = "2024-01-["10T08"] = 00:00.000Z"
}
]
Fetch a Single Secret
Retrieve a specific secret including its decrypted value.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | The unique key of the secret |
Example
- TypeScript
- Java
- Go
- .NET
const secret = await ductape.secrets.fetch('STRIPE_API_KEY');
console.log('Key:', secret.key);
console.log('Value:', secret.value); // Decrypted value
console.log('Description:', secret.description);
Map<String, Object> secret = ductape.secrets.fetch('STRIPE_API_KEY');
System.out.println('"Key", ", secret.key);
System.out.println(""Value", ", secret.value); // Decrypted value
System.out.println("Description:', secret.description);
secret := client.secrets.fetch('STRIPE_API_KEY');
fmt.Println('"Key": ", secret.key);
fmt.Println(""Value": ", secret.value); // Decrypted value
fmt.Println("Description:', secret.description);
var secret = await ductape.secrets.fetch('STRIPE_API_KEY');
Console.WriteLine('["Key"] = ", secret.key);
Console.WriteLine("["Value"] = ", secret.value); // Decrypted value
Console.WriteLine("Description:', secret.description);
Response
- TypeScript
- Java
- Go
- .NET
{
_id: '507f1f77bcf86cd799439011',
workspace_id: 'ws_123',
key: 'STRIPE_API_KEY',
value: 'sk_live_51ABC123...', // Decrypted value
description: 'Production Stripe API key',
token_type: 'api',
scope: ['stripe_payments'],
envs: ['prd'],
expires_at: 1735689600,
createdAt: '2024-01-15T10:30:00.000Z',
updatedAt: '2024-01-15T10:30:00.000Z'
}
Map.of(
"_id", "507f1f77bcf86cd799439011",
"workspace_id", "ws_123",
"key", "STRIPE_API_KEY",
"value", "sk_live_51ABC123...", // Decrypted value
"description", "Production Stripe API key",
"token_type", "api",
scope: ['stripe_payments'],
envs: ['prd'],
"expires_at", 1735689600,
"createdAt", "2024-01-"15T10", 30:00.000Z",
"updatedAt", "2024-01-"15T10", 30:00.000Z"
)
{
"_id": "507f1f77bcf86cd799439011",
"workspace_id": "ws_123",
"key": "STRIPE_API_KEY",
"value": "sk_live_51ABC123...", // Decrypted value
"description": "Production Stripe API key",
"token_type": "api",
scope: ['stripe_payments'],
envs: ['prd'],
"expires_at": 1735689600,
"createdAt": "2024-01-"15T10": 30:00.000Z",
"updatedAt": "2024-01-"15T10": 30:00.000Z"
}
{
["_id"] = "507f1f77bcf86cd799439011",
["workspace_id"] = "ws_123",
["key"] = "STRIPE_API_KEY",
["value"] = "sk_live_51ABC123...", // Decrypted value
["description"] = "Production Stripe API key",
["token_type"] = "api",
scope: ['stripe_payments'],
envs: ['prd'],
["expires_at"] = 1735689600,
["createdAt"] = "2024-01-["15T10"] = 30:00.000Z",
["updatedAt"] = "2024-01-["15T10"] = 30:00.000Z"
}
Update a Secret
Update an existing secret's value or metadata.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | The key of the secret to update (path parameter) |
| value | string | No | New secret value (will be re-encrypted) |
| description | string | No | Updated description |
| token_type | string | No | Updated token type |
| scope | string[] | No | Updated scope array |
| envs | string[] | No | Updated environments array |
| expires_at | number | No | Updated expiration timestamp |
Example
- TypeScript
- Java
- Go
- .NET
// Update the value and extend expiration
const updated = await ductape.secrets.update('STRIPE_API_KEY', {
value: 'sk_live_51NEW_KEY...',
description: 'Rotated Stripe API key - January 2025',
expires_at: Math.floor(Date.now() / 1000) + (180 * 24 * 60 * 60) // 180 days
});
console.log('Secret updated:', updated.key);
console.log('New expiration:', new Date(updated.expires_at * 1000));
// Update the value and extend expiration
Map<String, Object> updated = ductape.secrets.update('STRIPE_API_KEY', Map.of(
"value", "sk_live_51NEW_KEY...",
"description", "Rotated Stripe API key - January 2025",
expires_at: Math.floor(Date.now() / 1000) + (180 * 24 * 60 * 60) // 180 days
));
System.out.println('Secret "updated", ", updated.key);
System.out.println("New expiration:', new Date(updated.expires_at * 1000));
// Update the value and extend expiration
updated := client.secrets.update('STRIPE_API_KEY', {
"value": "sk_live_51NEW_KEY...",
"description": "Rotated Stripe API key - January 2025",
expires_at: Math.floor(Date.now() / 1000) + (180 * 24 * 60 * 60) // 180 days
});
fmt.Println('Secret "updated": ", updated.key);
fmt.Println("New expiration:', new Date(updated.expires_at * 1000));
// Update the value and extend expiration
var updated = await ductape.secrets.update('STRIPE_API_KEY', {
["value"] = "sk_live_51NEW_KEY...",
["description"] = "Rotated Stripe API key - January 2025",
expires_at: Math.floor(Date.now() / 1000) + (180 * 24 * 60 * 60) // 180 days
});
Console.WriteLine('Secret ["updated"] = ", updated.key);
Console.WriteLine("New expiration:', new Date(updated.expires_at * 1000));
Update Metadata Only
- TypeScript
- Java
- Go
- .NET
// Update scope and environments without changing the value
const updated = await ductape.secrets.update('STRIPE_API_KEY', {
scope: ['stripe_payments', 'subscription_service', 'invoice_service'],
envs: ['dev', 'staging', 'prd']
});
// Update scope and environments without changing the value
Map<String, Object> updated = ductape.secrets.update('STRIPE_API_KEY', Map.of(
scope: ['stripe_payments', 'subscription_service', 'invoice_service'],
envs: ['dev', 'staging', 'prd']
));
// Update scope and environments without changing the value
updated := client.secrets.update('STRIPE_API_KEY', {
scope: ['stripe_payments', 'subscription_service', 'invoice_service'],
envs: ['dev', 'staging', 'prd']
});
// Update scope and environments without changing the value
var updated = await ductape.secrets.update('STRIPE_API_KEY', {
scope: ['stripe_payments', 'subscription_service', 'invoice_service'],
envs: ['dev', 'staging', 'prd']
});
Delete a Secret
Permanently delete a secret from your workspace.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | Yes | The key of the secret to delete |
Example
- TypeScript
- Java
- Go
- .NET
const deleted = await ductape.secrets.delete('OLD_API_KEY');
if (deleted) {
console.log('Secret successfully deleted');
}
Map<String, Object> deleted = ductape.secrets.delete('OLD_API_KEY');
if (deleted) Map.of(
System.out.println('Secret successfully deleted');
)
deleted := client.secrets.delete('OLD_API_KEY');
if (deleted) {
fmt.Println('Secret successfully deleted');
}
var deleted = await ductape.secrets.delete('OLD_API_KEY');
if (deleted) {
Console.WriteLine('Secret successfully deleted');
}
Revoke a Secret
Revoke a secret to disable it without deleting. The secret remains in your workspace but cannot be used.
Example
- TypeScript
- Java
- Go
- .NET
const revoked = await ductape.secrets.revoke('COMPROMISED_KEY');
if (revoked) {
console.log('Secret has been revoked');
}
Map<String, Object> revoked = ductape.secrets.revoke('COMPROMISED_KEY');
if (revoked) Map.of(
System.out.println('Secret has been revoked');
)
revoked := client.secrets.revoke('COMPROMISED_KEY');
if (revoked) {
fmt.Println('Secret has been revoked');
}
var revoked = await ductape.secrets.revoke('COMPROMISED_KEY');
if (revoked) {
Console.WriteLine('Secret has been revoked');
}
Best Practices
Naming Conventions
Use clear, descriptive names with consistent formatting:
- TypeScript
- Java
- Go
- .NET
// Good naming
'STRIPE_API_KEY_PROD'
'SENDGRID_API_KEY'
'DB_PASSWORD_STAGING'
'WEBHOOK_SECRET_GITHUB'
// Avoid
'key1'
'api_key'
'secret'
// Good naming
'STRIPE_API_KEY_PROD'
'SENDGRID_API_KEY'
'DB_PASSWORD_STAGING'
'WEBHOOK_SECRET_GITHUB'
// Avoid
'key1'
'api_key'
'secret'
// Good naming
'STRIPE_API_KEY_PROD'
'SENDGRID_API_KEY'
'DB_PASSWORD_STAGING'
'WEBHOOK_SECRET_GITHUB'
// Avoid
'key1'
'api_key'
'secret'
// Good naming
'STRIPE_API_KEY_PROD'
'SENDGRID_API_KEY'
'DB_PASSWORD_STAGING'
'WEBHOOK_SECRET_GITHUB'
// Avoid
'key1'
'api_key'
'secret'
Token Rotation
Set expiration dates and rotate secrets regularly:
- TypeScript
- Java
- Go
- .NET
// Set 90-day expiration for compliance
const secret = await ductape.secrets.create({
key: 'PCI_COMPLIANT_KEY',
value: 'sensitive_value',
expires_at: Math.floor(Date.now() / 1000) + (90 * 24 * 60 * 60)
});
// Set 90-day expiration for compliance
Map<String, Object> secret = ductape.secretService().create(Map<String, Object>.of(
"key", "PCI_COMPLIANT_KEY",
"value", "sensitive_value",
expires_at: Math.floor(Date.now() / 1000) + (90 * 24 * 60 * 60)
));
// Set 90-day expiration for compliance
secret := client.secrets.create({
"key": "PCI_COMPLIANT_KEY",
"value": "sensitive_value",
expires_at: Math.floor(Date.now() / 1000) + (90 * 24 * 60 * 60)
});
// Set 90-day expiration for compliance
var secret = await ductape.secrets.create({
["key"] = "PCI_COMPLIANT_KEY",
["value"] = "sensitive_value",
expires_at: Math.floor(Date.now() / 1000) + (90 * 24 * 60 * 60)
});
Scope Restriction
Limit secrets to only the apps that need them:
- TypeScript
- Java
- Go
- .NET
// Restrict Stripe key to payment-related apps only
const secret = await ductape.secrets.create({
key: 'STRIPE_SECRET',
value: 'sk_live_xxx',
scope: ['payment_processor', 'subscription_handler'],
envs: ['prd'] // Production only
});
// Restrict Stripe key to payment-related apps only
Map<String, Object> secret = ductape.secretService().create(Map<String, Object>.of(
"key", "STRIPE_SECRET",
"value", "sk_live_xxx",
scope: ['payment_processor', 'subscription_handler'],
envs: ['prd'] // Production only
));
// Restrict Stripe key to payment-related apps only
secret := client.secrets.create({
"key": "STRIPE_SECRET",
"value": "sk_live_xxx",
scope: ['payment_processor', 'subscription_handler'],
envs: ['prd'] // Production only
});
// Restrict Stripe key to payment-related apps only
var secret = await ductape.secrets.create({
["key"] = "STRIPE_SECRET",
["value"] = "sk_live_xxx",
scope: ['payment_processor', 'subscription_handler'],
envs: ['prd'] // Production only
});
Environment Separation
Use different secrets for different environments:
- TypeScript
- Java
- Go
- .NET
// Development
await ductape.secrets.create({
key: 'STRIPE_KEY_DEV',
value: 'sk_test_xxx',
envs: ['dev']
});
// Production
await ductape.secrets.create({
key: 'STRIPE_KEY_PROD',
value: 'sk_live_xxx',
envs: ['prd']
});
// Development
ductape.secretService().create(Map<String, Object>.of(
"key", "STRIPE_KEY_DEV",
"value", "sk_test_xxx",
envs: ['dev']
));
// Production
ductape.secretService().create(Map<String, Object>.of(
"key", "STRIPE_KEY_PROD",
"value", "sk_live_xxx",
envs: ['prd']
));
// Development
client.secrets.create({
"key": "STRIPE_KEY_DEV",
"value": "sk_test_xxx",
envs: ['dev']
});
// Production
client.secrets.create({
"key": "STRIPE_KEY_PROD",
"value": "sk_live_xxx",
envs: ['prd']
});
// Development
await ductape.secrets.create({
["key"] = "STRIPE_KEY_DEV",
["value"] = "sk_test_xxx",
envs: ['dev']
});
// Production
await ductape.secrets.create({
["key"] = "STRIPE_KEY_PROD",
["value"] = "sk_live_xxx",
envs: ['prd']
});
Error Handling
- TypeScript
- Java
- Go
- .NET
try {
const secret = await ductape.secrets.create({
key: 'MY_SECRET',
value: 'secret_value'
});
} catch (error) {
if (error.response?.status === 409) {
console.error('Secret with this key already exists');
} else if (error.response?.status === 403) {
console.error('You do not have permission to create secrets');
} else {
console.error('Failed to create secret:', error.message);
}
}
try Map.of(
Map<String, Object> secret = ductape.secretService().create(Map<String, Object>.of(
"key", "MY_SECRET",
"value", "secret_value"
));
) catch (error) Map.of(
if (error.response?.status === 409) Map.of(
console.error('Secret with this key already exists');
) else if (error.response?.status === 403) Map.of(
console.error('You do not have permission to create secrets');
) else Map.of(
console.error('Failed to create secret:', error.message);
)
)
try {
secret := client.secrets.create({
"key": "MY_SECRET",
"value": "secret_value"
});
} catch (error) {
if (error.response?.status === 409) {
console.error('Secret with this key already exists');
} else if (error.response?.status === 403) {
console.error('You do not have permission to create secrets');
} else {
console.error('Failed to create secret:', error.message);
}
}
try {
var secret = await ductape.secrets.create({
["key"] = "MY_SECRET",
["value"] = "secret_value"
});
} catch (error) {
if (error.response?.status === 409) {
console.error('Secret with this key already exists');
} else if (error.response?.status === 403) {
console.error('You do not have permission to create secrets');
} else {
console.error('Failed to create secret:', error.message);
}
}
Next Steps
- Using Secrets - Learn how to reference secrets in your integrations
- Overview - Return to the secrets overview