ObjectStackObjectStack

Encryption

Encryption protocol schemas

Source: packages/spec/src/system/encryption.zod.ts

TypeScript Usage

import { EncryptionAlgorithmSchema, EncryptionConfigSchema, FieldEncryptionSchema, KeyManagementProviderSchema, KeyRotationPolicySchema } from '@objectstack/spec/system';
import type { EncryptionAlgorithm, EncryptionConfig, FieldEncryption, KeyManagementProvider, KeyRotationPolicy } from '@objectstack/spec/system';

// Validate data
const result = EncryptionAlgorithmSchema.parse(data);

EncryptionAlgorithm

Supported encryption algorithm

Allowed Values

  • aes-256-gcm
  • aes-256-cbc
  • chacha20-poly1305

EncryptionConfig

Field-level encryption configuration

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable field-level encryption
algorithmEnum<'aes-256-gcm' | 'aes-256-cbc' | 'chacha20-poly1305'>optional (default: "aes-256-gcm")Encryption algorithm
keyManagement{ provider: Enum<'local' | 'aws-kms' | 'azure-key-vault' | 'gcp-kms' | 'hashicorp-vault'>; keyId?: string; rotationPolicy?: object }Key management configuration
scopeEnum<'field' | 'record' | 'table' | 'database'>Encryption scope level
deterministicEncryptionbooleanoptional (default: false)Allows equality queries on encrypted data
searchableEncryptionbooleanoptional (default: false)Allows search on encrypted data

Nested Shape: EncryptionConfig.keyManagement

PropertyTypeRequiredDescription
providerEnum<'local' | 'aws-kms' | 'azure-key-vault' | 'gcp-kms' | 'hashicorp-vault'>Key management service provider
keyIdstringoptionalKey identifier in the provider
rotationPolicy{ enabled: boolean; frequencyDays: number; retainOldVersions: number; autoRotate: boolean }optionalKey rotation policy

FieldEncryption

Per-field encryption assignment

Properties

PropertyTypeRequiredDescription
fieldNamestringName of the field to encrypt
encryptionConfig{ enabled: boolean; algorithm: Enum<'aes-256-gcm' | 'aes-256-cbc' | 'chacha20-poly1305'>; keyManagement: object; scope: Enum<'field' | 'record' | 'table' | 'database'>; … }Encryption settings for this field
indexablebooleanoptional (default: false)Allow indexing on encrypted field

Nested Shape: FieldEncryption.encryptionConfig

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable field-level encryption
algorithmEnum<'aes-256-gcm' | 'aes-256-cbc' | 'chacha20-poly1305'>optional (default: "aes-256-gcm")Encryption algorithm
keyManagement{ provider: Enum<'local' | 'aws-kms' | 'azure-key-vault' | 'gcp-kms' | 'hashicorp-vault'>; keyId?: string; rotationPolicy?: object }Key management configuration
scopeEnum<'field' | 'record' | 'table' | 'database'>Encryption scope level
deterministicEncryptionbooleanoptional (default: false)Allows equality queries on encrypted data
searchableEncryptionbooleanoptional (default: false)Allows search on encrypted data

KeyManagementProvider

Key management service provider

Allowed Values

  • local
  • aws-kms
  • azure-key-vault
  • gcp-kms
  • hashicorp-vault

KeyRotationPolicy

Policy for automatic encryption key rotation

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable automatic key rotation
frequencyDaysnumberoptional (default: 90)Rotation frequency in days
retainOldVersionsnumberoptional (default: 3)Number of old key versions to retain
autoRotatebooleanoptional (default: true)Automatically rotate without manual approval

On this page