Vault access, secret generation, hashing and encryption. Each function lists its parameters, defaults and return value.
Vault secret management functions using the service’s pre-initialized vault client.
Scope: Network
Note: The vault namespace is NOT included in the default namespace set.
Enable it explicitly via namespaces: "http,vault" or namespaces: "all" in your script task config.
Unlike the vault task (which requires full TLS/infrastructure parameters to create its own vault client), the vault namespace uses the vault client already initialized during service boot. Scripts just provide secret names — no need for datacenter, cluster, certificate, or URL parameters.
The vault client is resolved from the service container at call time. If the service was not initialized with a vault client (e.g., running locally without vault), the functions return {success: false, error: "vault client not available"}.
Function Description vault.get()Retrieve a secret by name vault.save()Save a secret to vault vault.exists()Check if a secret exists vault.delete()Delete a secret vault.serviceJwt()Get a service JWT token for internal service auth
Retrieve a secret value from vault by name.
Accepts either a string or a map:
Input Type Description (string) string Secret name (shorthand: vault.get("name")) namestring Secret name (map form: vault.get({name: "name"}))
Field Type Description successbool Whether the operation succeeded valuestring The secret value errorstring Error message if failed
var result = vault . get ( " database-password " );
log ( " Password: " + result . value . substring ( 0 , 3 ) + " *** " );
var result = vault . get ( {name: " stripe-api-key " } );
log ( " API key retrieved: " + result . success );
var result = vault . get ( " nonexistent-key " );
log ( " Error: " + result . error );
Save a secret to vault.
Parameter Type Required Default Description namestring Yes - Secret name valuestring Yes - Secret value startdatestring No ""Validity start date enddatestring No ""Validity end date indefinitebool No falseIf true, secret has no expiry
Field Type Description successbool Whether the operation succeeded errorstring Error message if failed
var result = vault . save ( {
value: " sk_live_abc123def456 "
var newKey = " sk_ " + id . generate ( {pattern: " hex " , length: 32 } ) . id ;
vault . save ({name: " generated-key " , value: newKey , indefinite: true });
Check if a secret exists in vault.
Accepts either a string or a map:
Input Type Description (string) string Secret name (shorthand: vault.exists("name")) namestring Secret name (map form: vault.exists({name: "name"}))
Field Type Description successbool Whether the operation succeeded existsbool Whether the secret exists errorstring Error message if failed
var check = vault . exists ( " database-password " );
if ( check . success && check . exists ) {
var secret = vault . get ( " database-password " );
log ( " Secret not found, creating default... " );
vault . save ({name: " database-password " , value: " default-pass " , indefinite: true });
var check = vault . exists ( {name: " api-key " } );
log ( " Exists: " + check . exists );
Delete a secret from vault.
Accepts either a string or a map:
Input Type Description (string) string Secret name (shorthand: vault.delete("name")) namestring Secret name (map form: vault.delete({name: "name"}))
Field Type Description successbool Whether the operation succeeded deletedbool Whether the secret was deleted errorstring Error message if failed
var result = vault . delete ( " old-api-key " );
log ( " Deleted: " + result . deleted );
// Rotate: delete old, save new
vault . delete ( " service-token " );
value: " new-token-value " ,
Obtain a service JWT token from vault for authenticating with other internal services. The JWT is signed by the vault and can be used as a Bearer token in Authorization headers.
Accepts zero arguments, a string, or a map:
Input Type Description (none) — Uses the current service name (auto-detected) (string) string Service name to authenticate as servicestring Service name (map form)
Field Type Description successbool Whether the operation succeeded tokenstring The JWT token string errorstring Error message if failed
// Get JWT for the current service (auto-detected name)
var auth = vault . serviceJwt ();
// Use token in HTTP requests to internal services
url: " https://internal-api.example.com/data " ,
headers: { " Authorization " : auth . token }
// Get JWT for a specific service name
var auth = vault . serviceJwt ( " jobs " );
var auth = vault . serviceJwt ( {service: " vulcan " } );
namespaces : http,vault,id
// Check if current key exists
var existing = vault.exists("service-api-key");
var old = vault.get("service-api-key");
name: "service-api-key-backup",
// Generate and store new key
var newKey = "sk_" + id.generate({pattern: "hex", length: 32}).id;
vault.save({name: "service-api-key", value: newKey, indefinite: true});
var verify = vault.get("service-api-key");
if (verify.value !== newKey) {
throw new Error("Key rotation verification failed");
Feature vault taskvault namespaceVault client Creates new per-execution Uses service’s pre-initialized client Parameters Full (URL, cert, DC, cluster, …) Just secret name/value Use case Cross-cluster or custom vault access Same-service secret operations Config needed All infrastructure params in YAML namespaces: "vault" in script taskAvailable in Any workflow task Script tasks only JWT auth Not available vault.serviceJwt() for internal service calls
Secret generation and encoding functions.
Scope: System
Function Description secret.generate()Generate random secrets and passwords secret.encode()Encode data using various encoding schemes secret.decode()Decode encoded data secret.hash()Hash a secret value using bcrypt secret.validate()Validate password strength
Generate random secrets and passwords with configurable patterns and character sets.
Parameter Type Default Description patternstring "alphanumeric"Secret pattern (see table below) lengthint 32Secret length prefixstring — Prefix to add to generated secret uppercasebool falseInclude uppercase letters lowercasebool falseInclude lowercase letters digitsbool falseInclude digits specialbool falseInclude special characters charsetstring — Custom character set hashbool falseAlso return hash of the secret separatorstring "-"Separator for passphrase pattern wordsint — Number of words for passphrase pattern
Pattern Description alphanumericLetters and digits hexHexadecimal characters base64Base64 characters passphraseWord-based passphrase numericDigits only alphaLetters only specialSpecial characters only urlURL-safe characters customCustom character set (use charset) apikeyAPI key format
Field Type Description successbool Whether generation succeeded secretstring Generated secret hashstring Hash of the secret (if hash: true)
// Generate alphanumeric secret (default)
let result = secret . generate ( {} )
log ( " Secret: " + result . secret )
let result = secret . generate ( {
log ( " Hex: " + result . secret )
// Generate API key with prefix
let result = secret . generate ( {
log ( " API Key: " + result . secret )
let result = secret . generate ( {
log ( " Passphrase: " + result . secret )
let result = secret . generate ( {
log ( " Secret: " + result . secret )
log ( " Hash: " + result . hash )
let result = secret . generate ( {
charset: " ABCDEF0123456789 " ,
log ( " Custom: " + result . secret )
Encode data using various encoding schemes.
Parameter Type Default Description datastring — String data to encode (required) encodingstring "base64"Encoding scheme: "base64", "base32", "hex"
Field Type Description successbool Whether encoding succeeded encodedstring Encoded string
let result = secret . encode ( {
log ( " Base64: " + result . encoded )
let result = secret . encode ( {
log ( " Hex: " + result . encoded )
Decode encoded data.
Parameter Type Default Description datastring — Encoded string to decode (required) encodingstring "base64"Encoding scheme: "base64", "base32", "hex"
Field Type Description successbool Whether decoding succeeded decodedstring Decoded string
let result = secret . decode ( {
data: " SGVsbG8sIFdvcmxkIQ== " ,
log ( " Decoded: " + result . decoded )
let result = secret . decode ( {
log ( " Decoded: " + result . decoded )
Hash a secret value using bcrypt for secure password storage.
Parameter Type Default Description valuestring — Secret value to hash (required)
Field Type Description successbool Whether hashing succeeded hashstring Bcrypt hash
let result = secret . hash ( { value: " my-password-123 " } )
log ( " Bcrypt hash: " + result . hash )
// Store hash in database
let hashed = secret . hash ( { value: userPassword } )
connectionId: conn . connectionId ,
sql: " UPDATE users SET password_hash = $1 WHERE id = $2 " ,
args: [ hashed . hash , userId ]
Validate a secret against password strength requirements.
Parameter Type Default Description valuestring — Secret value to validate (required)
Field Type Description successbool true if the password meets strength requirementserrorstring Validation error message if requirements not met
// Validate password strength
let result = secret . validate ( { value: " weak " } )
log ( " Password too weak: " + result . error )
// Validate a strong password
let result = secret . validate ( { value: " C0mpl3x!P@ssw0rd " } )
log ( " Password meets requirements " )
Encryption and decryption functions.
Scope: System
Function Description crypt.encryptFile()Encrypt a file using AES encryption crypt.decryptFile()Decrypt a file using AES decryption crypt.encrypt()Encrypt data in memory crypt.decrypt()Decrypt data in memory
Algorithm Description aes-256-gcmAES-256 in GCM mode (default, authenticated encryption) aes-256-cbcAES-256 in CBC mode aes-128-gcmAES-128 in GCM mode
Encrypt a file using AES encryption with PBKDF2 key derivation.
Parameter Type Default Description secretstring — Encryption key/passphrase (required) sourcestring — Source file path (required) destinationstring — Destination file path (required) algorithmstring "aes-256-gcm"Encryption algorithm overwritebool falseOverwrite existing destination file iterationsint 100000PBKDF2 iterations for key derivation
Field Type Description successbool Whether encryption succeeded destinationstring Output file path
secret: " my-encryption-key " ,
source: " /data/sensitive.json " ,
destination: " /data/sensitive.json.enc "
// Encrypt with specific algorithm
source: " /data/backup.tar.gz " ,
destination: " /data/backup.tar.gz.enc " ,
algorithm: " aes-256-cbc " ,
Decrypt a file using AES decryption.
Parameter Type Default Description secretstring — Decryption key/passphrase (required) sourcestring — Source file path (required) destinationstring — Destination file path (required) algorithmstring "aes-256-gcm"Decryption algorithm overwritebool falseOverwrite existing destination file iterationsint 100000PBKDF2 iterations for key derivation
Field Type Description successbool Whether decryption succeeded destinationstring Output file path
secret: " my-encryption-key " ,
source: " /data/sensitive.json.enc " ,
destination: " /data/sensitive.json "
// Decrypt with overwrite
source: " /data/backup.tar.gz.enc " ,
destination: " /data/backup.tar.gz " ,
Encrypt data in memory using AES encryption. Returns encrypted data as a base64-encoded string.
Parameter Type Default Description secretstring — Encryption key/passphrase (required) datastring — String data to encrypt (required) algorithmstring "aes-256-gcm"Encryption algorithm iterationsint 100000PBKDF2 iterations
Field Type Description successbool Whether encryption succeeded encryptedstring Base64-encoded encrypted data
let result = crypt . encrypt ( {
data: " sensitive information "
log ( " Encrypted: " + result . encrypted )
let encrypted = crypt . encrypt ( {
data: JSON . stringify ( { apiKey: " sk-123 " , dbPass: " secret " } )
path: " /config/secrets.enc " ,
content: encrypted . encrypted
Decrypt data in memory. Accepts base64-encoded encrypted data.
Parameter Type Default Description secretstring — Decryption key/passphrase (required) datastring — Base64-encoded encrypted data (required) algorithmstring "aes-256-gcm"Decryption algorithm iterationsint 100000PBKDF2 iterations
Field Type Description successbool Whether decryption succeeded decryptedstring Decrypted string
let result = crypt . decrypt ( {
data: encryptedBase64String
log ( " Decrypted: " + result . decrypted )
// Round-trip encryption/decryption
let encrypted = crypt . encrypt ( {
let decrypted = crypt . decrypt ( {
data: encrypted . encrypted
log ( decrypted . decrypted ) // "hello world"
// Read and decrypt stored secrets
let encData = file . read ( { path: " /config/secrets.enc " } )
let secrets = crypt . decrypt ( {
let config = JSON . parse ( secrets . decrypted )
log ( " API Key: " + config . apiKey )
Cryptographic hashing functions.
Scope: System
Function Description hash.string()Compute a hash of a string value hash.file()Compute a hash of a file hash.bytes()Compute a hash of byte data
Algorithm Description sha256SHA-256 (default) sha512SHA-512 sha1SHA-1 md5MD5 blake2bBLAKE2b xxhashxxHash (fast, non-cryptographic)
Compute a hash of a string value.
Parameter Type Default Description datastring — String data to hash (required) algorithmstring "sha256"Hash algorithm lengthint 0Truncate hash to specified length (0 = full hash)
Field Type Description successbool Whether hashing succeeded hashstring Hex-encoded hash value algorithmstring Algorithm used
// SHA-256 hash (default)
let result = hash . string ( { data: " hello world " } )
log ( " SHA-256: " + result . hash )
let result = hash . string ( {
log ( " MD5: " + result . hash )
let result = hash . string ( {
log ( " Short hash: " + result . hash )
// xxHash for fast non-crypto hashing
let result = hash . string ( {
data: " large content here " ,
log ( " xxHash: " + result . hash )
Compute a hash of a file.
Parameter Type Default Description pathstring — Path to file to hash (required) algorithmstring "sha256"Hash algorithm lengthint 0Truncate hash to specified length
Field Type Description successbool Whether hashing succeeded hashstring Hex-encoded hash value algorithmstring Algorithm used
let result = hash . file ( { path: " /tmp/release.tar.gz " } )
log ( " File SHA-256: " + result . hash )
let expected = " abc123... "
path: " /tmp/download.bin " ,
if ( result . hash === expected ) {
log ( " File integrity verified " )
// Quick hash for comparison
path: " /data/large-file.bin " ,
log ( " Fast hash: " + result . hash )
Compute a hash of byte data (passed as string).
Parameter Type Default Description datastring — Byte data as string (required) algorithmstring "sha256"Hash algorithm lengthint 0Truncate hash to specified length
Field Type Description successbool Whether hashing succeeded hashstring Hex-encoded hash value algorithmstring Algorithm used
let result = hash . bytes ( {
log ( " BLAKE2b: " + result . hash )
Identifier generation functions.
Scope: System
Function Description id.generate()Generate unique identifiers (ULID, UUID, NanoID, KSUID, XID)
Generate unique identifiers of various types.
Parameter Type Default Description typestring "ulid"ID type: "ulid", "uuid", "nanoid", "ksuid", "xid" countint 1Number of IDs to generate
Type Description Example ulidUniversally Unique Lexicographically Sortable Identifier 01ARZ3NDEKTSV4RRFFQ69G5FAVuuidUUID v4 (random) 550e8400-e29b-41d4-a716-446655440000nanoidCompact URL-safe identifier V1StGXR8_Z5jdHi6B-myTksuidK-Sortable Unique Identifier 1HCpXwx2EK9oYluGXoYAtlFNRpkxidGlobally unique, sortable, compact 9m4e2mr0ui3e8a215n4g
Field Type Description successbool Whether generation succeeded idstring Generated ID (when count is 1) idsarray Array of generated IDs
// Generate a ULID (default)
let result = id . generate ( {} )
let result = id . generate ( { type: " uuid " } )
log ( " UUID: " + result . id )
let result = id . generate ( { type: " nanoid " } )
log ( " NanoID: " + result . id )
let result = id . generate ( { type: " ulid " , count: 5 } )
for ( let id of result . ids ) {
let result = id . generate ( { type: " ksuid " } )
log ( " KSUID: " + result . id )