Crypto TypeORM
    Preparing search index...

    Interface EncryptionConfig

    Configuration for column-level encryption.

    const config: EncryptionConfig = {
    key: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
    algorithm: "xchacha20-poly1305",
    };
    interface EncryptionConfig {
        key: string;
        algorithm?: string;
        fields?: Map<string, string[]>;
        context?: string;
        allowPlaintextFallback?: boolean;
        acceptLegacyCiphertext?: boolean;
    }
    Index
    key: string

    256-bit key as a 64-character hex string. New values are sealed under a subkey derived from it with HKDF-SHA-256; the key itself is used only to read legacy (pre-v2) ciphertexts.

    algorithm?: string

    Algorithm identifier. Currently only "xchacha20-poly1305" is supported. Reserved for future algorithm additions.

    "xchacha20-poly1305"
    
    fields?: Map<string, string[]>

    Per-entity field mapping. Keys are entity names, values are arrays of property names that should be encrypted. Used by EncryptionSubscriber to know which fields to process automatically.

    fields: new Map([
    ["User", ["ssn", "email"]],
    ["Payment", ["cardNumber"]],
    ])
    context?: string

    Column context bound into every ciphertext as associated data, by convention "Entity.property". A value sealed for one context fails to decrypt under another, so ciphertexts cannot be swapped between columns. @EncryptedColumn sets it to ClassName.property unless given here; EncryptionSubscriber always uses EntityName.field. A bare EncryptionTransformer without a context binds the empty context, which every other context-less transformer shares.

    ""
    
    allowPlaintextFallback?: boolean

    Return a stored value as-is when it is not a ciphertext at all, instead of throwing a FieldDecryptionError. Meant only for the window in which existing plaintext rows are being migrated. A value in the v2: format that fails authentication is always rejected.

    false
    
    acceptLegacyCiphertext?: boolean

    Accept legacy ciphertexts written before the v2: format (sealed with the configured key and no associated data). Legacy values are not bound to their column, so anyone able to write the database could move one into another encrypted column. Set this only while re-writing old rows, then remove it.

    false