Class

Client

Client(kastelaUrl, caCert, clientCert, clientKey)

Create a new Kastela Client instance for communicating with the server. Require server information and return client instance.
Constructor

# new Client(kastelaUrl, caCert, clientCert, clientKey)

Parameters:
Name Type Description
kastelaUrl string Kastela server url
caCert string Kastela ca certificate
clientCert string Kastela client certificate
clientKey string kastela client key

View Source index.ts, line 17

Classes

Client

Methods

# async cryptoDecrypt(input) → {Promise.<Array.<any>>}

Decrypt data
Parameters:
Name Type Description
input Array.<string> array of ciphertext

View Source index.ts, line 435

array of plaintext. the order of plaintext corresponds to the order of ciphertext
Promise.<Array.<any>>
Example
const plaintexts = await client.cryptoDecrypt(["foo", "bar"]);

# async cryptoEncrypt(input) → {Promise.<Array.<Array.<string>>>}

Encrypt data
Parameters:
Name Type Description
input Array.<Object> input
keyID string key id
mode string encryption mode
plaintexts Array.<any> array of plaintexts

View Source index.ts, line 425

array of ciphertext. the order of ciphertext corresponds to the order of input
Promise.<Array.<Array.<string>>>
Example
const ciphertexts = await client.cryptoEncrypt([{keyID: "your-key-id", mode: "AES_GCM", plaintexts: ["foo", "bar"]}]);

# async cryptoEqual(input) → {Promise.<Array.<boolean>>}

Compare hash and data
Parameters:
Name Type Description
input Array.<Object> input
hash string hash
value any value

View Source index.ts, line 460

array of result. the order of result corresponds to the order of input
Promise.<Array.<boolean>>
Example
const result = await client.cryptoEqual([{hash: "foo", value: 123}, {hash: "bar", value: 456}]);

# async cryptoHMAC(input) → {Promise.<Array.<Array.<string>>>}

HMAC data
Parameters:
Name Type Description
input Array.<Object> input
keyID string key id
mode string hash mode
values Array.<any> array of value

View Source index.ts, line 448

array of hash. the order of hash corresponds to the order of input
Promise.<Array.<Array.<string>>>
Example
const hashes = await client.cryptoHMAC([{keyID: "your-key-id", mode: "SHA256", values: ["foo", "bar"]}]);

# async cryptoSign(input) → {Promise.<Array.<Array.<string>>>}

Sign data
Parameters:
Name Type Description
input Array.<Object> input
keyID string key id
values Array.<any> array of value

View Source index.ts, line 472

array of signature. the order of signature corresponds to the order of input
Promise.<Array.<Array.<string>>>
Example
const signatures = await client.cryptoSign([{keyID: "your-key-id", values: ["foo", "bar"]}]);

# async cryptoVerify(input) → {Promise.<Array.<boolean>>}

Verify data signature
Parameters:
Name Type Description
input Array.<Object> input
signature string hash
value any value

View Source index.ts, line 484

array of result. the order of result corresponds to the order of input
Promise.<Array.<boolean>>
Example
const result = await client.cryptoVerify([{signature: "foo", value: 123}, {signature: "bar", value: 456}]);

# async privacyProxyRequest(type, url, commonopt) → {Promise.<any>}

proxying your request.
Parameters:
Name Type Attributes Description
type "json" | "xml" request body type
url string request url
param.method "get" | "post" request method
common object <optional>
needed information for protection and vault.
vaults object <optional>
vaults object list. Define column with prefix as key and array with id as first index and vault column as second index.
protections object <optional>
protections object list. Define column with prefix as key and protectionId as value.
options.headers object <optional>
request headers, use "_" prefix for encrypted column key and data id/token as value.
options.params object <optional>
request parameters, use "_" prefix for encrypted column key and data id/token as value.
options.body object <optional>
request body, use "_" prefix for encrypted column key and data id/token as value.
options.query object <optional>
request query, use "_" prefix for encrypted column key and data id/token as value.
options.rootTag string <optional>
root tag, required for xml type

View Source index.ts, line 705

Promise.<any>
Example
client.privacyProxyRequest(
      "json",
      "https://enskbwhbhec7l.x.pipedream.net/:_phone/:_salary",
      "post",
      {
        protections: {
          _email: "124edec8-530e-4fd2-a04b-d4dc21ce625a", // email protection id
          _phone: "9f53aa3b-7214-436d-af9b-d2952be9f0c4", // phone protection id
        },
        vaults: {
          _salary: ["c5f9236d-aea0-46a5-a2fe-fb75c0596c87", "salary"], // salary vault id & column
        },
      },
      {
        headers: {
          _email: "1", // email data id
        },
        params: {
          _phone: "1", // email data id
          _salary: "01GQEATT1Q3NKKDC3A2JSMN7ZJ", // salary vault token
        },
        body: {
          name: "jhon daeng",
          _email: "1", // email data id
          _phone: "1", // phone data id
          _salary: "01GQEATT1Q3NKKDC3A2JSMN7ZJ", salary vault token
        },
        query: {
          id: "123456789",
          _email: "1",
        },
      }
    );

# async protectionCount(input) → {Promise.<number>}

Count protection data
Parameters:
Name Type Description
input Object protection count input data
protectionID string protection id
search any data to search

