
Security News
TC39 Advances Temporal to Stage 4 Alongside Several ECMAScript Proposals
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.
@djangocfg/crypto
Advanced tools
Client-side AES-256-GCM decryption for Django-CFG encrypted API responses using Web Crypto API
Client-side AES-256-GCM decryption for Django-CFG encrypted API responses using Web Crypto API.
pnpm add @djangocfg/crypto
import { createDecryptionClient } from '@djangocfg/crypto';
// Create a decryption client
const crypto = await createDecryptionClient({
secretKey: 'your-django-secret-key',
userId: 123, // optional, for per-user encryption
});
// Fetch encrypted data
const response = await fetch('/api/products/?encrypt=true');
const encryptedData = await response.json();
// Decrypt all encrypted fields
const data = await crypto.decryptObject(encryptedData);
console.log(data.price); // decrypted value
import { useDecrypt } from '@djangocfg/crypto/react';
function ProductPrice({ product }: { product: Product }) {
const { data, isLoading, error } = useDecrypt(product, {
secretKey: process.env.NEXT_PUBLIC_DECRYPT_KEY!,
userId: user.id,
});
if (isLoading) return <Skeleton />;
if (error) return <ErrorMessage error={error} />;
return <span>${data.price}</span>;
}
import { useLazyDecrypt } from '@djangocfg/crypto/react';
function LazyProduct({ product }: { product: Product }) {
const { decrypt, data, isLoading } = useLazyDecrypt({
secretKey: process.env.NEXT_PUBLIC_DECRYPT_KEY!,
});
return (
<div>
<button onClick={() => decrypt(product)}>
Show Price
</button>
{isLoading && <Spinner />}
{data && <span>{data.price}</span>}
</div>
);
}
createDecryptionClient(config)Creates a decryption client with pre-derived key.
const crypto = await createDecryptionClient({
secretKey: string; // Django SECRET_KEY
userId?: string|number; // Optional user ID
sessionId?: string; // Optional session ID
iterations?: number; // PBKDF2 iterations (default: 100000)
keyPrefix?: string; // Key prefix (default: "djangocfg_encryption")
});
// Methods
await crypto.decryptField(encryptedField); // Decrypt single field
await crypto.decryptObject(data); // Decrypt all fields recursively
crypto.isEncryptedField(value); // Type guard
decryptField(field, key)Decrypt a single encrypted field.
decryptObject(data, key)Recursively decrypt all encrypted fields in an object.
useDecrypt(data, config)Decrypt data on mount.
useDecryptionClient(config)Create a memoized decryption client.
useLazyDecrypt(config)Decrypt data on demand with manual trigger.
useIsEncrypted(value)Check if a value is encrypted.
interface EncryptedField {
encrypted: true;
field?: string;
algorithm: 'AES-256-GCM';
iv: string; // base64
data: string; // base64
auth_tag: string; // base64
}
interface DecryptionConfig {
secretKey: string;
userId?: string | number;
sessionId?: string;
iterations?: number;
keyPrefix?: string;
}
SECRET_KEY directly in frontend codeMIT
FAQs
Client-side AES-256-GCM decryption for Django-CFG encrypted API responses using Web Crypto API
The npm package @djangocfg/crypto receives a total of 1,460 weekly downloads. As such, @djangocfg/crypto popularity was classified as popular.
We found that @djangocfg/crypto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.

Research
/Security News
Since January 31, 2026, we identified at least 72 additional malicious Open VSX extensions, including transitive GlassWorm loader extensions targeting developers.

Research
Six malicious Packagist packages posing as OphimCMS themes contain trojanized jQuery that exfiltrates URLs, injects ads, and loads FUNNULL-linked redirects.