| 1 | import type * as paymentcryptographydata from "@distilled.cloud/aws/payment-cryptography-data"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Key } from "./Key.ts"; |
| 5 | |
| 6 | export interface EncryptDataRequest extends Omit< |
| 7 | paymentcryptographydata.EncryptDataInput, |
| 8 | "KeyIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `payment-cryptography:EncryptData` — encrypts |
| 13 | * hex-encoded plaintext under a {@link Key}. Provide `EncryptDataHttp` on |
| 14 | * the Function to satisfy this service. |
| 15 | * ### Encrypting Data |
| 16 | * **Example:** Encrypt hex-encoded plaintext |
| 17 | * ```typescript |
| 18 | * // init |
| 19 | * const encrypt = yield* PaymentCryptography.EncryptData(key); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const result = yield* encrypt({ |
| 23 | * PlainText: "31323334353637383930313233343536", |
| 24 | * EncryptionAttributes: { |
| 25 | * Symmetric: { Mode: "CBC", InitializationVector: "00000000000000000000000000000000" }, |
| 26 | * }, |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface EncryptData extends Binding.Service< |
| 33 | EncryptData, |
| 34 | "AWS.PaymentCryptography.EncryptData", |
| 35 | <K extends Key>( |
| 36 | key: K, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: EncryptDataRequest, |
| 40 | ) => Effect.Effect< |
| 41 | paymentcryptographydata.EncryptDataOutput, |
| 42 | paymentcryptographydata.EncryptDataError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | |
| 47 | export const EncryptData = Binding.Service<EncryptData>( |
| 48 | "AWS.PaymentCryptography.EncryptData", |
| 49 | ); |