Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SK-1621: update readme #166

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
475 changes: 210 additions & 265 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions samples/vault-api/delete-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ async function performDeletion() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Delete Data
const deleteIds = ['skyflow_id1', 'skyflow_id2', 'skyflow_id3']; // Record IDs to delete
const tableName = 'sensitive_data_table'; // Table name in the vault schema
const deleteIds: Array<string> = ['skyflow_id1', 'skyflow_id2', 'skyflow_id3']; // Record IDs to delete
const tableName: string = 'sensitive_data_table'; // Table name in the vault schema

// Create Delete Request
const deleteRequest = new DeleteRequest(
const deleteRequest: DeleteRequest = new DeleteRequest(
tableName,
deleteIds
);
Expand Down
12 changes: 6 additions & 6 deletions samples/vault-api/detokenzie-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ async function performDetokenization() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Detokenization Data
const detokenizeData = ['token1', 'token2', 'token3']; // Tokens to be detokenized
const redactionType = RedactionType.REDACTED; // Redaction type
const detokenizeData: Array<string> = ['token1', 'token2', 'token3']; // Tokens to be detokenized
const redactionType: RedactionType = RedactionType.REDACTED; // Redaction type

// Create Detokenize Request
const detokenizeRequest = new DetokenizeRequest(
const detokenizeRequest: DetokenizeRequest = new DetokenizeRequest(
detokenizeData,
redactionType
);

// Configure Detokenize Options
const detokenizeOptions = new DetokenizeOptions();
const detokenizeOptions: DetokenizeOptions = new DetokenizeOptions();
detokenizeOptions.setContinueOnError(true); // Continue processing on errors
detokenizeOptions.setDownloadURL(false); // Disable download URL generation

// Step 5: Perform Detokenization
const response = await skyflowClient
const response: DetokenizeResponse = await skyflowClient
.vault(primaryVaultConfig.vaultId)
.detokenize(detokenizeRequest, detokenizeOptions);

Expand Down
17 changes: 9 additions & 8 deletions samples/vault-api/get-column-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Credentials,
SkyflowConfig,
VaultConfig,
SkyflowError
SkyflowError,
GetResponse
} from 'skyflow-node';

/**
Expand Down Expand Up @@ -54,29 +55,29 @@ async function performSecureColumnRetrieval() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Column-Based Retrieval Data
const columnValues: string[] = [
const columnValues: Array<string> = [
'value1', // Example Unique Column value 1
'value2', // Example Unique Column value 2
];
const tableName = 'table-name'; // Replace with your actual table name
const columnName = 'column-name'; // Column name configured as unique in the schema
const tableName: string = 'table-name'; // Replace with your actual table name
const columnName: string = 'column-name'; // Column name configured as unique in the schema

// Step 5: Create Get Column Request
const getRequest = new GetColumnRequest(
const getRequest: GetColumnRequest = new GetColumnRequest(
tableName,
columnName,
columnValues // Column values of the records to return
);

// Step 6: Configure Get Options
const getOptions = new GetOptions();
const getOptions: GetOptions = new GetOptions();
getOptions.setReturnTokens(true); // Optional: Get tokens for retrieved data

// Step 7: Perform Secure Retrieval
const response = await skyflowClient
const response: GetResponse = await skyflowClient
.vault(primaryVaultConfig.vaultId)
.get(getRequest, getOptions);

Expand Down
13 changes: 7 additions & 6 deletions samples/vault-api/get-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Skyflow,
VaultConfig,
SkyflowConfig,
SkyflowError
SkyflowError,
GetResponse
} from 'skyflow-node';

/**
Expand Down Expand Up @@ -54,26 +55,26 @@ async function performSecureDataRetrieval() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Retrieval Data
const getIds: string[] = [
const getIds: Array<string> = [
'skyflow-id1',
'skyflow-id2',
];

// Step 5: Create Get Request
const getRequest = new GetRequest(
const getRequest: GetRequest = new GetRequest(
'sensitive_data_table', // Replace with your actual table name
getIds
);

// Step 6: Configure Get Options
const getOptions = new GetOptions();
const getOptions: GetOptions = new GetOptions();
getOptions.setReturnTokens(true); // Optional: Get tokens for retrieved data

// Step 7: Perform Secure Retrieval
const response = await skyflowClient
const response: GetResponse = await skyflowClient
.vault(primaryVaultConfig.vaultId)
.get(getRequest, getOptions);

Expand Down
13 changes: 7 additions & 6 deletions samples/vault-api/insert-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Skyflow,
VaultConfig,
SkyflowConfig,
SkyflowError
SkyflowError,
InsertResponse
} from 'skyflow-node';

/**
Expand Down Expand Up @@ -42,26 +43,26 @@ async function performSecureDataInsertion() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Insertion Data
const insertData = [
const insertData: Array<object> = [
{ card_number: '4111111111111112' } // Example sensitive data
];

// Step 5: Create Insert Request
const insertReq = new InsertRequest(
const insertReq: InsertRequest = new InsertRequest(
'sensitive_data_table', // Replace with your actual table name
insertData
);

// Step 6: Configure Insertion Options
const insertOptions = new InsertOptions();
const insertOptions: InsertOptions = new InsertOptions();
insertOptions.setReturnTokens(true); // Optional: Get tokens for inserted data
// insertOptions.setContinueOnError(true); // Optional: Continue on partial errors

// Step 7: Perform Secure Insertion
const response = await skyflowClient
const response: InsertResponse = await skyflowClient
.vault(primaryVaultConfig.vaultId)
.insert(insertReq, insertOptions);

Expand Down
4 changes: 2 additions & 2 deletions samples/vault-api/invoke-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function invokeSkyflowConnection() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 5: Prepare Connection Request
const requestBody = {
Expand All @@ -66,7 +66,7 @@ async function invokeSkyflowConnection() {
const requestMethod: RequestMethod = RequestMethod.POST;

// Step 6: Create Invoke Connection Request
const invokeReq = new InvokeConnectionRequest(
const invokeReq: InvokeConnectionRequest = new InvokeConnectionRequest(
requestMethod,
requestBody,
requestHeaders
Expand Down
8 changes: 4 additions & 4 deletions samples/vault-api/update-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ async function performSecureDataUpdate() {
};

// Initialize Skyflow Client
const skyflowClient = new Skyflow(skyflowConfig);
const skyflowClient: Skyflow = new Skyflow(skyflowConfig);

// Step 4: Prepare Update Data
const updateData = {
const updateData: object = {
skyflowId: 'your-skyflow-id', // Skyflow ID of the record to update
card_number: '1234567890123456' // Updated sensitive data
};

// Step 5: Create Update Request
const updateReq = new UpdateRequest(
const updateReq: UpdateRequest = new UpdateRequest(
'sensitive_data_table', // Replace with your actual table name
updateData
);

// Step 6: Configure Update Options
const updateOptions = new UpdateOptions();
const updateOptions: UpdateOptions = new UpdateOptions();
updateOptions.setReturnTokens(true); // Optional: Get tokens for updated data

// Step 7: Perform Secure Update
Expand Down
Loading