Encryption
Encryption is a function in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.
Function: Encryption()
function Encryption(config): Promise<EncryptionClient>;Defined in: packages/stack/src/encryption/index.ts:652
Creates and initializes an Encryption client for encrypting and decrypting data with CipherStash.
Provide at least one schema (from encryptedTable) so the client knows which tables and
columns to use. Credentials are read from the optional config or from the environment
(CS_WORKSPACE_CRN, CS_CLIENT_ID, CS_CLIENT_KEY, CS_CLIENT_ACCESS_KEY).
Parameters
config
Initialization options. Must include schemas; optionally include config for
workspace/keys. Logging is configured via the STASH_STACK_LOG environment variable
(debug | info | error, default: error).
Returns
Promise<EncryptionClient>
A Promise that resolves to an initialized EncryptionClient ready for EncryptionClient.encrypt, EncryptionClient.decrypt, and related operations.
Throws
Throws if schemas is empty, or if a keyset id is supplied but is not a valid UUID.
Also throws if the client fails to initialize (e.g. invalid credentials or config).
Example
import { Encryption, encryptedTable, encryptedColumn } from "@cipherstash/stack"
const users = encryptedTable("users", {
email: encryptedColumn("email"),
})
const client = await Encryption({ schemas: [users] })
const result = await client.encrypt("[email protected]", { column: users.email, table: users })See
- EncryptionClientConfig for full config options.
- EncryptionClient for available methods after initialization.
EncryptionClient
The EncryptionClient is the main entry point for interacting with the CipherStash Encryption library. It provides methods for encrypting and decrypting indiv...
noClientError
noClientError is a function in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.