Skip to content

Latest commit

 

History

History

samples

Folders and files

README.md

Node.js SDK samples

Explore working examples that demonstrate common SDK operations. Start with basic vault operations like insert-records.ts, then explore other samples for specific use cases.

Prerequisites

  • A Skyflow account. If you don't have one, register for one on the Try Skyflow page.
  • Node 7.6.0 and above.

Prepare

Install the Node SDK:

npm install skyflow-node

Create a vault

  1. Navigate to Skyflow Studio in your browser.
  2. Click Create Vault > Start With a Template > Quickstart vault.
  3. When the vault is ready, click the gear icon and select Edit Vault Details.
  4. Copy your Vault URL and Vault ID, then click Cancel.

Create a service account

  1. In the side navigation, click Access > Service Accounts > New Service Account.
  2. Enter "SDK Samples" for Name and choose Vault Editor for Roles.
  3. Click Create. Your browser downloads a credentials.json file. Store this file securely.

The samples

Sample files are organized by API type:

  • vault-api/ - Vault operations (insert, get, update, delete, tokenize, detokenize)
  • detect-api/ - Detect operations (deidentify, reidentify)
  • service-account/ - Token generation examples

Running a sample

  1. Open the sample file you want to run (for example, vault-api/insert-records.ts)

  2. Update placeholder values:

    Placeholder Replace With
    <VAULT_ID> Your Vault ID from Skyflow Studio
    <CLUSTER_ID> Your Cluster ID from the vault URL
    <YOUR_CREDENTIAL_FILE> Relative path to your actual credentials file
    <TABLE_NAME> The name of a table in your vault (for example, users)
    <COLUMN_NAME> The name of a column in your table (for example, name)
    <ID1>, <ID2>, etc. Actual record IDs from your vault
    <VALUE> Actual values to insert into your vault
    <TOKEN1>, <TOKEN2>, etc. Actual tokens from your vault
    <CONNECTION_URL> Your connection URL
  3. Run the sample:

    cd samples
    npm install
    ts-node vault-api/insert-records.ts

Sample files overview

Vault API samples (vault-api/):

Detect API samples (detect-api/):

Service Account samples (service-account/):

For detailed API documentation, see the main README.