| 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 GenerateMacRequest extends Omit< |
| 7 | paymentcryptographydata.GenerateMacInput, |
| 8 | "KeyIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `payment-cryptography:GenerateMac` — computes a |
| 13 | * Message Authentication Code over hex-encoded message data under a |
| 14 | * {@link Key}. Provide `GenerateMacHttp` on the Function to satisfy this |
| 15 | * service. |
| 16 | * ### Generating MACs |
| 17 | * **Example:** Generate an HMAC over message data |
| 18 | * ```typescript |
| 19 | * // init |
| 20 | * const generateMac = yield* PaymentCryptography.GenerateMac(macKey); |
| 21 | * |
| 22 | * // runtime — MessageData is hex-encoded |
| 23 | * const result = yield* generateMac({ |
| 24 | * MessageData: "31323334353637383930313233343536", |
| 25 | * GenerationAttributes: { Algorithm: "HMAC" }, |
| 26 | * }); |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface GenerateMac extends Binding.Service< |
| 32 | GenerateMac, |
| 33 | "AWS.PaymentCryptography.GenerateMac", |
| 34 | <K extends Key>( |
| 35 | key: K, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: GenerateMacRequest, |
| 39 | ) => Effect.Effect< |
| 40 | paymentcryptographydata.GenerateMacOutput, |
| 41 | paymentcryptographydata.GenerateMacError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const GenerateMac = Binding.Service<GenerateMac>( |
| 47 | "AWS.PaymentCryptography.GenerateMac", |
| 48 | ); |