StackLatestPackagesStackSrcSchemaFunctions
buildEncryptConfig
buildEncryptConfig is a function in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.
Function: buildEncryptConfig()
function buildEncryptConfig(...protectTables): {
v: number;
tables: Record<string, Record<string, {
cast_as: "string" | "number" | "bigint" | "boolean" | "text" | "date" | "json";
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: {
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
};
ste_vec?: {
prefix: string;
array_index_mode?: | "all"
| "none"
| {
item?: boolean;
wildcard?: boolean;
position?: boolean;
};
};
};
}>>;
};Defined in: packages/stack/src/schema/index.ts:680
Build an encrypt config from a list of encrypted tables.
Parameters
protectTables
...EncryptedTable<EncryptedTableColumn>[]
The list of encrypted tables to build the config from.
Returns
{
v: number;
tables: Record<string, Record<string, {
cast_as: "string" | "number" | "bigint" | "boolean" | "text" | "date" | "json";
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: {
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
};
ste_vec?: {
prefix: string;
array_index_mode?: | "all"
| "none"
| {
item?: boolean;
wildcard?: boolean;
position?: boolean;
};
};
};
}>>;
}An encrypt config object.
v
v: number;tables
tables: Record<string, Record<string, {
cast_as: "string" | "number" | "bigint" | "boolean" | "text" | "date" | "json";
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: {
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
};
ste_vec?: {
prefix: string;
array_index_mode?: | "all"
| "none"
| {
item?: boolean;
wildcard?: boolean;
position?: boolean;
};
};
};
}>> = tablesSchema;Example
import { buildEncryptConfig } from "@cipherstash/stack/schema"
const users = encryptedTable("users", {
email: encryptedColumn("email").equality(),
})
const orders = encryptedTable("orders", {
amount: encryptedColumn("amount").dataType("number"),
})
const config = buildEncryptConfig(users, orders)
console.log(config)