Skip to content

MAX_AES_GCM_PLAINTEXT_SIZE

const MAX_AES_GCM_PLAINTEXT_SIZE: 67108864 = 67108864

Defined in: packages/filecoin-encryption-envelope/src/constants.ts:69

Largest plaintext the one-shot AES-256-GCM scheme accepts.

Memory sets this number, not cryptography: NIST allows nearly 64 GiB per GCM message. But scheme 1 cannot stream — one tag covers the whole ciphertext, so the whole plaintext and Web Crypto’s result are held at once: the caller’s buffer, Web Crypto’s internal copy, the ciphertext it returns, and the final joined envelope. Runtime allocation ceilings differ and cannot be queried, so this sits well under all of them. Larger objects use the chunked scheme, which is flat in memory.

Raise it only with measurements, and never lower it: raising accepts inputs older versions rejected, lowering breaks callers that work today.