CipherStashDocs
StackLatestPackagesStackSrcDynamodbFunctions

encryptedDynamoDB

encryptedDynamoDB is a function in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.

@cipherstash/stack


Function: encryptedDynamoDB()

function encryptedDynamoDB(config): EncryptedDynamoDBInstance;

Defined in: packages/stack/src/dynamodb/index.ts:39

Create an encrypted DynamoDB helper bound to an EncryptionClient.

Returns an object with encryptModel, decryptModel, bulkEncryptModels, and bulkDecryptModels methods that transparently encrypt/decrypt DynamoDB items according to the provided table schema.

Parameters

config

EncryptedDynamoDBConfig

Configuration containing the encryptionClient and optional logging / error-handling callbacks.

Returns

EncryptedDynamoDBInstance

An EncryptedDynamoDBInstance with encrypt/decrypt operations.

Example

import { Encryption } from "@cipherstash/stack"
import { encryptedDynamoDB } from "@cipherstash/stack/dynamodb"
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"

const users = encryptedTable("users", {
  email: encryptedColumn("email").equality(),
})

const client = await Encryption({ schemas: [users] })
const dynamo = encryptedDynamoDB({ encryptionClient: client })

const encrypted = await dynamo.encryptModel({ email: "[email protected]" }, users)

On this page