Skip to main content

Vault Client

The Vault client provides secure credential management with AES-256-GCM encryption. Store usernames, passwords, and other sensitive data for use in workflow executions.
All sensitive fields (username, password, tfa_secret) are automatically encrypted by the SDK before being sent to CloudCruise servers. Plaintext credentials are never transmitted or stored.

Setup

import { CloudCruise } from 'cloudcruise';

const client = new CloudCruise({
  apiKey: "your-api-key",
  encryptionKey: "your-encryption-key",
});
The encryptionKey is required for vault operations. Get it from CloudCruise Settings.

Creating a Vault Entry

Use client.vault.create() to store new credentials:
const entry = await client.vault.create(
  "https://example.com",           // domain
  "unique-user-id",                // permissioned_user_id
  {
    user_name: "[email protected]",
    password: "secret-password",
    user_alias: "John's Account",
  }
);

console.log("Created vault entry:", entry.id);

Parameters

ParameterTypeRequiredDescription
domainstringYesTarget domain for the credentials (e.g., https://example.com)
permissioned_user_idstringYesUnique identifier to reference this entry in workflows
optionsobjectNoAdditional fields (see below)

Options Object

FieldTypeDescription
user_namestringUsername or email for authentication
passwordstringPassword credential
user_aliasstringHuman-readable label for the entry
tfa_secretstringTOTP secret for two-factor authentication
tfa_methodstringTFA method: "AUTHENTICATOR", "EMAIL", or "SMS"
persist_cookiesbooleanMaintain cookies across workflow executions
persist_local_storagebooleanMaintain local storage across executions
persist_session_storagebooleanMaintain session storage across executions
allow_multiple_sessionsbooleanAllow concurrent workflow sessions with these credentials
max_concurrencynumberMaximum concurrent sessions (when allow_multiple_sessions is true)
proxyobjectProxy configuration with enable (boolean) and target_ip (string)

Getting Vault Entries

Retrieve vault entries with optional filtering:
// Get all entries
const allEntries = await client.vault.get();

// Get specific entry by domain and user ID
const entries = await client.vault.get({
  domain: "https://example.com",
  permissioned_user_id: "unique-user-id",
});

// Get entries without decrypting credentials
const entriesEncrypted = await client.vault.get({
  domain: "https://example.com",
  permissioned_user_id: "unique-user-id",
  decryptCredentials: false,
});

Filter Options

FieldTypeDescription
domainstringFilter by target domain
permissioned_user_idstringFilter by user ID
decryptCredentialsbooleanWhether to decrypt credentials (default: true)
When filtering, both domain and permissioned_user_id must be provided together.

Updating a Vault Entry

Update an existing vault entry:
const updatedEntry = await client.vault.update({
  domain: "https://example.com",
  permissioned_user_id: "unique-user-id",
  user_name: "[email protected]",
  password: "new-password",
  user_alias: "Updated Account Name",
});

Required Fields for Update

FieldRequired
domainYes
permissioned_user_idYes
user_nameYes
passwordYes

Deleting a Vault Entry

Delete a vault entry by domain and user ID:
await client.vault.delete({
  domain: "https://example.com",
  permissioned_user_id: "unique-user-id",
});

Using Vault Entries in Workflows

Reference vault credentials in workflow runs by passing the permissioned_user_id as an input variable:
// First, ensure the vault entry exists
let entries = await client.vault.get({
  domain: "https://login.example.com",
  permissioned_user_id: "user-123",
});

if (!entries || entries.length === 0) {
  await client.vault.create(
    "https://login.example.com",
    "user-123",
    {
      user_name: "[email protected]",
      password: "secret-password",
    }
  );
}

// Start the workflow with the vault entry reference
const run = await client.runs.start({
  workflow_id: "your-workflow-id",
  run_input_variables: {
    USER: "user-123",  // References the permissioned_user_id
  },
});

const result = await run.wait();
console.log("Run completed:", result.status);
The input variable name (e.g., USER) depends on how your workflow is configured. Check your workflow’s input schema in the CloudCruise dashboard.