1import * as paymentcryptographydata from "@distilled.cloud/aws/payment-cryptography-data";
2import * as Layer from "effect/Layer";
3import { makePaymentCryptographyKeyHttpBinding } from "./BindingHttp.ts";
4import { DecryptData } from "./DecryptData.ts";
5
6/**
7 * HTTP implementation of {@link DecryptData} — grants the host Function
8 * `payment-cryptography:DecryptData` 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 decrypt = yield* PaymentCryptography.DecryptData(key);
15 *
16 * return {
17 * fetch: Effect.gen(function* () {
18 * const decrypted = yield* decrypt({
19 * CipherText: cipherTextHex,
20 * DecryptionAttributes: {
21 * Symmetric: { Mode: "CBC", InitializationVector: iv },
22 * },
23 * });
24 * // ...
25 * }),
26 * };
27 * }).pipe(Effect.provide(PaymentCryptography.DecryptDataHttp))
28 * ```
29 */
30export const DecryptDataHttp = Layer.effect(
31 DecryptData,
32 makePaymentCryptographyKeyHttpBinding({
33 tag: "AWS.PaymentCryptography.DecryptData",
34 operation: paymentcryptographydata.decryptData,
35 actions: ["payment-cryptography:DecryptData"],
36 }),
37);