Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The Skyflow SDK enables you to connect to your Skyflow Vault(s) to securely hand

## Installation

Requires Node v12.22.12 and above.
Requires Node.js v18 and above. File operations (`uploadFile`, `deidentifyFile`) require Node.js v20 and above.
Comment thread
promptless[bot] marked this conversation as resolved.

```sh
npm install skyflow-node
Expand Down Expand Up @@ -293,7 +293,7 @@ For all `InsertOptions` setters and `TokenMode` values, see [InsertOptions](docs

Convert tokens back into plaintext values (or masked values) using the `.detokenize()` method. Detokenization accepts tokens and returns values.

Create a detokenization request with the [`DetokenizeRequest`](docs/api_reference.md#detokenizerequest) class, which requires a list of tokens and column groups as input.
Create a detokenization request with the [`DetokenizeRequest`](docs/api_reference.md#detokenizerequest) class, which requires a list of tokens as input, each with an optional redaction type.
Comment thread
promptless[bot] marked this conversation as resolved.

Provide optional parameters such as the redaction type and the option to continue on error.

Expand All @@ -304,6 +304,7 @@ import {
DetokenizeOptions,
DetokenizeRequest,
DetokenizeResponse,
RedactionType,
Comment thread
promptless[bot] marked this conversation as resolved.
} from "skyflow-node";

const detokenizeRequest = new DetokenizeRequest([
Expand Down Expand Up @@ -733,15 +734,19 @@ De-identify files using the `deidentifyFile` method. Create a de-identify file r
> File de-identification requires Node.js v20.x or above.

```typescript
import fs from 'fs';
import {
DeidentifyFileRequest,
DeidentifyFileOptions,
DeidentifyFileResponse
DeidentifyFileResponse,
SkyflowError,
DetectEntities,
MaskingMethod,
DetectOutputTranscription,
Bleep
Bleep,
FileInput,
Comment thread
promptless[bot] marked this conversation as resolved.
TokenFormat,
TokenType,
} from 'skyflow-node';

// Prepare the file to be deidentified
Expand All @@ -765,8 +770,6 @@ options.setTokenFormat(tokenFormat);
options.setOutputDirectory('<OUTPUT_DIRECTORY_PATH>'); // Output directory for saving the deidentified file. Not supported in Cloudflare workers.
options.setWaitTime(64); // Wait time for polling (max 64 seconds; returns runId + status if exceeded)


