Skip to content

Decrypt

Source: src/Fly/Decrypt.ts

Decrypt with a Fly SecretKey. The App and key name are fixed by Decrypt(key).

Provide DecryptHttp. Plaintext comes back Redacted. Unwrap with Redacted.value only where you need the raw bytes.

import * as Redacted from "effect/Redacted";
const decrypt = yield* Fly.Decrypt(Box);
const { plaintext } = yield* decrypt({ ciphertext });
const bytes = Redacted.value(plaintext);

associatedData must match the bytes passed to Encrypt.

const { plaintext } = yield* decrypt({
ciphertext,
associatedData: nonce,
});