From e2e9f8894635bde88c8d5ff2498da1d6c942521d Mon Sep 17 00:00:00 2001 From: "promptless[bot]" Date: Mon, 19 Oct 2026 17:02:36 +0000 Subject: [PATCH 1/2] docs: fix Java SDK documentation accuracy issues --- docs/api_reference.md | 2 +- docs/migrate_to_v2.md | 2 +- flowvault/README.md | 31 +++++++ skyvault/README.md | 56 ++++++------- skyvault/samples/README.md | 160 ++++++++++++++++++++----------------- 5 files changed, 147 insertions(+), 104 deletions(-) diff --git a/docs/api_reference.md b/docs/api_reference.md index 8f5716a5..8b286294 100644 --- a/docs/api_reference.md +++ b/docs/api_reference.md @@ -1,6 +1,6 @@ # API Reference -A reference for the public Skyflow Java SDK surface: client-management methods, config classes, request and response objects, helper classes, enums, and service-account utilities. For task-oriented usage and examples, see the [README](../README.md). +A reference for the public Skyflow Java SDK surface: client-management methods, config classes, request and response objects, helper classes, enums, and service-account utilities. For task-oriented usage and examples, see the [skyvault README](../skyvault/README.md). All attributes, parameters, and enum values below are taken directly from the SDK source. diff --git a/docs/migrate_to_v2.md b/docs/migrate_to_v2.md index 671210fd..64b80697 100644 --- a/docs/migrate_to_v2.md +++ b/docs/migrate_to_v2.md @@ -55,7 +55,7 @@ skyflowCredentials.setToken(""); > **Notes:** > - Use only ONE authentication method per credentials object. > - API Key or environment variable are recommended for production. -> - For priority order see [Quickstart — Initialize the client](../README.md#initialize-the-client). +> - For priority order see [Quickstart — Initialize the client](../skyvault/README.md#initialize-the-client). --- diff --git a/flowvault/README.md b/flowvault/README.md index c6d78f26..6865d86c 100644 --- a/flowvault/README.md +++ b/flowvault/README.md @@ -97,7 +97,15 @@ import com.skyflow.Skyflow; import com.skyflow.config.Credentials; import com.skyflow.config.VaultConfig; import com.skyflow.enums.Env; +import com.skyflow.errors.SkyflowException; import com.skyflow.vault.controller.VaultController; +import com.skyflow.vault.data.BulkInsertRequest; +import com.skyflow.vault.data.BulkInsertRequestRecord; +import com.skyflow.vault.data.BulkInsertResponse; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; Credentials credentials = new Credentials(); credentials.setApiKey(""); // or setToken / setCredentialsString / setPath @@ -114,10 +122,33 @@ Skyflow skyflowClient = Skyflow.builder() // Returns the controller for the first configured vault VaultController vault = skyflowClient.vault(); + +// A minimal bulk insert, to confirm the setup above actually works +Map data = new HashMap<>(); +data.put("card_number", "4111111111111111"); + +BulkInsertRequestRecord record = BulkInsertRequestRecord.builder() + .data(data) + .build(); + +BulkInsertRequest insertRequest = BulkInsertRequest.builder() + .tableName("") + .records(Collections.singletonList(record)) + .build(); + +try { + BulkInsertResponse insertResponse = vault.bulkInsert(insertRequest); + System.out.println("inserted " + insertResponse.getSummary().getTotalInserted() + + " of " + insertResponse.getSummary().getTotalRecords()); +} catch (SkyflowException e) { + System.err.println("bulk insert failed: " + e.getMessage()); +} ``` `vault()` with no arguments returns the controller for the first vault added to the builder. To talk to more than one vault from a single client, register each with `addVaultConfig(...)` and fetch each controller by ID: `skyflowClient.vault("")`. +The `bulkInsert` call above is the [Bulk Insert](#bulk-insert) operation; see that section for multi-table inserts, upserts, and reading back tokens, and [Error Handling](#error-handling) for the per-record result model that `getSummary()` is part of. + # Authenticate Requests are authorized with Skyflow credentials that you attach to a `Credentials` object. `Credentials` comes from the shared `common` module, so it is the same class `skyvault` uses. diff --git a/skyvault/README.md b/skyvault/README.md index e996553a..1e22cfba 100644 --- a/skyvault/README.md +++ b/skyvault/README.md @@ -34,7 +34,7 @@ The Skyflow Java SDK is designed to help with integrating Skyflow into a Java ba - [DetokenizeRecordResponse](#detokenizerecordresponse) - [Tokenize](#tokenize) - [Get](#get) - - [Get by skyflow IDS](#get-by-skyflow-ids) + - [Get by skyflow IDs](#get-by-skyflow-ids) - [Get tokens](#get-tokens) - [Get by column name and column values](#get-by-column-name-and-column-values) - [Redaction types](#redaction-types) @@ -90,7 +90,7 @@ The Skyflow Java SDK is designed to help with integrating Skyflow into a Java ba Add this dependency to your project's `build.gradle` file: ``` -implementation 'com.skyflow:skyflow-java:2.0.0' +implementation 'com.skyflow:skyflow-java:2.1.1' ``` ### Maven users @@ -101,10 +101,12 @@ Add this dependency to your project's `pom.xml` file: com.skyflow skyflow-java - 2.0.0 + 2.1.1 ``` +The snippets above pin the latest release at the time of writing. Check [Maven Central](https://central.sonatype.com/artifact/com.skyflow/skyflow-java) for the current version and [GitHub releases](https://github.com/skyflowapi/skyflow-java/releases) for what changed in each one. + --- # Migrate from v1 to v2 @@ -320,7 +322,7 @@ Skyflow returns tokens for the record that was just inserted. # Vault -The [Vault](https://github.com/skyflowapi/skyflow-java/tree/main/samples/src/main/java/com/example/vault) module performs operations on the vault, including inserting records, detokenizing tokens, and retrieving tokens associated with a `skyflow_id`. +The [Vault](https://github.com/skyflowapi/skyflow-java/tree/main/skyvault/samples/src/main/java/com/example/vault) module performs operations on the vault, including inserting records, detokenizing tokens, and retrieving tokens associated with a `skyflow_id`. ## VaultController @@ -409,7 +411,7 @@ public class InsertSchema { } ``` -### Insert call [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/InsertExample.java) with `continueOnError` option +### Insert call [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/InsertExample.java) with `continueOnError` option The `continueOnError` flag is a boolean that determines whether insert operation should proceed despite encountering partial errors. Set to `true` to allow the process to continue even if some errors occur. @@ -626,7 +628,7 @@ Notes: - `redactionType` defaults to [`RedactionType.PLAIN_TEXT`](#redaction-types). - `continueOnError` defaults to `true`. -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/DetokenizeExample.java) of a detokenize call: +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/DetokenizeExample.java) of a detokenize call: ```java import com.skyflow.enums.RedactionType; @@ -846,7 +848,7 @@ public class TokenizeSchema { } ``` -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/TokenizeExample.java) of Tokenize call: +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/TokenizeExample.java) of Tokenize call: ```java import com.skyflow.errors.SkyflowException; @@ -985,7 +987,7 @@ public class GetSchema { Retrieve specific records using `skyflow_ids`. Ideal for fetching exact records when IDs are known. -#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/GetExample.java) of a get call to retrieve data using Redaction type: +#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/GetExample.java) of a get call to retrieve data using Redaction type: ```java import com.skyflow.enums.RedactionType; @@ -1067,7 +1069,7 @@ Sample response: Return tokens for records. Ideal for securely processing sensitive data while maintaining data privacy. -#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/getExample.java) of get call to retrieve tokens using Skyflow IDs: +#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/GetExample.java) of get call to retrieve tokens using Skyflow IDs: ```java import com.skyflow.enums.RedactionType; @@ -1145,7 +1147,7 @@ Sample response: Retrieve records by unique column values. Ideal for querying data without knowing Skyflow IDs, using alternate unique identifiers. -#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/GetExample.java) of get call to retrieve data using column name and column values: +#### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/GetExample.java) of get call to retrieve data using column name and column values: ```java import com.skyflow.enums.RedactionType; @@ -1282,7 +1284,7 @@ public class UpdateSchema { } ``` -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/UpdateExample.java) of update call +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/UpdateExample.java) of update call ```java import com.skyflow.enums.TokenMode; @@ -1406,7 +1408,7 @@ public class DeleteSchema { } ``` -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/DeleteExample.java) of delete call: +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/DeleteExample.java) of delete call: ```java import com.skyflow.errors.SkyflowException; @@ -1509,7 +1511,7 @@ public class QuerySchema { } ``` -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/QueryExample.java) of query call +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/QueryExample.java) of query call ```java import com.skyflow.errors.SkyflowException; @@ -1611,7 +1613,7 @@ public class UploadFileSchema { ``` -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/vault/FileUploadExample.java) of file upload call +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/vault/FileUploadExample.java) of file upload call ```java import com.skyflow.errors.SkyflowException; import com.skyflow.vault.data.FileUploadRequest; @@ -1771,7 +1773,7 @@ public class DeidentifyTextSchema { ``` -## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/detect/DeidentifyTextExample.java) of deidentify text: +## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/detect/DeidentifyTextExample.java) of deidentify text: ```java import java.util.ArrayList; import java.util.List; @@ -1934,7 +1936,7 @@ public class ReidentifyTextSchema { } ``` -## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/detect/ReidentifyTextExample.java) of Reidentify text +## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/detect/ReidentifyTextExample.java) of Reidentify text ```java import com.skyflow.enums.DetectEntities; @@ -2100,7 +2102,7 @@ public class DeidentifyFileSchema { } ``` -## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/detect/DeidentifyFileExample.java) of Deidentify file +## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/detect/DeidentifyFileExample.java) of Deidentify file ```java import java.io.File; @@ -2277,7 +2279,7 @@ public class GetDetectRunSchema { ``` -## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/detect/GetDetectRunExample.java) of get run +## An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/detect/GetDetectRunExample.java) of get run ```java import com.skyflow.config.Credentials; import com.skyflow.config.VaultConfig; @@ -2415,7 +2417,7 @@ DeidentifyFileRequest request = DeidentifyFileRequest.builder() # Connections -Skyflow Connections is a gateway service that uses tokenization to securely send and receive data between your systems and first- or third-party services. The [connections](https://github.com/skyflowapi/skyflow-java/tree/main/src/main/java/com/skyflow/vault/connection) module invokes both inbound and/or outbound connections. +Skyflow Connections is a gateway service that uses tokenization to securely send and receive data between your systems and first- or third-party services. The [connections](https://github.com/skyflowapi/skyflow-java/tree/main/skyvault/src/main/java/com/skyflow/vault/connection) module invokes both inbound and/or outbound connections. - **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. @@ -2515,7 +2517,7 @@ public class InvokeConnectionSchema { **pathParams, queryParams, requestHeader, requestBody** are the JSON objects represented as HashMaps, that will be sent through the connection integration url. -### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/connection/InvokeConnectionExample.java) of invokeConnection +### An [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/connection/InvokeConnectionExample.java) of invokeConnection ```java import com.skyflow.Skyflow; @@ -2623,11 +2625,11 @@ This section covers methods for generating and managing tokens to authenticate A ## Generate a bearer token -The [Service Account](https://github.com/skyflowapi/skyflow-java/tree/main/src/main/java/com/skyflow/serviceaccount/util) Java module generates service account tokens using a service account credentials file, which is provided when a service account is created. The 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. +The [Service Account](https://github.com/skyflowapi/skyflow-java/tree/main/common/src/main/java/com/skyflow/serviceaccount/util) Java module generates service account tokens using a service account credentials file, which is provided when a service account is created. The 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. The `BearerToken` utility class generates bearer tokens using a credentials JSON file. Alternatively, you can pass the credentials as a string. -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationExample.java): +[Example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationExample.java): ```java /** @@ -2742,7 +2744,7 @@ credentials.setContext(ctx); Context map keys must contain only alphanumeric characters and underscores (`[a-zA-Z0-9_]`). Invalid keys will throw a `SkyflowException`. -[Full example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationWithContextExample.java) +[Full example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationWithContextExample.java) See Skyflow's [context-aware authorization](https://docs.skyflow.com) and [conditional data access](https://docs.skyflow.com) docs for policy variable syntax like `request.context.*`. @@ -2750,7 +2752,7 @@ See Skyflow's [context-aware authorization](https://docs.skyflow.com) and [condi A service account with multiple roles can generate bearer tokens with access limited to a specific role by specifying the appropriate `roleID`. This can be used to limit access to specific roles for services with multiple responsibilities, such as segregating access for billing and analytics. The generated bearer tokens are valid for 60 minutes and can only execute operations permitted by the permissions associated with the designated role. -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/ScopedTokenGenerationExample.java): +[Example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/ScopedTokenGenerationExample.java): ```java import com.skyflow.errors.SkyflowException; @@ -2801,7 +2803,7 @@ Notes: - You can pass either the file path of a service account key credentials file or the service account key credentials as a string to the `setCredentials` method of the `BearerTokenBuilder` class. - If both a file path and a string are provided, the last method used takes precedence. -- To generate multiple bearer tokens concurrently using threads, refer to the following [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationUsingThreadsExample.java). +- To generate multiple bearer tokens concurrently using threads, refer to the following [example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/BearerTokenGenerationUsingThreadsExample.java). ## Generate Signed Data Tokens @@ -2834,7 +2836,7 @@ SignedDataTokens signedToken = SignedDataTokens.builder() .build(); ``` -[Full example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/SignedTokenGenerationExample.java) +[Full example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/SignedTokenGenerationExample.java) Response: @@ -2863,7 +2865,7 @@ message: Authentication failed. Bearer token is expired. Use a valid bearer toke If you encounter this kind of error, retry the request. During the retry, the SDK detects that the previous bearer token has expired and generates a new one for the current and subsequent requests. -#### [Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/serviceaccount/BearerTokenExpiryExample.java): +#### [Example](https://github.com/skyflowapi/skyflow-java/blob/main/skyvault/samples/src/main/java/com/example/serviceaccount/BearerTokenExpiryExample.java): ```java package com.example.serviceaccount; diff --git a/skyvault/samples/README.md b/skyvault/samples/README.md index 666b2186..ab583da0 100644 --- a/skyvault/samples/README.md +++ b/skyvault/samples/README.md @@ -1,84 +1,94 @@ -# Java SDK samples -Test the SDK by adding `VAULT-ID`, `VAULT-URL`, and `SERVICE-ACCOUNT` details in the required places for each sample. +# Skyvault Java SDK samples + +Runnable samples for the `skyvault` module (`com.skyflow:skyflow-java`) — vault CRUD, tokenize/detokenize, +query, file upload, Detect, Connections, and the shared service-account/bearer-token utilities. + +See the [skyvault README](../README.md) for the full guide these samples exercise. ## Prerequisites -- A Skyflow account. If you don't have one, register for one on the [Try Skyflow](https://skyflow.com/try-skyflow) page. -- Java 1.8 or higher. -### Create the vault +- A Skyflow account. If you don't have one, register on the [Try Skyflow](https://skyflow.com/try-skyflow) page. +- Java 8 or higher, and Maven. + +### Create a vault + 1. In a browser, sign in to Skyflow Studio. -2. Create a vault by clicking **Create Vault** > **Start With a Template** > **Quickstart vault**. +2. Create a vault: **Create Vault** > **Start With a Template** > **Quickstart vault**. 3. Once the vault is ready, click the gear icon and select **Edit Vault Details**. -4. Note your **Vault URL** and **Vault ID** values, then click **Cancel**. You'll need these later. +4. Note the **Vault ID** and **Vault URL**. The cluster ID that samples pass to `setClusterId(...)` + is the subdomain of the vault URL — e.g. for `https://a1b2c3d4.vault.skyflowapis.com`, the + cluster ID is `a1b2c3d4`. ### Create a service account -1. In the side navigation click, **IAM** > **Service Accounts** > **New Service Account**. -2. For **Name**, enter "SDK Sample". For **Roles**, choose **Vault Editor**. -3. Click **Create**. Your browser downloads a **credentials.json** file. Keep this file secure, as You'll need it for each of the samples. + +1. In the side navigation: **IAM** > **Service Accounts** > **New Service Account**. +2. Name it, and for **Roles** choose **Vault Editor**. +3. Click **Create**. Your browser downloads a `credentials.json` — keep it secure, you'll need its + path or contents for most samples below. + +## Running a sample + +Each sample is a `public class X { public static void main(String[] args) ... }` under +`src/main/java/com/example/`. Fill in the placeholders (``, ``, +``, etc.) with real values, then compile and run with Maven from +`skyvault/samples/`: + +```bash +mvn compile +mvn org.codehaus.mojo:exec-maven-plugin:3.1.0:java -Dexec.mainClass="com.example.vault.InsertExample" +``` + +Swap `-Dexec.mainClass` for the fully-qualified class name of the sample you want to run. ## The samples -### Detokenize -Detokenize a data token from the vault. Make sure the specified token is for data that exists in the vault. If you need a valid token, use [InsertExample.java](src/main/java/com/example/InsertExample.java) to insert the data, then use this data's token for detokenization. -#### [Configure](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/DetokenizeExample.java) -1. Replace **** with **VAULT ID** -2. Replace **** with **VAULT URL** -3. Replace **** with **Data Token**. -4. Replace **** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE**.See #Create a service account. -#### Run the sample - - javac DetokenizeExample.java - java DetokenizeExample -### Get a record by ID -Get data using skyflow id. -#### Configure -1. Replace **** with **VAULT ID** -2. Replace **** with **VAULT URL**. -3. Replace **** with **Skyflow id**. -4. Replace **** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE**. See #Create a Service Account. -5. Replace **** with **credit_cards**. -#### Run the sample - - javac GetByIdExample.java - java GetByIdExample -### Insert data into a vault -Insert data in the vault. -#### [Configure](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/InsertExample.java) -1. Replace **** with **VAULT ID**. -2. Replace **** with **VAULT URL**. -3. Replace **** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE**. -4. Replace **** with **credit_cards**. -5. Replace **** with **column name**. -6. Replace **** with **valid value corresponding to column name**. -#### Run the sample - - javac InsertExample.java - java InsertExample -### Invoke a connection -Skyflow Connections is a gateway service that uses Skyflow's underlying tokenization capabilities to securely connect to first-party and third-party services. This way, your infrastructure is never directly exposed to sensitive data, and you offload security and compliance requirements to Skyflow. -#### Configure -1. Replace **** with **VAULT ID**. -2. Replace **** with **VAULT URL**. -3. Replace **** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE**. -4. Replace **** with **Connection url**. -5. Replace **** with **Path param key**. -6. Replace **** with **Path param value**. -7. Replace **** with **Query param key**. -8. Replace **** with **Query param value**. -9. Replace **** with **Request header key**. -10. Replace **** with **Request header value**. -11. Replace **** with **Request body key**. -12. Replace **** with **Request body value**. -#### Run the sample - - javac InvokeConnectionExample.java - java InvokeConnectionExample - -### Generate a service account bearer token -Generates a bearer token using a file path and content of a service account credentials file. -#### [Configure](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/TokenGenerationExample.java) -1. Replace **** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE PATH**. See #Create a service account. -2. Replace **<>** with relative path of **SERVICE ACCOUNT CREDENTIAL FILE CONTENT AS STRING**. -#### Run the sample - - javac TokenGenerationExample.java - java TokenGenerationExample + +### Vault operations (`com.example.vault`) + +| Sample | Demonstrates | +|---|---| +| [InsertExample.java](src/main/java/com/example/vault/InsertExample.java) | Inserting records with `TokenMode` enabled and with `upsert`. | +| [GetExample.java](src/main/java/com/example/vault/GetExample.java) | Retrieving records by Skyflow ID and by column name/value. | +| [UpdateExample.java](src/main/java/com/example/vault/UpdateExample.java) | Updating records with and without `TokenMode`. | +| [DeleteExample.java](src/main/java/com/example/vault/DeleteExample.java) | Deleting records from one or more vaults by Skyflow ID. | +| [DetokenizeExample.java](src/main/java/com/example/vault/DetokenizeExample.java) | Detokenizing data tokens. | +| [TokenizeExample.java](src/main/java/com/example/vault/TokenizeExample.java) | Tokenizing values against a column group. | +| [QueryExample.java](src/main/java/com/example/vault/QueryExample.java) | Running a SQL query against a vault. | +| [FileUploadExample.java](src/main/java/com/example/vault/FileUploadExample.java) | Uploading a file into a vault. | +| [ClientOperations.java](src/main/java/com/example/vault/ClientOperations.java) | Configuring a primary and secondary vault on one client, updating configs at runtime, and removing a vault config. | +| [CredentialsOptions.java](src/main/java/com/example/vault/CredentialsOptions.java) | Using the different `Credentials` authentication options across multiple vault configs. | + +`vault/deprecated/` keeps pre-v2.1 versions of the Detokenize, Get, and Update samples. Each one +shows the deprecated API it replaces — for example `downloadURL()` vs. `downloadUrl()`, and the +`skyflow_id` vs. `skyflowId` keys. See [Migrate from v1 to v2](../../docs/migrate_to_v2.md) for the +full set of renames. + +### Detect (`com.example.detect`) + +| Sample | Demonstrates | +|---|---| +| [DeidentifyTextExample.java](src/main/java/com/example/detect/DeidentifyTextExample.java) | De-identifying text and reading the detected entities. | +| [ReidentifyTextExample.java](src/main/java/com/example/detect/ReidentifyTextExample.java) | Reversing `deidentifyText` to restore the original values. | +| [DeidentifyFileExample.java](src/main/java/com/example/detect/DeidentifyFileExample.java) / [DeidentifyFileExampleAsync.java](src/main/java/com/example/detect/DeidentifyFileExampleAsync.java) | De-identifying a file synchronously and asynchronously, with the available masking and transformation options. | +| [GetDetectRunExample.java](src/main/java/com/example/detect/GetDetectRunExample.java) | Polling an async file de-identification run by `runId`. | + +### Connections (`com.example.connection`) + +| Sample | Demonstrates | +|---|---| +| [InvokeConnectionExample.java](src/main/java/com/example/connection/InvokeConnectionExample.java) | Setting up a connection configuration and invoking it with a request body and headers. | + +### Service account (`com.example.serviceaccount`) + +These use the `BearerToken` / `SignedDataTokens` utilities directly, for callers who want to +manage their own bearer tokens rather than passing a credentials file/string straight to +`Credentials`. See [Authenticate with bearer tokens](../README.md#authenticate-with-bearer-tokens) +for when you'd do which. + +| Sample | Demonstrates | +|---|---| +| [BearerTokenGenerationExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationExample.java) | Basic token generation from a credentials file or credentials string. | +| [BearerTokenExpiryExample.java](src/main/java/com/example/serviceaccount/BearerTokenExpiryExample.java) | Using `Token.isExpired()` to avoid re-minting a still-valid token before a detokenize call. | +| [BearerTokenGenerationUsingThreadsExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationUsingThreadsExample.java) | Sharing one `BearerToken` instance safely across multiple threads. | +| [BearerTokenGenerationWithContextExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationWithContextExample.java) | Context-aware tokens via `setCtx(String)` and `setCtx(Map)`. | +| [ScopedTokenGenerationExample.java](src/main/java/com/example/serviceaccount/ScopedTokenGenerationExample.java) | Scoped tokens via `setRoles(...)`, restricting the token to specific role IDs. | +| [SignedTokenGenerationExample.java](src/main/java/com/example/serviceaccount/SignedTokenGenerationExample.java) | Signed data tokens via `SignedDataTokens`, with string and object context variants. | From 58e55bff63a387a25e08f3f48c8decd37dd28de0 Mon Sep 17 00:00:00 2001 From: "promptless[bot]" Date: Mon, 19 Oct 2026 17:17:18 +0000 Subject: [PATCH 2/2] docs: fix BearerTokenExpiryExample description in samples README --- skyvault/samples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skyvault/samples/README.md b/skyvault/samples/README.md index ab583da0..17124099 100644 --- a/skyvault/samples/README.md +++ b/skyvault/samples/README.md @@ -87,7 +87,7 @@ for when you'd do which. | Sample | Demonstrates | |---|---| | [BearerTokenGenerationExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationExample.java) | Basic token generation from a credentials file or credentials string. | -| [BearerTokenExpiryExample.java](src/main/java/com/example/serviceaccount/BearerTokenExpiryExample.java) | Using `Token.isExpired()` to avoid re-minting a still-valid token before a detokenize call. | +| [BearerTokenExpiryExample.java](src/main/java/com/example/serviceaccount/BearerTokenExpiryExample.java) | Retrying a detokenize call after a 401, letting the SDK's internal `Token.isExpired()` check mint a fresh bearer token on the retry. | | [BearerTokenGenerationUsingThreadsExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationUsingThreadsExample.java) | Sharing one `BearerToken` instance safely across multiple threads. | | [BearerTokenGenerationWithContextExample.java](src/main/java/com/example/serviceaccount/BearerTokenGenerationWithContextExample.java) | Context-aware tokens via `setCtx(String)` and `setCtx(Map)`. | | [ScopedTokenGenerationExample.java](src/main/java/com/example/serviceaccount/ScopedTokenGenerationExample.java) | Scoped tokens via `setRoles(...)`, restricting the token to specific role IDs. |