CipherStash Docs
StackLatestDynamodbFunctions

encryptedDynamoDB

API reference for encryptedDynamoDB

@cipherstash/stack


Function: encryptedDynamoDB()

function encryptedDynamoDB(config): EncryptedDynamoDBInstance;

Defined in: .tmp-stack/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: "a@b.com" }, users)

On this page