View Source index.ts, line 618

count of data
Promise.<number>
Example
const count = await client.protectionCount({ protectionID: "your-protection-id", search: "foo"})

# async protectionFetch(input) → {Promise.<Array.<any>>}

Fetch protection data
Parameters:
Name Type Description
input Object protection fetch input data
protectionID string protection id
search any data to search

View Source index.ts, line 606

array of primary keys
Promise.<Array.<any>>
Example
const primaryKeys = await client.protectionFetch({ protectionID: "your-protection-id", search: "foo"})

# async protectionOpen(input) → {Promise.<Array.<Array.<any>>>}

Decrypt protection data
Parameters:
Name Type Description
input Array.<Object> protection open input data
protectionID string protection id
tokens Array.<any> array of tokens

View Source index.ts, line 594

array of decrypted data. the order of values corresponds to the order of input.
Promise.<Array.<Array.<any>>>
Example
const data = await client.protectionOpen([{ protectionID: "your-protection-id", tokens: ["foo", "bar", "baz"]}])

# async protectionSeal(input) → {Promise.<void>}

Encrypt protection data
Parameters:
Name Type Description
input Array.<Object> protection seal input data
protectionID string protection id
primaryKeys Array.<any> array of data primary keys

View Source index.ts, line 582

Promise.<void>
Example
await client.protectionSeal([{ protectionID: "your-protection-id", primaryKeys: [1, 2, 3]}])

# async protectionTokenize(input) → {Promise.<void>}

Tokenize data for protection
Parameters:
Name Type Description
input Array.<Object> protection tokenize input data
protectionID string protection id
values Array.<any> array of data

View Source index.ts, line 570

Promise.<void>
Example
const tokens = await client.protectionTokenize([{ protectionID: "your-protection-id", values: ["foo", "bar", "baz"]}])

# async secureProtectionCommit(credential) → {Promise.<void>}

Commit secure protection.
Parameters:
Name Type Description
credential string

View Source index.ts, line 640

Promise.<void>
Example
await client.secureProtectionCommit("your-credential")

# async secureProtectionInit(operation, protectionIDs, ttl) → {Promise.<{credential: string}>}

Initialize secure protection.
Parameters:
Name Type Description
operation string secure protection operation mode
protectionIDs Array.<string> array of protection id
ttl number time to live in minutes

View Source index.ts, line 630

secure protection credential
Promise.<{credential: string}>
Example
const { credential } = await client.secureProtectionInit(["your-protection-id"], 5)

# async secureVaultInit(operation, vaultIDs, ttl) → {Promise.<{credential: string}>}

Initialize secure vault.
Parameters:
Name Type Description
operation string secure vault operation mode
vaultIDs Array.<string> array of vault id
ttl number time to live in minutes

View Source index.ts, line 652

secure vault credential
Promise.<{credential: string}>
Example
const { credential } = await client.secureVaultInit(["your-vault-id"], 5)

# async vaultCount(input) → {Promise.<Array.<string>>}

Count vault data
Parameters:
Name Type Description
input Object input
vaultID string vault id
search string data to search

View Source index.ts, line 520

Promise.<Array.<string>>
Example
const count = await client.vaultCount({vaultID: "your-vault-id", search: "foo"})

# async vaultDelete(input) → {Promise.<void>}

Delete vault data
Parameters:
Name Type Description
input Array.<Object>
vaultID string vault id
tokens Array.<string> array of tokens

View Source index.ts, line 558

Promise.<void>
Example
await client.vaultDelete([{ vaultID: "your-vault-id", tokens: ["foo", "bar"]}])

# async vaultFetch(input) → {Promise.<Array.<string>>}

Search vault data
Parameters:
Name Type Description
input Object input
vaultID string vault id
search string data to search

View Source index.ts, line 508

Promise.<Array.<string>>
Example
const tokens = await client.vaultFetch({vaultID: "your-vault-id", search: "foo", size: 10, after: "bar"})

# async vaultGet(input) → {Promise.<Array.<Array.<any>>>}

Get vault data
Parameters:
Name Type Description
input Array.<Object>
vaultID string vault id
tokens Array.<string> array of token

View Source index.ts, line 532

array of value, the order of value corresponds to the order of token
Promise.<Array.<Array.<any>>>
Example
const values = await client.VaultGet([{vaultID: "your-vault-id", tokens: ["foo", "bar", "baz"]}]);

# async vaultStore(input) → {Promise.<Array.<Array.<string>>>}

Store vault data
Parameters:
Name Type Description
input Array.<Object> input
vaultID string vault id
values Array.<any> array of vault data

View Source index.ts, line 496

array of vault token. the order of token corresponds to the order of input
Promise.<Array.<Array.<string>>>
Example
const tokens = await client.vaultStore([{vaultID: "your-vault-id", values: ["foo", "bar"]}]);

# async vaultUpdate(input) → {Promise.<void>}

Update vault data
Parameters:
Name Type Description
input Array.<Object>
vaultID string vault id
values Array.<Object> array of values
values[].token string token
values[].value any value

View Source index.ts, line 546

Promise.<void>
Example
await client.vaultUpdate([{vaultID: "your-vault-id", values: [{ token: "foo", value: "bar"}]}])