CWebCryptoEncryptionProvider Class

The built-in, production-ready encryption provider for Katlux applications. Extends AEncryptionProvider and uses the native Web Crypto API (crypto.subtle) to deliver hardware-accelerated AES-256-GCM encryption with zero external npm dependencies.

๐Ÿ›๏ธ AEncryptionProvider (Base Class) ยท ๐Ÿ”Œ IEncryptionProvider Interface ยท ๐Ÿ“‹ IProviderEncryptionOptions ยท ๐Ÿ“– Encryption & SSR Security Guide

Standalone Cipher Operations

Instantiate CWebCryptoEncryptionProvider directly for ad-hoc encryption and decryption, or inject it via IProviderEncryptionOptions into RequestProvider or DataProviders. Inherits key handling from AEncryptionProvider and fulfills the IEncryptionProvider contract:

import { CWebCryptoEncryptionProvider } from '@katlux/providers'

const cipher = new CWebCryptoEncryptionProvider('my-secret-passphrase')

// Encrypt arbitrary object, string, or array
const envelope = await cipher.encrypt({
    account: 'ACC-89123',
    balance: 45000
})

console.log(envelope)
// {
//   __encrypted: true,
//   ciphertext: "5x8Y...",
//   iv: "9zLp...",
//   alg: "AES-GCM"
// }

// Decrypt back to original object
const decrypted = await cipher.decrypt(envelope)
console.log(decrypted.account) // "ACC-89123"