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 |
Classes
Methods
# async cryptoDecrypt(input) → {Promise.<Array.<any>>}
Decrypt data
Parameters:
Name | Type | Description |
---|---|---|
input |
Array.<string>
|
array of ciphertext |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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
|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Promise.<void>
Example
await client.vaultUpdate([{vaultID: "your-vault-id", values: [{ token: "foo", value: "bar"}]}])