# Encryption Demo Form
#
# This form demonstrates the encryption and redaction pipeline in typedialog.
# Fields marked as "sensitive" will be:
# - Redacted to [REDACTED] with --redact flag
# - Encrypted with --encrypt flag (requires Age, SOPS, SecretumVault, or KMS backend)
#
# Usage:
#   # Redaction mode (no encryption service needed)
#   typedialog form examples/08-encryption/credentials.toml --redact --format json
#
#   # Age encryption (local, requires ~/.age/key.txt)
#   typedialog form examples/08-encryption/credentials.toml \
#     --encrypt --backend age --key-file ~/.age/key.txt --format json
#
#   # SOPS encryption (supports AWS/GCP/Azure KMS via .sops.yaml)
#   export AWS_REGION=us-east-1
#   typedialog form examples/08-encryption/credentials.toml \
#     --encrypt --backend sops --format json
#
#   # SecretumVault encryption (post-quantum cryptography ready)
#   export VAULT_ADDR=https://vault.internal:8200
#   export VAULT_TOKEN=hvs.CAAA...
#   typedialog form examples/08-encryption/credentials.toml \
#     --encrypt --backend secretumvault --format json

description = "User credentials with encryption support"
display_mode = "complete"
name = "user_credentials"

# ============================================================================
# Non-sensitive fields (will be output as plaintext)
# ============================================================================

[[fields]]
name = "username"
prompt = "Username"
required = true
sensitive = false
type = "text"

[[fields]]
name = "email"
prompt = "Email address"
required = true
sensitive = false
type = "text"

[[fields]]
name = "company"
prompt = "Company (optional)"
required = false
sensitive = false
type = "text"

# ============================================================================
# Sensitive fields - Auto-detected (FieldType::Password = sensitive by default)
# ============================================================================

[[fields]]
name = "password"
prompt = "Password"
required = true
type = "password"
# sensitive not specified - auto-detected as true from FieldType::Password

[[fields]]
name = "confirm_password"
prompt = "Confirm password"
required = true
type = "password"

# ============================================================================
# Sensitive fields - Explicit (sensitive = true)
# These are non-password fields but marked sensitive
# ============================================================================

[[fields]]
encryption_backend = "age"
name = "api_token"
prompt = "API Token"
required = false
sensitive = true
type = "text"

[[fields]]
name = "ssh_key"
prompt = "SSH Private Key (multiline)"
required = false
sensitive = true
type = "editor"

[[fields]]
name = "database_url"
prompt = "Database Connection String"
required = false
sensitive = true
type = "text"

# ============================================================================
# Encryption configuration per field (optional)
# If not specified, uses CLI --backend flag or global default
# ============================================================================

[[fields]]
encryption_backend = "sops"
name = "vault_token"
prompt = "Vault Token (encrypted with SOPS)"
required = false
sensitive = true
type = "text"
# Note: SOPS reads configuration from .sops.yaml in current directory or parent
# No additional config needed - SOPS uses .sops.yaml for KMS setup

[[fields]]
encryption_backend = "awskms"
name = "kms_key_id"
prompt = "AWS KMS Key ID (encrypted with AWS KMS)"
required = false
sensitive = true
type = "text"

  [fields.encryption_config]
  key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
  region = "us-east-1"

  # ============================================================================
  # Non-sensitive field (explicit override)
  # Note: This field is type=password but marked as NOT sensitive
  # Will be output as plaintext (useful for test/demo passwords)
  # ============================================================================

[[fields]]
name = "demo_password"
prompt = "Demo password (shown in plaintext)"
required = false
sensitive = false
type = "password"