tifyFile
const response: DeidentifyFileResponse = await skyflowClient
.detect(primaryVaultConfig.vaultId)
.deidentifyFile(fileReq, options);
Expand Down Expand Up @@ -808,14 +811,11 @@ Retrieve the results of a previously started file de-identification operation (o
import {
GetDetectRunRequest,
DeidentifyFileResponse,
DeidentifyFileResponse
SkyflowError
SkyflowError,
} from 'skyflow-node';

// Prepare the GetDetectRunRequest with the runId from a previous deidentifyFile call
const request = new GetDetectRunRequest({
runId: '<RUN_ID_FROM_DEIDENTIFY_FILE>', // Replace with the runId you received earlier
});
const request = new GetDetectRunRequest('<RUN_ID_FROM_DEIDENTIFY_FILE>'); // Replace with the runId you received earlier
Comment thread
promptless[bot] marked this conversation as resolved.

// Step 2: Call getDetectRun
const response: DeidentifyFileResponse = await skyflowClient
Expand All @@ -837,7 +837,7 @@ Get Detect Run Response: { status: 'SUCCESS', runId: 'run-abc123', fileBase64: '

## Connections

Securely send and receive data between your systems and first- or third-party services using Skyflow Connections, a gateway service that uses tokenization. The [connections](https://github.com/skyflowapi/skyflow-node/tree/v2/src/vault/controller/connections) module invokes both inbound and outbound connections.
Securely send and receive data between your systems and first- or third-party services using Skyflow Connections, a gateway service that uses tokenization. The [connections](https://github.com/skyflowapi/skyflow-node/tree/main/src/vault/controller/connections) module invokes both inbound and outbound connections.
Comment thread
promptless[bot] marked this conversation as resolved.

- **Inbound connections**: Act as intermediaries between your client and server, tokenizing sensitive data before it reaches your backend, ensuring downstream services handle only tokenized data.
- **Outbound connections**: Enable secure extraction of data from the vault and transfer it to third-party services via your backend server, such as processing checkout or card issuance flows.
Expand Down Expand Up @@ -900,7 +900,7 @@ Invoke connection response: { data: { status: 'success', transaction_id: 'txn_ab
**pathParams, queryParams, header, body** are the JSON objects represented as dictionaries that will be sent through the connection integration url.

> [!TIP]
> See the full example in the samples directory: [scoped-token-generation-example.ts](samples/vault-api/invoke-connection.ts)
> See the full example in the samples directory: [invoke-connection.ts](samples/vault-api/invoke-connection.ts)
Comment thread
promptless[bot] marked this conversation as resolved.
> See [docs.skyflow.com](https://docs.skyflow.com) for more details on integrations with Connections, Functions, and Pipelines.

## Authentication & authorization
Expand Down Expand Up @@ -957,7 +957,7 @@ Generate and manage bearer tokens to authenticate API calls. This section covers

#### Generate a bearer token

Generate service account tokens using the [Service Account](https://github.com/skyflowapi/skyflow-node/tree/v2/src/service-account) Node package with a service account credentials file provided when a service account is created. Tokens generated by this module are valid for 60 minutes and can be used to make API calls to the [Data](https://docs.skyflow.com/record/) and [Management](https://docs.skyflow.com/management/) APIs, depending on the permissions assigned to the service account.
Generate service account tokens using the [Service Account](https://github.com/skyflowapi/skyflow-node/tree/main/src/service-account) Node package with a service account credentials file provided when a service account is created. Tokens generated by this module are valid for 60 minutes and can be used to make API calls to the [Data](https://docs.skyflow.com/record/) and [Management](https://docs.skyflow.com/management/) APIs, depending on the permissions assigned to the service account.
Comment thread
promptless[bot] marked this conversation as resolved.

##### `generateBearerToken(filepath)`

Expand Down Expand Up @@ -1019,7 +1019,7 @@ if (expired) {
```

> [!TIP]
> See the full example in the samples directory: [token-generation-example.ts](http://github.com/skyflowapi/skyflow-node/blob/v2/samples/service-account/token-generation-example.ts)
> See the full example in the samples directory: [token-generation-example.ts](samples/service-account/token-generation-example.ts)
Comment thread
promptless[bot] marked this conversation as resolved.

#### Generate bearer tokens scoped to certain roles

Expand Down Expand Up @@ -1278,7 +1278,7 @@ Most first-run problems come from configuration mismatches. Every error thrown b

| Symptom | Likely cause | Fix |
|---|---|---|
| `npm install skyflow-node` fails | Unsupported Node version | Requires Node v12.22.12 or above. |
| `npm install skyflow-node` fails | Unsupported Node version | Requires Node.js v18 or above. |
Comment thread
promptless[bot] marked this conversation as resolved.
| Connection/DNS failures, or 404 on every call | Wrong `clusterId` | `clusterId` is the first segment of your vault URL: `https://{clusterId}.vault.skyflowapis.com`. |
| Requests hit the wrong host / unexpected auth failures | Wrong `env` | Match `env` to where your vault runs (`Env.PROD`, `Env.SANDBOX`, `Env.DEV`, `Env.STAGE`). |
| `401 Unauthorized` | Invalid or expired credentials | Verify your API key or service-account credentials. Regenerate if needed. |
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const tertiaryVaultConfig: VaultConfig = {

const skyflowConfig: SkyflowConfig = {
vaultConfigs: [primaryVaultConfig, secondaryVaultConfig, tertiaryVaultConfig], // Add the primary, secondary and tertiary vault configurations.
skyflowCredentials: skyflowCredentials, // Add JSON-formatted credentials if applicable.
skyflowCredentials: { credentialsString: credentialsString }, // Use the stringified JSON credentials as the shared fallback credentials.
Comment thread
promptless[bot] marked this conversation as resolved.
logLevel: LogLevel.INFO, // Recommended to use LogLevel.ERROR in production environment.
};

Expand Down
4 changes: 2 additions & 2 deletions docs/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Passed to `detect().getDetectRun()`.

| Constructor argument | Type | Description |
|---|---|---|
| `options` | `{ runId: string }` | The `runId` returned by a prior `deidentifyFile` call. |
| `runId` | `string` | The `runId` returned by a prior `deidentifyFile` call. |
Comment thread
promptless[bot] marked this conversation as resolved.

### `InvokeConnectionRequest`

Expand Down Expand Up @@ -252,7 +252,7 @@ Provide **exactly one** file source: `setFileObject`, `setFilePath`, or `setBase

| Setter | Type | Description |
|---|---|---|
| `setSkyflowId(id)` | `string` | **Required.** Skyflow ID of the record to attach the file to. |
| `setSkyflowId(id)` | `string` | Skyflow ID of the record to attach the file to. Omit to upload the file to a new record. |
Comment thread
promptless[bot] marked this conversation as resolved.
| `setFileObject(file)` | `File` | In-memory `File` object. |
| `setFilePath(path)` | `string` | Path to a file on disk. Requires Node.js v20+. |
| `setBase64(data)` | `string` | Base64-encoded file content. Use with `setFileName`. |
Expand Down
22 changes: 14 additions & 8 deletions docs/migrate_to_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This guide outlines the steps required to migrate the Skyflow Node SDK from version 1 (V1) to version 2 (V2).

> [!IMPORTANT]
> V1 is in maintenance mode and will reach End of Life on October 31, 2026. Migrate to V2 before that date.
Comment thread
promptless[bot] marked this conversation as resolved.

## Authentication

In V2, multiple authentication options have been introduced. You can now provide credentials in the following ways:
Expand All @@ -28,6 +31,8 @@ const auth = function () {

#### v2 Authentication: Credentials object

**Option 1: API key**

```typescript
import { Credentials } from 'skyflow-node';

Expand All @@ -36,24 +41,25 @@ const credentials: Credentials = {
};
```

// Option 2: Environment Variables (Recommended)
// Set SKYFLOW_CREDENTIALS in your environment
**Option 2: Environment variable (recommended)**

Set `SKYFLOW_CREDENTIALS` in your environment. The SDK reads it automatically when no credentials are passed.
Comment thread
promptless[bot] marked this conversation as resolved.

// Option 3: Credentials File
**Option 3: Credentials file**

```typescript
const credentials: Credentials = { path: "<YOUR_CREDENTIALS_FILE_PATH>" };
```

// Option 4: Stringified JSON
**Option 4: Stringified JSON**

```typescript
const credentials: Credentials = {
credentialsString: JSON.stringify(process.env.SKYFLOW_CREDENTIALS),
};
```

// Option 5: Bearer Token
**Option 5: Bearer token**

```typescript
const credentials: Credentials = { token: "<YOUR_BEARER_TOKEN>" };
Expand Down Expand Up @@ -124,10 +130,10 @@ const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

### Request and Response Structure

In v2, with the introduction of TypeScript support, you can now pass an **InsertRequest** of type **InsertRequest**. This request requires:
In v2, with the introduction of TypeScript support, you can now pass an **InsertRequest** of type **InsertRequest**. Its constructor takes two positional arguments:

- **`tableName`**: The name of the table.
- **`insertData`**: An array of objects containing the data to be inserted
- **`table`**: The name of the table.
Comment thread
promptless[bot] marked this conversation as resolved.
- **`data`**: An array of objects containing the data to insert.

The response will be of type InsertResponse, which contains insertedFields and errors.

Expand Down
2 changes: 1 addition & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Explore working examples that demonstrate common SDK operations. Start with basi
## Prerequisites

- A Skyflow account. If you don't have one, register for one on the [Try Skyflow](https://skyflow.com/try-skyflow) page.
- [Node 7.6.0](https://nodejs.org/en/) and above.
- [Node.js](https://nodejs.org/en/) v18 and above. File-upload and de-identify-file samples require Node.js v20 and above.
Comment thread
promptless[bot] marked this conversation as resolved.

## Prepare

Expand Down
Loading