1import * as paymentcryptographydata from "@distilled.cloud/aws/payment-cryptography-data";
2import * as Layer from "effect/Layer";
3import { makePaymentCryptographyKeyHttpBinding } from "./BindingHttp.ts";
4import { EncryptData } from "./EncryptData.ts";
5
6/**
7 * HTTP implementation of {@link EncryptData} — grants the host Function
8 * `payment-cryptography:EncryptData` on the key and calls the
9 * Payment Cryptography Data API at runtime.
10 * @example Provide on a Lambda Function
11 * ```typescript
12 * Effect.gen(function* () {
13 * const key = yield* PaymentCryptography.Key("DataKey", { ... });
14 * const encrypt = yield* PaymentCryptography.EncryptData(key);
15 *
16 * return {
17 * fetch: Effect.gen(function* () {
18 * const encrypted = yield* encrypt({
19 * PlainText: plainTextHex,
20 * EncryptionAttributes: {
21 * Symmetric: { Mode: "CBC", InitializationVector: iv },
22 * },
23 * });
24 * // ...
25 * }),
26 * };
27 * }).pipe(Effect.provide(PaymentCryptography.EncryptDataHttp))
28 * ```
29 */
30export const EncryptDataHttp = Layer.effect(
31 EncryptData,
32 makePaymentCryptographyKeyHttpBinding({
33 tag: "AWS.PaymentCryptography.EncryptData",
34 operation: paymentcryptographydata.encryptData,
35 actions: ["payment-cryptography:EncryptData"],
36 }),
37);