Skip to main content

Read secrets from an SDK

Read the values your application needs at runtime with the SDKs or Refine. Create and manage secrets through TaruviBase Console.

This page covers JavaScript SDK 1.5.4 and Python SDK 0.2.3.

Prerequisites#

  • Create the type and value through TaruviBase Console.
  • Configure a JavaScript secrets client or Python client for the intended site and app. See JavaScript or Python.
  • Use the exact existing key. The API schema caps keys at 255 characters.

Read one secret#

import type {SecretResponse} from '@taruvi/sdk';

await secrets
.get('app_config', {app: 'APP_SLUG'})
.execute<SecretResponse>();

JavaScript execute() returns the standard response wrapper, so read the secret from its data field. Python get() returns the extracted secret object. A Python client substitutes its configured app_slug when app is omitted; pass the app explicitly when scope must be obvious in code. The JavaScript Secrets helper uses its explicit app option. All three examples above request APP_SLUG.

Retrieve several secrets#

Fetch up to 100 keys in one call. Missing or sensitivity-denied keys are omitted rather than returned with empty values.

await secrets.list(['app_config', 'feature_flags'], {
app: 'APP_SLUG',
includeMetadata: true,
});

Both SDK list() methods return the response wrapper; the requested map is in data. Values can be strings or JSON objects; check the value's shape before using it.

Verify without exposing values#

Check that the expected keys are present and that the value has the expected type. Do not print, snapshot, or attach the value to logs, traces, tickets, or test output. If a key is missing, confirm site/app scope and sensitivity before retrying.

Next steps#